import functools
from math import sqrt
from time import time

def   a_					(_lowerCAmelCase  :   Any			,	*_lowerCAmelCase  :   List[Any]			,	**_lowerCAmelCase  :   Any       )->				Tuple:
    snake_case:						Union[str, Any]         =   time()
    snake_case:						List[str]         =   func(*_lowerCAmelCase			,	**_lowerCAmelCase       )
    snake_case:						Any         =   time()
    if int(end - start       ) > 0:
        print(F"{func.__name__} runtime: {(end - start):0.4f} s"       )
    else:
        print(F"{func.__name__} runtime: {(end - start) * 1000:0.4f} ms"       )
    return output

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

def   a_					(_lowerCAmelCase  :   int       )->				list[int]:

    def fib_recursive_term(_lowerCAmelCase  :   int       ) -> 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(_lowerCAmelCase       ) for i in range(n + 1       )]

def   a_					(_lowerCAmelCase  :   int       )->				list[int]:

    @functools.cache
    def fib_recursive_term(_lowerCAmelCase  :   int       ) -> 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(_lowerCAmelCase       ) for i in range(n + 1       )]

def   a_					(_lowerCAmelCase  :   int       )->				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.
    snake_case:						dict[int, int]         =   {0: 0, 1: 1, 2: 1}  # Prefilled cache

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

        snake_case:						Union[str, Any]         =   rec_fn_memoized(num - 1       ) + rec_fn_memoized(num - 2       )
        snake_case:						List[str]         =   value
        return value

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

def   a_					(_lowerCAmelCase  :   int       )->				list[int]:
    if n < 0:
        raise Exception("""n is negative"""       )
    if n >= 1475:
        raise Exception("""n is too large"""       )
    snake_case:						Optional[Any]         =   sqrt(5       )
    snake_case:						Optional[int]         =   (1 + sqrt_a) / 2
    return [round(phi**i / sqrt_a       ) for i in range(n + 1       )]


if __name__ == "__main__":
    __lowerCAmelCase    :  str										= 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)



from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

__lowerCAmelCase    :  Optional[int]										= 'https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true'

def   a_					(_lowerCAmelCase  :   str			,	_lowerCAmelCase  :   str       )->				list | None:

    try:
        # Has user provided both inputs?
        if not drug_name or not zip_code:
            return None

        snake_case:						List[str]         =   BASE_URL.format(_lowerCAmelCase			,	_lowerCAmelCase       )
        snake_case:						Optional[Any]         =   get(_lowerCAmelCase       )

        # Is the response ok?
        response.raise_for_status()

        # Scrape the data using bs4
        snake_case:						Tuple         =   BeautifulSoup(response.text			,	"""html.parser"""       )

        # This list will store the name and price.
        snake_case:						List[Any]         =   []

        # Fetch all the grids that contains the items.
        snake_case:						Any         =   soup.find_all("""div"""			,	{"""class""": """grid-x pharmCard"""}       )
        if grid_list and len(_lowerCAmelCase       ) > 0:
            for grid in grid_list:
                # Get the pharmacy price.
                snake_case:						Union[str, Any]         =   grid.find("""p"""			,	{"""class""": """list-title"""}       ).text

                # Get price of the drug.
                snake_case:						Optional[Any]         =   grid.find("""span"""			,	{"""p""", """price price-large"""}       ).text

                pharmacy_price_list.append(
                    {
                        """pharmacy_name""": pharmacy_name,
                        """price""": price,
                    }       )

        return pharmacy_price_list

    except (HTTPError, exceptions.RequestException, ValueError):
        return None


if __name__ == "__main__":
    # Enter a drug name and a zip code
    __lowerCAmelCase    :  Union[str, Any]										= input('Enter drug name: ').strip()
    __lowerCAmelCase    :  Tuple										= input('Enter zip code: ').strip()

    __lowerCAmelCase    :  list | None										= fetch_pharmacy_and_price_list(
        drug_name, zip_code
    )

    if pharmacy_price_list:
        print(F"""\nSearch results for {drug_name} at location {zip_code}:""")
        for pharmacy_price in pharmacy_price_list:
            __lowerCAmelCase    :  int										= pharmacy_price['pharmacy_name']
            __lowerCAmelCase    :  List[str]										= pharmacy_price['price']

            print(F"""Pharmacy: {name} Price: {price}""")
    else:
        print(F"""No results found for {drug_name}""")


