
'''simple docstring'''





def 							snake_case				(		UpperCAmelCase   ,	UpperCAmelCase   ,	UpperCAmelCase   ,	UpperCAmelCase						)->      int:







      """simple docstring"""
      __A													=      int((lower_bound + upper_bound) // 2						)
      if array[r] == value:
            return r
      if lower_bound >= upper_bound:
            return -1
      if array[r] < value:
            return binary_search(UpperCAmelCase   ,	r + 1   ,	UpperCAmelCase   ,	UpperCAmelCase						)
      else:
            return binary_search(UpperCAmelCase   ,	UpperCAmelCase   ,	r - 1   ,	UpperCAmelCase						)





def 							snake_case				(		UpperCAmelCase   ,	UpperCAmelCase						)->      list:







      """simple docstring"""
      __A													=      0
      if matrix[index][0] == value:
            return [index, 0]
      while index < len(UpperCAmelCase						) and matrix[index][0] < value:
            __A													=      binary_search(matrix[index]   ,	0   ,	len(matrix[index]						) - 1   ,	UpperCAmelCase						)
            if r != -1:
                  return [index, r]
            index += 1
      return [-1, -1]


if __name__ == "__main__":
 import doctest

 doctest.testmod()












'''simple docstring'''
import os
def 							snake_case_    (  ):



    """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())




