'''simple docstring'''





import functools




def       lowerCAmelCase_     (		lowercase:							list[int]  ,					lowercase:							list[int]		)    ->				Union[str, Any]:







 '''simple docstring'''






 if not isinstance(lowercase  ,					lowercase		) or not all(isinstance(lowercase  ,					lowercase		) for day in days		):
  raise ValueError('''The parameter days should be a list of integers'''		)

 if len(lowercase		) != 3 or not all(isinstance(lowercase  ,					lowercase		) for cost in costs		):
  raise ValueError('''The parameter costs should be a list of three integers'''		)

 if len(lowercase		) == 0:
  return 0

 if min(lowercase		) <= 0:
  raise ValueError('''All days elements should be greater than 0'''		)

 if max(lowercase		) >= 366:
  raise ValueError('''All days elements should be less than 366'''		)

 _UpperCamelCase:     str							= set(lowercase		)

 @functools.cache
 def dynamic_programming(lowercase:							int		) -> int:
  if index > 365:
   return 0

  if index not in days_set:
   return dynamic_programming(index + 1		)

  return min(
      costs[0] + dynamic_programming(index + 1		)  ,					costs[1] + dynamic_programming(index + 7		)  ,					costs[2] + dynamic_programming(index + 30		)  ,					)

 return dynamic_programming(1		)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
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=1_337  ,					num_examples=42  ,					dataset_name='''my_dataset'''		)}		),
        SplitDict({'''train''': SplitInfo(name='''train'''  ,					num_bytes=1_337  ,					num_examples=42		)}		),
        SplitDict({'''train''': SplitInfo()}		),
    ]  ,					)
def       lowerCAmelCase_     (		lowercase:							SplitDict		)    ->				List[str]:







 '''simple docstring'''
 _UpperCamelCase:     List[str]							= split_dict._to_yaml_list()
 assert len(lowercase		) == len(lowercase		)
 _UpperCamelCase:     Tuple							= SplitDict._from_yaml_list(lowercase		)
 for split_name, split_info in split_dict.items():
  # dataset_name field is deprecated, and is therefore not part of the YAML dump
  _UpperCamelCase:     Optional[Any]							= None
  # the split name of split_dict takes over the name of the split info object
  _UpperCamelCase:     Any							= split_name
 assert split_dict == reloaded





@pytest.mark.parametrize(
    '''split_info'''  ,					[SplitInfo(), SplitInfo(dataset_name=lowercase		), SplitInfo(dataset_name='''my_dataset'''		)]		)
def       lowerCAmelCase_     (		lowercase:							str		)    ->				Tuple:







 '''simple docstring'''
 # For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
 # field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
 _UpperCamelCase:     Optional[Any]							= asdict(SplitDict({'''train''': split_info}		)		)
 assert "dataset_name" in split_dict_asdict["train"]
 assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name