Initialize a temporary array which stores the cumulative value of the original array
tmp = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT tmp [ i ] = ( arr [ i ] + K * ( i + 1 ) ) NEW_LINE DEDENT