


'''simple docstring'''
import os


def     a   (    __a     )						->			str:



					'''simple docstring'''






					UpperCamelCase__     :Optional[int]							      =				len(grid[0]     )
					UpperCamelCase__     :Any							      =				len(__a     )

					UpperCamelCase__     :Any							      =				0
					UpperCamelCase__     :Union[str, Any]							      =				0
					UpperCamelCase__     :Any							      =				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     ):
															UpperCamelCase__     :Optional[Any]							      =				grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
															UpperCamelCase__     :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:
																				UpperCamelCase__     :List[str]							      =				(
																				    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:
																				UpperCamelCase__     :List[Any]							      =				(
																				    grid[i][j]
																				    * grid[i - 1][j + 1]
																				    * grid[i - 2][j + 2]
																				    * grid[i - 3][j + 3]
																				)

															UpperCamelCase__     :Optional[int]							      =				max(
															    __a				,      __a				,      __a				,      __a     )
															if max_product > largest:
																				UpperCamelCase__     :Optional[Any]							      =				max_product

					return largest


def     a   (    )						->			Tuple:



					'''simple docstring'''






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

					UpperCamelCase__     :Union[str, Any]							      =				[[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 __future__ import annotations

import csv

import requests
from bsa import BeautifulSoup


def     a   (    __a = ""     )						->			dict[str, float]:



					'''simple docstring'''






					UpperCamelCase__     :Optional[Any]							      =				url or '''https://www.imdb.com/chart/top/?ref_=nv_mv_250'''
					UpperCamelCase__     :Optional[int]							      =				BeautifulSoup(requests.get(__a     ).text				,      '''html.parser'''     )
					UpperCamelCase__     :Tuple							      =				soup.find_all('''td'''				,      attrs='''titleColumn'''     )
					UpperCamelCase__     :Union[str, Any]							      =				soup.find_all('''td'''				,      class_='''ratingColumn imdbRating'''     )
					return {
					    title.a.text: float(rating.strong.text     )
					    for title, rating in zip(__a				,      __a     )
					}


def     a   (    __a = "IMDb_Top_250_Movies.csv"     )						->			None:



					'''simple docstring'''






					UpperCamelCase__     :Optional[Any]							      =				get_imdb_top_aaa_movies()
					with open(__a				,      '''w'''				,      newline=''''''     ) as out_file:
										UpperCamelCase__     :int							      =				csv.writer(__a     )
										writer.writerow(['''Movie title''', '''IMDb rating''']     )
										for title, rating in movies.items():
															writer.writerow([title, rating]     )


if __name__ == "__main__":
		write_movies()