





import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict



@pytest.mark.parametrize(
    "split_dict"							,       [
        SplitDict(),
        SplitDict({"train": SplitInfo(name="train"							,       num_bytes=1337							,       num_examples=42							,       dataset_name="my_dataset"					)}					),
        SplitDict({"train": SplitInfo(name="train"							,       num_bytes=1337							,       num_examples=42					)}					),
        SplitDict({"train": SplitInfo()}					),
    ]							,       )
def 		A_    (					_lowerCAmelCase					)						->			List[Any]:
 UpperCamelCase     : str	     =       split_dict._to_yaml_list()
 assert len(_lowerCAmelCase					) == len(_lowerCAmelCase					)
 UpperCamelCase     : Union[str, Any]	     =       SplitDict._from_yaml_list(_lowerCAmelCase					)
 for split_name, split_info in split_dict.items():
  # dataset_name field is deprecated, and is therefore not part of the YAML dump
  UpperCamelCase     : List[str]	     =       None
  # the split name of split_dict takes over the name of the split info object
  UpperCamelCase     : Dict	     =       split_name
 assert split_dict == reloaded



@pytest.mark.parametrize(
    "split_info"							,       [SplitInfo(), SplitInfo(dataset_name=_lowerCAmelCase					), SplitInfo(dataset_name="my_dataset"					)]					)
def 		A_    (					_lowerCAmelCase					)						->			Optional[Any]:
 UpperCamelCase     : str	     =       asdict(SplitDict({"train": split_info}					)					)
 assert "dataset_name" in split_dict_asdict["train"]
 assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name







import os



def 		A_    (					)						->			int:
 UpperCamelCase     : List[str]	     =       os.path.dirname(os.path.realpath(_lowerCAmelCase					)					)
 UpperCamelCase     : Any	     =       os.path.join(_lowerCAmelCase							,       "triangle.txt"					)

 with open(_lowerCAmelCase					) as f:
  UpperCamelCase     : Optional[Any]	     =       f.readlines()

 UpperCamelCase     : Tuple	     =       []
 for line in triangle:
  UpperCamelCase     : List[str]	     =       []
  for number in line.strip().split(" "					):
   numbers_from_line.append(int(_lowerCAmelCase					)					)
  a.append(_lowerCAmelCase					)

 for i in range(1							,       len(_lowerCAmelCase					)					):
  for j in range(len(a[i]					)					):
   UpperCamelCase     : List[Any]	     =       a[i - 1][j] if j != len(a[i - 1]					) else 0
   UpperCamelCase     : Dict	     =       a[i - 1][j - 1] if j > 0 else 0
   a[i][j] += max(_lowerCAmelCase							,       _lowerCAmelCase					)
 return max(a[-1]					)


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