import torch
from torch import autograd


class _a       (	autograd.Function ):

	'''simple docstring'''



	@staticmethod
	def 					__UpperCAmelCase(       __UpperCAmelCase							,			__UpperCAmelCase							,			__UpperCAmelCase							,			__UpperCAmelCase   ):
			__A							:   int	  =				inputs.numel()
			__A							:   Any	  =				int(0.0_05 * nb_elems   ) + 1
			if sigmoid:
					__A							:   str	  =				(torch.sigmoid(__UpperCAmelCase   ) > threshold).type(inputs.type()   )
			else:
					__A							:   List[str]	  =				(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
					__A							:   Dict	  =				inputs.flatten().kthvalue(max(nb_elems - nb_min							,			1   )   ).values
					__A							:   Optional[Any]	  =				(inputs > k_threshold).type(inputs.type()   )
			return mask







	@staticmethod
	def 					__UpperCAmelCase(       __UpperCAmelCase							,			__UpperCAmelCase   ):
			return gradOutput, None, None


class _a       (	autograd.Function ):

	'''simple docstring'''



	@staticmethod
	def 					__UpperCAmelCase(       __UpperCAmelCase							,			__UpperCAmelCase							,			__UpperCAmelCase   ):
			__A							:   Optional[int]	  =				inputs.clone()
			__A  ,       __A							:   int	  =				inputs.flatten().sort(descending=__UpperCAmelCase   )
			__A							:   List[str]	  =				int(threshold * inputs.numel()   )

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







	@staticmethod
	def 					__UpperCAmelCase(       __UpperCAmelCase							,			__UpperCAmelCase   ):
			return gradOutput, None


class _a       (	lowerCAmelCase__ ):

	'''simple docstring'''



	@staticmethod
	def 					__UpperCAmelCase(       __UpperCAmelCase							,			__UpperCAmelCase   ):
			__A							:   Tuple	  =				inputs.clone()
			__A  ,       __A							:   Optional[int]	  =				inputs.abs().flatten().sort(descending=__UpperCAmelCase   )
			__A							:   str	  =				int(threshold * inputs.numel()   )

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






def    lowerCamelCase_   (  _lowercase ,     _lowercase ,     _lowercase    )							->	Tuple:
		__A							:   Union[str, Any]	  =				index
		__A							:   int	  =				2 * index + 1
		__A							:   Dict	  =				2 * index + 2
		if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
				__A							:   Dict	  =				left_index

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

		if largest != index:
				__A  ,       __A							:   Dict	  =				unsorted[index], unsorted[largest]
				heapify(_lowercase ,     _lowercase ,     _lowercase    )



def    lowerCamelCase_   (  _lowercase    )							->	Tuple:
		__A							:   Dict	  =				len(_lowercase    )
		for i in range(n // 2 - 1 ,     -1 ,     -1    ):
				heapify(_lowercase ,     _lowercase ,     _lowercase    )
		for i in range(n - 1 ,     0 ,     -1    ):
				__A  ,       __A							:   Dict	  =				unsorted[i], unsorted[0]
				heapify(_lowercase ,     0 ,     _lowercase    )
		return unsorted


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





