





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer


__lowerCamelCase	:					Optional[int]			  =					logging.get_logger(__name__)

__lowerCamelCase	:					Any			  =					{'vocab_file': 'vocab.txt'}

__lowerCamelCase	:					Union[str, Any]			  =					{
    'vocab_file': {
        'YituTech/conv-bert-base': 'https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt',
        'YituTech/conv-bert-medium-small': (
            'https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt'
        ),
        'YituTech/conv-bert-small': 'https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt',
    }
}

__lowerCamelCase	:					int			  =					{
    'YituTech/conv-bert-base': 512,
    'YituTech/conv-bert-medium-small': 512,
    'YituTech/conv-bert-small': 512,
}


__lowerCamelCase	:					List[str]			  =					{
    'YituTech/conv-bert-base': {'do_lower_case': True},
    'YituTech/conv-bert-medium-small': {'do_lower_case': True},
    'YituTech/conv-bert-small': {'do_lower_case': True},
}



class  A__       (	lowerCAmelCase__      ):
      _UpperCAmelCase     :int						   =       VOCAB_FILES_NAMES
      _UpperCAmelCase     :int						   =       PRETRAINED_VOCAB_FILES_MAP
      _UpperCAmelCase     :Optional[int]						   =       PRETRAINED_INIT_CONFIGURATION
      _UpperCAmelCase     :Optional[int]						   =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      _UpperCAmelCase     :List[Any]						   =       ConvBertTokenizer





      def __init__(			self	,							A_=None	,							A_=None	,							A_=True	,							A_="[UNK]"	,							A_="[SEP]"	,							A_="[PAD]"	,							A_="[CLS]"	,							A_="[MASK]"	,							A_=True	,							A_=None	,							**A_	,							):
       '''simple docstring'''




       super().__init__(
           _SCREAMING_SNAKE_CASE	,							tokenizer_file=_SCREAMING_SNAKE_CASE	,							do_lower_case=_SCREAMING_SNAKE_CASE	,							unk_token=_SCREAMING_SNAKE_CASE	,							sep_token=_SCREAMING_SNAKE_CASE	,							pad_token=_SCREAMING_SNAKE_CASE	,							cls_token=_SCREAMING_SNAKE_CASE	,							mask_token=_SCREAMING_SNAKE_CASE	,							tokenize_chinese_chars=_SCREAMING_SNAKE_CASE	,							strip_accents=_SCREAMING_SNAKE_CASE	,							**_SCREAMING_SNAKE_CASE	,							)

       UpperCamelCase     : List[str]	     =       json.loads(self.backend_tokenizer.normalizer.__getstate__()       )
       if (
           normalizer_state.get("lowercase"	,							_SCREAMING_SNAKE_CASE       ) != do_lower_case
           or normalizer_state.get("strip_accents"	,							_SCREAMING_SNAKE_CASE       ) != strip_accents
           or normalizer_state.get("handle_chinese_chars"	,							_SCREAMING_SNAKE_CASE       ) != tokenize_chinese_chars
       ):
        UpperCamelCase     : Union[str, Any]	     =       getattr(_SCREAMING_SNAKE_CASE	,							normalizer_state.pop("type"       )       )
        UpperCamelCase     : Any	     =       do_lower_case
        UpperCamelCase     : Dict	     =       strip_accents
        UpperCamelCase     : int	     =       tokenize_chinese_chars
        UpperCamelCase     : str	     =       normalizer_class(**_SCREAMING_SNAKE_CASE       )

       UpperCamelCase     : Tuple	     =       do_lower_case





      def 	__UpperCamelCase(			self	,							A_	,							A_=None       ):
       '''simple docstring'''




       UpperCamelCase     : Dict	     =       [self.cls_token_id] + token_ids_a + [self.sep_token_id]

       if token_ids_a:
        output += token_ids_a + [self.sep_token_id]

       return output





      def 	__UpperCamelCase(			self	,							A_	,							A_ = None       ):
       '''simple docstring'''




       UpperCamelCase     : List[Any]	     =       [self.sep_token_id]
       UpperCamelCase     : List[str]	     =       [self.cls_token_id]
       if token_ids_a is None:
        return len(cls + token_ids_a + sep       ) * [0]
       return len(cls + token_ids_a + sep       ) * [0] + len(token_ids_a + sep       ) * [1]





      def 	__UpperCamelCase(			self	,							A_	,							A_ = None       ):
       '''simple docstring'''




       UpperCamelCase     : Any	     =       self._tokenizer.model.save(_SCREAMING_SNAKE_CASE	,							name=_SCREAMING_SNAKE_CASE       )
       return tuple(_SCREAMING_SNAKE_CASE       )







import os



def 		A_    (					)						->			int:
 UpperCamelCase     : List[str]	     =       os.path.dirname(os.path.realpath(_lowerCAmelCase					)					)
 UpperCamelCase     : Any	     =       os.path.join(_lowerCAmelCase							,       "triangle.txt"					)

 with open(_lowerCAmelCase					) as f:
  UpperCamelCase     : Optional[Any]	     =       f.readlines()

 UpperCamelCase     : Tuple	     =       []
 for line in triangle:
  UpperCamelCase     : List[str]	     =       []
  for number in line.strip().split(" "					):
   numbers_from_line.append(int(_lowerCAmelCase					)					)
  a.append(_lowerCAmelCase					)

 for i in range(1							,       len(_lowerCAmelCase					)					):
  for j in range(len(a[i]					)					):
   UpperCamelCase     : List[Any]	     =       a[i - 1][j] if j != len(a[i - 1]					) else 0
   UpperCamelCase     : Dict	     =       a[i - 1][j - 1] if j > 0 else 0
   a[i][j] += max(_lowerCAmelCase							,       _lowerCAmelCase					)
 return max(a[-1]					)


if __name__ == "__main__":
    print(solution())
