You have an array of n integers and must process q operations in order. An operation `1 i v` sets the i-th element to v. An operation `2 l r` asks for the sum of the elements from position l to position r, inclusive. Positions start at 1.
The first line has n and q. The second line has the n initial values. Each of the next q lines is either `1 i v` or `2 l r`.
For every operation of type 2, print the requested sum on its own line, in order.
1 <= n, q <= 200000 |value| <= 10^9 There is at least one operation of type 2. Sums can exceed 32 bits.
1000 ms256 MB
5 5 1 2 3 4 5 2 1 5 1 3 10 2 1 3 2 3 5 2 5 5
15 13 19 5
After the update the array is 1 2 10 4 5, so the sums of positions 1..3, 3..5 and 5..5 are 13, 19 and 5.