
"""simple docstring"""







import unittest

from transformers import BigBirdConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
		import jax

		from transformers.models.big_bird.modeling_flax_big_bird import (
		    FlaxBigBirdForCausalLM,
		    FlaxBigBirdForMaskedLM,
		    FlaxBigBirdForMultipleChoice,
		    FlaxBigBirdForPreTraining,
		    FlaxBigBirdForQuestionAnswering,
		    FlaxBigBirdForSequenceClassification,
		    FlaxBigBirdForTokenClassification,
		    FlaxBigBirdModel,
		)







class 							__magic_name__     (		unittest.TestCase   ):





					def __init__(				self   :							Any							,						snake_case_   :							int							,						snake_case_   :							str=2							,						snake_case_   :							Optional[Any]=56							,						snake_case_   :							Dict=True							,						snake_case_   :							Tuple=True							,						snake_case_   :							Optional[int]=True							,						snake_case_   :							str=True							,						snake_case_   :							List[str]=99							,						snake_case_   :							Any=32							,						snake_case_   :							Optional[int]=2							,						snake_case_   :							Optional[Any]=2							,						snake_case_   :							Union[str, Any]=7							,						snake_case_   :							Any="gelu_new"							,						snake_case_   :							str=0.1							,						snake_case_   :							Optional[Any]=0.1							,						snake_case_   :							List[Any]=512							,						snake_case_   :							Union[str, Any]=16							,						snake_case_   :							int=2							,						snake_case_   :							List[Any]=0.02							,						snake_case_   :							Optional[Any]=4							,						snake_case_   :							List[Any]="block_sparse"							,						snake_case_   :							List[Any]=True							,						snake_case_   :							Union[str, Any]=False							,						snake_case_   :							List[str]=2							,						snake_case_   :							Any=3							,						):
												__snake_case     			=       parent
												__snake_case     			=       batch_size
												__snake_case     			=       seq_length
												__snake_case     			=       is_training
												__snake_case     			=       use_attention_mask
												__snake_case     			=       use_token_type_ids
												__snake_case     			=       use_labels
												__snake_case     			=       vocab_size
												__snake_case     			=       hidden_size
												__snake_case     			=       num_hidden_layers
												__snake_case     			=       num_attention_heads
												__snake_case     			=       intermediate_size
												__snake_case     			=       hidden_act
												__snake_case     			=       hidden_dropout_prob
												__snake_case     			=       attention_probs_dropout_prob
												__snake_case     			=       max_position_embeddings
												__snake_case     			=       type_vocab_size
												__snake_case     			=       type_sequence_label_size
												__snake_case     			=       initializer_range
												__snake_case     			=       num_choices

												__snake_case     			=       rescale_embeddings
												__snake_case     			=       attention_type
												__snake_case     			=       use_bias
												__snake_case     			=       block_size
												__snake_case     			=       num_random_blocks





					def 							lowerCAmelCase      (				self   :							Optional[int]    ):
												__snake_case     			=       ids_tensor([self.batch_size, self.seq_length]							,						self.vocab_size    )

												__snake_case     			=       None
												if self.use_attention_mask:
																			__snake_case     			=       random_attention_mask([self.batch_size, self.seq_length]    )

												__snake_case     			=       None
												if self.use_token_type_ids:
																			__snake_case     			=       ids_tensor([self.batch_size, self.seq_length]							,						self.type_vocab_size    )

												__snake_case     			=       BigBirdConfig(
												    vocab_size=self.vocab_size							,						hidden_size=self.hidden_size							,						num_hidden_layers=self.num_hidden_layers							,						num_attention_heads=self.num_attention_heads							,						intermediate_size=self.intermediate_size							,						hidden_act=self.hidden_act							,						hidden_dropout_prob=self.hidden_dropout_prob							,						attention_probs_dropout_prob=self.attention_probs_dropout_prob							,						max_position_embeddings=self.max_position_embeddings							,						type_vocab_size=self.type_vocab_size							,						is_decoder=snake_case_							,						initializer_range=self.initializer_range							,						attention_type=self.attention_type							,						block_size=self.block_size							,						num_random_blocks=self.num_random_blocks							,						use_bias=self.use_bias							,						rescale_embeddings=self.rescale_embeddings							,						)

												return config, input_ids, token_type_ids, attention_mask





					def 							lowerCAmelCase      (				self   :							List[Any]    ):
												__snake_case     			=       self.prepare_config_and_inputs()
												__snake_case			,   __snake_case			,   __snake_case			,   __snake_case     			=       config_and_inputs
												__snake_case     			=       {
												    "input_ids": input_ids,
												    "token_type_ids": token_type_ids,
												    "attention_mask": attention_mask,
												}
												return config, inputs_dict







@require_flax
class 							__magic_name__     (		lowercase__      ,		unittest.TestCase   ):
					_SCREAMING_SNAKE_CASE       :					Union[str, Any]     							=   (
					    (
					        FlaxBigBirdForCausalLM,
					        FlaxBigBirdModel,
					        FlaxBigBirdForPreTraining,
					        FlaxBigBirdForMaskedLM,
					        FlaxBigBirdForMultipleChoice,
					        FlaxBigBirdForQuestionAnswering,
					        FlaxBigBirdForSequenceClassification,
					        FlaxBigBirdForTokenClassification,
					    )
					    if is_flax_available()
					    else ()
					)

					_SCREAMING_SNAKE_CASE       :					int     							=   False
					_SCREAMING_SNAKE_CASE       :					int     							=   False





					def 							lowerCAmelCase      (				self   :							Optional[Any]    ):
												__snake_case     			=       FlaxBigBirdModelTester(self    )





					@slow
					# copied from `test_modeling_flax_common` because it takes much longer than other models
					def 							lowerCAmelCase      (				self   :							Union[str, Any]    ):
												super().test_from_pretrained_save_pretrained()





					@slow
					# copied from `test_modeling_flax_common` because it takes much longer than other models
					def 							lowerCAmelCase      (				self   :							Optional[Any]    ):
												super().test_from_pretrained_with_no_automatic_init()





					@slow
					# copied from `test_modeling_flax_common` because it takes much longer than other models
					def 							lowerCAmelCase      (				self   :							int    ):
												super().test_no_automatic_init()





					@slow
					# copied from `test_modeling_flax_common` because it takes much longer than other models
					def 							lowerCAmelCase      (				self   :							Any    ):
												super().test_hidden_states_output()





					@slow
					def 							lowerCAmelCase      (				self   :							int    ):
												for model_class_name in self.all_model_classes:
																			__snake_case     			=       model_class_name.from_pretrained("google/bigbird-roberta-base"    )
																			self.assertIsNotNone(snake_case_    )





					def 							lowerCAmelCase      (				self   :							Dict    ):
												if self.test_attn_probs:
																			super().test_attention_outputs()





					@slow
					# copied from `test_modeling_flax_common` because it takes much longer than other models
					def 							lowerCAmelCase      (				self   :							Dict    ):
												__snake_case			,   __snake_case     			=       self.model_tester.prepare_config_and_inputs_for_common()

												for model_class in self.all_model_classes:
																			with self.subTest(model_class.__name__    ):
																										__snake_case     			=       self._prepare_for_class(snake_case_							,						snake_case_    )
																										__snake_case     			=       model_class(snake_case_    )

																										@jax.jit
																										def model_jitted(snake_case_   :							int							,						snake_case_   :							Optional[int]=None							,						**snake_case_   :							Optional[Any]    ):
																																	return model(input_ids=snake_case_							,						attention_mask=snake_case_							,						**snake_case_    )

																										with self.subTest("JIT Enabled"    ):
																																	__snake_case     			=       model_jitted(**snake_case_    ).to_tuple()

																										with self.subTest("JIT Disabled"    ):
																																	with jax.disable_jit():
																																								__snake_case     			=       model_jitted(**snake_case_    ).to_tuple()

																										self.assertEqual(len(snake_case_    )							,						len(snake_case_    )    )
																										for jitted_output, output in zip(snake_case_							,						snake_case_    ):
																																	self.assertEqual(jitted_output.shape							,						output.shape    )





					def 							lowerCAmelCase      (				self   :							Union[str, Any]							,						snake_case_   :							Tuple							,						snake_case_   :							List[str]							,						snake_case_   :							int							,						snake_case_   :							Tuple=1e-5							,						snake_case_   :							Any="outputs"							,						snake_case_   :							str=None    ):
												# `bigbird_block_sparse_attention` in `FlaxBigBird` returns `attention_probs = None`, while in PyTorch version,
												# an effort was done to return `attention_probs` (yet to be verified).
												if name.startswith("outputs.attentions"    ):
																			return
												else:
																			super().check_pt_flax_outputs(snake_case_							,						snake_case_							,						snake_case_							,						snake_case_							,						snake_case_							,						snake_case_    )


"""simple docstring"""







def   __UpperCamelCase   (					SCREAMING_SNAKE_CASE )  ->     list:







							"""simple docstring"""


							__snake_case     			=       len(SCREAMING_SNAKE_CASE )
							for i in range(1							,    SCREAMING_SNAKE_CASE ):
														__snake_case     			=       collection[i]
														__snake_case     			=       0
														__snake_case     			=       i - 1

														while low <= high:
																					__snake_case     			=       (low + high) // 2
																					if val < collection[mid]:
																												__snake_case     			=       mid - 1
																					else:
																												__snake_case     			=       mid + 1
														for j in range(SCREAMING_SNAKE_CASE							,    SCREAMING_SNAKE_CASE							,    -1 ):
																					__snake_case     			=       collection[j - 1]
														__snake_case     			=       val
							return collection


if __name__ == "__main__":
		_SCREAMING_SNAKE_CASE	       =      input("""Enter numbers separated by a comma:\n""").strip()
		_SCREAMING_SNAKE_CASE	       =      [int(item) for item in user_input.split(""",""")]
		print(binary_insertion_sort(unsorted))
