comefrom: <doocs>0503.Next Greater Element II_1.py
code: def nextGreaterElements( nums: List[int]) -> List[int]:
      n = len(nums)
      ans = [-1] * n
      stk = []
      for i in range(n << 1):
          while stk and nums[stk[-1]] < nums[i % n]:
              ans[stk.pop()] = nums[i % n]
          stk.append(i % n)
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
      var_1 = len ( var_0 )
      var_2 = [ - 1 ] * var_1
      var_3 = [ ]
      for var_4 in range ( var_1 << 1 ) :
          while var_3 and var_0 [ var_3 [ - 1 ] ] < var_0 [ var_4 % var_1 ] :
              var_2 [ var_3.pop ( ) ] = var_0 [ var_4 % var_1 ]
          var_3.append ( var_4 % var_1 )
      return var_2
  