"""simple docstring"""




import math

import qiskit






def   UpperCAmelCase					(	UpperCamelCase__ = 1       ,    UpperCamelCase__ = 1       ,    UpperCamelCase__ = 1				):






							"""simple docstring"""





							if (
							    isinstance(UpperCamelCase__       ,    UpperCamelCase__				)
							    or isinstance(UpperCamelCase__       ,    UpperCamelCase__				)
							    or isinstance(UpperCamelCase__       ,    UpperCamelCase__				)
							):
														raise TypeError('inputs must be integers.'				)

							if (input_a < 0) or (input_a < 0) or (carry_in < 0):
														raise ValueError('inputs must be positive.'				)

							if (
							    (math.floor(UpperCamelCase__				) != input_a)
							    or (math.floor(UpperCamelCase__				) != input_a)
							    or (math.floor(UpperCamelCase__				) != carry_in)
							):
														raise ValueError('inputs must be exact integers.'				)

							if (input_a > 2) or (input_a > 2) or (carry_in > 2):
														raise ValueError('inputs must be less or equal to 2.'				)

							# build registers
							A__	     =							qiskit.QuantumRegister(4       ,    'qr'				)
							A__	     =							qiskit.ClassicalRegister(2       ,    'cr'				)
							# list the entries
							A__	     =							[input_a, input_a, carry_in]

							A__	     =							qiskit.QuantumCircuit(UpperCamelCase__       ,    UpperCamelCase__				)

							for i in range(0       ,    3				):
														if entry[i] == 2:
																					quantum_circuit.h(UpperCamelCase__				)  # for hadamard entries
														elif entry[i] == 1:
																					quantum_circuit.x(UpperCamelCase__				)  # for 1 entries
														elif entry[i] == 0:
																					quantum_circuit.i(UpperCamelCase__				)  # for 0 entries

    # build the circuit
							quantum_circuit.ccx(0       ,    1       ,    3				)  # ccx = toffoli gate
							quantum_circuit.cx(0       ,    1				)
							quantum_circuit.ccx(1       ,    2       ,    3				)
							quantum_circuit.cx(1       ,    2				)
							quantum_circuit.cx(0       ,    1				)

							quantum_circuit.measure([2, 3]       ,    UpperCamelCase__				)  # measure the last two qbits

							A__	     =							qiskit.Aer.get_backend('aer_simulator'				)
							A__	     =							qiskit.execute(UpperCamelCase__       ,    UpperCamelCase__       ,    shots=1_000				)

							return job.result().get_counts(UpperCamelCase__				)


if __name__ == "__main__":
				print(F'''Total sum count for state is: {quantum_full_adder(1, 1, 1)}''')






"""simple docstring"""




def   UpperCAmelCase					(	UpperCamelCase__				):






							"""simple docstring"""





							if len(UpperCamelCase__				) <= 1:
														return [tuple(UpperCamelCase__				)]

							A__	     =							[]

							def generate(UpperCamelCase__       ,    UpperCamelCase__				):
														if k == 1:
																					res.append(tuple(arr[:]				)				)
																					return

														generate(k - 1       ,    UpperCamelCase__				)

														for i in range(k - 1				):
																					if k % 2 == 0:  # k is even
																												A__     ,  A__	     =							arr[k - 1], arr[i]
																					else:  # k is odd
																												A__     ,  A__	     =							arr[k - 1], arr[0]
																					generate(k - 1       ,    UpperCamelCase__				)

							generate(len(UpperCamelCase__				)       ,    UpperCamelCase__				)
							return res


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





