



'''simple docstring'''





import math

import qiskit




def lowerCAmelCase						(__A = 1						,			__A = 1						,			__A = 1):



					"""simple docstring"""



					if (
					    isinstance(__A						,			__A)
					    or isinstance(__A						,			__A)
					    or isinstance(__A						,			__A)
					):
										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(__A) != input_a)
					    or (math.floor(__A) != input_a)
					    or (math.floor(__A) != 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(__A						,			__A)

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

					_a											=						qiskit.Aer.get_backend('''aer_simulator''')
					_a											=						qiskit.execute(__A						,			__A						,			shots=1_000)

					return job.result().get_counts(__A)


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








'''simple docstring'''





def lowerCAmelCase						(__A):



     """simple docstring"""



     _a											=						set()
     # To detect a back edge, keep track of vertices currently in the recursion stack
     _a											=						set()
     return any(
         node not in visited and depth_first_search(__A						,			__A						,			__A						,			__A)
         for node in graph)




def lowerCAmelCase						(__A						,			__A						,			__A						,			__A):



     """simple docstring"""



     visited.add(__A)
     rec_stk.add(__A)

     for node in graph[vertex]:
          if node not in visited:
               if depth_first_search(__A						,			__A						,			__A						,			__A):
                    return True
          elif node in rec_stk:
               return True

    # The node needs to be removed from recursion stack before function ends
     rec_stk.remove(__A)
     return False


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

  testmod()



