comefrom: <doocs>2012.Sum of Beauty in the Array_1.py
code: def sumOfBeauties( nums: List[int]) -> int:
      n = len(nums)
      lmx = [0] * n
      for i in range(1, n):
          lmx[i] = max(lmx[i - 1], nums[i - 1])
      rmi = [100001] * n
      for i in range(n - 2, -1, -1):
          rmi[i] = min(rmi[i + 1], nums[i + 1])
      ans = 0
      for i in range(1, n - 1):
          if lmx[i] < nums[i] < rmi[i]:
              ans += 2
          elif nums[i - 1] < nums[i] < nums[i + 1]:
              ans += 1
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 = len ( var_0 )
      var_6 = [ 0 ] * var_4
      for var_9 in range ( 1 , var_4 ) :
          var_6 [ var_9 ] = max ( var_6 [ var_9 - 1 ] , var_0 [ var_9 - 1 ] )
      var_12 = [ 100001 ] * var_4
      for var_9 in range ( var_4 - 2 , - 1 , - 1 ) :
          var_12 [ var_9 ] = min ( var_12 [ var_9 + 1 ] , var_0 [ var_9 + 1 ] )
      var_15 = 0
      for var_9 in range ( 1 , var_4 - 1 ) :
          if var_6 [ var_9 ] < var_0 [ var_9 ] < var_12 [ var_9 ] :
              var_15 += 2
          elif var_0 [ var_9 - 1 ] < var_0 [ var_9 ] < var_0 [ var_9 + 1 ] :
              var_15 += 1
      return var_15
  