






"""simple docstring"""



import os




def      _lowerCAmelCase		(							)		->List[str]:
						with open(os.path.dirname(UpperCAmelCase__      ) + """/grid.txt"""      ) as f:
												A__						:  str		  =  []  # noqa: E741
												for _ in range(2_0      ):
																		l.append([int(UpperCAmelCase__      ) for x in f.readline().split()]      )

												A__						:  List[str]		  =  0

												# right
												for i in range(2_0      ):
																		for j in range(1_7      ):
																								A__						:  str		  =  l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
																								if temp > maximum:
																														A__						:  Dict		  =  temp

        # down
												for i in range(1_7      ):
																		for j in range(2_0      ):
																								A__						:  Dict		  =  l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
																								if temp > maximum:
																														A__						:  List[Any]		  =  temp

        # diagonal 1
												for i in range(1_7      ):
																		for j in range(1_7      ):
																								A__						:  Tuple		  =  l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
																								if temp > maximum:
																														A__						:  Tuple		  =  temp

        # diagonal 2
												for i in range(1_7      ):
																		for j in range(3,						2_0      ):
																								A__						:  Union[str, Any]		  =  l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
																								if temp > maximum:
																														A__						:  List[str]		  =  temp
												return maximum


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














"""simple docstring"""



import unittest

import numpy as np
import torch

from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()






class 							__SCREAMING_SNAKE_CASE						(				unittest.TestCase		):


							@property
							def 						_UpperCamelCase       (			self      :						Dict							):
													'''simple docstring'''





													torch.manual_seed(0							)
													A__						:  Optional[Any]		  =  UNetaDModel(
													    block_out_channels=(32, 64)			,    layers_per_block=2			,    sample_size=32			,    in_channels=3			,    out_channels=3			,    down_block_types=("""DownBlock2D""", """AttnDownBlock2D""")			,    up_block_types=("""AttnUpBlock2D""", """UpBlock2D""")			,    )
													return model


							def 						_UpperCamelCase       (			self      :						Optional[Any]							):
													'''simple docstring'''





													A__						:  List[Any]		  =  self.dummy_uncond_unet
													A__						:  Dict		  =  ScoreSdeVeScheduler()

													A__						:  str		  =  ScoreSdeVePipeline(unet=snake_case			,    scheduler=snake_case							)
													sde_ve.to(snake_case							)
													sde_ve.set_progress_bar_config(disable=snake_case							)

													A__						:  Optional[int]		  =  torch.manual_seed(0							)
													A__						:  Any		  =  sde_ve(num_inference_steps=2			,    output_type="""numpy"""			,    generator=snake_case							).images

													A__						:  List[str]		  =  torch.manual_seed(0							)
													A__						:  int		  =  sde_ve(num_inference_steps=2			,    output_type="""numpy"""			,    generator=snake_case			,    return_dict=snake_case							)[
													    0
													]

													A__						:  int		  =  image[0, -3:, -3:, -1]
													A__						:  Optional[Any]		  =  image_from_tuple[0, -3:, -3:, -1]

													assert image.shape == (1, 32, 32, 3)
													A__						:  Optional[Any]		  =  np.array([0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]							)

													assert np.abs(image_slice.flatten() - expected_slice							).max() < 1e-2
													assert np.abs(image_from_tuple_slice.flatten() - expected_slice							).max() < 1e-2






@slow
@require_torch
class 							__SCREAMING_SNAKE_CASE						(				unittest.TestCase		):


							def 						_UpperCamelCase       (			self      :						Tuple							):
													'''simple docstring'''





													A__						:  Union[str, Any]		  =  """google/ncsnpp-church-256"""
													A__						:  Tuple		  =  UNetaDModel.from_pretrained(snake_case							)

													A__						:  int		  =  ScoreSdeVeScheduler.from_pretrained(snake_case							)

													A__						:  List[Any]		  =  ScoreSdeVePipeline(unet=snake_case			,    scheduler=snake_case							)
													sde_ve.to(snake_case							)
													sde_ve.set_progress_bar_config(disable=snake_case							)

													A__						:  Dict		  =  torch.manual_seed(0							)
													A__						:  Optional[int]		  =  sde_ve(num_inference_steps=10			,    output_type="""numpy"""			,    generator=snake_case							).images

													A__						:  Optional[int]		  =  image[0, -3:, -3:, -1]

													assert image.shape == (1, 256, 256, 3)

													A__						:  Dict		  =  np.array([0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]							)

													assert np.abs(image_slice.flatten() - expected_slice							).max() < 1e-2






