






import os

from apache_beam.io.filesystems import FileSystems
from apache_beam.pipeline import Pipeline

from .logging import get_logger


snake_case_   :	Any							      =2 << 20  # 2mb
snake_case_   :	Union[str, Any]							      =get_logger(__name__)





class        a__      (	lowerCAmelCase__		):






		def 					_lowerCamelCase					(      self						)				->				Tuple:
				__A    =							self._options.get_all_options().get("runner"						)
				return runner in [None, "DirectRunner", "PortableRunner"]



def      UpperCAmelCase						( lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__=False	):


		'''simple docstring'''

		__A    =							FileSystems
		if fs.exists(lowerCAmelCase__	):
				if force_upload:
						logger.info(F"""Remote path already exist: {remote_file_path}. Overwriting it as force_upload=True."""	)
				else:
						logger.info(F"""Remote path already exist: {remote_file_path}. Skipping it as force_upload=False."""	)
						return
		with fs.create(lowerCAmelCase__	) as remote_file:
				with open(lowerCAmelCase__					,     "rb"	) as local_file:
						__A    =							local_file.read(lowerCAmelCase__	)
						while chunk:
								remote_file.write(lowerCAmelCase__	)
								__A    =							local_file.read(lowerCAmelCase__	)





def      UpperCAmelCase						( lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__=False	):


		'''simple docstring'''

		__A    =							FileSystems
		if os.path.exists(lowerCAmelCase__	):
				if force_download:
						logger.info(F"""Local path already exist: {remote_file_path}. Overwriting it as force_upload=True."""	)
				else:
						logger.info(F"""Local path already exist: {remote_file_path}. Skipping it as force_upload=False."""	)
						return
		with fs.open(lowerCAmelCase__	) as remote_file:
				with open(lowerCAmelCase__					,     "wb"	) as local_file:
						__A    =							remote_file.read(lowerCAmelCase__	)
						while chunk:
								local_file.write(lowerCAmelCase__	)
								__A    =							remote_file.read(lowerCAmelCase__	)




"""simple docstring"""

import os





def 					__UpperCamelCase (     )					->      int:




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


