


import copy
import random

from transformers import CLIPTokenizer







class 				snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						def __init__(				self   ,						*__lowercase   ,						**__lowercase							)					->    Dict:
										super().__init__(*__lowercase   ,						**__lowercase							)
										lowerCAmelCase_ :      Union[str, Any]    				=				{}




						def 						lowercase_ (				self   ,						__lowercase   ,						*__lowercase   ,						**__lowercase							)					->    int:
										lowerCAmelCase_ :      Optional[Any]    				=				super().add_tokens(__lowercase   ,						*__lowercase   ,						**__lowercase							)
										if num_added_tokens == 0:
														raise ValueError(
														    f"""The tokenizer already contains the token {placeholder_token}. Please pass a different"""
														    ''' `placeholder_token` that is not already in the tokenizer.'''							)




						def 						lowercase_ (				self   ,						__lowercase   ,						*__lowercase   ,						__lowercase=1   ,						**__lowercase							)					->    Any:
										lowerCAmelCase_ :      Union[str, Any]    				=				[]
										if num_vec_per_token == 1:
														self.try_adding_tokens(__lowercase   ,						*__lowercase   ,						**__lowercase							)
														output.append(__lowercase							)
										else:
														lowerCAmelCase_ :      Any    				=				[]
														for i in range(__lowercase							):
																		lowerCAmelCase_ :      Union[str, Any]    				=				placeholder_token + f"""_{i}"""
																		self.try_adding_tokens(__lowercase   ,						*__lowercase   ,						**__lowercase							)
																		output.append(__lowercase							)
        # handle cases where there is a new placeholder token that contains the current placeholder token but is larger
										for token in self.token_map:
														if token in placeholder_token:
																		raise ValueError(
																		    f"""The tokenizer already has placeholder token {token} that can get confused with"""
																		    f""" {placeholder_token}keep placeholder tokens independent"""							)
										lowerCAmelCase_ :      Dict    				=				output




						def 						lowercase_ (				self   ,						__lowercase   ,						__lowercase=False   ,						__lowercase=1.0							)					->    str:
										if isinstance(__lowercase   ,						__lowercase							):
														lowerCAmelCase_ :      str    				=				[]
														for i in range(len(__lowercase							)							):
																		output.append(self.replace_placeholder_tokens_in_text(text[i]   ,						vector_shuffle=__lowercase							)							)
														return output
										for placeholder_token in self.token_map:
														if placeholder_token in text:
																		lowerCAmelCase_ :      Optional[int]    				=				self.token_map[placeholder_token]
																		lowerCAmelCase_ :      int    				=				tokens[: 1 + int(len(__lowercase							) * prop_tokens_to_load							)]
																		if vector_shuffle:
																						lowerCAmelCase_ :      str    				=				copy.copy(__lowercase							)
																						random.shuffle(__lowercase							)
																		lowerCAmelCase_ :      Any    				=				text.replace(__lowercase   ,						''' '''.join(__lowercase							)							)
										return text




						def __call__(				self   ,						__lowercase   ,						*__lowercase   ,						__lowercase=False   ,						__lowercase=1.0   ,						**__lowercase							)					->    Any:
										return super().__call__(
										    self.replace_placeholder_tokens_in_text(
										        __lowercase   ,						vector_shuffle=__lowercase   ,						prop_tokens_to_load=__lowercase							)   ,						*__lowercase   ,						**__lowercase   ,						)




						def 						lowercase_ (				self   ,						__lowercase   ,						*__lowercase   ,						__lowercase=False   ,						__lowercase=1.0   ,						**__lowercase							)					->    Dict:
										return super().encode(
										    self.replace_placeholder_tokens_in_text(
										        __lowercase   ,						vector_shuffle=__lowercase   ,						prop_tokens_to_load=__lowercase							)   ,						*__lowercase   ,						**__lowercase   ,						)



import math

import qiskit



def 			lowerCAmelCase (		lowerCAmelCase_ = 1 ,   lowerCAmelCase_ = 1 ,   lowerCAmelCase_ = 1 )-> qiskit.result.counts.Counts:
				if (
				    isinstance(lowerCAmelCase_ ,   lowerCAmelCase_ )
				    or isinstance(lowerCAmelCase_ ,   lowerCAmelCase_ )
				    or isinstance(lowerCAmelCase_ ,   lowerCAmelCase_ )
				):
								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(lowerCAmelCase_ ) != input_a)
				    or (math.floor(lowerCAmelCase_ ) != input_a)
				    or (math.floor(lowerCAmelCase_ ) != 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
				lowerCAmelCase_ :      str    				=				qiskit.QuantumRegister(4 ,   '''qr''' )
				lowerCAmelCase_ :      str    				=				qiskit.ClassicalRegister(2 ,   '''cr''' )
				# list the entries
				lowerCAmelCase_ :      Any    				=				[input_a, input_a, carry_in]

				lowerCAmelCase_ :      int    				=				qiskit.QuantumCircuit(lowerCAmelCase_ ,   lowerCAmelCase_ )

				for i in range(0 ,   3 ):
								if entry[i] == 2:
												quantum_circuit.h(lowerCAmelCase_ )  # for hadamard entries
								elif entry[i] == 1:
												quantum_circuit.x(lowerCAmelCase_ )  # for 1 entries
								elif entry[i] == 0:
												quantum_circuit.i(lowerCAmelCase_ )  # 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] ,   lowerCAmelCase_ )  # measure the last two qbits

				lowerCAmelCase_ :      Tuple    				=				qiskit.Aer.get_backend('''aer_simulator''' )
				lowerCAmelCase_ :      Union[str, Any]    				=				qiskit.execute(lowerCAmelCase_ ,   lowerCAmelCase_ ,   shots=1_000 )

				return job.result().get_counts(lowerCAmelCase_ )


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