
"""simple docstring"""

import requests

try:
					from django.contrib.auth import authenticate, login
					from django.shortcuts import redirect, render
except ImportError:
					_A				=					print
def 						UpperCAmelCase   (						a_     ):





		'''simple docstring'''


		lowerCamelCase	:     Any            =       """secretKey"""
		lowerCamelCase	:     Optional[int]            =       """https://www.google.com/recaptcha/api/siteverify"""

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

		# from the frontend, get username, password, and client_key
		lowerCamelCase	:     int            =       request.POST.get('username'     )
		lowerCamelCase	:     List[str]            =       request.POST.get('password'     )
		lowerCamelCase	:     Tuple            =       request.POST.get('g-recaptcha-response'     )

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









import itertools






def        __lowercase   (  _A = 1000000      )  ->    int:
      SCREAMING_SNAKE_CASE			:   Tuple	  = [1]

      for i in itertools.count(len(_A      )      ):
            SCREAMING_SNAKE_CASE			:   Optional[int]	  = 0
            for j in itertools.count(1      ):
                  SCREAMING_SNAKE_CASE			:   str	  = -1 if j % 2 == 0 else +1
                  SCREAMING_SNAKE_CASE			:   Any	  = (j * j * 3 - j) // 2
                  if index > i:
                        break
                  item += partitions[i - index] * sign
                  item %= number
                  index += j
                  if index > i:
                        break
                  item += partitions[i - index] * sign
                  item %= number

            if item == 0:
                  return i
            partitions.append(_A      )

      return 0


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  print(F"""{solution() = }""")




