



def 						_lowerCAmelCase    (					__lowerCamelCase :  Optional[Any]		,						__lowerCamelCase :  Optional[int]		,						__lowerCamelCase :  Optional[int]  ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE							:     List[Any]							=						index
 __SCREAMING_SNAKE_CASE							:     Optional[int]							=						2 * index + 1
 __SCREAMING_SNAKE_CASE							:     int							=						2 * index + 2
 if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
  __SCREAMING_SNAKE_CASE							:     Tuple							=						left_index

 if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
  __SCREAMING_SNAKE_CASE							:     Dict							=						right_index

 if largest != index:
  __SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							:     List[str]							=						unsorted[index], unsorted[largest]
  heapify(__lowerCamelCase		,						__lowerCamelCase		,						__lowerCamelCase  )






def 						_lowerCAmelCase    (					__lowerCamelCase :  Optional[int]  ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE							:     Tuple							=						len(__lowerCamelCase  )
 for i in range(n // 2 - 1		,						-1		,						-1  ):
  heapify(__lowerCamelCase		,						__lowerCamelCase		,						__lowerCamelCase  )
 for i in range(n - 1		,						0		,						-1  ):
  __SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							:     Optional[Any]							=						unsorted[i], unsorted[0]
  heapify(__lowerCamelCase		,						0		,						__lowerCamelCase  )
 return unsorted


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











def 						_lowerCAmelCase    (					__lowerCamelCase :  list  ):



 """simple docstring"""





 if len(__lowerCamelCase  ) <= 1:
  return data
 else:
  return [
      *quick_sort([e for e in data[1:] if e <= data[0]]  ),
      data[0],
      *quick_sort([e for e in data[1:] if e > data[0]]  ),
  ]


if __name__ == "__main__":
      import doctest

      doctest.testmod()






