
from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import TensorType, is_torch_available, logging


lowerCamelCase_  :       Optional[int]					      =     logging.get_logger(__name__)

lowerCamelCase_  :       Optional[Any]					      =     {
    """google/bigbird-pegasus-large-arxiv""": (
        """https://huggingface.co/google/bigbird-pegasus-large-arxiv/resolve/main/config.json"""
    ),
    """google/bigbird-pegasus-large-pubmed""": (
        """https://huggingface.co/google/bigbird-pegasus-large-pubmed/resolve/main/config.json"""
    ),
    """google/bigbird-pegasus-large-bigpatent""": (
        """https://huggingface.co/google/bigbird-pegasus-large-bigpatent/resolve/main/config.json"""
    ),
    # See all BigBirdPegasus models at https://huggingface.co/models?filter=bigbird_pegasus
}

class 				_UpperCamelCase (    _A     ):






			'''simple docstring'''

			__UpperCamelCase					:  Any    					=       """bigbird_pegasus"""
			__UpperCamelCase					:  Optional[Any]    					=       ["""past_key_values"""]
			__UpperCamelCase					:  Tuple    					=       {
			    """num_attention_heads""": """encoder_attention_heads""",
			    """hidden_size""": """d_model""",
			    """attention_probs_dropout_prob""": """attention_dropout""",
			}

			def __init__(				self       :				Optional[int]  ,		snake_case_       :				int=9_6103  ,		snake_case_       :				Any=4096  ,		snake_case_       :				Dict=16  ,		snake_case_       :				List[str]=4096  ,		snake_case_       :				Optional[int]=16  ,		snake_case_       :				Any=16  ,		snake_case_       :				Dict=4096  ,		snake_case_       :				Optional[int]=16  ,		snake_case_       :				List[str]=0.0  ,		snake_case_       :				str=0.0  ,		snake_case_       :				Tuple=True  ,		snake_case_       :				int=True  ,		snake_case_       :				List[Any]="gelu_new"  ,		snake_case_       :				int=1024  ,		snake_case_       :				str=0.1  ,		snake_case_       :				Any=0.0  ,		snake_case_       :				int=0.0  ,		snake_case_       :				Dict=0.02  ,		snake_case_       :				int=2  ,		snake_case_       :				int=0.0  ,		snake_case_       :				int=True  ,		snake_case_       :				Dict=0  ,		snake_case_       :				List[str]=2  ,		snake_case_       :				str=1  ,		snake_case_       :				Optional[Any]="block_sparse"  ,		snake_case_       :				Tuple=64  ,		snake_case_       :				Union[str, Any]=3  ,		snake_case_       :				Dict=False  ,		**snake_case_       :				int  ,		):
							UpperCamelCase_:							List[str]		=  vocab_size
							UpperCamelCase_:							Any		=  max_position_embeddings
							UpperCamelCase_:							List[Any]		=  d_model
							UpperCamelCase_:							List[Any]		=  encoder_ffn_dim
							UpperCamelCase_:							Union[str, Any]		=  encoder_layers
							UpperCamelCase_:							Union[str, Any]		=  encoder_attention_heads
							UpperCamelCase_:							str		=  decoder_ffn_dim
							UpperCamelCase_:							str		=  decoder_layers
							UpperCamelCase_:							List[Any]		=  decoder_attention_heads
							UpperCamelCase_:							List[Any]		=  dropout
							UpperCamelCase_:							Union[str, Any]		=  attention_dropout
							UpperCamelCase_:							Union[str, Any]		=  activation_dropout
							UpperCamelCase_:							Union[str, Any]		=  activation_function
							UpperCamelCase_:							Tuple		=  init_std
							UpperCamelCase_:							Any		=  encoder_layerdrop
							UpperCamelCase_:							Dict		=  decoder_layerdrop
							UpperCamelCase_:							int		=  classifier_dropout
							UpperCamelCase_:							Optional[int]		=  use_cache
							UpperCamelCase_:							Optional[Any]		=  encoder_layers
							UpperCamelCase_:							int		=  scale_embedding  # scale factor will be sqrt(d_model) if True

							# extra config
							UpperCamelCase_:							Any		=  attention_type
							UpperCamelCase_:							Union[str, Any]		=  block_size
							UpperCamelCase_:							List[str]		=  num_random_blocks
							UpperCamelCase_:							Optional[int]		=  use_bias

							super().__init__(
							    pad_token_id=snake_case_  ,		bos_token_id=snake_case_  ,		eos_token_id=snake_case_  ,		is_encoder_decoder=snake_case_  ,		decoder_start_token_id=snake_case_  ,		**snake_case_  ,		)




class 				_UpperCamelCase (    _A     ):






			'''simple docstring'''

			@property
			def 					lowerCAmelCase__		(				self       :				Union[str, Any]					):
							if self.task in ["default", "seq2seq-lm"]:
											UpperCamelCase_:							str		=  OrderedDict(
											    [
											        ("""input_ids""", {0: """batch""", 1: """encoder_sequence"""}),
											        ("""attention_mask""", {0: """batch""", 1: """encoder_sequence"""}),
											    ]					)

											if self.use_past:
															UpperCamelCase_:							Dict		=  {0: """batch"""}
															UpperCamelCase_:							Any		=  {0: """batch""", 1: """past_decoder_sequence + sequence"""}
											else:
															UpperCamelCase_:							int		=  {0: """batch""", 1: """decoder_sequence"""}
															UpperCamelCase_:							Tuple		=  {0: """batch""", 1: """decoder_sequence"""}

											if self.use_past:
															self.fill_with_past_key_values_(snake_case_  ,		direction="""inputs"""					)
							elif self.task == "causal-lm":
											# TODO: figure this case out.
											UpperCamelCase_:							List[str]		=  OrderedDict(
											    [
											        ("""input_ids""", {0: """batch""", 1: """encoder_sequence"""}),
											        ("""attention_mask""", {0: """batch""", 1: """encoder_sequence"""}),
											    ]					)
											if self.use_past:
															UpperCamelCase_,      UpperCamelCase_:							str		=  self.num_layers
															for i in range(snake_case_					):
																			UpperCamelCase_:							int		=  {0: """batch""", 2: """past_sequence + sequence"""}
																			UpperCamelCase_:							Optional[Any]		=  {0: """batch""", 2: """past_sequence + sequence"""}
							else:
											UpperCamelCase_:							Optional[Any]		=  OrderedDict(
											    [
											        ("""input_ids""", {0: """batch""", 1: """encoder_sequence"""}),
											        ("""attention_mask""", {0: """batch""", 1: """encoder_sequence"""}),
											        ("""decoder_input_ids""", {0: """batch""", 1: """decoder_sequence"""}),
											        ("""decoder_attention_mask""", {0: """batch""", 1: """decoder_sequence"""}),
											    ]					)

							return common_inputs

			@property
			def 					lowerCAmelCase__		(				self       :				str					):
							if self.task in ["default", "seq2seq-lm"]:
											UpperCamelCase_:							int		=  super().outputs
							else:
											UpperCamelCase_:							Optional[int]		=  super(snake_case_  ,		self					).outputs
											if self.use_past:
															UpperCamelCase_,      UpperCamelCase_:							Any		=  self.num_layers
															for i in range(snake_case_					):
																			UpperCamelCase_:							List[str]		=  {0: """batch""", 2: """past_sequence + sequence"""}
																			UpperCamelCase_:							str		=  {0: """batch""", 2: """past_sequence + sequence"""}
							return common_outputs

			def 					lowerCAmelCase__		(				self       :				Dict  ,		snake_case_       :				PreTrainedTokenizer  ,		snake_case_       :				int = -1  ,		snake_case_       :				int = -1  ,		snake_case_       :				bool = False  ,		snake_case_       :				Optional[TensorType] = None  ,		):
							UpperCamelCase_:							List[str]		=  self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
							    snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_					)

							# Generate decoder inputs
							UpperCamelCase_:							Any		=  seq_length if not self.use_past else 1
							UpperCamelCase_:							int		=  self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
							    snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_					)
							UpperCamelCase_:							str		=  {f'''decoder_{name}''': tensor for name, tensor in decoder_inputs.items()}
							UpperCamelCase_:							List[str]		=  dict(**snake_case_  ,		**snake_case_					)

							if self.use_past:
											if not is_torch_available():
															raise ValueError("""Cannot generate dummy past_keys inputs without PyTorch installed."""					)
											else:
															import torch
											UpperCamelCase_,      UpperCamelCase_:							Tuple		=  common_inputs["""input_ids"""].shape
											UpperCamelCase_:							Union[str, Any]		=  common_inputs["""decoder_input_ids"""].shape[1]
											UpperCamelCase_,      UpperCamelCase_:							Optional[int]		=  self.num_attention_heads
											UpperCamelCase_:							Any		=  (
											    batch,
											    num_encoder_attention_heads,
											    encoder_seq_length,
											    self._config.hidden_size // num_encoder_attention_heads,
											)
											UpperCamelCase_:							Tuple		=  decoder_seq_length + 3
											UpperCamelCase_:							List[Any]		=  (
											    batch,
											    num_decoder_attention_heads,
											    decoder_past_length,
											    self._config.hidden_size // num_decoder_attention_heads,
											)

											UpperCamelCase_:							Optional[int]		=  torch.cat(
											    [common_inputs["""decoder_attention_mask"""], torch.ones(snake_case_  ,		snake_case_					)]  ,		dim=1					)

											UpperCamelCase_:							Dict		=  []
											# If the number of encoder and decoder layers are present in the model configuration, both are considered
											UpperCamelCase_,      UpperCamelCase_:							str		=  self.num_layers
											UpperCamelCase_:							Union[str, Any]		=  min(snake_case_  ,		snake_case_					)
											UpperCamelCase_:							Optional[Any]		=  max(snake_case_  ,		snake_case_					) - min_num_layers
											UpperCamelCase_:							Any		=  """encoder""" if num_encoder_layers > num_decoder_layers else """decoder"""

											for _ in range(snake_case_					):
															common_inputs["past_key_values"].append(
															    (
															        torch.zeros(snake_case_					),
															        torch.zeros(snake_case_					),
															        torch.zeros(snake_case_					),
															        torch.zeros(snake_case_					),
															    )					)
											# TODO: test this.
											UpperCamelCase_:							Dict		=  encoder_shape if remaining_side_name == """encoder""" else decoder_shape
											for _ in range(snake_case_  ,		snake_case_					):
															common_inputs["past_key_values"].append((torch.zeros(snake_case_					), torch.zeros(snake_case_					))					)
							return common_inputs

			def 					lowerCAmelCase__		(				self       :				Any  ,		snake_case_       :				PreTrainedTokenizer  ,		snake_case_       :				int = -1  ,		snake_case_       :				int = -1  ,		snake_case_       :				bool = False  ,		snake_case_       :				Optional[TensorType] = None  ,		):
							UpperCamelCase_:							List[Any]		=  self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
							    snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_					)

							if self.use_past:
											if not is_torch_available():
															raise ValueError("""Cannot generate dummy past_keys inputs without PyTorch installed."""					)
											else:
															import torch
											UpperCamelCase_,      UpperCamelCase_:							str		=  common_inputs["""input_ids"""].shape
											# Not using the same length for past_key_values
											UpperCamelCase_:							Dict		=  seqlen + 2
											UpperCamelCase_,      UpperCamelCase_:							Optional[Any]		=  self.num_layers
											UpperCamelCase_,      UpperCamelCase_:							List[str]		=  self.num_attention_heads
											UpperCamelCase_:							Optional[int]		=  (
											    batch,
											    num_encoder_attention_heads,
											    past_key_values_length,
											    self._config.hidden_size // num_encoder_attention_heads,
											)

											UpperCamelCase_:							Tuple		=  common_inputs["""attention_mask"""].dtype
											UpperCamelCase_:							List[Any]		=  torch.cat(
											    [common_inputs["""attention_mask"""], torch.ones(snake_case_  ,		snake_case_  ,		dtype=snake_case_					)]  ,		dim=1					)
											UpperCamelCase_:							Optional[Any]		=  [
											    (torch.zeros(snake_case_					), torch.zeros(snake_case_					)) for _ in range(snake_case_					)
											]
							return common_inputs

			def 					lowerCAmelCase__		(				self       :				int  ,		snake_case_       :				PreTrainedTokenizer  ,		snake_case_       :				int = -1  ,		snake_case_       :				int = -1  ,		snake_case_       :				bool = False  ,		snake_case_       :				Optional[TensorType] = None  ,		):
							# Copied from OnnxConfig.generate_dummy_inputs
							# Did not use super(OnnxConfigWithPast, self).generate_dummy_inputs for code clarity.
							# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
							UpperCamelCase_:							Optional[Any]		=  compute_effective_axis_dimension(
							    snake_case_  ,		fixed_dimension=OnnxConfig.default_fixed_batch  ,		num_token_to_add=0					)

							# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
							UpperCamelCase_:							Any		=  tokenizer.num_special_tokens_to_add(snake_case_					)
							UpperCamelCase_:							Union[str, Any]		=  compute_effective_axis_dimension(
							    snake_case_  ,		fixed_dimension=OnnxConfig.default_fixed_sequence  ,		num_token_to_add=snake_case_					)

							# Generate dummy inputs according to compute batch and sequence
							UpperCamelCase_:							int		=  [""" """.join([tokenizer.unk_token]					) * seq_length] * batch_size
							UpperCamelCase_:							str		=  dict(tokenizer(snake_case_  ,		return_tensors=snake_case_					)					)
							return common_inputs

			def 					lowerCAmelCase__		(				self       :				List[str]  ,		snake_case_       :				PreTrainedTokenizer  ,		snake_case_       :				int = -1  ,		snake_case_       :				int = -1  ,		snake_case_       :				bool = False  ,		snake_case_       :				Optional[TensorType] = None  ,		):
							if self.task in ["default", "seq2seq-lm"]:
											UpperCamelCase_:							Optional[int]		=  self._generate_dummy_inputs_for_default_and_seqaseq_lm(
											    snake_case_  ,		batch_size=snake_case_  ,		seq_length=snake_case_  ,		is_pair=snake_case_  ,		framework=snake_case_					)

							elif self.task == "causal-lm":
											UpperCamelCase_:							Optional[int]		=  self._generate_dummy_inputs_for_causal_lm(
											    snake_case_  ,		batch_size=snake_case_  ,		seq_length=snake_case_  ,		is_pair=snake_case_  ,		framework=snake_case_					)
							else:
											UpperCamelCase_:							int		=  self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
											    snake_case_  ,		batch_size=snake_case_  ,		seq_length=snake_case_  ,		is_pair=snake_case_  ,		framework=snake_case_					)

							return common_inputs




			def 					lowerCAmelCase__		(				self       :				Any  ,		snake_case_       :				int  ,		snake_case_       :				Optional[int]  ,		snake_case_       :				Dict  ,		snake_case_       :				List[Any]					):
							if self.task in ["default", "seq2seq-lm"]:
											UpperCamelCase_:							int		=  super()._flatten_past_key_values_(snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_					)
							else:
											UpperCamelCase_:							int		=  super(snake_case_  ,		self					)._flatten_past_key_values_(
											    snake_case_  ,		snake_case_  ,		snake_case_  ,		snake_case_					)








def 				A__    (  lowerCamelCase  )     ->		Optional[Any]:
				UpperCamelCase_:							Optional[int]		=  len(lowerCamelCase  )
				for _ in range(
				    0   ,			int(((no_of_elements - 1) / 2) + 1  )  ):  # we don't need to traverse to end of list as
								for j in range(0   ,			no_of_elements - 1  ):
												if (
												    lst[j + 1] < lst[j]
												):  # applying bubble sort algorithm from left to right (or forwards)
																UpperCamelCase_:							str		=  lst[j + 1]
																UpperCamelCase_:							Tuple		=  lst[j]
																UpperCamelCase_:							str		=  temp
												if (
												    lst[no_of_elements - 1 - j] < lst[no_of_elements - 2 - j]
												):  # applying bubble sort algorithm from right to left (or backwards)
																UpperCamelCase_:							Union[str, Any]		=  lst[no_of_elements - 1 - j]
																UpperCamelCase_:							Dict		=  lst[no_of_elements - 2 - j]
																UpperCamelCase_:							List[Any]		=  temp
				return lst


if __name__ == "__main__":
							print("""enter the list to be sorted""")
							lowerCamelCase_  :       Union[str, Any]					      =     [int(x) for x in input().split()]  # inputing elements of the list in one line
							lowerCamelCase_  :       Union[str, Any]					      =     double_sort(lst)
							print("""the sorted list is""")
							print(sorted_lst)






