





import requests

try:
 from django.contrib.auth import authenticate, login
 from django.shortcuts import redirect, render
except ImportError:
 _UpperCamelCase   :							List[str]     =	print
def 				__UpperCamelCase  (		snake_case     )  ->						Tuple:


   '''simple docstring'''







   __A				 =       '''secretKey'''
   __A				 =       '''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
   __A				 =       request.POST.get('''username'''     )
   __A				 =       request.POST.get('''password'''     )
   __A				 =       request.POST.get('''g-recaptcha-response'''     )

   # post recaptcha response to Google's recaptcha api
   __A				 =       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
      __A				 =       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'''     )








from __future__ import annotations
def 				__UpperCamelCase  (		snake_case    ,	snake_case     )  ->						list:


   '''simple docstring'''







   __A				 =       [None] * (len(snake_case     ) + len(snake_case     ))

   __A				 =       0  # pointer to current index for left Half
   __A				 =       0  # pointer to current index for the right Half
   __A				 =       0  # pointer to current index for the sorted array Half

   while pointera < len(snake_case     ) and pointera < len(snake_case     ):
      if left_half[pointera] < right_half[pointera]:
         __A				 =       left_half[pointera]
         pointera += 1
         index += 1
      else:
         __A				 =       right_half[pointera]
         pointera += 1
         index += 1
   while pointera < len(snake_case     ):
      __A				 =       left_half[pointera]
      pointera += 1
      index += 1

   while pointera < len(snake_case     ):
      __A				 =       right_half[pointera]
      pointera += 1
      index += 1

   return sorted_array
def 				__UpperCamelCase  (		snake_case     )  ->						list:


   '''simple docstring'''







   if len(snake_case     ) <= 1:
      return array
   # the actual formula to calculate the middle element = left + (right - left) // 2
   # this avoids integer overflow in case of large N
   __A				 =       0 + (len(snake_case     ) - 0) // 2

   # Split the array into halves till the array length becomes equal to One
   # merge the arrays of single length returned by mergeSort function and
   # pass them into the merge arrays function which merges the array
   __A				 =       array[:middle]
   __A				 =       array[middle:]

   return merge(merge_sort(snake_case     )    ,	merge_sort(snake_case     )     )


if __name__ == "__main__":
    import doctest

    doctest.testmod()

