comefrom: <qiyuangong>135_Candy_1.py
code: def candy( ratings):
      if ratings is None or len(ratings) == 0:
          return 0
      ls = len(ratings)
      num = [1] * ls
      for i in range(1, ls):
          if ratings[i] > ratings[i - 1]:
              num[i] = num[i - 1] + 1
      for i in range(ls - 1, 0, -1):
          if ratings[i - 1] > ratings[i]:
              num[i - 1] = max(num[i] + 1, num[i - 1])
      return sum(num)
masked: def sample_funcname ( var_0 ) :
      if var_0 is None or len ( var_0 ) == 0 :
          return 0
      var_4 = len ( var_0 )
      var_6 = [ 1 ] * var_4
      for var_8 in range ( 1 , var_4 ) :
          if var_0 [ var_8 ] > var_0 [ var_8 - 1 ] :
              var_6 [ var_8 ] = var_6 [ var_8 - 1 ] + 1
      for var_8 in range ( var_4 - 1 , 0 , - 1 ) :
          if var_0 [ var_8 - 1 ] > var_0 [ var_8 ] :
              var_6 [ var_8 - 1 ] = max ( var_6 [ var_8 ] + 1 , var_6 [ var_8 - 1 ] )
      return sum ( var_6 )
  