





"""simple docstring"""




import os





def 						UpperCAmelCase__		(     _UpperCAmelCase					):






  """simple docstring"""





  A_  :       int										=  len(grid[0]					)
  A_  :       str										=  len(_UpperCAmelCase					)

  A_  :       int										=  0
  A_  :       int										=  0
  A_  :       Union[str, Any]										=  0

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

      A_  :       List[Any]										=  max(
          _UpperCAmelCase ,					_UpperCAmelCase ,					_UpperCAmelCase ,					_UpperCAmelCase					)
      if max_product > largest:
        A_  :       List[str]										=  max_product

  return largest





def 						UpperCAmelCase__		(     ):






  """simple docstring"""





  A_  :       Optional[int]										=  []
  with open(os.path.dirname(_UpperCAmelCase					) + '/grid.txt'					) as file:
    for line in file:
      grid.append(line.strip('\n'					).split(' '					)					)

  A_  :       Tuple										=  [[int(_UpperCAmelCase					) for i in grid[j]] for j in range(len(_UpperCAmelCase					)					)]

  return largest_product(_UpperCAmelCase					)


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






"""simple docstring"""




import os

# Precomputes a list of the 100 first triangular numbers
lowerCamelCase_     :						List[str]						=					[int(0.5 * n * (n + 1)) for n in range(1, 1_01)]





def 						UpperCAmelCase__		(     ):






  """simple docstring"""





  A_  :       Union[str, Any]										=  os.path.dirname(os.path.realpath(_UpperCAmelCase					)					)
  A_  :       Tuple										=  os.path.join(_UpperCAmelCase ,					'words.txt'					)

  A_  :       List[Any]										=  ''
  with open(_UpperCAmelCase					) as f:
    A_  :       int										=  f.readline()

  A_  :       Optional[Any]										=  [word.strip('"'					) for word in words.strip('\r\n'					).split(','					)]
  A_  :       Dict										=  [
      word
      for word in [sum(ord(_UpperCAmelCase					) - 64 for x in word					) for word in words]
      if word in TRIANGULAR_NUMBERS
  ]
  return len(_UpperCAmelCase					)


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