from __future__ import annotations

import requests





def 	__lowerCamelCase							(UpperCAmelCase__     :							str  ):
					SCREAMING_SNAKE_CASE    			=       F"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"
					return requests.get(UpperCAmelCase__  ).json()





def 	__lowerCamelCase							(UpperCAmelCase__     :							int = 1_0  ):
					SCREAMING_SNAKE_CASE    			=       "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
					SCREAMING_SNAKE_CASE    			=       requests.get(UpperCAmelCase__  ).json()[:max_stories]
					return [get_hackernews_story(UpperCAmelCase__  ) for story_id in story_ids]





def 	__lowerCamelCase							(UpperCAmelCase__     :							int = 1_0  ):
					SCREAMING_SNAKE_CASE    			=       hackernews_top_stories(UpperCAmelCase__  )
					return "\n".join("* [{title}]({url})".format(**UpperCAmelCase__  ) for story in stories  )


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





import functools





def 	__lowerCamelCase							(UpperCAmelCase__     :							list[int]      , UpperCAmelCase__     :							list[int]  ):

					# Validation
					if not isinstance(UpperCAmelCase__      , UpperCAmelCase__  ) or not all(isinstance(UpperCAmelCase__      , UpperCAmelCase__  ) for day in days  ):
										raise ValueError("The parameter days should be a list of integers"  )

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

					if len(UpperCAmelCase__  ) == 0:
										return 0

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

					if max(UpperCAmelCase__  ) >= 3_6_6:
										raise ValueError("All days elements should be less than 366"  )

					SCREAMING_SNAKE_CASE    			=       set(UpperCAmelCase__  )

					@functools.cache
					def dynamic_programming(UpperCAmelCase__     :							int  ) -> int:
										if index > 3_6_5:
															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 + 3_0  )      , )

					return dynamic_programming(1  )


if __name__ == "__main__":
							import doctest

							doctest.testmod()




