





import math

import qiskit





def lowerCAmelCase__(__snake_case = 1 ,__snake_case = 1 ,__snake_case = 1							)       ->   qiskit.result.counts.Counts:







	'''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
	lowerCamelCase__              =	qiskit.QuantumRegister(4 ,'''qr'''							)
	lowerCamelCase__              =	qiskit.ClassicalRegister(2 ,'''cr'''							)
	# list the entries
	lowerCamelCase__              =	[input_a, input_a, carry_in]

	lowerCamelCase__              =	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

	lowerCamelCase__              =	qiskit.Aer.get_backend('''aer_simulator'''							)
	lowerCamelCase__              =	qiskit.execute(UpperCAmelCase__ ,UpperCAmelCase__ ,shots=1000							)

	return job.result().get_counts(UpperCAmelCase__							)


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










from __future__ import annotations





def lowerCAmelCase__(__snake_case ,__snake_case = None ,__snake_case = None							)       ->   None:







	'''simple docstring'''







	if start is None:
		lowerCamelCase__              =	0

	if end is None:
		lowerCamelCase__              =	len(__snake_case							) - 1

	if start >= end:
		return

	lowerCamelCase__              =	(start + end) // 2

	slowsort(__snake_case ,__snake_case ,__snake_case							)
	slowsort(__snake_case ,mid + 1 ,__snake_case							)

	if sequence[end] < sequence[mid]:
		lowerCamelCase__       ,			lowerCamelCase__              =	sequence[mid], sequence[end]

	slowsort(__snake_case ,__snake_case ,end - 1							)


if __name__ == "__main__":
			from doctest import testmod

			testmod()



