





import functools
from math import sqrt
from time import time





def    _lowercase    (  _UpperCAmelCase	,					*_UpperCAmelCase	,					**_UpperCAmelCase )  ->     str:
				lowerCamelCase		       =time()
				lowerCamelCase		       =func(*_UpperCAmelCase	,					**_UpperCAmelCase )
				lowerCamelCase		       =time()
				if int(end - start ) > 0:
								print(F"""{func.__name__} runtime: {(end - start):0.4f} s""" )
				else:
								print(F"""{func.__name__} runtime: {(end - start) * 10_00:0.4f} ms""" )
				return output





def    _lowercase    (  _UpperCAmelCase )  ->     list[int]:
				if n < 0:
								raise Exception("""n is negative""" )
				if n == 0:
								return [0]
				lowerCamelCase		       =[0, 1]
				for _ in range(n - 1 ):
								fib.append(fib[-1] + fib[-2] )
				return fib





def    _lowercase    (  _UpperCAmelCase )  ->     list[int]:

				def fib_recursive_term(_UpperCAmelCase ) -> int:
								if i < 0:
												raise Exception("""n is negative""" )
								if i < 2:
												return i
								return fib_recursive_term(i - 1 ) + fib_recursive_term(i - 2 )

				if n < 0:
								raise Exception("""n is negative""" )
				return [fib_recursive_term(_UpperCAmelCase ) for i in range(n + 1 )]





def    _lowercase    (  _UpperCAmelCase )  ->     list[int]:

				@functools.cache
				def fib_recursive_term(_UpperCAmelCase ) -> int:
								if i < 0:
												raise Exception("""n is negative""" )
								if i < 2:
												return i
								return fib_recursive_term(i - 1 ) + fib_recursive_term(i - 2 )

				if n < 0:
								raise Exception("""n is negative""" )
				return [fib_recursive_term(_UpperCAmelCase ) for i in range(n + 1 )]





def    _lowercase    (  _UpperCAmelCase )  ->     list[int]:
				if n < 0:
								raise Exception("""n is negative""" )
				# Cache must be outside recursuive function
				# other it will reset every time it calls itself.
				lowerCamelCase		       ={0: 0, 1: 1, 2: 1}  # Prefilled cache

				def rec_fn_memoized(_UpperCAmelCase ) -> int:
								if num in cache:
												return cache[num]

								lowerCamelCase		       =rec_fn_memoized(num - 1 ) + rec_fn_memoized(num - 2 )
								lowerCamelCase		       =value
								return value

				return [rec_fn_memoized(_UpperCAmelCase ) for i in range(n + 1 )]





def    _lowercase    (  _UpperCAmelCase )  ->     list[int]:
				if n < 0:
								raise Exception("""n is negative""" )
				if n >= 14_75:
								raise Exception("""n is too large""" )
				lowerCamelCase		       =sqrt(5 )
				lowerCamelCase		       =(1 + sqrt_a) / 2
				return [round(phi**i / sqrt_a ) for i in range(n + 1 )]


if __name__ == "__main__":
							UpperCAmelCase__  :	Any     =30
							time_func(fib_iterative, num)
							time_func(fib_recursive, num)  # Around 3s runtime
							time_func(fib_recursive_cached, num)  # Around 0ms runtime
							time_func(fib_memoization, num)
							time_func(fib_binet, num)







'''simple docstring'''
import bsa
import requests




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__       )   ->				dict[str, str]:


		'''simple docstring'''


		return {
		    "name": soup.ha.a.text,
		    "genre": soup.find('''span'''      ,    class_='''genre'''       ).text.strip(),
		    "rating": soup.strong.text,
		    "page_link": F'https://www.imdb.com{soup.a.get("href"       )}',
		}




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__ = 5       )   ->				tuple:


		'''simple docstring'''


		snake_case   :    List[Any]			       =		int(float(SCREAMING_SNAKE_CASE__       )       )
		if num_movies < 1:
				return ()
		snake_case   :    int			       =		(
		    '''https://www.imdb.com/search/title?title_type='''
		    F'feature&sort=num_votes,desc&count={num_movies}'
		)
		snake_case   :    Optional[Any]			       =		bsa.BeautifulSoup(requests.get(SCREAMING_SNAKE_CASE__       ).content      ,    '''html.parser'''       )
		return tuple(
		    get_movie_data_from_soup(SCREAMING_SNAKE_CASE__       )
		    for movie in source.find_all('''div'''      ,    class_='''lister-item mode-advanced'''       )       )


if __name__ == "__main__":
						import json

						lowercase__		    =	int(input("How many movies would you like to see? "))
						print(
						    ", ".join(
						        json.dumps(movie, indent=4) for movie in get_imdb_top_movies(num_movies)
						    )
						)


