Question
Maintain an array of `n` integers, all initially 0, supporting two operations given in `ops` (0-indexed): `["u", l, r, delta]` adds `delta` to every element in the inclusive range [l, r], and `["q", i]` returns the current value at index i. Return the answers to the query operations in order. Both operations must run in O(log n). `1 <= n <= 100000`, `len(ops) <= 100000`.
fenwick_range_update(n: int, ops: list[list]) → list[int][5,[["u",1,3,2],["q",2],["q",4]]]out[2,0]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.