





'''simple docstring'''

import math




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_ = 0			,      lowerCAmelCase_ = 0	):





      """simple docstring"""



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




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):  # Max Heap





      """simple docstring"""



      _snake_case		:	Tuple					     =     index
      _snake_case		:	Optional[Any]					     =     2 * index + 1  # Left Node
      _snake_case		:	Any					     =     2 * index + 2  # Right Node

      if left_index < heap_size and array[largest] < array[left_index]:
            _snake_case		:	Optional[int]					     =     left_index

      if right_index < heap_size and array[largest] < array[right_index]:
            _snake_case		:	Optional[int]					     =     right_index

      if largest != index:
            _snake_case     ,							_snake_case		:	List[str]					     =     array[largest], array[index]
            heapify(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Tuple					     =     len(lowerCAmelCase_	)

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

      for i in range(n - 1			,      0			,      -1	):
            _snake_case     ,							_snake_case		:	Optional[int]					     =     array[0], array[i]
            heapify(lowerCAmelCase_			,      0			,      lowerCAmelCase_	)

      return array




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """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    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



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




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      if len(lowerCAmelCase_	) == 0:
            return array
      _snake_case		:	Optional[int]					     =     2 * math.ceil(math.loga(len(lowerCAmelCase_	)	)	)
      _snake_case		:	Union[str, Any]					     =     16
      return intro_sort(lowerCAmelCase_			,      0			,      len(lowerCAmelCase_	)			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      while end - start > size_threshold:
            if max_depth == 0:
                  return heap_sort(lowerCAmelCase_	)
            max_depth -= 1
            _snake_case		:	Tuple					     =     median_of_a(lowerCAmelCase_			,      lowerCAmelCase_			,      start + ((end - start) // 2) + 1			,      end - 1	)
            _snake_case		:	Any					     =     partition(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)
            intro_sort(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)
            _snake_case		:	Optional[int]					     =     p
      return insertion_sort(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

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









'''simple docstring'''

import os

import numpy
import onnx




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	List[Any]					     =     a.name
      _snake_case		:	List[Any]					     =     b.name

      _snake_case		:	Tuple					     =     ''''''
      _snake_case		:	Tuple					     =     ''''''

      _snake_case		:	Optional[Any]					     =     a == b

      _snake_case		:	List[Any]					     =     name_a
      _snake_case		:	str					     =     name_b

      return res




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      for i, input_name in enumerate(node_proto.input	):
            if input_name == name:
                  node_proto.input.insert(lowerCAmelCase_			,      lowerCAmelCase_	)
                  node_proto.input.pop(i + 1	)

      if node_proto.op_type == "If":
            _graph_replace_input_with(node_proto.attribute[0].g			,      lowerCAmelCase_			,      lowerCAmelCase_	)
            _graph_replace_input_with(node_proto.attribute[1].g			,      lowerCAmelCase_			,      lowerCAmelCase_	)
      if node_proto.op_type == "Loop":
            _graph_replace_input_with(node_proto.attribute[0].g			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      for n in graph_proto.node:
            _node_replace_input_with(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Optional[Any]					     =     list(model.graph.initializer	)
      _snake_case		:	List[str]					     =     list(model_without_ext.graph.initializer	)
      for i, ref_i in ind_to_replace:
            assert inits_with_data[i].name == inits[i].name
            assert inits_with_data[ref_i].name == inits[ref_i].name
            assert i > ref_i

            _snake_case		:	List[Any]					     =     inits[i].name
            _snake_case		:	List[str]					     =     inits[ref_i].name

            model_without_ext.graph.initializer.remove(inits[i]	)

            # for n in model.graph.node:
            _graph_replace_input_with(model_without_ext.graph			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Tuple					     =     os.path.dirname(lowerCAmelCase_	)
      _snake_case		:	str					     =     os.path.basename(lowerCAmelCase_	)

      _snake_case		:	Tuple					     =     onnx.load(os.path.join(lowerCAmelCase_			,      lowerCAmelCase_	)	)

      _snake_case		:	Union[str, Any]					     =     list(model.graph.initializer	)

      _snake_case		:	Union[str, Any]					     =     set()
      _snake_case		:	Any					     =     {}
      _snake_case		:	str					     =     []

      _snake_case		:	Union[str, Any]					     =     0

      for i in range(len(lowerCAmelCase_	)	):
            if i in dup_set:
                  continue

            for j in range(i + 1			,      len(lowerCAmelCase_	)	):
                  if j in dup_set:
                        continue
                  if _is_equal_tensor_proto(inits[i]			,      inits[j]	):
                        dup_set.add(lowerCAmelCase_	)
                        dup_set.add(lowerCAmelCase_	)

                        _snake_case		:	List[Any]					     =     inits[j].data_type
                        _snake_case		:	Dict					     =     numpy.prod(inits[j].dims	)
                        if dtype == 1:
                              mem_size *= 4
                        elif dtype == 6:
                              mem_size *= 4
                        elif dtype == 7 or dtype == 11:
                              mem_size *= 8
                        else:
                              print('''unexpected data type: '''			,      lowerCAmelCase_	)
                        total_reduced_size += mem_size

                        _snake_case		:	Union[str, Any]					     =     inits[i].name
                        _snake_case		:	Any					     =     inits[j].name

                        if name_i in dup_map:
                              dup_map[name_i].append(lowerCAmelCase_	)
                        else:
                              _snake_case		:	Union[str, Any]					     =     [name_j]
                        ind_to_replace.append((j, i)	)

      print('''total reduced size: '''			,      total_reduced_size / 1_024 / 1_024 / 1_024			,      '''GB'''	)

      _snake_case		:	List[str]					     =     sorted(lowerCAmelCase_	)
      _remove_dup_initializers_from_model(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)

      _snake_case		:	List[str]					     =     '''optimized_''' + model_file_name
      _snake_case		:	List[Any]					     =     os.path.join(lowerCAmelCase_			,      lowerCAmelCase_	)
      onnx.save(lowerCAmelCase_			,      lowerCAmelCase_	)

      return new_model


