


'''simple docstring'''






from __future__ import annotations

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





def lowerCamelCase__      (						__lowerCamelCase	:							list[float]							):







   '''simple docstring'''




   _UpperCAmelCase       :       Union[str, Any]							   =[]
   _UpperCAmelCase       :       List[str]							   =len(__lowerCamelCase							)

   for i in range(__lowerCamelCase							):
      _UpperCAmelCase       :       float							   =-1
      for j in range(i + 1	,   __lowerCamelCase							):
         if arr[i] < arr[j]:
            _UpperCAmelCase       :       List[str]							   =arr[j]
            break
      result.append(__lowerCamelCase							)
   return result





def lowerCamelCase__      (						__lowerCamelCase	:							list[float]							):







   '''simple docstring'''




   _UpperCAmelCase       :       Optional[int]							   =[]
   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 lowerCamelCase__      (						__lowerCamelCase	:							list[float]							):







   '''simple docstring'''




   _UpperCAmelCase       :       Union[str, Any]							   =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       :       List[str]							   =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							=(
     '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'''






from __future__ import annotations





def lowerCamelCase__      (						__lowerCamelCase	:							list[int]							):







   '''simple docstring'''




   if not nums:
      return 0
   _UpperCAmelCase       :       Tuple							   =nums[0]
   _UpperCAmelCase       :       int							   =0
   for num in nums[1:]:
      _UpperCAmelCase   ,	_UpperCAmelCase       :       Optional[int]							   =(
          max_excluding + num,
          max(__lowerCamelCase	,   __lowerCamelCase							),
      )
   return max(__lowerCamelCase	,   __lowerCamelCase							)


if __name__ == "__main__":
 import doctest

 doctest.testmod()

