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






def       __SCREAMING_SNAKE_CASE   (						_SCREAMING_SNAKE_CASE							,      _SCREAMING_SNAKE_CASE   ):
							_snake_case,							_snake_case     =						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   ):
														_snake_case     =						y.zfill(len(_SCREAMING_SNAKE_CASE   )   )
							else:
														_snake_case     =						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
							_snake_case     =						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       __SCREAMING_SNAKE_CASE   (						_SCREAMING_SNAKE_CASE							,      _SCREAMING_SNAKE_CASE							,      _SCREAMING_SNAKE_CASE							,      _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.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       __SCREAMING_SNAKE_CASE   (						_SCREAMING_SNAKE_CASE							,      _SCREAMING_SNAKE_CASE							,      _SCREAMING_SNAKE_CASE = qiskit.Aer.get_backend("""aer_simulator"""   )							,      ):

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

							# Store the Integers
							_snake_case,							_snake_case,							_snake_case     =						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]   )

							_snake_case     =						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()

'''simple docstring'''
import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
				from .tokenization_xglm import XGLMTokenizer
else:
				__lowerCAmelCase  							= None


__lowerCAmelCase  							= logging.get_logger(__name__)

__lowerCAmelCase  							= {'vocab_file': 'sentencepiece.bpe.model', 'tokenizer_file': 'tokenizer.json'}

__lowerCAmelCase  							= {
    'vocab_file': {
        'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/sentencepiece.bpe.model',
    },
    'tokenizer_file': {
        'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/tokenizer.json',
    },
}

__lowerCAmelCase  							= {
    'facebook/xglm-564M': 2_048,
}


class     _lowerCAmelCase					(					__snake_case   ):







							'''simple docstring'''

							lowerCAmelCase_      		=		VOCAB_FILES_NAMES
							lowerCAmelCase_      		=		PRETRAINED_VOCAB_FILES_MAP
							lowerCAmelCase_      		=		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							lowerCAmelCase_      		=		["input_ids", "attention_mask"]
							lowerCAmelCase_      		=		XGLMTokenizer

							def __init__(self						,						UpperCAmelCase=None						,						UpperCAmelCase=None						,						UpperCAmelCase="<s>"						,						UpperCAmelCase="</s>"						,						UpperCAmelCase="</s>"						,						UpperCAmelCase="<s>"						,						UpperCAmelCase="<unk>"						,						UpperCAmelCase="<pad>"						,						**UpperCAmelCase						,						)  ->     List[Any]:
														# Compatibility with the original tokenizer
														_snake_case     =						7
														_snake_case     =						[f"""<madeupword{i}>""" for i in range(self.num_madeup_words						)]

														_snake_case     =						kwargs.get("""additional_special_tokens"""						,						[]						)
														kwargs["additional_special_tokens"] += [
														    word for word in madeup_words if word not in kwargs["additional_special_tokens"]
														]

														super().__init__(
														    UpperCAmelCase						,						tokenizer_file=UpperCAmelCase						,						bos_token=UpperCAmelCase						,						eos_token=UpperCAmelCase						,						sep_token=UpperCAmelCase						,						cls_token=UpperCAmelCase						,						unk_token=UpperCAmelCase						,						pad_token=UpperCAmelCase						,						**UpperCAmelCase						,						)

														_snake_case     =						vocab_file
														_snake_case     =						False if not self.vocab_file else True

							def  lowercase							(self						,						UpperCAmelCase						,						UpperCAmelCase = None						)  ->     List[int]:

														if token_ids_a is None:
																					return [self.sep_token_id] + token_ids_a
														_snake_case     =						[self.sep_token_id]
														return sep + token_ids_a + sep + sep + token_ids_a

							def  lowercase							(self						,						UpperCAmelCase						,						UpperCAmelCase = None						)  ->     List[int]:
														_snake_case     =						[self.sep_token_id]

														if token_ids_a is None:
																					return len(sep + token_ids_a						) * [0]
														return len(sep + token_ids_a + sep + sep + token_ids_a						) * [0]





							def  lowercase							(self						,						UpperCAmelCase						,						UpperCAmelCase = None						)  ->     Tuple[str]:
														if not self.can_save_slow_tokenizer:
																					raise ValueError(
																					    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
																					    """tokenizer."""						)

														if not os.path.isdir(UpperCAmelCase						):
																					logger.error(f"""Vocabulary path ({save_directory}) should be a directory."""						)
																					return
														_snake_case     =						os.path.join(
														    UpperCAmelCase						,						(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]						)

														if os.path.abspath(self.vocab_file						) != os.path.abspath(UpperCAmelCase						):
																					copyfile(self.vocab_file						,						UpperCAmelCase						)

														return (out_vocab_file,)