





"""simple docstring"""




import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput






@dataclass
class  __A   (   lowerCAmelCase			):

			'''simple docstring'''







			lowerCAmelCase_												=						42






class  __A   (   unittest.TestCase			):

			'''simple docstring'''







			def 		__lowerCamelCase    (   self							):



				'''simple docstring'''







				lowerCamelCase__        =		CustomOutput(images=np.random.rand(1	,  3	,  4	,  4							)							)

				# check every way of getting the attribute
				assert isinstance(outputs.images	,  np.ndarray							)
				assert outputs.images.shape == (1, 3, 4, 4)
				assert isinstance(outputs['''images''']	,  np.ndarray							)
				assert outputs["images"].shape == (1, 3, 4, 4)
				assert isinstance(outputs[0]	,  np.ndarray							)
				assert outputs[0].shape == (1, 3, 4, 4)

				# test with a non-tensor attribute
				lowerCamelCase__        =		CustomOutput(images=[PIL.Image.new('''RGB'''	,  (4, 4)							)]							)

				# check every way of getting the attribute
				assert isinstance(outputs.images	,  __lowerCAmelCase							)
				assert isinstance(outputs.images[0]	,  PIL.Image.Image							)
				assert isinstance(outputs['''images''']	,  __lowerCAmelCase							)
				assert isinstance(outputs['''images'''][0]	,  PIL.Image.Image							)
				assert isinstance(outputs[0]	,  __lowerCAmelCase							)
				assert isinstance(outputs[0][0]	,  PIL.Image.Image							)





			def 		__lowerCamelCase    (   self							):



				'''simple docstring'''







				lowerCamelCase__        =		CustomOutput({'''images''': np.random.rand(1	,  3	,  4	,  4							)}							)

				# check every way of getting the attribute
				assert isinstance(outputs.images	,  np.ndarray							)
				assert outputs.images.shape == (1, 3, 4, 4)
				assert isinstance(outputs['''images''']	,  np.ndarray							)
				assert outputs["images"].shape == (1, 3, 4, 4)
				assert isinstance(outputs[0]	,  np.ndarray							)
				assert outputs[0].shape == (1, 3, 4, 4)

				# test with a non-tensor attribute
				lowerCamelCase__        =		CustomOutput({'''images''': [PIL.Image.new('''RGB'''	,  (4, 4)							)]}							)

				# check every way of getting the attribute
				assert isinstance(outputs.images	,  __lowerCAmelCase							)
				assert isinstance(outputs.images[0]	,  PIL.Image.Image							)
				assert isinstance(outputs['''images''']	,  __lowerCAmelCase							)
				assert isinstance(outputs['''images'''][0]	,  PIL.Image.Image							)
				assert isinstance(outputs[0]	,  __lowerCAmelCase							)
				assert isinstance(outputs[0][0]	,  PIL.Image.Image							)










import os





def lowerCAmelCase__()    ->				Optional[Any]:







	'''simple docstring'''







	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__        =		[[int(__snake_case							) for y in x.rstrip('''\r\n'''							).split(''' '''							)] for x in triangle]

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



