
from __future__ import annotations

from typing import Generic, TypeVar

_UpperCamelCase:					str     =TypeVar('T')





class 						__lowercase(     _lowerCamelCase   ):


       """simple docstring"""







       pass





class 						__lowercase(     _lowerCamelCase   ):


       """simple docstring"""







       pass





class 						__lowercase(     Generic[T]   ):


       """simple docstring"""







       def __init__(     self					:			str  ,      _lowerCAmelCase					:			int = 10       )					->   int:
         _lowerCAmelCase						=		[]
         _lowerCAmelCase						=		limit



       def __bool__(     self					:			Tuple       )					->   bool:
         return bool(self.stack       )



       def __str__(     self					:			Dict       )					->   str:
         return str(self.stack       )



       def SCREAMING_SNAKE_CASE_				(     self					:			Union[str, Any]  ,      _lowerCAmelCase					:			T       )					->   None:
         if len(self.stack       ) >= self.limit:
           raise StackOverflowError
         self.stack.append(_UpperCamelCase       )



       def SCREAMING_SNAKE_CASE_				(     self					:			List[Any]       )					->   T:
         if not self.stack:
           raise StackUnderflowError
         return self.stack.pop()



       def SCREAMING_SNAKE_CASE_				(     self					:			Union[str, Any]       )					->   T:
         if not self.stack:
           raise StackUnderflowError
         return self.stack[-1]



       def SCREAMING_SNAKE_CASE_				(     self					:			Union[str, Any]       )					->   bool:
         return not bool(self.stack       )



       def SCREAMING_SNAKE_CASE_				(     self					:			List[str]       )					->   bool:
         return self.size() == self.limit



       def SCREAMING_SNAKE_CASE_				(     self					:			List[str]       )					->   int:
         return len(self.stack       )






       def __contains__(     self					:			List[Any]  ,      _lowerCAmelCase					:			T       )					->   bool:
         return item in self.stack



def 	_a  (					):






  """simple docstring"""




  _lowerCAmelCase						=		Stack(10    )
  assert bool(__SCREAMING_SNAKE_CASE    ) is False
  assert stack.is_empty() is True
  assert stack.is_full() is False
  assert str(__SCREAMING_SNAKE_CASE    ) == "[]"

  try:
    _lowerCAmelCase						=		stack.pop()
    raise AssertionError  # This should not happen
  except StackUnderflowError:
    assert True  # This should happen

  try:
    _lowerCAmelCase						=		stack.peek()
    raise AssertionError  # This should not happen
  except StackUnderflowError:
    assert True  # This should happen

  for i in range(10    ):
    assert stack.size() == i
    stack.push(__SCREAMING_SNAKE_CASE    )

  assert bool(__SCREAMING_SNAKE_CASE    )
  assert not stack.is_empty()
  assert stack.is_full()
  assert str(__SCREAMING_SNAKE_CASE    ) == str(list(range(10    )    )    )
  assert stack.pop() == 9
  assert stack.peek() == 8

  stack.push(100    )
  assert str(__SCREAMING_SNAKE_CASE    ) == str([0, 1, 2, 3, 4, 5, 6, 7, 8, 100]    )

  try:
    stack.push(200    )
    raise AssertionError  # This should not happen
  except StackOverflowError:
    assert True  # This should happen

  assert not stack.is_empty()
  assert stack.size() == 10

  assert 5 in stack
  assert 55 not in stack


if __name__ == "__main__":
       test_stack()







import os



def _a							(      )      ->		int:







      '''simple docstring'''






      __A			  =							os.path.dirname(os.path.realpath(lowerCamelCase					)					)
      __A			  =							os.path.join(lowerCamelCase   ,							'''triangle.txt'''					)

      with open(lowerCamelCase					) as in_file:
            __A			  =							[[int(lowerCamelCase					) for i in line.split()] for line in in_file]

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


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





