




from __future__ import annotations

A   =       [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
A   =       [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]

def 					_UpperCamelCase    (			UpperCamelCase							)			->			list[float]:


			"""simple docstring"""
			__UpperCAmelCase	: Any		=					[]
			__UpperCAmelCase	: Any		=					len(UpperCamelCase							)

			for i in range(UpperCamelCase							):
						__UpperCAmelCase	: Optional[Any]		=					-1
						for j in range(i + 1				,       UpperCamelCase							):
									if arr[i] < arr[j]:
												__UpperCAmelCase	: Dict		=					arr[j]
												break
						result.append(UpperCamelCase							)
			return result

def 					_UpperCamelCase    (			UpperCamelCase							)			->			list[float]:


			"""simple docstring"""
			__UpperCAmelCase	: List[str]		=					[]
			for i, outer in enumerate(UpperCamelCase							):
						__UpperCAmelCase	: Any		=					-1
						for inner in arr[i + 1 :]:
									if outer < inner:
												__UpperCAmelCase	: Dict		=					inner
												break
						result.append(UpperCamelCase							)
			return result

def 					_UpperCamelCase    (			UpperCamelCase							)			->			list[float]:


			"""simple docstring"""
			__UpperCAmelCase	: Dict		=					len(UpperCamelCase							)
			__UpperCAmelCase	: Optional[Any]		=					[]
			__UpperCAmelCase	: Optional[int]		=					[-1] * arr_size

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

					A   =       (
					    "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 					_UpperCamelCase    (			UpperCamelCase				,       UpperCamelCase				,       UpperCamelCase							)			->			int:


			"""simple docstring"""

			if exponent == 1:
						return base
			if exponent % 2 == 0:
						__UpperCAmelCase	: Union[str, Any]		=					_modexpt(UpperCamelCase				,       exponent // 2				,       UpperCamelCase							) % modulo_value
						return (x * x) % modulo_value
			else:
						return (base * _modexpt(UpperCamelCase				,       exponent - 1				,       UpperCamelCase							)) % modulo_value

def 					_UpperCamelCase    (			UpperCamelCase = 1777				,       UpperCamelCase = 1855				,       UpperCamelCase = 8							)			->			int:


			"""simple docstring"""
			__UpperCAmelCase	: Optional[int]		=					base
			for _ in range(1				,       UpperCamelCase							):
						__UpperCAmelCase	: str		=					_modexpt(UpperCamelCase				,       UpperCamelCase				,       10**digits							)

			return result


if __name__ == "__main__":
					print(f'''{solution() = }''')


