
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


__A							=logging.get_logger(__name__)

__A							='''▁'''

__A							={'''vocab_file''': '''sentencepiece.bpe.model'''}

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

__A							={
    '''facebook/xglm-564M''': 2_0_4_8,
}




class        _SCREAMING_SNAKE_CASE	( snake_case_		):
	lowerCAmelCase__   =					VOCAB_FILES_NAMES
	lowerCAmelCase__   =					PRETRAINED_VOCAB_FILES_MAP
	lowerCAmelCase__   =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	lowerCAmelCase__   =					['input_ids', 'attention_mask']



	def __init__(       self		,    lowercase		,    lowercase="<s>"		,    lowercase="</s>"		,    lowercase="</s>"		,    lowercase="<s>"		,    lowercase="<unk>"		,    lowercase="<pad>"		,    lowercase = None		,    **lowercase		,    )							->			None:
					lowerCamelCase_         =     {} if sp_model_kwargs is None else sp_model_kwargs

					# Compatibility with the original tokenizer
					lowerCamelCase_         =     7
					lowerCamelCase_         =     [f'<madeupword{i}>' for i in range(self.num_madeup_words					)]

					lowerCamelCase_         =     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__(
					    bos_token=lowercase		,    eos_token=lowercase		,    unk_token=lowercase		,    sep_token=lowercase		,    cls_token=lowercase		,    pad_token=lowercase		,    sp_model_kwargs=self.sp_model_kwargs		,    **lowercase		,    )

					lowerCamelCase_         =     spm.SentencePieceProcessor(**self.sp_model_kwargs					)
					self.sp_model.Load(str(lowercase					)					)
					lowerCamelCase_         =     vocab_file

					# Original fairseq vocab and spm vocab must be "aligned":
					# Vocab    |    0    |    1    |   2    |    3    |  4  |  5  |  6  |   7   |   8   |  9
					# -------- | ------- | ------- | ------ | ------- | --- | --- | --- | ----- | ----- | ----
					# fairseq  | '<s>'   | '<pad>' | '</s>' | '<unk>' | ',' | '.' | '▁' | 's'   | '▁de' | '-'
					# spm      | '<unk>' | '<s>'   | '</s>' | ','     | '.' | '▁' | 's' | '▁de' | '-'   | '▁a'

					# The first "real" token "," has position 4 in the original fairseq vocab and position 3 in the spm vocab
					lowerCamelCase_         =     1

					# Mimic fairseq token-to-id alignment for the first 4 token
					lowerCamelCase_         =     {"<s>": 0, "<pad>": 1, "</s>": 2, "<unk>": 3}

					lowerCamelCase_         =     len(self.sp_model					)
					lowerCamelCase_         =     {f'<madeupword{i}>': sp_size + i + self.fairseq_offset for i in range(self.num_madeup_words					)}
					self.fairseq_tokens_to_ids.update(lowercase					)

					lowerCamelCase_         =     {v: k for k, v in self.fairseq_tokens_to_ids.items()}



	def __getstate__(       self					)							->			Optional[int]:
					lowerCamelCase_         =     self.__dict__.copy()
					lowerCamelCase_         =     None
					lowerCamelCase_         =     self.sp_model.serialized_model_proto()
					return state



	def __setstate__(       self		,    lowercase					)							->			Union[str, Any]:
					lowerCamelCase_         =     d

					# for backward compatibility
					if not hasattr(self		,    "sp_model_kwargs"					):
									lowerCamelCase_         =     {}

					lowerCamelCase_         =     spm.SentencePieceProcessor(**self.sp_model_kwargs					)
					self.sp_model.LoadFromSerializedProto(self.sp_model_proto					)



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

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



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

					if already_has_special_tokens:
									return super().get_special_tokens_mask(
									    token_ids_a=lowercase		,    token_ids_a=lowercase		,    already_has_special_tokens=lowercase					)

					if token_ids_a is None:
									return [1] + ([0] * len(lowercase					))
					return [1] + ([0] * len(lowercase					)) + [1, 1] + ([0] * len(lowercase					))



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase		,    lowercase = None					)							->			List[int]:
					lowerCamelCase_         =     [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]



	@property
	def        SCREAMING_SNAKE_CASE_(       self					)							->			Any:
					return len(self.sp_model					) + self.fairseq_offset + self.num_madeup_words



	def        SCREAMING_SNAKE_CASE_(       self					)							->			int:
					lowerCamelCase_         =     {self.convert_ids_to_tokens(lowercase					): i for i in range(self.vocab_size					)}
					vocab.update(self.added_tokens_encoder					)
					return vocab



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase					)							->			List[str]:
					return self.sp_model.encode(lowercase		,    out_type=lowercase					)



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase					)							->			List[Any]:
					if token in self.fairseq_tokens_to_ids:
									return self.fairseq_tokens_to_ids[token]
					lowerCamelCase_         =     self.sp_model.PieceToId(lowercase					)

					# Need to return unknown token if the SP model returned 0
					return spm_id + self.fairseq_offset if spm_id else self.unk_token_id



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase					)							->			str:
					if index in self.fairseq_ids_to_tokens:
									return self.fairseq_ids_to_tokens[index]
					return self.sp_model.IdToPiece(index - self.fairseq_offset					)



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase					)							->			Optional[Any]:
					lowerCamelCase_         =     "".join(lowercase					).replace(lowercase		,    " "					).strip()
					return out_string



	def        SCREAMING_SNAKE_CASE_(       self		,    lowercase		,    lowercase = None					)							->			Tuple[str]:
					if not os.path.isdir(lowercase					):
									logger.error(f'Vocabulary path ({save_directory}) should be a directory'					)
									return
					lowerCamelCase_         =     os.path.join(
					    lowercase		,    (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]					)

					if os.path.abspath(self.vocab_file					) != os.path.abspath(lowercase					) and os.path.isfile(self.vocab_file					):
									copyfile(self.vocab_file		,    lowercase					)
					elif not os.path.isfile(self.vocab_file					):
									with open(lowercase		,    "wb"					) as fi:
													lowerCamelCase_         =     self.sp_model.serialized_model_proto()
													fi.write(lowercase					)

					return (out_vocab_file,)




import math





def      lowerCamelCase_					(							lowerCamelCase__      ,					lowerCamelCase__       ):
				if 0 not in (x, y):
								# We use the relation x^y = y*log10(x), where 10 is the base.
								return y * math.logaa(lowerCamelCase__       )
				else:
								if x == 0:  # 0 raised to any number is 0
												return 0
								elif y == 0:
												return 1  # any number raised to 0 is 1
				raise AssertionError("This should never happen"       )


if __name__ == "__main__":  # Main function
			# Read two numbers from input and typecast them to int using map function.
			# Here x is the base and y is the power.
			__A							='''Enter the base and the power separated by a comma: '''
			__A,		__A							=map(int, input(prompt).split(''','''))
			__A,		__A							=map(int, input(prompt).split(''','''))

			# We find the log of each number, using the function res(), which takes two
			# arguments.
			__A							=res(xa, ya)
			__A							=res(xa, ya)

			# We check for the largest number
			if resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			elif resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			else:
						print('''Both are equal''')


