LearnPy Hub
← Arena
IntermediateRating 1400

Range Updates

Start with n zeros. Apply q updates 'l r v' that add v to every position from l to r (1-based). Print the final array. Use a difference array.

Input

n q, then q lines.

Output

One line.

Sample 1

Input
5 3
1 3 2
2 5 1
4 4 10
Output
2 3 3 11 1

Sample 2

Input
1 1
1 1 5
Output
5
solution.py
Output appears here
Range Updates · Python Arena problem · LearnPy Hub