





'''simple docstring'''






import math

import qiskit






def   __A    (				a_    :	int = 1   ,a_    :	int = 1   ,a_    :	int = 1						):







		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  :     Dict       						= qiskit.QuantumRegister(4   ,"qr"						)
		lowerCAmelCase  :     Dict       						= qiskit.ClassicalRegister(2   ,"cr"						)
		# list the entries
		lowerCAmelCase  :     List[str]       						= [input_a, input_a, carry_in]

		lowerCAmelCase  :     Dict       						= 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  :     Dict       						= qiskit.Aer.get_backend("aer_simulator"						)
		lowerCAmelCase  :     Any       						= qiskit.execute(UpperCamelCase__   ,UpperCamelCase__   ,shots=1_0_0_0						)

		return job.result().get_counts(UpperCamelCase__						)


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







from ..utils import DummyObject, requires_backends






class    _UpperCamelCase     (       metaclass=__snake_case					):

				"""simple docstring"""







				lowerCAmelCase					=			['note_seq']

				def __init__(    self					, *a__					, **a__ )						->					Optional[int]:
					requires_backends(self					, ["""note_seq"""] )

				@classmethod
				def   _UpperCAmelCase       (    cls					, *a__					, **a__ )						->					Dict:
					requires_backends(cls					, ["""note_seq"""] )

				@classmethod
				def   _UpperCAmelCase       (    cls					, *a__					, **a__ )						->					Optional[int]:
					requires_backends(cls					, ["""note_seq"""] )



