



from collections.abc import Callable







def       lowerCAmelCase_     (lowerCAmelCase__:						Callable[[float], float]						,		lowerCAmelCase__:						float						,		lowerCAmelCase__:						float   ):





			"""simple docstring"""


			UpperCAmelCase_:						str					=			a
			UpperCAmelCase_:						List[str]					=			b
			if function(_A   ) == 0:  # one of the a or b is a root for the function
						return a
			elif function(_A   ) == 0:
						return b
			elif (
			    function(_A   ) * function(_A   ) > 0
			):  # if none of these are root and they are both positive or negative,
						# then this algorithm can't find the root
						raise ValueError("""could not find root in given interval."""   )
			else:
						UpperCAmelCase_:						List[str]					=			start + (end - start) / 2.0
						while abs(start - mid   ) > 1_0**-7:  # until precisely equals to 10^-7
									if function(_A   ) == 0:
												return mid
									elif function(_A   ) * function(_A   ) < 0:
												UpperCAmelCase_:						Union[str, Any]					=			mid
									else:
												UpperCAmelCase_:						Optional[Any]					=			mid
									UpperCAmelCase_:						Optional[int]					=			start + (end - start) / 2.0
						return mid







def       lowerCAmelCase_     (lowerCAmelCase__:						float   ):





			"""simple docstring"""


			return x**3 - 2 * x - 5


if __name__ == "__main__":
	print(bisection(f, 1, 1_000))

	import doctest

	doctest.testmod()









import os




def 			UpperCAmelCase__				(			_A      : Any							):





  '''simple docstring'''







  a__  =len(grid[0]							)
  a__  =len(_A							)

  a__  =0
  a__  =0
  a__  =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							):
      a__  =grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
      a__  =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__  =(
            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__  =(
            grid[i][j]
            * grid[i - 1][j + 1]
            * grid[i - 2][j + 2]
            * grid[i - 3][j + 3]
        )

      a__  =max(
          _A	,      _A	,      _A	,      _A							)
      if max_product > largest:
        a__  =max_product

  return largest




def 			UpperCAmelCase__				(			):





  '''simple docstring'''







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

  a__  =[[int(_A							) for i in grid[j]] for j in range(len(_A							)							)]

  return largest_product(_A							)


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