



import math

import qiskit



def __lowerCAmelCase (     SCREAMING_SNAKE_CASE_ = 1						,  SCREAMING_SNAKE_CASE_ = 1						,  SCREAMING_SNAKE_CASE_ = 1  ):
			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
			lowercase__					  =				qiskit.QuantumRegister(4						,  "qr"  )
			lowercase__					  =				qiskit.ClassicalRegister(2						,  "cr"  )
			# list the entries
			lowercase__					  =				[input_a, input_a, carry_in]

			lowercase__					  =				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

			lowercase__					  =				qiskit.Aer.get_backend("aer_simulator"  )
			lowercase__					  =				qiskit.execute(SCREAMING_SNAKE_CASE_						,  SCREAMING_SNAKE_CASE_						,  shots=1000  )

			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)}')









import json
from typing import Iterator, List, Union

from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers
from tokenizers.implementations.base_tokenizer import BaseTokenizer
from tokenizers.models import Unigram
from tokenizers.processors import TemplateProcessing
class 				_snake_case			(					lowercase__):




				def __init__(						self					:						Optional[Any],					__lowercase					:						str = "▁",					__lowercase					:						bool = True,					__lowercase					:						Union[str, AddedToken] = "<unk>",					__lowercase					:						Union[str, AddedToken] = "</s>",					__lowercase					:						Union[str, AddedToken] = "<pad>",					):
							lowercase__					  =				{
							    "pad": {"id": 0, "token": pad_token},
							    "eos": {"id": 1, "token": eos_token},
							    "unk": {"id": 2, "token": unk_token},
							}

							lowercase__					  =				[None] * len(self.special_tokens						)
							for token_dict in self.special_tokens.values():
										lowercase__					  =				token_dict["token"]

							lowercase__					  =				Tokenizer(Unigram()						)

							lowercase__					  =				normalizers.Sequence(
							    [
							        normalizers.Nmt(),
							        normalizers.NFKC(),
							        normalizers.Replace(Regex(" {2,}"						),					" "						),
							        normalizers.Lowercase(),
							    ]						)
							lowercase__					  =				pre_tokenizers.Sequence(
							    [
							        pre_tokenizers.Metaspace(replacement=__lowercase,					add_prefix_space=__lowercase						),
							        pre_tokenizers.Digits(individual_digits=__lowercase						),
							        pre_tokenizers.Punctuation(),
							    ]						)
							lowercase__					  =				decoders.Metaspace(replacement=__lowercase,					add_prefix_space=__lowercase						)

							lowercase__					  =				TemplateProcessing(
							    single=F'''$A {self.special_tokens["eos"]["token"]}''',					special_tokens=[(self.special_tokens["eos"]["token"], self.special_tokens["eos"]["id"])],					)

							lowercase__					  =				{
							    "model": "SentencePieceUnigram",
							    "replacement": replacement,
							    "add_prefix_space": add_prefix_space,
							}

							super().__init__(__lowercase,					__lowercase						)




				def 							A__      (						self					:						Union[str, Any],					__lowercase					:						Union[str, List[str]],					__lowercase					:						int = 8000,					__lowercase					:						bool = True,					):
							lowercase__					  =				trainers.UnigramTrainer(
							    vocab_size=__lowercase,					special_tokens=self.special_tokens_list,					show_progress=__lowercase,					)

							if isinstance(__lowercase,					__lowercase						):
										lowercase__					  =				[files]
							self._tokenizer.train(__lowercase,					trainer=__lowercase						)

							self.add_unk_id()




				def 							A__      (						self					:						List[Any],					__lowercase					:						Union[Iterator[str], Iterator[Iterator[str]]],					__lowercase					:						int = 8000,					__lowercase					:						bool = True,					):
							lowercase__					  =				trainers.UnigramTrainer(
							    vocab_size=__lowercase,					special_tokens=self.special_tokens_list,					show_progress=__lowercase,					)

							self._tokenizer.train_from_iterator(__lowercase,					trainer=__lowercase						)

							self.add_unk_id()




				def 							A__      (						self					:						str						):
							lowercase__					  =				json.loads(self._tokenizer.to_str()						)

							lowercase__					  =				self.special_tokens["unk"]["id"]

							lowercase__					  =				Tokenizer.from_str(json.dumps(__lowercase						)						)




