






"""simple docstring"""




import qiskit
from qiskit.providers import Backend


def   _A       (    SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int	):
    UpperCamelCase	:Optional[Any]     							=       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__	):
        UpperCamelCase	:str     							=       y.zfill(len(SCREAMING_SNAKE_CASE__	)	)
    else:
        UpperCamelCase	:List[Any]     							=       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
    UpperCamelCase	:Optional[Any]     							=       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   _A       (    SCREAMING_SNAKE_CASE__  :     qiskit.QuantumCircuit					,  SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int					,  ):
    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   _A       (    SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     Backend = qiskit.Aer.get_backend('''aer_simulator'''	)					,  ):







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

    # Store the Integers
    UpperCamelCase	:Tuple     							=       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]	)

    UpperCamelCase	:Union[str, Any]     							=       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()













def   _A       (    SCREAMING_SNAKE_CASE__  :     float					,  SCREAMING_SNAKE_CASE__  :     float					,  SCREAMING_SNAKE_CASE__  :     float	):
    if hue < 0 or hue > 360:
        raise Exception('''hue should be between 0 and 360'''	)

    if saturation < 0 or saturation > 1:
        raise Exception('''saturation should be between 0 and 1'''	)

    if value < 0 or value > 1:
        raise Exception('''value should be between 0 and 1'''	)

    UpperCamelCase	:Tuple     							=       value * saturation
    UpperCamelCase	:Any     							=       hue / 60
    UpperCamelCase	:Any     							=       chroma * (1 - abs(hue_section % 2 - 1	))
    UpperCamelCase	:Optional[int]     							=       value - chroma

    if hue_section >= 0 and hue_section <= 1:
        UpperCamelCase	:Any     							=       round(255 * (chroma + match_value)	)
        UpperCamelCase	:Union[str, Any]     							=       round(255 * (second_largest_component + match_value)	)
        UpperCamelCase	:List[str]     							=       round(255 * (match_value)	)
    elif hue_section > 1 and hue_section <= 2:
        UpperCamelCase	:Dict     							=       round(255 * (second_largest_component + match_value)	)
        UpperCamelCase	:Dict     							=       round(255 * (chroma + match_value)	)
        UpperCamelCase	:str     							=       round(255 * (match_value)	)
    elif hue_section > 2 and hue_section <= 3:
        UpperCamelCase	:Any     							=       round(255 * (match_value)	)
        UpperCamelCase	:Optional[Any]     							=       round(255 * (chroma + match_value)	)
        UpperCamelCase	:Union[str, Any]     							=       round(255 * (second_largest_component + match_value)	)
    elif hue_section > 3 and hue_section <= 4:
        UpperCamelCase	:Tuple     							=       round(255 * (match_value)	)
        UpperCamelCase	:Optional[Any]     							=       round(255 * (second_largest_component + match_value)	)
        UpperCamelCase	:str     							=       round(255 * (chroma + match_value)	)
    elif hue_section > 4 and hue_section <= 5:
        UpperCamelCase	:int     							=       round(255 * (second_largest_component + match_value)	)
        UpperCamelCase	:str     							=       round(255 * (match_value)	)
        UpperCamelCase	:List[str]     							=       round(255 * (chroma + match_value)	)
    else:
        UpperCamelCase	:Union[str, Any]     							=       round(255 * (chroma + match_value)	)
        UpperCamelCase	:List[str]     							=       round(255 * (match_value)	)
        UpperCamelCase	:Optional[int]     							=       round(255 * (second_largest_component + match_value)	)

    return [red, green, blue]


def   _A       (    SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int					,  SCREAMING_SNAKE_CASE__  :     int	):
    if red < 0 or red > 255:
        raise Exception('''red should be between 0 and 255'''	)

    if green < 0 or green > 255:
        raise Exception('''green should be between 0 and 255'''	)

    if blue < 0 or blue > 255:
        raise Exception('''blue should be between 0 and 255'''	)

    UpperCamelCase	:str     							=       red / 255
    UpperCamelCase	:List[str]     							=       green / 255
    UpperCamelCase	:int     							=       blue / 255
    UpperCamelCase	:Optional[int]     							=       max(SCREAMING_SNAKE_CASE__					,  SCREAMING_SNAKE_CASE__					,  SCREAMING_SNAKE_CASE__	)
    UpperCamelCase	:int     							=       value - min(SCREAMING_SNAKE_CASE__					,  SCREAMING_SNAKE_CASE__					,  SCREAMING_SNAKE_CASE__	)
    UpperCamelCase	:Dict     							=       0 if value == 0 else chroma / value

    if chroma == 0:
        UpperCamelCase	:Dict     							=       0.0
    elif value == float_red:
        UpperCamelCase	:Optional[Any]     							=       60 * (0 + (float_green - float_blue) / chroma)
    elif value == float_green:
        UpperCamelCase	:List[str]     							=       60 * (2 + (float_blue - float_red) / chroma)
    else:
        UpperCamelCase	:str     							=       60 * (4 + (float_red - float_green) / chroma)

    UpperCamelCase	:int     							=       (hue + 360) % 360

    return [hue, saturation, value]



def   _A       (    SCREAMING_SNAKE_CASE__  :     list[float]					,  SCREAMING_SNAKE_CASE__  :     list[float]	):
    UpperCamelCase	:str     							=       abs(hsv_a[0] - hsv_a[0]	) < 0.2
    UpperCamelCase	:List[str]     							=       abs(hsv_a[1] - hsv_a[1]	) < 0.0_02
    UpperCamelCase	:Any     							=       abs(hsv_a[2] - hsv_a[2]	) < 0.0_02

    return check_hue and check_saturation and check_value





