





import os





def      lowerCAmelCase_ (       __a		)     ->		Dict:







  """simple docstring"""





  lowerCamelCase__:      Union[str, Any]			  =len(grid[0]		)
  lowerCamelCase__:      List[Any]			  =len(__a		)

  lowerCamelCase__:      str			  =0
  lowerCamelCase__:      Tuple			  =0
  lowerCamelCase__:      Optional[int]			  =0

  # Check vertically, horizontally, diagonally at the same time (only works
  # for nxn grid)
  for i in range(__a		):
    for j in range(n_rows - 3		):
      lowerCamelCase__:      Any			  =grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
      lowerCamelCase__:      List[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:
        lowerCamelCase__:      List[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:
        lowerCamelCase__:      List[Any]			  =(
            grid[i][j]
            * grid[i - 1][j + 1]
            * grid[i - 2][j + 2]
            * grid[i - 3][j + 3]
        )

      lowerCamelCase__:      List[Any]			  =max(
          __a	,    __a	,    __a	,    __a		)
      if max_product > largest:
        lowerCamelCase__:      Union[str, Any]			  =max_product

  return largest





def      lowerCAmelCase_ (       )     ->		List[str]:







  """simple docstring"""





  lowerCamelCase__:      List[str]			  =[]
  with open(os.path.dirname(__a		) + "/grid.txt"		) as file:
    for line in file:
      grid.append(line.strip("\n"		).split(" "		)		)

  lowerCamelCase__:      str			  =[[int(__a		) for i in grid[j]] for j in range(len(__a		)		)]

  return largest_product(__a		)


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








import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Image
from .base import TaskTemplate



@dataclass(frozen=__SCREAMING_SNAKE_CASE    )
class    _SCREAMING_SNAKE_CASE						(	__SCREAMING_SNAKE_CASE    ):







 '''simple docstring'''
 lowercase_		=			field(default="image-classification"    ,							metadata={"include_in_asdict_even_if_is_default": True}    )
 lowercase_		=			Features({"image": Image()}    )
 lowercase_		=			Features({"labels": ClassLabel}    )
 lowercase_		=			"image"
 lowercase_		=			"labels"

 def 							SCREAMING_SNAKE_CASE_					(self				:   Tuple       , UpperCAmelCase_				:   Union[str, Any])       ->Tuple:



   '''simple docstring'''



   if self.label_column not in features:
     raise ValueError(F"""Column {self.label_column} is not present in features.""")
   if not isinstance(features[self.label_column]       , UpperCAmelCase_):
     raise ValueError(F"""Column {self.label_column} is not a ClassLabel.""")
   lowerCamelCase__:      List[Any]			  =copy.deepcopy(self)
   lowerCamelCase__:      Optional[int]			  =self.label_schema.copy()
   lowerCamelCase__:      int			  =features[self.label_column]
   lowerCamelCase__:      int			  =label_schema
   return task_template







 @property
 def 							SCREAMING_SNAKE_CASE_					(self				:   Dict)       ->Dict[str, str]:



   '''simple docstring'''



   return {
       self.image_column: "image",
       self.label_column: "labels",
   }

