






"""simple docstring"""





import os






def 							A(    ):
       """simple docstring"""





       lowercase__:							Optional[int]         =     os.path.dirname(os.path.realpath(snake_case_						)						)
       lowercase__:							Dict         =     os.path.join(snake_case_		,  "triangle.txt"						)

       with open(snake_case_						) as in_file:
              lowercase__:							Tuple         =     [[int(snake_case_						) for i in line.split()] for line in in_file]

       while len(snake_case_						) != 1:
              lowercase__:							int         =     triangle.pop()
              lowercase__:							int         =     triangle[-1]
              for j in range(len(snake_case_						) - 1						):
                     curr_row[j] += max(last_row[j]		,  last_row[j + 1]						)
       return triangle[0][0]


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













'''simple docstring'''

from __future__ import annotations




def  _a     (				lowerCAmelCase_      ,   lowerCAmelCase_      ,   lowerCAmelCase_      ,   lowerCAmelCase_						):





      """simple docstring"""



      if counter == 0 or capacity == 0:
            return 0

      # If weight of the nth item is more than Knapsack of capacity,
      #   then this item cannot be included in the optimal solution,
      # else return the maximum of two cases:
      #   (1) nth item included
      #   (2) not included
      if weights[counter - 1] > capacity:
            return knapsack(lowerCAmelCase_      ,   lowerCAmelCase_      ,   lowerCAmelCase_      ,   counter - 1						)
      else:
            _snake_case		:						List[str]         =  capacity - weights[counter - 1]
            _snake_case		:						Tuple         =  values[counter - 1] + knapsack(
                lowerCAmelCase_      ,   lowerCAmelCase_      ,   lowerCAmelCase_      ,   counter - 1						)
            _snake_case		:						Any         =  knapsack(lowerCAmelCase_      ,   lowerCAmelCase_      ,   lowerCAmelCase_      ,   counter - 1						)
            return max(lowerCAmelCase_      ,   lowerCAmelCase_						)


if __name__ == "__main__":
   import doctest

   doctest.testmod()


