



from collections.abc import Callable



class   UpperCAmelCase_    :







							def __init__(   self,			__a = None):

														'''simple docstring'''

														_lowerCAmelCase     :							list    =    []
														# Stores indexes of each item for supporting updates and deletion.
														_lowerCAmelCase     :							dict    =    {}
														# Stores current size of heap.
														_lowerCAmelCase     :							str    =    0
														# Stores function used to evaluate the score of an item on which basis ordering
														# will be done.
														_lowerCAmelCase     :							int    =    key or (lambda __a: x)







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														return int((i - 1) / 2) if i > 0 else None







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							Union[str, Any]    =    int(2 * i + 1)
														return left if 0 < left < self.size else None







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							Optional[int]    =    int(2 * i + 2)
														return right if 0 < right < self.size else None







							def    snake_case__      (   self,			__a,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							Optional[int]    =    (
														    self.pos_map[self.arr[j][0]],
														    self.pos_map[self.arr[i][0]],
														)
														# Then swap the items in the list.
														_lowerCAmelCase     :							List[Any]    =    self.arr[j], self.arr[i]







							def    snake_case__      (   self,			__a,			__a):

														'''simple docstring'''

														return self.arr[i][1] < self.arr[j][1]







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							List[str]    =    self._left(__lowercase)
														_lowerCAmelCase     :							Tuple    =    self._right(__lowercase)
														_lowerCAmelCase     :							List[str]    =    i

														if left is not None and not self._cmp(__lowercase,			__lowercase):
																					_lowerCAmelCase     :							Optional[Any]    =    left
														if right is not None and not self._cmp(__lowercase,			__lowercase):
																					_lowerCAmelCase     :							Optional[Any]    =    right

														return valid_parent







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							Optional[int]    =    self._parent(__lowercase)
														while parent is not None and not self._cmp(__lowercase,			__lowercase):
																					self._swap(__lowercase,			__lowercase)
																					_lowerCAmelCase     :							Union[str, Any]    =    parent, self._parent(__lowercase)







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							List[str]    =    self._get_valid_parent(__lowercase)
														while valid_parent != index:
																					self._swap(__lowercase,			__lowercase)
																					_lowerCAmelCase     :							Dict    =    valid_parent, self._get_valid_parent(__lowercase)







							def    snake_case__      (   self,			__a,			__a):

														'''simple docstring'''

														if item not in self.pos_map:
																					return
														_lowerCAmelCase     :							Any    =    self.pos_map[item]
														_lowerCAmelCase     :							Union[str, Any]    =    [item, self.key(__lowercase)]
														# Make sure heap is right in both up and down direction.
														# Ideally only one of them will make any change.
														self._heapify_up(__lowercase)
														self._heapify_down(__lowercase)







							def    snake_case__      (   self,			__a):

														'''simple docstring'''

														if item not in self.pos_map:
																					return
														_lowerCAmelCase     :							Any    =    self.pos_map[item]
														del self.pos_map[item]
														_lowerCAmelCase     :							Any    =    self.arr[self.size - 1]
														_lowerCAmelCase     :							Optional[int]    =    index
														self.size -= 1
														# Make sure heap is right in both up and down direction. Ideally only one
														# of them will make any change- so no performance loss in calling both.
														if self.size > index:
																					self._heapify_up(__lowercase)
																					self._heapify_down(__lowercase)







							def    snake_case__      (   self,			__a,			__a):

														'''simple docstring'''

														_lowerCAmelCase     :							Optional[Any]    =    len(self.arr)
														if arr_len == self.size:
																					self.arr.append([item, self.key(__lowercase)])
														else:
																					_lowerCAmelCase     :							Optional[Any]    =    [item, self.key(__lowercase)]
														_lowerCAmelCase     :							List[Any]    =    self.size
														self.size += 1
														self._heapify_up(self.size - 1)







							def    snake_case__      (   self):

														'''simple docstring'''

														return self.arr[0] if self.size else None







							def    snake_case__      (   self):

														'''simple docstring'''

														_lowerCAmelCase     :							Any    =    self.get_top()
														if top_item_tuple:
																					self.delete_item(top_item_tuple[0])
														return top_item_tuple






def 				A				(					):





							'''simple docstring'''













if __name__ == "__main__":
						import doctest

						doctest.testmod()

import math

import qiskit



def lowerCamelCase  (   SCREAMING_SNAKE_CASE = 1  ,			SCREAMING_SNAKE_CASE = 1  ,			SCREAMING_SNAKE_CASE = 1	):
    '''simple docstring'''







    if (
        isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
        or isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
        or isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
    ):
        raise TypeError('''inputs must be integers.'''	)

    if (input_a < 0) or (input_a < 0) or (carry_in < 0):
        raise ValueError('''inputs must be positive.'''	)

    if (
        (math.floor(SCREAMING_SNAKE_CASE	) != input_a)
        or (math.floor(SCREAMING_SNAKE_CASE	) != input_a)
        or (math.floor(SCREAMING_SNAKE_CASE	) != carry_in)
    ):
        raise ValueError('''inputs must be exact integers.'''	)

    if (input_a > 2) or (input_a > 2) or (carry_in > 2):
        raise ValueError('''inputs must be less or equal to 2.'''	)

    # build registers
    __UpperCamelCase     :List[str]			  =		qiskit.QuantumRegister(4  ,			'''qr'''	)
    __UpperCamelCase     :str			  =		qiskit.ClassicalRegister(2  ,			'''cr'''	)
    # list the entries
    __UpperCamelCase     :Tuple			  =		[input_a, input_a, carry_in]

    __UpperCamelCase     :Optional[int]			  =		qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)

    for i in range(0  ,			3	):
        if entry[i] == 2:
            quantum_circuit.h(SCREAMING_SNAKE_CASE	)  # for hadamard entries
        elif entry[i] == 1:
            quantum_circuit.x(SCREAMING_SNAKE_CASE	)  # for 1 entries
        elif entry[i] == 0:
            quantum_circuit.i(SCREAMING_SNAKE_CASE	)  # for 0 entries

    # build the circuit
    quantum_circuit.ccx(0  ,			1  ,			3	)  # ccx = toffoli gate
    quantum_circuit.cx(0  ,			1	)
    quantum_circuit.ccx(1  ,			2  ,			3	)
    quantum_circuit.cx(1  ,			2	)
    quantum_circuit.cx(0  ,			1	)

    quantum_circuit.measure([2, 3]  ,			SCREAMING_SNAKE_CASE	)  # measure the last two qbits

    __UpperCamelCase     :Optional[Any]			  =		qiskit.Aer.get_backend('''aer_simulator'''	)
    __UpperCamelCase     :Tuple			  =		qiskit.execute(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE  ,			shots=1_000	)

    return job.result().get_counts(SCREAMING_SNAKE_CASE	)


if __name__ == "__main__":
    print(F'Total sum count for state is: {quantum_full_adder(1, 1, 1)}')





