import os

def 							UpperCamelCase				(    lowerCAmelCase_   )		->						List[Any]:




       '''simple docstring'''






       _A=	len(grid[0]   )
       _A=	len(lowerCAmelCase_   )

       _A=	0
       _A=	0
       _A=	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   ):
                     _A=	grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
                     _A=	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=	(
                                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=	(
                                grid[i][j]
                                * grid[i - 1][j + 1]
                                * grid[i - 2][j + 2]
                                * grid[i - 3][j + 3]
                            )

                     _A=	max(
                         lowerCAmelCase_       ,					lowerCAmelCase_       ,					lowerCAmelCase_       ,					lowerCAmelCase_   )
                     if max_product > largest:
                            _A=	max_product

       return largest

def 							UpperCamelCase				(    )		->						Tuple:




       '''simple docstring'''






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

       _A=	[[int(lowerCAmelCase_   ) for i in grid[j]] for j in range(len(lowerCAmelCase_   )   )]

       return largest_product(lowerCAmelCase_   )


if __name__ == "__main__":
      print(solution())
import pickle
import unittest

import torch

from accelerate import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_utils import require_cpu





@require_cpu
class      lowerCAmelCase						(					unittest.TestCase			):



     def 			a__  (					self       ):
            _A=	torch.nn.Linear(10				,      10       )
            _A=	torch.optim.SGD(model.parameters()				,      0.1       )
            _A=	Accelerator()
            _A=	accelerator.prepare(lowerCAmelCase__       )
            try:
                   pickle.loads(pickle.dumps(lowerCAmelCase__       )       )
            except Exception as e:
                   self.fail(f"Accelerated optimizer pickling failed with {e}"       )
            AcceleratorState._reset_state()