




from __future__ import annotations




def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_   )							->						str:

    """simple docstring"""


    __UpperCamelCase			=    0
    __UpperCamelCase			=    len(lowercase_   ) - 1
    while left <= right:
        __UpperCamelCase			=    (left + right) // 2
        if left == right:
            if sorted_list[middle] < item:
                __UpperCamelCase			=    middle + 1
            break
        elif sorted_list[middle] < item:
            __UpperCamelCase			=    middle + 1
        else:
            __UpperCamelCase			=    middle - 1
    sorted_list.insert(lowercase_       ,  lowercase_   )
    return sorted_list




def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_   )							->						int:

    """simple docstring"""


    __UpperCamelCase			=    []
    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        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						str:

    """simple docstring"""


    __UpperCamelCase			=    len(lowercase_   )
    if length <= 1:
        return list_ad
    __UpperCamelCase			=    length // 2
    return merge(sortlist_ad(list_ad[:middle]   )       ,  sortlist_ad(list_ad[middle:]   )   )




def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						list[int]:

    """simple docstring"""


    if len(lowercase_   ) <= 1:
        return collection
    __UpperCamelCase			=    []
    __UpperCamelCase			=    False
    for i in range(0       ,  len(lowercase_   )       ,  2   ):
        if i == len(lowercase_   ) - 1:
            __UpperCamelCase			=    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			=    sortlist_ad(lowercase_   )
    __UpperCamelCase			=    [i[0] for i in sorted_list_ad]
    result.append(sorted_list_ad[-1][1]   )
    if has_last_odd_item:
        __UpperCamelCase			=    collection[-1]
        __UpperCamelCase			=    binary_search_insertion(lowercase_       ,  lowercase_   )
    __UpperCamelCase			=    False
    for i in range(len(lowercase_   ) - 1   ):
        if result[i] == collection[-1] and has_last_odd_item:
            __UpperCamelCase			=    True
        __UpperCamelCase			=    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			=    result[: i + 2] + binary_search_insertion(result[i + 2 :]       ,  lowercase_   )
        else:
            __UpperCamelCase			=    result[: i + 1] + binary_search_insertion(result[i + 1 :]       ,  lowercase_   )

    return result


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










'''simple docstring'''


import torch
from torch import autograd






class 						lowerCAmelCase__      (      autograd.Function						):




			@staticmethod
			def 				lowerCAmelCase__     (		lowerCamelCase__	:  Optional[int]						,	lowerCamelCase__	:  torch.tensor						,	lowerCamelCase__	:  float						,	lowerCamelCase__	:  bool			) ->Optional[Any]:



					'''simple docstring'''







					_UpperCAmelCase		:							Optional[int]             =   inputs.numel()
					_UpperCAmelCase		:							Any             =   int(0.0_0_5 * nb_elems			) + 1
					if sigmoid:
							_UpperCAmelCase		:							List[str]             =   (torch.sigmoid(lowerCamelCase__			) > threshold).type(inputs.type()			)
					else:
							_UpperCAmelCase		:							List[Any]             =   (inputs > threshold).type(inputs.type()			)
					if mask.sum() < nb_min:
							# We limit the pruning so that at least 0.5% (half a percent) of the weights are remaining
							_UpperCAmelCase		:							str             =   inputs.flatten().kthvalue(max(nb_elems - nb_min						,	1			)			).values
							_UpperCAmelCase		:							str             =   (inputs > k_threshold).type(inputs.type()			)
					return mask






			@staticmethod
			def 				lowerCAmelCase__     (		lowerCamelCase__	:  List[Any]						,	lowerCamelCase__	:  Optional[int]			) ->Dict:



					'''simple docstring'''







					return gradOutput, None, None






class 						lowerCAmelCase__      (      autograd.Function						):




			@staticmethod
			def 				lowerCAmelCase__     (		lowerCamelCase__	:  Optional[int]						,	lowerCamelCase__	:  torch.tensor						,	lowerCamelCase__	:  float			) ->List[str]:



					'''simple docstring'''







					_UpperCAmelCase		:							Optional[int]             =   inputs.clone()
					_UpperCAmelCase       ,     _UpperCAmelCase		:							Tuple             =   inputs.flatten().sort(descending=lowerCamelCase__			)
					_UpperCAmelCase		:							Optional[int]             =   int(threshold * inputs.numel()			)

					# flat_out and mask access the same memory.
					_UpperCAmelCase		:							str             =   mask.flatten()
					_UpperCAmelCase		:							Optional[int]             =   0
					_UpperCAmelCase		:							Optional[Any]             =   1
					return mask






			@staticmethod
			def 				lowerCAmelCase__     (		lowerCamelCase__	:  Optional[int]						,	lowerCamelCase__	:  Any			) ->Union[str, Any]:



					'''simple docstring'''







					return gradOutput, None






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			@staticmethod
			def 				lowerCAmelCase__     (		lowerCamelCase__	:  torch.tensor						,	lowerCamelCase__	:  float			) ->Tuple:



					'''simple docstring'''







					_UpperCAmelCase		:							List[Any]             =   inputs.clone()
					_UpperCAmelCase       ,     _UpperCAmelCase		:							Optional[Any]             =   inputs.abs().flatten().sort(descending=lowerCamelCase__			)
					_UpperCAmelCase		:							int             =   int(threshold * inputs.numel()			)

					# flat_out and mask access the same memory.
					_UpperCAmelCase		:							int             =   mask.flatten()
					_UpperCAmelCase		:							List[Any]             =   0
					_UpperCAmelCase		:							int             =   1
					return mask



