






"""simple docstring"""




import os







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							str       ):
	snake_case__			:				str       =  len(grid[0]       )
	snake_case__			:				List[str]       =  len(snake_case_       )

	snake_case__			:				Any       =  0
	snake_case__			:				Dict       =  0
	snake_case__			:				Any       =  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       ):
			snake_case__			:				Optional[Any]       =  grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
			snake_case__			:				int       =  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:
				snake_case__			:				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:
				snake_case__			:				str       =  (
				    grid[i][j]
				    * grid[i - 1][j + 1]
				    * grid[i - 2][j + 2]
				    * grid[i - 3][j + 3]
				)

			snake_case__			:				Union[str, Any]       =  max(
			    snake_case_					,  snake_case_					,  snake_case_					,  snake_case_       )
			if max_product > largest:
				snake_case__			:				str       =  max_product

	return largest







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

	snake_case__			:				str       =  [[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())











import os
import unittest

from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer

from ...test_tokenization_common import TokenizerTesterMixin



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_			,       unittest.TestCase						):





					"""simple docstring"""






					a_     =		PhobertTokenizer
					a_     =		False



					def 	_lowercase					( self					:  List[str]	):
						super().setUp()

						# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
						snake_case__			:				Optional[int]       =  ["T@@", "i", "I", "R@@", "r", "e@@"]
						snake_case__			:				int       =  dict(zip(__A							,		range(len(__A	)	)	)	)
						snake_case__			:				Dict       =  ["#version: 0.2", "l à</w>"]
						snake_case__			:				Optional[Any]       =  {"unk_token": "<unk>"}

						snake_case__			:				Tuple       =  os.path.join(self.tmpdirname							,		VOCAB_FILES_NAMES["vocab_file"]	)
						snake_case__			:				Union[str, Any]       =  os.path.join(self.tmpdirname							,		VOCAB_FILES_NAMES["merges_file"]	)

						with open(self.vocab_file							,		"w"							,		encoding="utf-8"	) as fp:
							for token in vocab_tokens:
								fp.write(f'''{token} {vocab_tokens[token]}\n'''	)
						with open(self.merges_file							,		"w"							,		encoding="utf-8"	) as fp:
							fp.write("\n".join(__A	)	)



					def 	_lowercase					( self					:  List[str]							,		**__A					:  Any	):
						kwargs.update(self.special_tokens_map	)
						return PhobertTokenizer.from_pretrained(self.tmpdirname							,		**__A	)



					def 	_lowercase					( self					:  Tuple							,		__A					:  List[Any]	):
						snake_case__			:				str       =  "Tôi là VinAI Research"
						snake_case__			:				int       =  "T<unk> i <unk> <unk> <unk> <unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>"
						return input_text, output_text






					def 	_lowercase					( self					:  Optional[int]	):
						snake_case__			:				int       =  PhobertTokenizer(self.vocab_file							,		self.merges_file							,		**self.special_tokens_map	)
						snake_case__			:				Tuple       =  "Tôi là VinAI Research"
						snake_case__			:				List[Any]       =  "T@@ ô@@ i l@@ à V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h".split()
						snake_case__			:				int       =  tokenizer.tokenize(__A	)
						print(__A	)
						self.assertListEqual(__A							,		__A	)

						snake_case__			:				Any       =  tokens + [tokenizer.unk_token]

						snake_case__			:				Any       =  [4, 3, 5, 3, 3, 3, 3, 3, 3, 6, 7, 9, 3, 9, 3, 3, 3, 3, 3]
						self.assertListEqual(tokenizer.convert_tokens_to_ids(__A	)							,		__A	)



