
"""simple docstring"""




import requests

try:
   from django.contrib.auth import authenticate, login
   from django.shortcuts import redirect, render
except ImportError:
   _A      :	Union[str, Any]       		=	print


def   __magic_name__     (				__snake_case    :	Dict  )			->    Union[str, Any]:
       # Enter your recaptcha secret key here
       lowercase   :    Union[str, Any]			=							"secretKey"
       lowercase   :    int			=							"https://www.google.com/recaptcha/api/siteverify"

       # when method is not POST, direct user to login page
       if request.method != "POST":
              return render(__snake_case					,			"login.html"  )

       # from the frontend, get username, password, and client_key
       lowercase   :    Union[str, Any]			=							request.POST.get("username"  )
       lowercase   :    Optional[int]			=							request.POST.get("password"  )
       lowercase   :    List[str]			=							request.POST.get("g-recaptcha-response"  )

       # post recaptcha response to Google's recaptcha api
       lowercase   :    Optional[int]			=							requests.post(__snake_case					,			data={"secret": secret_key, "response": client_key}  )
       # if the recaptcha api verified our keys
       if response.json().get("success"					,			__snake_case  ):
              # authenticate the user
              lowercase   :    str			=							authenticate(__snake_case					,			username=__snake_case					,			password=__snake_case  )
              if user_in_database:
                     login(__snake_case					,			__snake_case  )
                     return redirect("/your-webpage"  )
       return render(__snake_case					,			"login.html"  )




"""simple docstring"""




from __future__ import annotations

_A      :	List[str]       		=	"""Alexander Joslin"""


def   __magic_name__     (				__snake_case    :	int  )			->    int:

       if number <= 0:
              lowercase   :    Optional[Any]			=							f"""n must be greater than 0. Got n = {number}"""
              raise ValueError(__snake_case  )

       lowercase   :    List[str]			=							[number + 1] * (number + 1)

       # starting position
       lowercase   :    Optional[Any]			=							0
       for i in range(1					,			__snake_case  ):
              lowercase   :    str			=							min(table[i + 1]					,			table[i] + 1  )
              # check if out of bounds
              if i * 2 <= number:
                     lowercase   :    int			=							min(table[i * 2]					,			table[i] + 1  )
              # check if out of bounds
              if i * 3 <= number:
                     lowercase   :    Optional[int]			=							min(table[i * 3]					,			table[i] + 1  )
       return table[number]


if __name__ == "__main__":
   import doctest

   doctest.testmod()


