






'''simple docstring'''





import qiskit
from qiskit.providers import Backend






def  lowerCamelCase_  (     lowercase__					,  lowercase__):
 lowerCamelCase__	,						lowerCamelCase__	=  bin(lowercase__)[2:], bin(lowercase__)[2:]  # Remove leading '0b'

 # Ensure that both strings are of the same length
 if len(lowercase__) > len(lowercase__):
  lowerCamelCase__	=  y.zfill(len(lowercase__))
 else:
  lowerCamelCase__	=  x.zfill(len(lowercase__))

 # We need (3 * number of bits in the larger number)+1 qBits
 # The second parameter is the number of classical registers, to measure the result
 lowerCamelCase__	=  qiskit.QuantumCircuit((len(lowercase__) * 3) + 1					,  len(lowercase__) + 1)

 # We are essentially "not-ing" the bits that are 1
 # Reversed because it's easier to perform ops on more significant bits
 for i in range(len(lowercase__)):
  if x[::-1][i] == "1":
   circuit.x(lowercase__)
 for j in range(len(lowercase__)):
  if y[::-1][j] == "1":
   circuit.x(len(lowercase__) + j)

 return circuit, x, y






def  lowerCamelCase_  (     lowercase__					,  lowercase__					,  lowercase__					,  lowercase__					,  lowercase__					,  ):
 circuit.ccx(lowercase__					,  lowercase__					,  lowercase__)
 circuit.cx(lowercase__					,  lowercase__)
 circuit.ccx(lowercase__					,  lowercase__					,  lowercase__)
 circuit.cx(lowercase__					,  lowercase__)
 circuit.cx(lowercase__					,  lowercase__)






def  lowerCamelCase_  (     lowercase__					,  lowercase__					,  lowercase__ = qiskit.Aer.get_backend("aer_simulator")					,  ):

 if vala < 0 or vala < 0:
  raise ValueError("Both Integers must be positive!")

 # Store the Integers
 lowerCamelCase__	,						lowerCamelCase__	,						lowerCamelCase__	=  store_two_classics(lowercase__					,  lowercase__)
 for i in range(len(lowercase__)):
  full_adder(lowercase__					,  lowercase__					,  len(lowercase__) + i					,  len(lowercase__) + len(lowercase__) + i					,  len(lowercase__) + len(lowercase__) + i + 1)
  circuit.barrier()  # Optional, just for aesthetics

 # Measure the resultant qBits
 for i in range(len(lowercase__) + 1):
  circuit.measure([(len(lowercase__) * 2) + i]					,  [i])

 lowerCamelCase__	=  qiskit.execute(lowercase__					,  lowercase__					,  shots=1).result()

 # The result is in binary. Convert it back to int
 return int(list(res.get_counts())[0]					,  2)


if __name__ == "__main__":
 import doctest

 doctest.testmod()









'''simple docstring'''





def  lowerCamelCase_  (     lowercase__):
 return int(lowercase__) if x - int(lowercase__) <= 0 else int(lowercase__) + 1


if __name__ == "__main__":
 import doctest

 doctest.testmod()

