
import math

import qiskit
def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_ = 1       ,							SCREAMING_SNAKE_CASE_ = 1       ,							SCREAMING_SNAKE_CASE_ = 1     )				->		qiskit.result.counts.Counts:
			if (
			    isinstance(__lowerCamelCase       ,							__lowerCamelCase     )
			    or isinstance(__lowerCamelCase       ,							__lowerCamelCase     )
			    or isinstance(__lowerCamelCase       ,							__lowerCamelCase     )
			):
						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(__lowerCamelCase     ) != input_a)
			    or (math.floor(__lowerCamelCase     ) != input_a)
			    or (math.floor(__lowerCamelCase     ) != 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__      :      Any         =		qiskit.QuantumRegister(4       ,							'qr'     )
			lowerCAmelCase__      :      int         =		qiskit.ClassicalRegister(2       ,							'cr'     )
			# list the entries
			lowerCAmelCase__      :      Optional[Any]         =		[input_a, input_a, carry_in]

			lowerCAmelCase__      :      Dict         =		qiskit.QuantumCircuit(__lowerCamelCase       ,							__lowerCamelCase     )

			for i in range(0       ,							3     ):
						if entry[i] == 2:
									quantum_circuit.h(__lowerCamelCase     )  # for hadamard entries
						elif entry[i] == 1:
									quantum_circuit.x(__lowerCamelCase     )  # for 1 entries
						elif entry[i] == 0:
									quantum_circuit.i(__lowerCamelCase     )  # 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]       ,							__lowerCamelCase     )  # measure the last two qbits

			lowerCAmelCase__      :      List[str]         =		qiskit.Aer.get_backend('aer_simulator'     )
			lowerCAmelCase__      :      Union[str, Any]         =		qiskit.execute(__lowerCamelCase       ,							__lowerCamelCase       ,							shots=1_000     )

			return job.result().get_counts(__lowerCamelCase     )


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

"""simple docstring"""



def 					_UpperCAmelCase      ( __lowerCamelCase   :       list ,					__lowerCamelCase   :       int = 0		)     ->					list:
  _snake_case					     =       length or len(__lowerCamelCase		)
  _snake_case					     =       False
  for i in range(length - 1		):
    if list_data[i] > list_data[i + 1]:
      _snake_case     ,					_snake_case					     =       list_data[i + 1], list_data[i]
      _snake_case					     =       True

  return list_data if not swapped else bubble_sort(__lowerCamelCase ,					length - 1		)


if __name__ == "__main__":
 import doctest

 doctest.testmod()



