

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

import sentencepiece as spm

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


lowercase_             =     logging.get_logger(__name__)

lowercase_             =     {'vocab_file': 'sentencepiece.model'}

lowercase_             =     {
    'vocab_file': {
        'google/rembert': 'https://huggingface.co/google/rembert/resolve/main/sentencepiece.model',
    },
}

lowercase_             =     {
    'google/rembert': 2_5_6,
}





class 				__lowerCAmelCase  (      SCREAMING_SNAKE_CASE							):
  _a		    =						VOCAB_FILES_NAMES
  _a		    =						PRETRAINED_VOCAB_FILES_MAP
  _a		    =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES




  def __init__(       self							,     lowerCAmelCase							,     lowerCAmelCase=False							,     lowerCAmelCase=True							,     lowerCAmelCase=True							,     lowerCAmelCase="[CLS]"							,     lowerCAmelCase="[SEP]"							,     lowerCAmelCase="[UNK]"							,     lowerCAmelCase="[SEP]"							,     lowerCAmelCase="[PAD]"							,     lowerCAmelCase="[CLS]"							,     lowerCAmelCase="[MASK]"							,     **lowerCAmelCase							,     )						->				Optional[int]:
        '''simple docstring'''






        super().__init__(
            do_lower_case=lowerCAmelCase							,     remove_space=lowerCAmelCase							,     keep_accents=lowerCAmelCase							,     bos_token=lowerCAmelCase							,     eos_token=lowerCAmelCase							,     unk_token=lowerCAmelCase							,     sep_token=lowerCAmelCase							,     pad_token=lowerCAmelCase							,     cls_token=lowerCAmelCase							,     mask_token=lowerCAmelCase							,     **lowerCAmelCase							,     )

        _lowercase			 =do_lower_case
        _lowercase			 =remove_space
        _lowercase			 =keep_accents
        _lowercase			 =vocab_file

        _lowercase			 =spm.SentencePieceProcessor()
        self.sp_model.Load(lowerCAmelCase      )




  @property
  def 						A__  (       self      )						->				int:
        '''simple docstring'''






        return len(self.sp_model      )




  def 						A__  (       self      )						->				Optional[Any]:
        '''simple docstring'''






        _lowercase			 ={self.convert_ids_to_tokens(lowerCAmelCase      ): i for i in range(self.vocab_size      )}
        vocab.update(self.added_tokens_encoder      )
        return vocab




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






        _lowercase			 =self.__dict__.copy()
        _lowercase			 =None
        return state




  def __setstate__(       self							,     lowerCAmelCase      )						->				Dict:
        '''simple docstring'''






        _lowercase			 =d
        _lowercase			 =spm.SentencePieceProcessor()
        self.sp_model.Load(self.vocab_file      )




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase=False      )						->				Any:
        '''simple docstring'''






        _lowercase			 =self.sp_model.EncodeAsPieces(lowerCAmelCase      )
        return pieces




  def 						A__  (       self							,     lowerCAmelCase      )						->				List[str]:
        '''simple docstring'''






        return self.sp_model.PieceToId(lowerCAmelCase      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				List[str]:
        '''simple docstring'''






        return self.sp_model.IdToPiece(lowerCAmelCase      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				Optional[int]:
        '''simple docstring'''






        _lowercase			 =self.sp_model.decode_pieces(lowerCAmelCase      )
        return out_string




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase = None      )						->				List[int]:
        '''simple docstring'''






        _lowercase			 =[self.sep_token_id]
        _lowercase			 =[self.cls_token_id]
        if token_ids_a is None:
              return cls + token_ids_a + sep
        return cls + token_ids_a + sep + token_ids_a + sep




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase = None							,     lowerCAmelCase = False      )						->				List[int]:
        '''simple docstring'''






        if already_has_special_tokens:
              if token_ids_a is not None:
                    raise ValueError(
                        'You should not supply a second sequence if the provided sequence of '
                        'ids is already formatted with special tokens for the model.'      )
              return [1 if x in [self.sep_token_id, self.cls_token_id] else 0 for x in token_ids_a]

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




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase = None      )						->				List[int]:
        '''simple docstring'''






        _lowercase			 =[self.sep_token_id]
        _lowercase			 =[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 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase = None      )						->				Tuple[str]:
        '''simple docstring'''






        if not os.path.isdir(lowerCAmelCase      ):
              logger.error('Vocabulary path ({}) should be a directory'.format(lowerCAmelCase      )      )
              return
        _lowercase			 =os.path.join(
            lowerCAmelCase							,     (filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']      )

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

        return (out_vocab_file,)





import os
def   a   (    )					->   Optional[int]:





      """simple docstring"""



      with open(os.path.dirname(A__  ) + '/grid.txt'  ) as f:
            _lowercase			 =[]  # noqa: E741
            for _ in range(20  ):
                  l.append([int(A__  ) for x in f.readline().split()]  )

            _lowercase			 =0

            # right
            for i in range(20  ):
                  for j in range(17  ):
                        _lowercase			 =l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
                        if temp > maximum:
                              _lowercase			 =temp

        # down
            for i in range(17  ):
                  for j in range(20  ):
                        _lowercase			 =l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
                        if temp > maximum:
                              _lowercase			 =temp

        # diagonal 1
            for i in range(17  ):
                  for j in range(17  ):
                        _lowercase			 =l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
                        if temp > maximum:
                              _lowercase			 =temp

        # diagonal 2
            for i in range(17  ):
                  for j in range(3   ,     20  ):
                        _lowercase			 =l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
                        if temp > maximum:
                              _lowercase			 =temp
            return maximum


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


