
"""simple docstring"""



import os


def lowerCamelCase_				(     ):
       lowerCamelCase_       							=		os.path.dirname(os.path.realpath(snake_case__				)				)
       lowerCamelCase_       							=		os.path.join(snake_case__					,				'''triangle.txt'''				)

       with open(snake_case__				) as f:
              lowerCamelCase_       							=		f.readlines()

       lowerCamelCase_       							=		[]
       for line in triangle:
              lowerCamelCase_       							=		[]
              for number in line.strip().split(''' '''				):
                     numbers_from_line.append(int(snake_case__				)				)
              a.append(snake_case__				)

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


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





"""simple docstring"""




from collections.abc import Sequence



def        a__					(							snake_case__			,					snake_case__ = False							)		->   float:
			if not arr:
						return 0

			lowerCamelCase      =   0 if allow_empty_subarrays else float("""-inf"""							)
			lowerCamelCase      =   0.0
			for num in arr:
						lowerCamelCase      =   max(0 if allow_empty_subarrays else num			,					curr_sum + num							)
						lowerCamelCase      =   max(snake_case__			,					snake_case__							)

			return max_sum


if __name__ == "__main__":
					from doctest import testmod

					testmod()

					lowerCAmelCase				:     Union[str, Any]					=				[-2, 1, -3, 4, -1, 2, 1, -5, 4]
					print(F"""{max_subarray_sum(nums) = }""")



