**PROBLEM LINK**

**AUTHOR**

**TESTER**

**SOLUTION**

This is a trivial application of Fenwick tree. Those not familiar with Fenwick tree may look at the topcoder editorial available here.

All this is asking you to do is to online update of a single element in the array and the sum in a range. Note that the sum of elements of an array from indices i through j can be written as cum_sum[j]-cum_sum[i] where cum_sum[i] is the cumulative sum of all elements in 1 through i.

Seeking the cumulative sum at any point in an array after multiple updates can be done efficiently in O(log n) using the Fenwick tree. You may use the update and read function (available here) in order to do this efficiently.