
import os






def 			a_						(			__lowercase  :      Any					)					->    Tuple:
			_snake_case            =     len(grid[0]					)
			_snake_case            =     len(__A					)

			_snake_case            =     0
			_snake_case            =     0
			_snake_case            =     0

			# Check vertically, horizontally, diagonally at the same time (only works
			# for nxn grid)
			for i in range(__A					):
						for j in range(n_rows - 3					):
									_snake_case            =     grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
									_snake_case            =     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            =     (
												    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            =     (
												    grid[i][j]
												    * grid[i - 1][j + 1]
												    * grid[i - 2][j + 2]
												    * grid[i - 3][j + 3]
												)

									_snake_case            =     max(
									    __A			,   __A			,   __A			,   __A					)
									if max_product > largest:
												_snake_case            =     max_product

			return largest






def 			a_						(			)					->    Union[str, Any]:
			_snake_case            =     []
			with open(os.path.dirname(__A					) + '/grid.txt'					) as file:
						for line in file:
									grid.append(line.strip('\n'					).split(' '					)					)

			_snake_case            =     [[int(__A					) for i in grid[j]] for j in range(len(__A					)					)]

			return largest_product(__A					)


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







'''simple docstring'''



from math import isqrt


def 				lowercase_					(     __A			:							int      )							->   list[int]:



 """simple docstring"""




 lowercase       : Dict						=[True] * max_number
 for i in range(2       ,   isqrt(max_number - 1      ) + 1      ):
  if is_prime[i]:
   for j in range(i**2       ,   __A       ,   __A      ):
    lowercase       : str						=False

 return [i for i in range(2       ,   __A      ) if is_prime[i]]


def 				lowercase_					(     __A			:							int = 1_0**8      )							->   int:



 """simple docstring"""




 lowercase       : Dict						=calculate_prime_numbers(max_number // 2      )

 lowercase       : str						=0
 lowercase       : Optional[Any]						=0
 lowercase       : Union[str, Any]						=len(__A      ) - 1
 while left <= right:
  while prime_numbers[left] * prime_numbers[right] >= max_number:
   right -= 1
  semiprimes_count += right - left + 1
  left += 1

 return semiprimes_count


if __name__ == "__main__":
      print(f"""{solution() = }""")



