






from __future__ import annotations

lowerCamelCase	:							List[str]				=[-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
lowerCamelCase	:							int				=[-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	list[float]:
     UpperCamelCase__			:   Optional[Any]       				=  []
     UpperCamelCase__			:   Optional[Any]       				=  len(__lowerCAmelCase			)

     for i in range(__lowerCAmelCase			):
          UpperCamelCase__			:   float       				=  -1
          for j in range(i + 1					,    __lowerCAmelCase			):
               if arr[i] < arr[j]:
                    UpperCamelCase__			:   Dict       				=  arr[j]
                    break
          result.append(__lowerCAmelCase			)
     return result







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	list[float]:
     UpperCamelCase__			:   Dict       				=  []
     for i, outer in enumerate(__lowerCAmelCase			):
          UpperCamelCase__			:   float       				=  -1
          for inner in arr[i + 1 :]:
               if outer < inner:
                    UpperCamelCase__			:   Optional[int]       				=  inner
                    break
          result.append(__lowerCAmelCase			)
     return result







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase			) ->	list[float]:
     UpperCamelCase__			:   str       				=  len(__lowerCAmelCase			)
     UpperCamelCase__			:   list[float]       				=  []
     UpperCamelCase__			:   list[float]       				=  [-1] * arr_size

     for index in reversed(range(__lowerCAmelCase			)			):
          if stack:
               while stack[-1] <= arr[index]:
                    stack.pop()
                    if not stack:
                         break
          if stack:
               UpperCamelCase__			:   Any       				=  stack[-1]
          stack.append(arr[index]			)
     return result


if __name__ == "__main__":
 from doctest import testmod
 from timeit import timeit

 testmod()
 print(next_greatest_element_slow(arr))
 print(next_greatest_element_fast(arr))
 print(next_greatest_element(arr))

 lowerCamelCase	:							Union[str, Any]				=(
     '''from __main__ import arr, next_greatest_element_slow, '''
     '''next_greatest_element_fast, next_greatest_element'''
 )
 print(
     '''next_greatest_element_slow():''',
     timeit('''next_greatest_element_slow(arr)''', setup=setup),
 )
 print(
     '''next_greatest_element_fast():''',
     timeit('''next_greatest_element_fast(arr)''', setup=setup),
 )
 print(
     '''     next_greatest_element():''',
     timeit('''next_greatest_element(arr)''', setup=setup),
 )







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase					,    __lowerCAmelCase			) ->	int:
     while b:
          UpperCamelCase__				,     UpperCamelCase__			:   int       				=  b, a % b
     return a







def 		SCREAMING_SNAKE_CASE							(					__lowerCAmelCase					,    __lowerCAmelCase			) ->	int:
     return a if b == 0 else euclidean_gcd_recursive(__lowerCAmelCase					,    a % b			)







def 		SCREAMING_SNAKE_CASE							(					) ->	str:
     print(f'euclidean_gcd(3, 5) = {euclidean_gcd(3					,    5			)}'			)
     print(f'euclidean_gcd(5, 3) = {euclidean_gcd(5					,    3			)}'			)
     print(f'euclidean_gcd(1, 3) = {euclidean_gcd(1					,    3			)}'			)
     print(f'euclidean_gcd(3, 6) = {euclidean_gcd(3					,    6			)}'			)
     print(f'euclidean_gcd(6, 3) = {euclidean_gcd(6					,    3			)}'			)

     print(f'euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3					,    5			)}'			)
     print(f'euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5					,    3			)}'			)
     print(f'euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1					,    3			)}'			)
     print(f'euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3					,    6			)}'			)
     print(f'euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6					,    3			)}'			)


if __name__ == "__main__":
 main()