



"""simple docstring"""

import flax.linen as nn
import jax
import jax.numpy as jnp




class SCREAMING_SNAKE_CASE__					(       nn.Module      ):
						_lowerCAmelCase							=					4_2
						_lowerCAmelCase							=					jnp.floataa



						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		List[Any]									=       nn.Conv(
													    self.out_channels						,     kernel_size=(3, 3)						,     strides=(1, 1)						,     padding=((1, 1), (1, 1))						,     dtype=self.dtype						,     )





						def __call__(self						,     _lowercase							):





													'''simple docstring'''

													__a							,     __a							,     __a							,     __a		:		Union[str, Any]									=       hidden_states.shape
													__a		:		List[str]									=       jax.image.resize(
													    __A						,     shape=(batch, height * 2, width * 2, channels)						,     method="""nearest"""						,     )
													__a		:		Any									=       self.conv(__A							)
													return hidden_states







class SCREAMING_SNAKE_CASE__					(       nn.Module      ):
						_lowerCAmelCase							=					4_2
						_lowerCAmelCase							=					jnp.floataa



						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		Tuple									=       nn.Conv(
													    self.out_channels						,     kernel_size=(3, 3)						,     strides=(2, 2)						,     padding=((1, 1), (1, 1))						,     dtype=self.dtype						,     )





						def __call__(self						,     _lowercase							):





													'''simple docstring'''

													__a		:		List[Any]									=       self.conv(__A							)
													return hidden_states







class SCREAMING_SNAKE_CASE__					(       nn.Module      ):
						_lowerCAmelCase							=					4_2
						_lowerCAmelCase							=					None
						_lowerCAmelCase							=					0.0
						_lowerCAmelCase							=					None
						_lowerCAmelCase							=					jnp.floataa



						def     lowerCAmelCase__(self							):





													'''simple docstring'''

													__a		:		List[str]									=       self.in_channels if self.out_channels is None else self.out_channels

													__a		:		Optional[int]									=       nn.GroupNorm(num_groups=32						,     epsilon=1e-5							)
													__a		:		Tuple									=       nn.Conv(
													    __A						,     kernel_size=(3, 3)						,     strides=(1, 1)						,     padding=((1, 1), (1, 1))						,     dtype=self.dtype						,     )

													__a		:		Dict									=       nn.Dense(__A						,     dtype=self.dtype							)

													__a		:		Union[str, Any]									=       nn.GroupNorm(num_groups=32						,     epsilon=1e-5							)
													__a		:		Optional[Any]									=       nn.Dropout(self.dropout_prob							)
													__a		:		Dict									=       nn.Conv(
													    __A						,     kernel_size=(3, 3)						,     strides=(1, 1)						,     padding=((1, 1), (1, 1))						,     dtype=self.dtype						,     )

													__a		:		Optional[Any]									=       self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

													__a		:		List[str]									=       None
													if use_nin_shortcut:
																				__a		:		List[str]									=       nn.Conv(
																				    __A						,     kernel_size=(1, 1)						,     strides=(1, 1)						,     padding="""VALID"""						,     dtype=self.dtype						,     )





						def __call__(self						,     _lowercase						,     _lowercase						,     _lowercase=True							):





													'''simple docstring'''

													__a		:		Any									=       hidden_states
													__a		:		int									=       self.norma(__A							)
													__a		:		str									=       nn.swish(__A							)
													__a		:		Any									=       self.conva(__A							)

													__a		:		List[str]									=       self.time_emb_proj(nn.swish(__A							)							)
													__a		:		Dict									=       jnp.expand_dims(jnp.expand_dims(__A						,     1							)						,     1							)
													__a		:		int									=       hidden_states + temb

													__a		:		Union[str, Any]									=       self.norma(__A							)
													__a		:		Dict									=       nn.swish(__A							)
													__a		:		Union[str, Any]									=       self.dropout(__A						,     __A							)
													__a		:		Optional[int]									=       self.conva(__A							)

													if self.conv_shortcut is not None:
																				__a		:		Dict									=       self.conv_shortcut(__A							)

													return hidden_states + residual






"""simple docstring"""

import os





def       __magic_name__    (   _lowerCamelCase				: Dict					):
							__a		:		List[str]									=       len(grid[0]					)
							__a		:		int									=       len(_lowerCamelCase					)

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

																					__a		:		str									=       max(
																					    _lowerCamelCase  ,       _lowerCamelCase  ,       _lowerCamelCase  ,       _lowerCamelCase					)
																					if max_product > largest:
																												__a		:		Optional[Any]									=       max_product

							return largest





def       __magic_name__    (   ):
							__a		:		Tuple									=       []
							with open(os.path.dirname(_lowerCamelCase					) + """/grid.txt"""					) as file:
														for line in file:
																					grid.append(line.strip("""\n"""					).split(""" """					)					)

							__a		:		Tuple									=       [[int(_lowerCamelCase					) for i in grid[j]] for j in range(len(_lowerCamelCase					)					)]

							return largest_product(_lowerCamelCase					)


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

