Sum on a segment
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Array of integers is given. Find the sum of elements on a segment.
Input
The first line contains two integers and — the number of elements in array and number of queries. Next lines contain the queries of two types:
A i x — assign to the -th element the value of ;
Q l r — find the sum of numbers in array at positions from to .
Initially the array contains zeros.
Output
For each query of type print the sum of elements on a segment .
Examples
Input #1
Answer #1
Submissions 4K
Acceptance rate 36%