Prefix Sums
Know
Precomputing cumulative totals turns any range-sum query into a single subtraction, trading linear setup for constant queries.
Apply
Use prefix sums when many range queries will be asked of unchanging data.
Watch out
Rebuilding the prefix array after every update, which erases the benefit on changing data.
Study move
Answer three range-sum queries from one prefix array.
