code: 
  '''simple docstring'''
  
  from __future__ import annotations
  
  
  
  
  
  
  
  def 						snake_case__	(      UpperCamelCase			,UpperCamelCase	) ->      Any:
  		_UpperCamelCase       : str    =      0
  		_UpperCamelCase       : List[str]    =      len(UpperCamelCase__	) - 1
  		while left <= right:
  				_UpperCamelCase       : str    =      (left + right) // 2
  				if left == right:
  						if sorted_list[middle] < item:
  								_UpperCamelCase       : Dict    =      middle + 1
  						break
  				elif sorted_list[middle] < item:
  						_UpperCamelCase       : Optional[Any]    =      middle + 1
  				else:
  						_UpperCamelCase       : Any    =      middle - 1
  		sorted_list.insert(UpperCamelCase__			,UpperCamelCase__	)
  		return sorted_list
  
  
  
  
  
  
  
  def 						snake_case__	(      UpperCamelCase			,UpperCamelCase	) ->      int:
  		_UpperCamelCase       : int    =      []
  		while left and right:
  				if left[0][0] < right[0][0]:
  						result.append(left.pop(0	)	)
  				else:
  						result.append(right.pop(0	)	)
  		return result + left + right
  
  
  
  
  
  
  
  def 						snake_case__	(      UpperCamelCase	) ->      Union[str, Any]:
  		_UpperCamelCase       : Tuple    =      len(UpperCamelCase__	)
  		if length <= 1:
  				return list_ad
  		_UpperCamelCase       : Optional[int]    =      length // 2
  		return merge(sortlist_ad(list_ad[:middle]	)			,sortlist_ad(list_ad[middle:]	)	)
  
  
  
  
  
  
  
  def 						snake_case__	(      UpperCamelCase	) ->      List[Any]:
  
  		if len(UpperCamelCase__	) <= 1:
  				return collection
  		_UpperCamelCase       : Optional[int]    =      []
  		_UpperCamelCase       : List[Any]    =      False
  		for i in range(0			,len(UpperCamelCase__	)			,2	):
  				if i == len(UpperCamelCase__	) - 1:
  						_UpperCamelCase       : Optional[int]    =      True
  				else:
  						if collection[i] < collection[i + 1]:
  								two_paired_list.append([collection[i], collection[i + 1]]	)
  						else:
  								two_paired_list.append([collection[i + 1], collection[i]]	)
  		_UpperCamelCase       : Tuple    =      sortlist_ad(UpperCamelCase__	)
  		_UpperCamelCase       : Optional[int]    =      [i[0] for i in sorted_list_ad]
  		result.append(sorted_list_ad[-1][1]	)
  		if has_last_odd_item:
  				_UpperCamelCase       : Optional[int]    =      collection[-1]
  				_UpperCamelCase       : List[str]    =      binary_search_insertion(UpperCamelCase__			,UpperCamelCase__	)
  		_UpperCamelCase       : Union[str, Any]    =      False
  		for i in range(len(UpperCamelCase__	) - 1	):
  				if result[i] == collection[-1] and has_last_odd_item:
  						_UpperCamelCase       : Dict    =      True
  				_UpperCamelCase       : int    =      sorted_list_ad[i][1]
  				# If last_odd_item is inserted before the item's index,
  				# you should forward index one more.
  				if is_last_odd_item_inserted_before_this_index:
  						_UpperCamelCase       : Optional[Any]    =      result[: i + 2] + binary_search_insertion(result[i + 2 :]			,UpperCamelCase__	)
  				else:
  						_UpperCamelCase       : Union[str, Any]    =      result[: i + 1] + binary_search_insertion(result[i + 1 :]			,UpperCamelCase__	)
  
  		return result
  
  
  if __name__ == "__main__":
  	_UpperCAmelCase   :      List[str] 						=  input("""Enter numbers separated by a comma:\n""").strip()
  	_UpperCAmelCase   :      int 						=  [int(item) for item in user_input.split(""",""")]
  	print(merge_insertion_sort(unsorted))
  
  
  
  
  
  
style_context: 
  '''simple docstring'''
  
  from __future__ import annotations
  
  from collections.abc import Iterable
  from dataclasses import dataclass
  from typing import Any
  
  class 			UpperCAmelCase				:
  
  
  
  
  
  		"""simple docstring"""
  
  
  
  
  
  		A__  :   List[str]          =    ('_front', '_back', '_len')
  
  		@dataclass
  		class 			UpperCAmelCase				:
  
  
  
  
  
  				"""simple docstring"""
  
  
  
  
  
  				A__  :   Any          =    None
  				A__  :   Deque._Node | None          =    None
  				A__  :   Deque._Node | None          =    None
  
  
  
  
  
  
  
  		class 			UpperCAmelCase				:
  
  
  
  
  
  				"""simple docstring"""
  
  
  
  
  
  				A__  :   Any          =    ('_cur',)
  				def __init__(    self  ,					_snake_case     )				->    None:
  						_UpperCamelCase       : Any    =      cur
  				def __iter__(    self     )				->    Deque._Iterator:
  						return self
  
  
  
  
  				def _lowercase  (    self     )				->    Any:
  						if self._cur is None:
  								# finished iterating
  								raise StopIteration
  						_UpperCamelCase       : List[Any]    =      self._cur.val
  						_UpperCamelCase       : List[Any]    =      self._cur.next_node
  
  						return val
  
  
  
  
  
  
  
  		def __init__(    self  ,					_snake_case = None     )				->    None:
  				_UpperCamelCase       : Any    =      None
  				_UpperCamelCase       : Any    =      None
  				_UpperCamelCase       : int    =      0
  
  				if iterable is not None:
  						# append every value to the deque
  						for val in iterable:
  								self.append(_snake_case     )
  		def _lowercase  (    self  ,					_snake_case     )				->    None:
  				_UpperCamelCase       : List[str]    =      self._Node(_snake_case  ,					_snake_case  ,					_snake_case     )
  				if self.is_empty():
  						# front = back
  						_UpperCamelCase       : Union[str, Any]    =      node
  						_UpperCamelCase       : Tuple    =      1
  				else:
  						# connect nodes
  						_UpperCamelCase       : Union[str, Any]    =      node
  						_UpperCamelCase       : int    =      self._back
  						_UpperCamelCase       : List[Any]    =      node  # assign new back to the new node
  
  						self._len += 1
  
  						# make sure there were no errors
  						assert not self.is_empty(), "Error on appending value."
  		def _lowercase  (    self  ,					_snake_case     )				->    None:
  				_UpperCamelCase       : Optional[Any]    =      self._Node(_snake_case  ,					_snake_case  ,					_snake_case     )
  				if self.is_empty():
  						# front = back
  						_UpperCamelCase       : Union[str, Any]    =      node
  						_UpperCamelCase       : Optional[int]    =      1
  				else:
  						# connect nodes
  						_UpperCamelCase       : Tuple    =      self._front
  						_UpperCamelCase       : Optional[int]    =      node
  						_UpperCamelCase       : List[str]    =      node  # assign new front to the new node
  
  						self._len += 1
  
  						# make sure there were no errors
  						assert not self.is_empty(), "Error on appending value."
  		def _lowercase  (    self  ,					_snake_case     )				->    None:
  				for val in iterable:
  						self.append(_snake_case     )
  		def _lowercase  (    self  ,					_snake_case     )				->    None:
  				for val in iterable:
  						self.appendleft(_snake_case     )
  		def _lowercase  (    self     )				->    Any:
  				assert not self.is_empty(), "Deque is empty."
  
  				_UpperCamelCase       : int    =      self._back
  				_UpperCamelCase       : List[Any]    =      self._back.prev_node  # set new back
  				# drop the last node - python will deallocate memory automatically
  				_UpperCamelCase       : Union[str, Any]    =      None
  
  				self._len -= 1
  
  				return topop.val
  		def _lowercase  (    self     )				->    Any:
  				assert not self.is_empty(), "Deque is empty."
  
  				_UpperCamelCase       : List[Any]    =      self._front
  				_UpperCamelCase       : str    =      self._front.next_node  # set new front and drop the first node
  				_UpperCamelCase       : Union[str, Any]    =      None
  
  				self._len -= 1
  
  				return topop.val
  		def _lowercase  (    self     )				->    bool:
  				return self._front is None
  		def __len__(    self     )				->    int:
  				return self._len
  		def __eq__(    self  ,					_snake_case     )				->    bool:
  
  				if not isinstance(_snake_case  ,					_snake_case     ):
  						return NotImplemented
  
  				_UpperCamelCase       : Optional[int]    =      self._front
  				_UpperCamelCase       : List[Any]    =      other._front
  
  				# if the length of the dequeues are not the same, they are not equal
  				if len(self     ) != len(_snake_case     ):
  						return False
  
  				while me is not None and oth is not None:
  						# compare every value
  						if me.val != oth.val:
  								return False
  						_UpperCamelCase       : str    =      me.next_node
  						_UpperCamelCase       : List[str]    =      oth.next_node
  
  				return True
  		def __iter__(    self     )				->    Deque._Iterator:
  				return Deque._Iterator(self._front     )
  
  
  
  
  		def __repr__(    self     )				->    str:
  				_UpperCamelCase       : str    =      []
  				_UpperCamelCase       : Tuple    =      self._front
  				while aux is not None:
  						# append the values in a list to display
  						values_list.append(aux.val     )
  						_UpperCamelCase       : List[str]    =      aux.next_node
  
  				return F'''[{', '.join(repr(_snake_case     ) for val in values_list     )}]'''
  
  
  if __name__ == "__main__":
  	import doctest
  
  	doctest.testmod()
  
  
  
  
  
  