IntermediateRating 1300
Many Range Additions
Start with n zeros. Each of q operations adds v to every position from l to r. Print the final list. Use a difference array: q and n can be 10⁵.
Input
n and q; then q lines 'l r v'.
Output
n integers.
Sample 1
Input
5 3 1 2 10 2 3 20 2 5 25
Output
10 55 45 25 25
Sample 2
Input
1 1 1 1 -3
Output
-3
Output appears here