






import qiskit
from qiskit.providers import Backend






def   a      (						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   a      (						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   a      (						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()












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A__     :      int             =			{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      List[Any]             =			[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      int             =			[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__     :      Tuple             =			['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

							A__     :      Dict             =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




