





'''simple docstring'''

from __future__ import annotations

lowercase__		:     Dict			=							[-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
lowercase__		:     Optional[int]			=							[-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]







def    a__							(							lowercase   :	list[float] )						->						list[float]:





     """simple docstring"""

     _UpperCamelCase							       =			[]
     _UpperCamelCase							       =			len(lowercase )

     for i in range(lowercase ):
          _UpperCamelCase							       =			-1
          for j in range(i + 1,   lowercase ):
               if arr[i] < arr[j]:
                    _UpperCamelCase							       =			arr[j]
                    break
          result.append(lowercase )
     return result







def    a__							(							lowercase   :	list[float] )						->						list[float]:





     """simple docstring"""

     _UpperCamelCase							       =			[]
     for i, outer in enumerate(lowercase ):
          _UpperCamelCase							       =			-1
          for inner in arr[i + 1 :]:
               if outer < inner:
                    _UpperCamelCase							       =			inner
                    break
          result.append(lowercase )
     return result







def    a__							(							lowercase   :	list[float] )						->						list[float]:





     """simple docstring"""

     _UpperCamelCase							       =			len(lowercase )
     _UpperCamelCase							       =			[]
     _UpperCamelCase							       =			[-1] * arr_size

     for index in reversed(range(lowercase ) ):
          if stack:
               while stack[-1] <= arr[index]:
                    stack.pop()
                    if not stack:
                         break
          if stack:
               _UpperCamelCase							       =			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))

   lowercase__		:     Dict			=							(
       '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),
   )











"""simple docstring"""
def 				lowercase__		(					lowerCamelCase,						lowerCamelCase       ):
				return abs(lowerCamelCase       ) if a == 0 else greatest_common_divisor(b % a,						lowerCamelCase       )





def 				lowercase__		(					lowerCamelCase,						lowerCamelCase       ):
				while y:  # --> when y=0 then loop will terminate and return x as final GCD.
								_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    y, x % y
				return abs(lowerCamelCase       )





def 				lowercase__		(					):
				try:
								_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    input('Enter two integers separated by comma (,): '       ).split(','       )
								_SCREAMING_SNAKE_CASE   :		Dict       		=    int(nums[0]       )
								_SCREAMING_SNAKE_CASE   :		Dict       		=    int(nums[1]       )
								print(
								    f"""greatest_common_divisor({num_a}, {num_a}) = """
								    f"""{greatest_common_divisor(lowerCamelCase,						lowerCamelCase       )}"""       )
								print(f"""By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(lowerCamelCase,						lowerCamelCase       )}"""       )
				except (IndexError, UnboundLocalError, ValueError):
								print('Wrong input'       )


if __name__ == "__main__":
			main()

