



'''simple docstring'''






import numpy as np
from numpy import floataa
from numpy.typing import NDArray





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     NDArray[floataa] ,       snake_case_    :     NDArray[floataa]  )		->NDArray[floataa]:






							'''simple docstring'''
							_lowercase			, _lowercase							:		Any				=   np.shape(a__  )

							_lowercase							:		int				=   np.zeros((rows, 1) ,       dtype=a__  )
							for row in reversed(range(a__  )  ):
														_lowercase							:		Union[str, Any]				=   0
														for col in range(row + 1 ,       a__  ):
																					total += coefficients[row, col] * x[col]

														_lowercase							:		List[Any]				=   (vector[row] - total) / coefficients[row, row]

							return x





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     NDArray[floataa] ,       snake_case_    :     NDArray[floataa]  )		->NDArray[floataa]:






							'''simple docstring'''
							_lowercase			, _lowercase							:		List[str]				=   np.shape(a__  )
							if rows != columns:
														return np.array(() ,       dtype=a__  )

							# augmented matrix
							_lowercase							:		Any				=   np.concatenate((coefficients, vector) ,       axis=1  )
							_lowercase							:		Any				=   augmented_mat.astype('''float64'''  )

							# scale the matrix leaving it triangular
							for row in range(rows - 1  ):
														_lowercase							:		Dict				=   augmented_mat[row, row]
														for col in range(row + 1 ,       a__  ):
																					_lowercase							:		Any				=   augmented_mat[col, row] / pivot
																					augmented_mat[col, :] -= factor * augmented_mat[row, :]

							_lowercase							:		str				=   retroactive_resolution(
							    augmented_mat[:, 0:columns] ,       augmented_mat[:, columns : columns + 1]  )

							return x


if __name__ == "__main__":
						import doctest

						doctest.testmod()






"""simple docstring"""

import os





def 					__UpperCamelCase (     )					->      int:




					"""simple docstring"""



					__lowercase        =      os.path.dirname(os.path.realpath(a__      )      )
					__lowercase        =      os.path.join(a__			,						'''triangle.txt'''      )

					with open(a__      ) as f:
										__lowercase        =      f.readlines()

					__lowercase        =      [[int(a__      ) for y in x.rstrip('''\r\n'''      ).split(''' '''      )] for x in triangle]

					for i in range(1			,						len(a__      )      ):
										for j in range(len(a[i]      )      ):
															__lowercase        =      a[i - 1][j] if j != len(a[i - 1]      ) else 0
															__lowercase        =      a[i - 1][j - 1] if j > 0 else 0
															a[i][j] += max(a__			,						a__      )
					return max(a[-1]      )


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


