



from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
_snake_case	=						10






def        A       (      _lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							for i in range(_lowerCamelCase       ,				_lowerCamelCase						):
														if array[i] == target:
																					return i
							return -1






def        A       (      _lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							int				     =					0
							_lowerCAmelCase  :							Union[str, Any]				     =					len(_lowerCamelCase						)
							while left <= right:
														if right - left < precision:
																					return lin_search(_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						)

														_lowerCAmelCase  :							Optional[int]				     =					(left + right) // 3 + 1
														_lowerCAmelCase  :							Optional[int]				     =					2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					_lowerCAmelCase  :							List[Any]				     =					one_third - 1
														elif array[two_third] < target:
																					_lowerCAmelCase  :							Any				     =					two_third + 1

														else:
																					_lowerCAmelCase  :							Optional[int]				     =					one_third + 1
																					_lowerCAmelCase  :							Union[str, Any]				     =					two_third - 1
							else:
														return -1






def        A       (      _lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							if left < right:
														if right - left < precision:
																					return lin_search(_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						)
														_lowerCAmelCase  :							int				     =					(left + right) // 3 + 1
														_lowerCAmelCase  :							int				     =					2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					return rec_ternary_search(_lowerCamelCase       ,				one_third - 1       ,				_lowerCamelCase       ,				_lowerCamelCase						)
														elif array[two_third] < target:
																					return rec_ternary_search(two_third + 1       ,				_lowerCamelCase       ,				_lowerCamelCase       ,				_lowerCamelCase						)
														else:
																					return rec_ternary_search(one_third + 1       ,				two_third - 1       ,				_lowerCamelCase       ,				_lowerCamelCase						)
							else:
														return -1


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						_snake_case	=						input("Enter numbers separated by comma:\n").strip()
						_snake_case	=						[int(item.strip()) for item in user_input.split(",")]
						assert collection == sorted(collection), f"List must be ordered.\n{collection}."
						_snake_case	=						int(input("Enter the number to be found in the list:\n").strip())
						_snake_case	=						ite_ternary_search(collection, target)
						_snake_case	=						rec_ternary_search(0, len(collection) - 1, collection, target)
						if resulta != -1:
												print(f'''Iterative search: {target} found at positions: {resulta}''')
												print(f'''Recursive search: {target} found at positions: {resulta}''')
						else:
												print("Not found")





def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							int				     =					len(_lowerCamelCase						)
							for i in range(1       ,				_lowerCamelCase						):
														_lowerCAmelCase  :							List[Any]				     =					collection[i]
														_lowerCAmelCase  :							str				     =					0
														_lowerCAmelCase  :							Union[str, Any]				     =					i - 1

														while low <= high:
																					_lowerCAmelCase  :							List[str]				     =					(low + high) // 2
																					if val < collection[mid]:
																												_lowerCAmelCase  :							Optional[int]				     =					mid - 1
																					else:
																												_lowerCAmelCase  :							List[str]				     =					mid + 1
														for j in range(_lowerCamelCase       ,				_lowerCamelCase       ,				-1						):
																					_lowerCAmelCase  :							int				     =					collection[j - 1]
														_lowerCAmelCase  :							Optional[int]				     =					val
							return collection


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