
import qiskit
from qiskit.providers import Backend



def 			UpperCamelCase       (				lowerCAmelCase__					,     lowerCAmelCase__						):
					'''simple docstring'''
					lowercase      ,		lowercase		      =		bin(lowerCAmelCase__						)[2:], bin(lowerCAmelCase__						)[2:]  # Remove leading '0b'

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

					# 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
					lowercase		      =		qiskit.QuantumCircuit((len(lowerCAmelCase__						) * 3) + 1					,     len(lowerCAmelCase__						) + 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(lowerCAmelCase__						)						):
										if x[::-1][i] == "1":
															circuit.x(lowerCAmelCase__						)
					for j in range(len(lowerCAmelCase__						)						):
										if y[::-1][j] == "1":
															circuit.x(len(lowerCAmelCase__						) + j						)

					return circuit, x, y



def 			UpperCamelCase       (				lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__					,     ):
					'''simple docstring'''
					circuit.ccx(lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__						)
					circuit.cx(lowerCAmelCase__					,     lowerCAmelCase__						)
					circuit.ccx(lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__						)
					circuit.cx(lowerCAmelCase__					,     lowerCAmelCase__						)
					circuit.cx(lowerCAmelCase__					,     lowerCAmelCase__						)



def 			UpperCamelCase       (				lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__ = qiskit.Aer.get_backend('''aer_simulator'''						)					,     ):
					'''simple docstring'''

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

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

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

					lowercase		      =		qiskit.execute(lowerCAmelCase__					,     lowerCAmelCase__					,     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()






def 			UpperCamelCase       (				lowerCAmelCase__ = 30						):
					'''simple docstring'''
					lowercase		      =		exponent + 2
					lowercase		      =		(1 + 5**0.5) / 2
					lowercase		      =		(phi**fibonacci_index - (phi - 1) ** fibonacci_index) / 5**0.5

					return int(lowerCAmelCase__						)


if __name__ == "__main__":
							print(F'{solution() = }')




