

import math



def   __UpperCAmelCase					(      __a :     list						,__a :     int = 0						,__a :     int = 0      )     ->	list:

					"""simple docstring"""

					_a      :       int   =						end or len(__a      )
					for i in range(__a						,__a      ):
										_a      :       Optional[Any]   =						i
										_a      :       str   =						array[i]
										while temp_index != start and temp_index_value < array[temp_index - 1]:
															_a      :       Union[str, Any]   =						array[temp_index - 1]
															temp_index -= 1
										_a      :       Optional[Any]   =						temp_index_value
					return array



def   __UpperCAmelCase					(      __a :     list						,__a :     int						,__a :     int      )     ->	None:  # Max Heap

					"""simple docstring"""

					_a      :       Any   =						index
					_a      :       Any   =						2 * index + 1  # Left Node
					_a      :       Optional[int]   =						2 * index + 2  # Right Node

					if left_index < heap_size and array[largest] < array[left_index]:
										_a      :       Union[str, Any]   =						left_index

					if right_index < heap_size and array[largest] < array[right_index]:
										_a      :       str   =						right_index

					if largest != index:
										_a ,   _a      :       Tuple   =						array[largest], array[index]
										heapify(__a						,__a						,__a      )



def   __UpperCAmelCase					(      __a :     list      )     ->	list:

					"""simple docstring"""

					_a      :       Dict   =						len(__a      )

					for i in range(n // 2						,-1						,-1      ):
										heapify(__a						,__a						,__a      )

					for i in range(n - 1						,0						,-1      ):
										_a ,   _a      :       List[str]   =						array[0], array[i]
										heapify(__a						,0						,__a      )

					return array



def   __UpperCAmelCase					(      __a :     list						,__a :     int						,__a :     int						,__a :     int      )     ->	int:

					"""simple docstring"""

					if (array[first_index] > array[middle_index]) != (
					    array[first_index] > array[last_index]
					):
										return array[first_index]
					elif (array[middle_index] > array[first_index]) != (
					    array[middle_index] > array[last_index]
					):
										return array[middle_index]
					else:
										return array[last_index]



def   __UpperCAmelCase					(      __a :     list						,__a :     int						,__a :     int						,__a :     int      )     ->	int:

					"""simple docstring"""

					_a      :       List[str]   =						low
					_a      :       List[Any]   =						high
					while True:
										while array[i] < pivot:
															i += 1
										j -= 1
										while pivot < array[j]:
															j -= 1
										if i >= j:
															return i
										_a ,   _a      :       int   =						array[j], array[i]
										i += 1



def   __UpperCAmelCase					(      __a :     list      )     ->	list:

					"""simple docstring"""

					if len(__a      ) == 0:
										return array
					_a      :       int   =						2 * math.ceil(math.loga(len(__a      )      )      )
					_a      :       Tuple   =						16
					return intro_sort(__a						,0						,len(__a      )						,__a						,__a      )



def   __UpperCAmelCase					(      __a :     list						,__a :     int						,__a :     int						,__a :     int						,__a :     int      )     ->	list:

					"""simple docstring"""

					while end - start > size_threshold:
										if max_depth == 0:
															return heap_sort(__a      )
										max_depth -= 1
										_a      :       Dict   =						median_of_a(__a						,__a						,start + ((end - start) // 2) + 1						,end - 1      )
										_a      :       int   =						partition(__a						,__a						,__a						,__a      )
										intro_sort(__a						,__a						,__a						,__a						,__a      )
										_a      :       int   =						p
					return insertion_sort(__a						,__a						,__a      )


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			a__												=						input('''Enter numbers separated by a comma : ''').strip()
			a__												=						[float(item) for item in user_input.split(''',''')]
			print(sort(unsorted))











UpperCAmelCase__      			=						'''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''







def     a_   ()				->						None:



					"""simple docstring"""
					__a					:						Dict      =					input("Enter message: "      )
					__a					:						Dict      =					input("Enter key [alphanumeric]: "      )
					__a					:						str      =					input("Encrypt/Decrypt [e/d]: "      )

					if mode.lower().startswith("e"      ):
										__a					:						List[str]      =					"encrypt"
										__a					:						Union[str, Any]      =					encrypt_message(__A				,       __A      )
					elif mode.lower().startswith("d"      ):
										__a					:						int      =					"decrypt"
										__a					:						List[str]      =					decrypt_message(__A				,       __A      )

					print(f'\n{mode.title()}ed message:'      )
					print(__A      )







def     a_   (__A				,       __A      )				->						str:



					"""simple docstring"""
					return translate_message(__A				,       __A				,       "encrypt"      )







def     a_   (__A				,       __A      )				->						str:



					"""simple docstring"""
					return translate_message(__A				,       __A				,       "decrypt"      )







def     a_   (__A				,       __A				,       __A      )				->						str:



					"""simple docstring"""
					__a					:						Union[str, Any]      =					[]
					__a					:						Tuple      =					0
					__a					:						Dict      =					key.upper()

					for symbol in message:
										__a					:						Dict      =					LETTERS.find(symbol.upper()      )
										if num != -1:
															if mode == "encrypt":
																				num += LETTERS.find(key[key_index]      )
															elif mode == "decrypt":
																				num -= LETTERS.find(key[key_index]      )

															num %= len(__A      )

															if symbol.isupper():
																				translated.append(LETTERS[num]      )
															elif symbol.islower():
																				translated.append(LETTERS[num].lower()      )

															key_index += 1
															if key_index == len(__A      ):
																				__a					:						List[str]      =					0
										else:
															translated.append(__A      )
					return "".join(__A      )


if __name__ == "__main__":
			main()





