






import os







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     int:
     UpperCamelCase__      :       List[str]	    =  len(grid[0]      )
     UpperCamelCase__      :       Union[str, Any]	    =  len(__lowerCAmelCase      )

     UpperCamelCase__      :       Optional[Any]	    =  0
     UpperCamelCase__      :       str	    =  0
     UpperCamelCase__      :       List[Any]	    =  0

     # Check vertically, horizontally, diagonally at the same time (only works
     # for nxn grid)
     for i in range(__lowerCAmelCase      ):
          for j in range(n_rows - 3      ):
               UpperCamelCase__      :       Any	    =  grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
               UpperCamelCase__      :       Union[str, Any]	    =  grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]

               # Left-to-right diagonal (\) product
               if i < n_columns - 3:
                    UpperCamelCase__      :       Union[str, Any]	    =  (
                        grid[i][j]
                        * grid[i + 1][j + 1]
                        * grid[i + 2][j + 2]
                        * grid[i + 3][j + 3]
                    )

               # Right-to-left diagonal(/) product
               if i > 2:
                    UpperCamelCase__      :       int	    =  (
                        grid[i][j]
                        * grid[i - 1][j + 1]
                        * grid[i - 2][j + 2]
                        * grid[i - 3][j + 3]
                    )

               UpperCamelCase__      :       Union[str, Any]	    =  max(
                   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase      )
               if max_product > largest:
                    UpperCamelCase__      :       Dict	    =  max_product

     return largest







def 		SCREAMING_SNAKE_CASE							( )			->     Any:
     UpperCamelCase__      :       Dict	    =  []
     with open(os.path.dirname(__lowerCAmelCase      ) + "/grid.txt"      ) as file:
          for line in file:
               grid.append(line.strip("\n"      ).split(" "      )      )

     UpperCamelCase__      :       Any	    =  [[int(__lowerCAmelCase      ) for i in grid[j]] for j in range(len(__lowerCAmelCase      )      )]

     return largest_product(__lowerCAmelCase      )


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







from ...configuration_utils import PretrainedConfig
from ...utils import logging


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

lowerCamelCase     :							Optional[Any]    ={
    '''edbeeching/decision-transformer-gym-hopper-medium''': (
        '''https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/resolve/main/config.json'''
    ),
    # See all DecisionTransformer models at https://huggingface.co/models?filter=decision_transformer
}





class       __a  (   A__	):
 _lowerCAmelCase	:	str				=			'''decision_transformer'''
 _lowerCAmelCase	:	Optional[Any]				=			['''past_key_values''']
 _lowerCAmelCase	:	Optional[int]				=			{
     '''max_position_embeddings''': '''n_positions''',
     '''num_attention_heads''': '''n_head''',
     '''num_hidden_layers''': '''n_layer''',
 }







 def __init__(		self :       List[Any]							,       SCREAMING_SNAKE_CASE :       Optional[int]=17							,       SCREAMING_SNAKE_CASE :       Optional[int]=4							,       SCREAMING_SNAKE_CASE :       Optional[int]=1_28							,       SCREAMING_SNAKE_CASE :       Dict=40_96							,       SCREAMING_SNAKE_CASE :       Union[str, Any]=True							,       SCREAMING_SNAKE_CASE :       Tuple=1							,       SCREAMING_SNAKE_CASE :       Optional[int]=10_24							,       SCREAMING_SNAKE_CASE :       Any=3							,       SCREAMING_SNAKE_CASE :       str=1							,       SCREAMING_SNAKE_CASE :       Optional[int]=None							,       SCREAMING_SNAKE_CASE :       Dict="relu"							,       SCREAMING_SNAKE_CASE :       Optional[int]=0.1							,       SCREAMING_SNAKE_CASE :       str=0.1							,       SCREAMING_SNAKE_CASE :       str=0.1							,       SCREAMING_SNAKE_CASE :       Union[str, Any]=1e-5							,       SCREAMING_SNAKE_CASE :       Optional[int]=0.0_2							,       SCREAMING_SNAKE_CASE :       Optional[Any]=True							,       SCREAMING_SNAKE_CASE :       Tuple=True							,       SCREAMING_SNAKE_CASE :       int=5_02_56							,       SCREAMING_SNAKE_CASE :       List[Any]=5_02_56							,       SCREAMING_SNAKE_CASE :       Any=False							,       SCREAMING_SNAKE_CASE :       List[Any]=False							,       **SCREAMING_SNAKE_CASE :       Optional[int]							,       ):


      '''simple docstring'''






      UpperCamelCase__      :       List[str]	    =  state_dim
      UpperCamelCase__      :       Optional[int]	    =  act_dim
      UpperCamelCase__      :       Dict	    =  hidden_size
      UpperCamelCase__      :       Any	    =  max_ep_len
      UpperCamelCase__      :       Optional[Any]	    =  action_tanh
      UpperCamelCase__      :       str	    =  vocab_size
      UpperCamelCase__      :       List[str]	    =  n_positions
      UpperCamelCase__      :       Tuple	    =  n_layer
      UpperCamelCase__      :       Union[str, Any]	    =  n_head
      UpperCamelCase__      :       Dict	    =  n_inner
      UpperCamelCase__      :       int	    =  activation_function
      UpperCamelCase__      :       List[str]	    =  resid_pdrop
      UpperCamelCase__      :       Optional[int]	    =  embd_pdrop
      UpperCamelCase__      :       Optional[Any]	    =  attn_pdrop
      UpperCamelCase__      :       Optional[Any]	    =  layer_norm_epsilon
      UpperCamelCase__      :       int	    =  initializer_range
      UpperCamelCase__      :       Dict	    =  scale_attn_weights
      UpperCamelCase__      :       Tuple	    =  use_cache
      UpperCamelCase__      :       List[str]	    =  scale_attn_by_inverse_layer_idx
      UpperCamelCase__      :       Union[str, Any]	    =  reorder_and_upcast_attn

      UpperCamelCase__      :       Optional[Any]	    =  bos_token_id
      UpperCamelCase__      :       Optional[int]	    =  eos_token_id

      super().__init__(bos_token_id=SCREAMING_SNAKE_CASE							,       eos_token_id=SCREAMING_SNAKE_CASE							,       **SCREAMING_SNAKE_CASE						)