






'''simple docstring'''







import collections
import os
from typing import List, Optional, Tuple

from transformers.utils import is_jieba_available, requires_backends


if is_jieba_available():
		import jieba

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


__lowerCAmelCase       		=      logging.get_logger(__name__)

__lowerCAmelCase       		=      {'vocab_file': 'vocab.txt'}

__lowerCAmelCase       		=      {
    'vocab_file': {
        'openbmb/cpm-ant-10b': 'https://huggingface.co/openbmb/cpm-ant-10b/blob/main/vocab.txt',
    },
}

__lowerCAmelCase       		=      {
    'openbmb/cpm-ant-10b': 1_024,
}





def 		_UpperCAmelCase   (							__A							:   Any      ):
				a_		:  Union[str, Any]											=      collections.OrderedDict()
				with open(__A						,		'''r'''						,		encoding='''utf-8'''      ) as reader:
								a_		:  Optional[Any]											=      reader.readlines()
				for index, token in enumerate(__A      ):
								a_		:  Optional[Any]											=      token.rstrip('''\n'''      )
								a_		:  str											=      index
				return vocab





class 	SCREAMING_SNAKE_CASE					(					SCREAMING_SNAKE_CASE_       ):






			def __init__( self      :			Optional[Any]  ,						__SCREAMING_SNAKE_CASE      :			Optional[Any]  ,						__SCREAMING_SNAKE_CASE      :			Optional[int]="<unk>"  ,						__SCREAMING_SNAKE_CASE      :			Optional[int]=200					)			->			Dict:
							a_		:  int											=      vocab
							a_		:  str											=      unk_token
							a_		:  int											=      max_input_chars_per_word







			def 			SCREAMING_SNAKE_CASE      ( self      :			Any  ,						__SCREAMING_SNAKE_CASE      :			Dict					)			->			int:
							a_		:  List[str]											=      list(__SCREAMING_SNAKE_CASE					)
							if len(__SCREAMING_SNAKE_CASE					) > self.max_input_chars_per_word:
											return [self.unk_token]

							a_		:  Any											=      0
							a_		:  Any											=      []
							while start < len(__SCREAMING_SNAKE_CASE					):
											a_		:  Tuple											=      len(__SCREAMING_SNAKE_CASE					)
											a_		:  List[Any]											=      None
											while start < end:
															a_		:  Dict											=      ''''''.join(chars[start:end]					)
															if substr in self.vocab:
																			a_		:  List[Any]											=      substr
																			break
															end -= 1
											if cur_substr is None:
															sub_tokens.append(self.unk_token					)
															start += 1
											else:
															sub_tokens.append(__SCREAMING_SNAKE_CASE					)
															a_		:  Optional[Any]											=      end

							return sub_tokens





class 	SCREAMING_SNAKE_CASE					(					SCREAMING_SNAKE_CASE_       ):
			snake_case__  =				VOCAB_FILES_NAMES
			snake_case__  =				PRETRAINED_VOCAB_FILES_MAP
			snake_case__  =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
			snake_case__  =				["input_ids", "attention_mask"]
			snake_case__  =				False






			def __init__( self      :			Tuple  ,						__SCREAMING_SNAKE_CASE      :			List[str]  ,						__SCREAMING_SNAKE_CASE      :			Dict="<d>"  ,						__SCREAMING_SNAKE_CASE      :			int="</d>"  ,						__SCREAMING_SNAKE_CASE      :			Optional[int]="<s>"  ,						__SCREAMING_SNAKE_CASE      :			Tuple="</s>"  ,						__SCREAMING_SNAKE_CASE      :			List[Any]="<pad>"  ,						__SCREAMING_SNAKE_CASE      :			int="<unk>"  ,						__SCREAMING_SNAKE_CASE      :			Tuple="</n>"  ,						__SCREAMING_SNAKE_CASE      :			str="</_>"  ,						__SCREAMING_SNAKE_CASE      :			Union[str, Any]="left"  ,						**__SCREAMING_SNAKE_CASE      :			Union[str, Any]  ,						)			->			Union[str, Any]:
							requires_backends(self  ,						['''jieba''']					)
							super().__init__(
							    bod_token=__SCREAMING_SNAKE_CASE  ,						eod_token=__SCREAMING_SNAKE_CASE  ,						bos_token=__SCREAMING_SNAKE_CASE  ,						eos_token=__SCREAMING_SNAKE_CASE  ,						pad_token=__SCREAMING_SNAKE_CASE  ,						unk_token=__SCREAMING_SNAKE_CASE  ,						line_token=__SCREAMING_SNAKE_CASE  ,						space_token=__SCREAMING_SNAKE_CASE  ,						padding_side=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE  ,						)
							a_		:  Union[str, Any]											=      bod_token
							a_		:  str											=      eod_token
							a_		:  int											=      load_vocab(__SCREAMING_SNAKE_CASE					)
							a_		:  Any											=      self.encoder[space_token]
							a_		:  List[Any]											=      self.encoder[line_token]

							del self.encoder[space_token]
							del self.encoder[line_token]

							a_		:  Tuple											=      collections.OrderedDict(sorted(self.encoder.items()  ,						key=lambda __SCREAMING_SNAKE_CASE					: x[1]					)					)
							a_		:  List[Any]											=      {v: k for k, v in self.encoder.items()}

							a_		:  Tuple											=      WordpieceTokenizer(vocab=self.encoder  ,						unk_token=self.unk_token					)






			@property
			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]					)			->			Tuple:
							return self.encoder[self.bod_token]






			@property
			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]					)			->			Tuple:
							return self.encoder[self.eod_token]






			@property
			def 			SCREAMING_SNAKE_CASE      ( self      :			Union[str, Any]					)			->			Any:
							return self.encoder["\n"]






			@property
			def 			SCREAMING_SNAKE_CASE      ( self      :			Tuple					)			->			int:
							return len(self.encoder					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Dict					)			->			List[str]:
							return dict(self.encoder  ,						**self.added_tokens_encoder					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Union[str, Any]  ,						__SCREAMING_SNAKE_CASE      :			Union[str, Any]					)			->			Any:
							a_		:  Tuple											=      []
							for x in jieba.cut(__SCREAMING_SNAKE_CASE  ,						cut_all=__SCREAMING_SNAKE_CASE					):
											output_tokens.extend(self.wordpiece_tokenizer.tokenize(__SCREAMING_SNAKE_CASE					)					)
							return output_tokens






			def 			SCREAMING_SNAKE_CASE      ( self      :			Any  ,						__SCREAMING_SNAKE_CASE      :			List[str]  ,						**__SCREAMING_SNAKE_CASE      :			List[str]					)			->			Tuple:
							a_		:  Any											=      [i for i in token_ids if i >= 0]
							a_		:  Optional[Any]											=      [
							    x for x in token_ids if x != self.pad_token_id and x != self.eos_token_id and x != self.bos_token_id
							]
							return super()._decode(__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]  ,						__SCREAMING_SNAKE_CASE      :			Tuple					)			->			Union[str, Any]:
							return token in self.encoder






			def 			SCREAMING_SNAKE_CASE      ( self      :			Dict  ,						__SCREAMING_SNAKE_CASE      :			List[str]					)			->			str:
							return "".join(__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			str  ,						__SCREAMING_SNAKE_CASE      :			List[Any]					)			->			Optional[int]:
							return self.encoder.get(__SCREAMING_SNAKE_CASE  ,						self.encoder.get(self.unk_token					)					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]  ,						__SCREAMING_SNAKE_CASE      :			int					)			->			Dict:
							return self.decoder.get(__SCREAMING_SNAKE_CASE  ,						self.unk_token					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Any  ,						__SCREAMING_SNAKE_CASE      :			str  ,						__SCREAMING_SNAKE_CASE      :			Optional[str] = None					)			->			Tuple[str]:
							if os.path.isdir(__SCREAMING_SNAKE_CASE					):
											a_		:  List[Any]											=      os.path.join(
											    __SCREAMING_SNAKE_CASE  ,						(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']					)
							else:
											a_		:  Dict											=      (filename_prefix + '''-''' if filename_prefix else '''''') + save_directory
							a_		:  Optional[int]											=      0
							if " " in self.encoder:
											a_		:  List[Any]											=      self.encoder[''' ''']
											del self.encoder[" "]
							if "\n" in self.encoder:
											a_		:  str											=      self.encoder['''\n''']
											del self.encoder["\n"]
							a_		:  Dict											=      collections.OrderedDict(sorted(self.encoder.items()  ,						key=lambda __SCREAMING_SNAKE_CASE					: x[1]					)					)
							with open(__SCREAMING_SNAKE_CASE  ,						'''w'''  ,						encoding='''utf-8'''					) as writer:
											for token, token_index in self.encoder.items():
															if index != token_index:
																			logger.warning(
																			    f'Saving vocabulary to {vocab_file}: vocabulary indices are not consecutive.'
																			    ''' Please check that the vocabulary is not corrupted!'''					)
																			a_		:  int											=      token_index
															writer.write(token + '''\n'''					)
															index += 1
							return (vocab_file,)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Union[str, Any]  ,						__SCREAMING_SNAKE_CASE      :			List[int]  ,						__SCREAMING_SNAKE_CASE      :			List[int] = None					)			->			List[int]:
							if token_ids_a is None:
											return [self.bos_token_id] + token_ids_a
							return [self.bos_token_id] + token_ids_a + [self.bos_token_id] + token_ids_a







			def 			SCREAMING_SNAKE_CASE      ( self      :			Dict  ,						__SCREAMING_SNAKE_CASE      :			List[int]  ,						__SCREAMING_SNAKE_CASE      :			Optional[List[int]] = None  ,						__SCREAMING_SNAKE_CASE      :			bool = False					)			->			List[int]:

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

							if token_ids_a is not None:
											return [1] + ([0] * len(__SCREAMING_SNAKE_CASE					)) + [1] + ([0] * len(__SCREAMING_SNAKE_CASE					))
							return [1] + ([0] * len(__SCREAMING_SNAKE_CASE					))












'''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   (							__A							:   str      ):
				a_		:  Tuple											=      1
				for digit in s:
								product *= int(__A      )
				return product





def 		_UpperCAmelCase   (							__A							:   str = N      ):
				a_		:  Dict											=      -sys.maxsize - 1
				a_		:  Optional[int]											=      n[:13]
				a_		:  str											=      13
				while cur_index < len(__A      ) - 13:
								if int(n[cur_index]      ) >= int(substr[0]      ):
												a_		:  Tuple											=      substr[1:] + n[cur_index]
												cur_index += 1
								else:
												a_		:  Dict											=      max(__A						,		str_eval(__A      )      )
												a_		:  List[str]											=      n[cur_index : cur_index + 13]
												cur_index += 13
				return largest_product


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




