

'''simple docstring'''







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


__lowerCamelCase						    =      logging.get_logger(__name__)


__lowerCamelCase						    =      '''▁'''

__lowerCamelCase						    =      {'''vocab_file''': '''spiece.model'''}

__lowerCamelCase						    =      {
    '''vocab_file''': {
        '''google/reformer-crime-and-punishment''': (
            '''https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model'''
        )
    }
}

__lowerCamelCase						    =      {
    '''google/reformer-crime-and-punishment''': 52_4288,
}


class    A__ ( a_     ):
    lowercase		   =						VOCAB_FILES_NAMES
    lowercase		   =						PRETRAINED_VOCAB_FILES_MAP
    lowercase		   =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    lowercase		   =						['''input_ids''', '''attention_mask''']



    def __init__(   self						,			UpperCamelCase__						,			UpperCamelCase__="</s>"						,			UpperCamelCase__="<unk>"						,			UpperCamelCase__=[]						,			UpperCamelCase__ = None						,			**UpperCamelCase__						,			)  -> None:





           '''simple docstring'''
           A_		   = {} if sp_model_kwargs is None else sp_model_kwargs

           super().__init__(
               eos_token=lowercase_						,			unk_token=lowercase_						,			additional_special_tokens=lowercase_						,			sp_model_kwargs=self.sp_model_kwargs						,			**lowercase_						,			)

           A_		   = vocab_file
           A_		   = spm.SentencePieceProcessor(**self.sp_model_kwargs    )
           self.sp_model.Load(lowercase_    )



    @property
    def    snake_case_     (   self    )  -> Any:





           '''simple docstring'''
           return self.sp_model.get_piece_size()



    def    snake_case_     (   self    )  -> Dict[str, int]:





           '''simple docstring'''
           A_		   = {self.convert_ids_to_tokens(lowercase_    ): i for i in range(self.vocab_size    )}
           vocab.update(self.added_tokens_encoder    )
           return vocab



    def __getstate__(   self    )  -> Optional[int]:





           '''simple docstring'''
           A_		   = self.__dict__.copy()
           A_		   = None
           return state



    def __setstate__(   self						,			UpperCamelCase__    )  -> Union[str, Any]:





           '''simple docstring'''
           A_		   = d

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

           A_		   = spm.SentencePieceProcessor(**self.sp_model_kwargs    )
           self.sp_model.Load(self.vocab_file    )



    def    snake_case_     (   self						,			UpperCamelCase__    )  -> List[str]:





           '''simple docstring'''
           return self.sp_model.encode(lowercase_						,			out_type=lowercase_    )



    def    snake_case_     (   self						,			UpperCamelCase__    )  -> Any:





           '''simple docstring'''
           return self.sp_model.piece_to_id(lowercase_    )



    def    snake_case_     (   self						,			UpperCamelCase__    )  -> Union[str, Any]:





           '''simple docstring'''

           if index < self.sp_model.get_piece_size():
                  A_		   = self.sp_model.IdToPiece(lowercase_    )
           return token



    def    snake_case_     (   self						,			UpperCamelCase__    )  -> str:





           '''simple docstring'''
           A_		   = []
           A_		   = """"""
           for token in tokens:
                  # make sure that special tokens are not decoded using sentencepiece model
                  if token in self.all_special_tokens:
                         out_string += self.sp_model.decode(lowercase_    ) + token
                         A_		   = []
                  else:
                         current_sub_tokens.append(lowercase_    )
           out_string += self.sp_model.decode(lowercase_    )
           return out_string.strip()







    def    snake_case_     (   self						,			UpperCamelCase__						,			UpperCamelCase__ = None    )  -> Tuple[str]:





           '''simple docstring'''

           if not os.path.isdir(lowercase_    ):
                  logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''    )
                  return
           A_		   = 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:
                         A_		   = self.sp_model.serialized_model_proto()
                         fi.write(lowercase_    )

           return (out_vocab_file,)



'''simple docstring'''







import sys

__lowerCamelCase						    =      (
    '''73167176531330624919225119674426574742355349194934'''
    '''96983520312774506326239578318016984801869478851843'''
    '''85861560789112949495459501737958331952853208805511'''
    '''12540698747158523863050715693290963295227443043557'''
    '''66896648950445244523161731856403098711121722383113'''
    '''62229893423380308135336276614282806444486645238749'''
    '''30358907296290491560440772390713810515859307960866'''
    '''70172427121883998797908792274921901699720888093776'''
    '''65727333001053367881220235421809751254540594752243'''
    '''52584907711670556013604839586446706324415722155397'''
    '''53697817977846174064955149290862569321978468622482'''
    '''83972241375657056057490261407972968652414535100474'''
    '''82166370484403199890008895243450658541227588666881'''
    '''16427171479924442928230863465674813919123162824586'''
    '''17866458359124566529476545682848912883142607690042'''
    '''24219022671055626321111109370544217506941658960408'''
    '''07198403850962455444362981230987879927244284909188'''
    '''84580156166097919133875499200524063689912560717606'''
    '''05886116467109405077541002256983155200055935729725'''
    '''71636269561882670428252483600823257530420752963450'''
)
def  UpperCAmelCase__      ( UpperCAmelCase__ = N			)     ->     int:
       A_		   = -sys.maxsize - 1
       for i in range(len(UpperCAmelCase__			) - 12			):
              A_		   = 1
              for j in range(13			):
                     product *= int(n[i + j]			)
              if product > largest_product:
                     A_		   = product
       return largest_product


if __name__ == "__main__":
      print(f"""{solution() = }""")
