
import os
def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Dict          =   len(grid[0]      )
		lowerCamelCase					:      Tuple          =   len(lowerCAmelCase__      )

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

						lowerCamelCase					:      int          =   max(
						    lowerCAmelCase__,						lowerCAmelCase__,						lowerCAmelCase__,						lowerCAmelCase__      )
						if max_product > largest:
								lowerCamelCase					:      Dict          =   max_product

		return largest
def 		UpperCAmelCase (		):





		'''simple docstring'''


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

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

		return largest_product(lowerCAmelCase__      )


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








"""simple docstring"""

import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding






class 	_lowercase       (    __UpperCAmelCase		):
	lowercase_				=     ['image_processor', 'tokenizer']
	lowercase_				=     'ChineseCLIPImageProcessor'
	lowercase_				=     ('BertTokenizer', 'BertTokenizerFast')




	def __init__(			self		,			UpperCAmelCase_=None		,			UpperCAmelCase_=None		,			**UpperCAmelCase_ )		->							List[str]:
			lowerCamelCase					:      Tuple          =   None
			if "feature_extractor" in kwargs:
					warnings.warn(
					    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
					    ' instead.'		,			UpperCAmelCase_		,			)
					lowerCamelCase					:      int          =   kwargs.pop('feature_extractor' )

			lowerCamelCase					:      Any          =   image_processor if image_processor is not None else feature_extractor
			if image_processor is None:
					raise ValueError('You need to specify an `image_processor`.' )
			if tokenizer is None:
					raise ValueError('You need to specify a `tokenizer`.' )

			super().__init__(UpperCAmelCase_		,			UpperCAmelCase_ )
			lowerCamelCase					:      Tuple          =   self.image_processor




	def __call__(			self		,			UpperCAmelCase_=None		,			UpperCAmelCase_=None		,			UpperCAmelCase_=None		,			**UpperCAmelCase_ )		->							str:

			if text is None and images is None:
					raise ValueError('You have to specify either text or images. Both cannot be none.' )

			if text is not None:
					lowerCamelCase					:      Any          =   self.tokenizer(UpperCAmelCase_		,			return_tensors=UpperCAmelCase_		,			**UpperCAmelCase_ )

			if images is not None:
					lowerCamelCase					:      Dict          =   self.image_processor(UpperCAmelCase_		,			return_tensors=UpperCAmelCase_		,			**UpperCAmelCase_ )

			if text is not None and images is not None:
					lowerCamelCase					:      Tuple          =   image_features.pixel_values
					return encoding
			elif text is not None:
					return encoding
			else:
					return BatchEncoding(data=dict(**UpperCAmelCase_ )		,			tensor_type=UpperCAmelCase_ )




	def       _UpperCamelCase   (			self		,			*UpperCAmelCase_		,			**UpperCAmelCase_ )		->							List[str]:
			return self.tokenizer.batch_decode(*UpperCAmelCase_		,			**UpperCAmelCase_ )




	def       _UpperCamelCase   (			self		,			*UpperCAmelCase_		,			**UpperCAmelCase_ )		->							Optional[int]:
			return self.tokenizer.decode(*UpperCAmelCase_		,			**UpperCAmelCase_ )




	@property
	def       _UpperCamelCase   (			self )		->							Optional[Any]:
			lowerCamelCase					:      List[Any]          =   self.tokenizer.model_input_names
			lowerCamelCase					:      Union[str, Any]          =   self.image_processor.model_input_names
			return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names ) )




	@property
	def       _UpperCamelCase   (			self )		->							List[str]:
			warnings.warn(
			    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'		,			UpperCAmelCase_		,			)
			return self.image_processor_class






