






import os
def 		lowercase__  (				_UpperCamelCase) ->			Optional[Any]:
      """simple docstring"""

      UpperCamelCase					       =  len(grid[0])
      UpperCamelCase					       =  len(_UpperCamelCase)

      UpperCamelCase					       =  0
      UpperCamelCase					       =  0
      UpperCamelCase					       =  0

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

                  UpperCamelCase					       =  max(
                      _UpperCamelCase       ,							_UpperCamelCase       ,							_UpperCamelCase       ,							_UpperCamelCase)
                  if max_product > largest:
                        UpperCamelCase					       =  max_product

      return largest
def 		lowercase__  (				) ->			int:
      """simple docstring"""

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

      UpperCamelCase					       =  [[int(_UpperCamelCase) for i in grid[j]] for j in range(len(_UpperCamelCase))]

      return largest_product(_UpperCamelCase)


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











def 		lowercase__  (				_UpperCamelCase) ->			list:
      """simple docstring"""

      if bit_count < 0:
            raise ValueError('The given input must be positive')

      # get the generated string sequence
      UpperCamelCase					       =  gray_code_sequence_string(_UpperCamelCase)
      #
      # convert them to integers
      for i in range(len(_UpperCamelCase)):
            UpperCamelCase					       =  int(sequence[i]       ,							2)

      return sequence
def 		lowercase__  (				_UpperCamelCase) ->			list:
      """simple docstring"""

      if bit_count == 0:
            return ["0"]

      if bit_count == 1:
            return ["0", "1"]

      UpperCamelCase					       =  1 << bit_count  # defines the length of the sequence
      # 1<< n is equivalent to 2^n

      # recursive answer will generate answer for n-1 bits
      UpperCamelCase					       =  gray_code_sequence_string(bit_count - 1)

      UpperCamelCase					       =  []

      # append 0 to first half of the smaller sequence generated
      for i in range(seq_len // 2):
            UpperCamelCase					       =  '0' + smaller_sequence[i]
            sequence.append(_UpperCamelCase)

      # append 1 to second half ... start from the end of the list
      for i in reversed(range(seq_len // 2)):
            UpperCamelCase					       =  '1' + smaller_sequence[i]
            sequence.append(_UpperCamelCase)

      return sequence


if __name__ == "__main__":
       import doctest

       doctest.testmod()



