




'''simple docstring'''


import argparse
from collections import defaultdict

import yaml


_snake_case : int  				=						'docs/source/en/_toctree.yml'
def 						snake_case_       (UpperCamelCase			:    List[Any] ):





							'''simple docstring'''


							_a      	=							defaultdict(UpperCamelCase )
							for doc in model_doc:
														counts[doc["local"]] += 1
							_a      	=							[key for key, value in counts.items() if value > 1]

							_a      	=							[]
							for duplicate_key in duplicates:
														_a      	=							list({doc['''title'''] for doc in model_doc if doc['''local'''] == duplicate_key} )
														if len(UpperCamelCase ) > 1:
																					raise ValueError(
																					    f'{duplicate_key} is present several times in the documentation table of content at '
																					    '''`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the '''
																					    '''others.''' )
														# Only add this once
														new_doc.append({'''local''': duplicate_key, '''title''': titles[0]} )

							# Add none duplicate-keys
							new_doc.extend([doc for doc in model_doc if counts[doc['''local''']] == 1] )

							# Sort
							return sorted(UpperCamelCase					,		key=lambda UpperCamelCase : s["title"].lower() )
def 						snake_case_       (UpperCamelCase			:    Any=False ):





							'''simple docstring'''


							with open(UpperCamelCase					,		encoding='''utf-8''' ) as f:
														_a      	=							yaml.safe_load(f.read() )

							# Get to the API doc
							_a      	=							0
							while content[api_idx]["title"] != "API":
														api_idx += 1
							_a      	=							content[api_idx]['''sections''']

							# Then to the model doc
							_a      	=							0
							while api_doc[model_idx]["title"] != "Models":
														model_idx += 1

							_a      	=							api_doc[model_idx]['''sections''']

							_a      	=							[(idx, section) for idx, section in enumerate(UpperCamelCase ) if '''sections''' in section]
							_a      	=							False
							for idx, modality_doc in modalities_docs:
														_a      	=							modality_doc['''sections''']
														_a      	=							clean_model_doc_toc(UpperCamelCase )

														if old_modality_doc != new_modality_doc:
																					_a      	=							True
																					if overwrite:
																												_a      	=							new_modality_doc

							if diff:
														if overwrite:
																					_a      	=							model_doc
																					_a      	=							api_doc
																					with open(UpperCamelCase					,		'''w'''					,		encoding='''utf-8''' ) as f:
																												f.write(yaml.dump(UpperCamelCase					,		allow_unicode=UpperCamelCase ) )
														else:
																					raise ValueError(
																					    '''The model doc part of the table of content is not properly sorted, run `make style` to fix this.''' )


if __name__ == "__main__":
				_snake_case : str  				=						argparse.ArgumentParser()
				parser.add_argument('--fix_and_overwrite', action='store_true', help='Whether to fix inconsistencies.')
				_snake_case : Optional[int]  				=						parser.parse_args()

				check_model_doc(args.fix_and_overwrite)


'''simple docstring'''

import os



def snake_case_      (					__snake_case  :							List[Any])			->					str:
   lowerCAmelCase_			=      len(grid[0])
   lowerCAmelCase_			=      len(__snake_case)

   lowerCAmelCase_			=      0
   lowerCAmelCase_			=      0
   lowerCAmelCase_			=      0

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

         lowerCAmelCase_			=      max(
             __snake_case	,   __snake_case	,   __snake_case	,   __snake_case)
         if max_product > largest:
            lowerCAmelCase_			=      max_product

   return largest



def snake_case_      (					)			->					List[Any]:
   lowerCAmelCase_			=      []
   with open(os.path.dirname(__snake_case) + '''/grid.txt''') as file:
      for line in file:
         grid.append(line.strip('''\n''').split(''' '''))

   lowerCAmelCase_			=      [[int(__snake_case) for i in grid[j]] for j in range(len(__snake_case))]

   return largest_product(__snake_case)


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





