
'''simple docstring'''
import qiskit
from qiskit.providers import Backend

def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE    ):
    """simple docstring"""






    snake_case_     ,	snake_case_	:      Tuple            =  bin(lowerCamelCase_    )[2:], bin(lowerCamelCase_    )[2:]  # Remove leading '0b'

    # Ensure that both strings are of the same length
    if len(lowerCamelCase_    ) > len(lowerCamelCase_    ):
        snake_case_	:      List[str]            =  y.zfill(len(lowerCamelCase_    )    )
    else:
        snake_case_	:      Any            =  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
    snake_case_	:      int            =  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_       (		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						):
    """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_       (		__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
    snake_case_     ,	snake_case_     ,	snake_case_	:      List[Any]            =  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]    )

    snake_case_	:      List[str]            =  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()






'''simple docstring'''
from __future__ import annotations

from collections.abc import Callable

def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE = 1_0_0,						):
    """simple docstring"""






    snake_case_	:      Optional[Any]            =  x_start
    snake_case_	:      str            =  fnc(__SCREAMING_SNAKE_CASE    )
    snake_case_	:      List[str]            =  0.0

    for _ in range(__SCREAMING_SNAKE_CASE    ):
        # Approximates small segments of curve as linear and solve
        # for trapezoidal area
        snake_case_	:      List[str]            =  (x_end - x_start) / steps + xa
        snake_case_	:      Optional[int]            =  fnc(__SCREAMING_SNAKE_CASE    )
        area += abs(fxa + fxa    ) * (xa - xa) / 2

        # Increment step
        snake_case_	:      List[Any]            =  xa
        snake_case_	:      Optional[Any]            =  fxa
    return area


if __name__ == "__main__":

  def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE    ):
      """simple docstring"""






      return x**3

  print("f(x) = x^3")
  print("The area between the curve, x = -10, x = 10 and the x axis is:")
  a_     =  10
  while i <= 10_0000:
    a_     =  trapezoidal_area(f, -5, 5, i)
    print(f"""with {i} steps: {area}""")
    i *= 10




