
"""simple docstring"""




import os




def 			_lowerCAmelCase		(		_UpperCamelCase = "matrix.txt"    ):






  """simple docstring"""



  with open(os.path.join(os.path.dirname(_UpperCamelCase    )			,					_UpperCamelCase    )    ) as in_file:
    _lowercase:      int   			=  in_file.read()

  _lowercase:      Tuple   			=  [[int(_UpperCamelCase    ) for cell in row.split(''','''    )] for row in data.strip().splitlines()]
  _lowercase:      Dict   			=  [[0 for cell in row] for row in grid]
  _lowercase:      Any   			=  len(grid[0]    )

  _lowercase:      int   			=  [[0 for i in range(_UpperCamelCase    )] for j in range(_UpperCamelCase    )]
  _lowercase:      int   			=  grid[0][0]
  for i in range(1			,					_UpperCamelCase    ):
    _lowercase:      Any   			=  grid[0][i] + dp[0][i - 1]
  for i in range(1			,					_UpperCamelCase    ):
    _lowercase:      int   			=  grid[i][0] + dp[i - 1][0]

  for i in range(1			,					_UpperCamelCase    ):
    for j in range(1			,					_UpperCamelCase    ):
      _lowercase:      List[str]   			=  grid[i][j] + min(dp[i - 1][j]			,					dp[i][j - 1]    )

  return dp[-1][-1]


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


"""simple docstring"""




from __future__ import annotations

import typing
from collections import Counter




def 			_lowerCAmelCase		(		_UpperCamelCase    ):






  """simple docstring"""



  _lowercase:      typing.Counter[int]   			=  Counter()
  for base in range(1			,					max_perimeter + 1    ):
    for perpendicular in range(_UpperCamelCase			,					max_perimeter + 1    ):
      _lowercase:      str   			=  (base * base + perpendicular * perpendicular) ** 0.5
      if hypotenuse == int(_UpperCamelCase    ):
        _lowercase:      str   			=  int(base + perpendicular + hypotenuse    )
        if perimeter > max_perimeter:
          continue
        triplets[perimeter] += 1
  return triplets




def 			_lowerCAmelCase		(		_UpperCamelCase = 1_000    ):






  """simple docstring"""



  _lowercase:      int   			=  pythagorean_triple(_UpperCamelCase    )
  return triplets.most_common(1    )[0][0]


if __name__ == "__main__":
  print(f"""Perimeter {solution()} has maximum solutions""")
