




"""simple docstring"""




import os



def 					a__				(       snake_case__       )		->      Union[str, Any]:
			lowerCamelCase       =      len(grid[0]       )
			lowerCamelCase       =      len(snake_case__       )

			lowerCamelCase       =      0
			lowerCamelCase       =      0
			lowerCamelCase       =      0

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

									lowerCamelCase       =      max(
									    snake_case__ ,				snake_case__ ,				snake_case__ ,				snake_case__       )
									if max_product > largest:
												lowerCamelCase       =      max_product

			return largest



def 					a__				(       )		->      List[Any]:
			lowerCamelCase       =      []
			with open(os.path.dirname(snake_case__       ) + """/grid.txt"""       ) as file:
						for line in file:
									grid.append(line.strip("""\n"""       ).split(""" """       )       )

			lowerCamelCase       =      [[int(snake_case__       ) for i in grid[j]] for j in range(len(snake_case__       )       )]

			return largest_product(snake_case__       )


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









"""simple docstring"""




from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase							:    List[str]  							=							{
    """configuration_autoformer""": [
        """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AutoformerConfig""",
    ],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase							:    Tuple  							=							[
					    """AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """AutoformerForPrediction""",
					    """AutoformerModel""",
					    """AutoformerPreTrainedModel""",
					]


if TYPE_CHECKING:
					from .configuration_autoformer import (
					    AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    AutoformerConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_autoformer import (
										    AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    AutoformerForPrediction,
										    AutoformerModel,
										    AutoformerPreTrainedModel,
										)

else:
					import sys

					lowerCAmelCase							:    str  							=							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



