



'''simple docstring'''



import qiskit
from qiskit.providers import Backend



def 	__lowerCAmelCase       (				lowerCamelCase :    int					,		lowerCamelCase :    int       ):






	'''simple docstring'''




	__lowerCAmelCase				,							__lowerCAmelCase       				=	bin(lowerCamelCase       )[2:], bin(lowerCamelCase       )[2:]  # Remove leading '0b'

	# Ensure that both strings are of the same length
	if len(lowerCamelCase       ) > len(lowerCamelCase       ):
		__lowerCAmelCase       				=	y.zfill(len(lowerCamelCase       )       )
	else:
		__lowerCAmelCase       				=	x.zfill(len(lowerCamelCase       )       )

	# We need (3 * number of bits in the larger number)+1 qBits
	# The second parameter is the number of classical registers, to measure the result
	__lowerCAmelCase       				=	qiskit.QuantumCircuit((len(lowerCamelCase       ) * 3) + 1					,		len(lowerCamelCase       ) + 1       )

	# We are essentially "not-ing" the bits that are 1
	# Reversed because it's easier to perform ops on more significant bits
	for i in range(len(lowerCamelCase       )       ):
		if x[::-1][i] == "1":
			circuit.x(lowerCamelCase       )
	for j in range(len(lowerCamelCase       )       ):
		if y[::-1][j] == "1":
			circuit.x(len(lowerCamelCase       ) + j       )

	return circuit, x, y



def 	__lowerCAmelCase       (				lowerCamelCase :    qiskit.QuantumCircuit					,		lowerCamelCase :    int					,		lowerCamelCase :    int					,		lowerCamelCase :    int					,		lowerCamelCase :    int					,		):






	'''simple docstring'''




	circuit.ccx(lowerCamelCase					,		lowerCamelCase					,		lowerCamelCase       )
	circuit.cx(lowerCamelCase					,		lowerCamelCase       )
	circuit.ccx(lowerCamelCase					,		lowerCamelCase					,		lowerCamelCase       )
	circuit.cx(lowerCamelCase					,		lowerCamelCase       )
	circuit.cx(lowerCamelCase					,		lowerCamelCase       )



def 	__lowerCAmelCase       (				lowerCamelCase :    int					,		lowerCamelCase :    int					,		lowerCamelCase :    Backend = qiskit.Aer.get_backend("aer_simulator"       )					,		):






	'''simple docstring'''




	if vala < 0 or vala < 0:
		raise ValueError("Both Integers must be positive!"       )

	# Store the Integers
	__lowerCAmelCase				,							__lowerCAmelCase				,							__lowerCAmelCase       				=	store_two_classics(lowerCamelCase					,		lowerCamelCase       )
	for i in range(len(lowerCamelCase       )       ):
		full_adder(lowerCamelCase					,		lowerCamelCase					,		len(lowerCamelCase       ) + i					,		len(lowerCamelCase       ) + len(lowerCamelCase       ) + i					,		len(lowerCamelCase       ) + len(lowerCamelCase       ) + i + 1       )
		circuit.barrier()  # Optional, just for aesthetics

	# Measure the resultant qBits
	for i in range(len(lowerCamelCase       ) + 1       ):
		circuit.measure([(len(lowerCamelCase       ) * 2) + i]					,		[i]       )

	__lowerCAmelCase       				=	qiskit.execute(lowerCamelCase					,		lowerCamelCase					,		shots=1       ).result()

	# The result is in binary. Convert it back to int
	return int(list(res.get_counts()       )[0]					,		2       )


if __name__ == "__main__":
	import doctest

	doctest.testmod()




'''simple docstring'''



from __future__ import annotations

from random import randrange



def 	__lowerCAmelCase       (				lowerCamelCase :    list       ):






	'''simple docstring'''




	if len(lowerCamelCase       ) < 2:
		return collection
	__lowerCAmelCase       				=	randrange(len(lowerCamelCase       )       )  # Use random element as pivot
	__lowerCAmelCase       				=	collection[pivot_index]
	__lowerCAmelCase       				=	[]  # All elements greater than pivot
	__lowerCAmelCase       				=	[]  # All elements less than or equal to pivot

	for element in collection[:pivot_index]:
		(greater if element > pivot else lesser).append(lowerCamelCase       )

	for element in collection[pivot_index + 1 :]:
		(greater if element > pivot else lesser).append(lowerCamelCase       )

	return [*quick_sort(lowerCamelCase       ), pivot, *quick_sort(lowerCamelCase       )]


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