cho.sh
Notes
Loading...

Range Sum Query with Updates

Time limit

2s

Memory limit

256 MB

Problem

You are given an array of N integers. Then two kinds of operations are given in sequence. One operation changes the value at a specific position, and the other asks for the sum of a contiguous range in the current array. Process all operations in order and print the answer to each range-sum query.

Input

The first line contains the number of integers N, the number of value updates M, and the number of range-sum queries K.

1 <= N <= 1,000,000, 1 <= M <= 10,000, and 1 <= K <= 10,000.

The next N lines contain the initial array values, one per line.

Each of the following M + K lines contains three integers a, b, and c.

  • If a = 1, change the b-th number to c. In this case, 1 <= b <= N.
  • If a = 2, compute the sum from the b-th number through the c-th number. In this case, 1 <= b <= c <= N.

Every integer given in the input is between -2^63 and 2^63 - 1, inclusive.

Output

For each range-sum query, print its answer on its own line. Every answer is guaranteed to be between -2^63 and 2^63 - 1, inclusive.