


"""simple docstring"""
def     _a					(   _SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					)     ->					List[str]:
							snake_case_     							=		index
							snake_case_     							=		2 * index + 1
							snake_case_     							=		2 * index + 2
							if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
														snake_case_     							=		left_index

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

							if largest != index:
														snake_case_							,    snake_case_     							=		unsorted[index], unsorted[largest]
														heapify(_SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					)







def     _a					(   _SCREAMING_SNAKE_CASE					)     ->					Optional[int]:
							snake_case_     							=		len(_SCREAMING_SNAKE_CASE					)
							for i in range(n // 2 - 1					,			-1					,			-1					):
														heapify(_SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					,			_SCREAMING_SNAKE_CASE					)
							for i in range(n - 1					,			0					,			-1					):
														snake_case_							,    snake_case_     							=		unsorted[i], unsorted[0]
														heapify(_SCREAMING_SNAKE_CASE					,			0					,			_SCREAMING_SNAKE_CASE					)
							return unsorted


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







"""simple docstring"""
import doctest

import projectq
from projectq.ops import H, Measure







def     _a					(   _SCREAMING_SNAKE_CASE					)     ->					int:
							snake_case_     							=		quantum_engine.allocate_qubit()
							H | qubit
							Measure | qubit
							return int(_SCREAMING_SNAKE_CASE					)


if __name__ == "__main__":
				doctest.testmod()

				# initialises a new quantum backend
				__SCREAMING_SNAKE_CASE				:     Dict		=     projectq.MainEngine()

				# Generate a list of 10 random numbers
				__SCREAMING_SNAKE_CASE				:     Optional[Any]		=     [get_random_number(quantum_engine) for _ in range(10)]

				# Flushes the quantum engine from memory
				quantum_engine.flush()

				print('Random numbers', random_numbers_list)



