






import qiskit
from qiskit.providers import Backend
def    a__    (	A		,					A       ):
   lowercase__  ,       lowercase__    :						Optional[Any]       =			bin(A       )[2:], bin(A       )[2:]  # Remove leading '0b'

   # Ensure that both strings are of the same length
   if len(A       ) > len(A       ):
      lowercase__    :						List[str]       =			y.zfill(len(A       )       )
   else:
      lowercase__    :						str       =			x.zfill(len(A       )       )

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

   return circuit, x, y
def    a__    (	A		,					A		,					A		,					A		,					A		,					):
   circuit.ccx(A		,					A		,					A       )
   circuit.cx(A		,					A       )
   circuit.ccx(A		,					A		,					A       )
   circuit.cx(A		,					A       )
   circuit.cx(A		,					A       )
def    a__    (	A		,					A		,					A = qiskit.Aer.get_backend("""aer_simulator"""       )		,					):

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

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

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

   lowercase__    :						Dict       =			qiskit.execute(A		,					A		,					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()










from __future__ import annotations

from typing import Any
class 							__snake_case:



 def __init__(						self : str			,		UpperCAmelCase__ : Any			,		UpperCAmelCase__ : Any						):  # noqa: A002

    """simple docstring"""






    lowercase__    :						Optional[int]       =			item
    lowercase__    :						Union[str, Any]       =			next
class 							__snake_case:



 def __init__(						self : List[Any]						):

    """simple docstring"""






    lowercase__    :						Node | None       =			None
    lowercase__    :						Optional[Any]       =			0



 def     UpperCAmelCase     (						self : List[Any]			,		UpperCAmelCase__ : Any						):

    """simple docstring"""






    lowercase__    :						Any       =			Node(UpperCAmelCase__			,		self.head						)
    self.size += 1



 def     UpperCAmelCase     (						self : Dict						):

    """simple docstring"""






    if self.head is None:
       return None
    else:
       lowercase__    :						List[Any]       =			self.head.item
       lowercase__    :						Optional[Any]       =			self.head.next
       self.size -= 1
       return item



 def     UpperCAmelCase     (						self : Union[str, Any]						):

    """simple docstring"""






    return self.head is None



 def __str__(						self : List[str]						):

    """simple docstring"""






    if self.is_empty():
       return ""
    else:
       lowercase__    :						Optional[Any]       =			self.head
       lowercase__    :						str       =			""""""
       lowercase__    :						list[str]       =			[]
       while iterate:
          item_list.append(str(iterate.item						)						)
          lowercase__    :						List[str]       =			iterate.next

       lowercase__    :						List[str]       =			""" --> """.join(UpperCAmelCase__						)

       return item_str







 def __len__(						self : List[Any]						):

    """simple docstring"""






    return self.size


