






import math

import qiskit





def  _lowerCamelCase						(						__lowerCamelCase = 1 ,							__lowerCamelCase = 1 ,							__lowerCamelCase = 1       ) ->			qiskit.result.counts.Counts:

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

     UpperCAmelCase__      :  List[Any]				      =			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

     UpperCAmelCase__      :  Tuple				      =			qiskit.Aer.get_backend("""aer_simulator"""       )
     UpperCAmelCase__      :  List[str]				      =			qiskit.execute(__lowerCamelCase ,							__lowerCamelCase ,							shots=1000       )

     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 lowerCAmelCase    (__A):



     """simple docstring"""



     if not isinstance(__A    ,      __A):
          raise ValueError('''multiplicative_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''multiplicative_persistence() does not accept negative values''')

     _a           =    0
     _a           =    str(__A)

     while len(__A) != 1:
          _a           =    [int(__A) for i in num_string]

          _a           =    1
          for i in range(0    ,      len(__A)):
               total *= numbers[i]

          _a           =    str(__A)

          steps += 1
     return steps




def lowerCAmelCase    (__A):



     """simple docstring"""



     if not isinstance(__A    ,      __A):
          raise ValueError('''additive_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''additive_persistence() does not accept negative values''')

     _a           =    0
     _a           =    str(__A)

     while len(__A) != 1:
          _a           =    [int(__A) for i in num_string]

          _a           =    0
          for i in range(0    ,      len(__A)):
               total += numbers[i]

          _a           =    str(__A)

          steps += 1
     return steps


if __name__ == "__main__":
  import doctest

  doctest.testmod()



