





import qiskit
from qiskit.providers import Backend

def     UpperCAmelCase_						(						_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int							)  ->							tuple[qiskit.QuantumCircuit, str, str]:
     '''simple docstring'''


     A_      ,						A_					      =					bin(_UpperCAmelCase							)[2:], bin(_UpperCAmelCase							)[2:]  # Remove leading '0b'

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

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

     return circuit, x, y

def     UpperCAmelCase_						(						_UpperCAmelCase       :qiskit.QuantumCircuit     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	)  ->							int:
     '''simple docstring'''


     circuit.ccx(_UpperCAmelCase     ,	_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.ccx(_UpperCAmelCase     ,	_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)

def     UpperCAmelCase_						(						_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :Backend = qiskit.Aer.get_backend('''aer_simulator'''							)     ,	)  ->							int:
     '''simple docstring'''


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

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

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

     A_					      =					qiskit.execute(_UpperCAmelCase     ,	_UpperCAmelCase     ,	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 transformers import HfArgumentParser, PyTorchBenchmark, PyTorchBenchmarkArguments

def     UpperCAmelCase_						(						)  ->							Optional[int]:
     '''simple docstring'''


     A_					      =					HfArgumentParser(_UpperCAmelCase							)
     try:
          A_					      =					parser.parse_args_into_dataclasses()[0]
     except ValueError as e:
          A_					      =					'''Arg --no_{0} is no longer used, please use --no-{0} instead.'''
          A_					      =					''' '''.join(str(_UpperCAmelCase							).split(''' '''							)[:-1]							)
          A_					      =					''''''
          A_					      =					eval(str(_UpperCAmelCase							).split(''' '''							)[-1]							)
          A_					      =					[]
          for arg in depreciated_args:
               # arg[2:] removes '--'
               if arg[2:] in PyTorchBenchmarkArguments.deprecated_args:
                    # arg[5:] removes '--no_'
                    full_error_msg += arg_error_msg.format(arg[5:]							)
               else:
                    wrong_args.append(_UpperCAmelCase							)
          if len(_UpperCAmelCase							) > 0:
               A_					      =					full_error_msg + begin_error_msg + str(_UpperCAmelCase							)
          raise ValueError(_UpperCAmelCase							)

     A_					      =					PyTorchBenchmark(args=_UpperCAmelCase							)
     benchmark.run()


if __name__ == "__main__":
      main()



