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_1 = len ( var_0 )
      var_2 = [ 0 ] * ( var_1 + 1 )
      for var_3 in range ( var_1 ) :
          var_2 [ var_3 + 1 ] = var_2 [ var_3 ] + var_0 [ var_3 ]
      var_4 = [ ]
      for var_3 , var_5 in enumerate ( var_0 ) :
          var_6 = var_5 * var_3 - var_2 [ var_3 ] + var_2 [ var_1 ] - var_2 [ var_3 + 1 ] - var_5 * ( var_1 - var_3 - 1 )
          var_4.append ( var_6 )
      return var_4
  