Core Idea
Point updates and range sums are a standard Fenwick tree use case. The tree stores enough prefix-sum information to update and query in logarithmic time.
Algorithm
To add at position i, update all Fenwick nodes covering that position. A range sum l..r equals prefix(r) - prefix(l - 1).
Common Mistakes
Fenwick trees are usually 1-indexed. Convert carefully if the input is 1-indexed, and use 64-bit sums when values or update counts are large.