


import qiskit
from qiskit.providers import Backend






def 		lowercase_(  SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  lowerCamelCase   ,     lowerCamelCase			: Optional[int]   =    bin(SCREAMING_SNAKE_CASE_     )[2:], bin(SCREAMING_SNAKE_CASE_     )[2:]  # Remove leading '0b'

  # Ensure that both strings are of the same length
  if len(SCREAMING_SNAKE_CASE_     ) > len(SCREAMING_SNAKE_CASE_     ):
    lowerCamelCase			: Optional[int]   =    y.zfill(len(SCREAMING_SNAKE_CASE_     )     )
  else:
    lowerCamelCase			: str   =    x.zfill(len(SCREAMING_SNAKE_CASE_     )     )

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

  return circuit, x, y






def 		lowercase_(  SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						):


  '''simple docstring'''

  circuit.ccx(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )
  circuit.cx(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )
  circuit.ccx(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )
  circuit.cx(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )
  circuit.cx(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )






def 		lowercase_(  SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_ = qiskit.Aer.get_backend("aer_simulator"     )				,						):


  '''simple docstring'''

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

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

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

  lowerCamelCase			: List[str]   =    qiskit.execute(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						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 typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


_snake_case					=					{'''configuration_hubert''': ['''HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''HubertConfig''']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _snake_case					=					[
       '''HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''HubertForCTC''',
       '''HubertForSequenceClassification''',
       '''HubertModel''',
       '''HubertPreTrainedModel''',
   ]


try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _snake_case					=					[
       '''TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFHubertForCTC''',
       '''TFHubertModel''',
       '''TFHubertPreTrainedModel''',
   ]

if TYPE_CHECKING:
   from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_hubert import (
          HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          HubertForCTC,
          HubertForSequenceClassification,
          HubertModel,
          HubertPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_hubert import (
          TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFHubertForCTC,
          TFHubertModel,
          TFHubertPreTrainedModel,
      )


else:
   import sys

   _snake_case					=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



