Fenwick tree
Change one number and find the sum from the start of the row to a chosen endpoint.
Cell bit[i] stores a block ending at i. Its length is the lowest set bit, i & −i.
An update visits every block containing the changed index. A prefix query takes disjoint blocks from right to left.
Building takes O(n). Updates and queries take O(log n), with O(n) storage.