comefrom: <doocs>1685.Sum of Absolute Differences in a Sorted Array_1.py
code: def getSumAbsoluteDifferences( nums: List[int]) -> List[int]:
      n = len(nums)
      presum = [0] * (n + 1)
      for i in range(n):
          presum[i + 1] = presum[i] + nums[i]
      res = []
      for i, num in enumerate(nums):
          t = num * i - presum[i] + presum[n] - presum[i + 1] - num * (n - i - 1)
          res.append(t)
      return res
masked: def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
      var_4 = len ( var_0 )
      var_7 = [ 0 ] * ( var_4 + 1 )
      for var_9 in range ( var_4 ) :
          var_7 [ var_9 + 1 ] = var_7 [ var_9 ] + var_0 [ var_9 ]
      var_10 = [ ]
      for var_9 , var_12 in enumerate ( var_0 ) :
          var_13 = var_12 * var_9 - var_7 [ var_9 ] + var_7 [ var_4 ] - var_7 [ var_9 + 1 ] - var_12 * ( var_4 - var_9 - 1 )
          var_10.append ( var_13 )
      return var_10
  