



import os







def  lowerCAmelCase_	(lowerCAmelCase__:		Any  ):





			"""simple docstring"""


			UpperCAmelCase_:		Tuple							      =     len(grid[0]  )
			UpperCAmelCase_:		Optional[int]							      =     len(lowerCAmelCase__  )

			UpperCAmelCase_:		Union[str, 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_:		Tuple							      =     grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
									UpperCAmelCase_:		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_:		Optional[int]							      =     (
												    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_:		List[Any]							      =     (
												    grid[i][j]
												    * grid[i - 1][j + 1]
												    * grid[i - 2][j + 2]
												    * grid[i - 3][j + 3]
												)

									UpperCAmelCase_:		Any							      =     max(
									    lowerCAmelCase__		,						lowerCAmelCase__		,						lowerCAmelCase__		,						lowerCAmelCase__  )
									if max_product > largest:
												UpperCAmelCase_:		int							      =     max_product

			return largest







def  lowerCAmelCase_	():





			"""simple docstring"""


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

			UpperCAmelCase_:		Union[str, Any]							      =     [[int(lowerCAmelCase__  ) for i in grid[j]] for j in range(len(lowerCAmelCase__  )  )]

			return largest_product(lowerCAmelCase__  )


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











from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


a      :  Dict			     =			{
    'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'],
    'tokenization_lxmert': ['LxmertTokenizer'],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  Any			     =			['LxmertTokenizerFast']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  str			     =			[
	    'LxmertEncoder',
	    'LxmertForPreTraining',
	    'LxmertForQuestionAnswering',
	    'LxmertModel',
	    'LxmertPreTrainedModel',
	    'LxmertVisualFeatureEncoder',
	    'LxmertXLayer',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a      :  str			     =			[
	    'TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFLxmertForPreTraining',
	    'TFLxmertMainLayer',
	    'TFLxmertModel',
	    'TFLxmertPreTrainedModel',
	    'TFLxmertVisualFeatureEncoder',
	]


if TYPE_CHECKING:
	from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
	from .tokenization_lxmert import LxmertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_lxmert_fast import LxmertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_lxmert import (
		    LxmertEncoder,
		    LxmertForPreTraining,
		    LxmertForQuestionAnswering,
		    LxmertModel,
		    LxmertPreTrainedModel,
		    LxmertVisualFeatureEncoder,
		    LxmertXLayer,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_lxmert import (
		    TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFLxmertForPreTraining,
		    TFLxmertMainLayer,
		    TFLxmertModel,
		    TFLxmertPreTrainedModel,
		    TFLxmertVisualFeatureEncoder,
		)

else:
	import sys

	a      :  str			     =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






