Given an array of size initialized to 0, perform operations: - add(l, r, val): Add val to all elements in range - query(l, r): Return sum of elements in range This requires lazy propagation because:
Range updates would be with point updates
you need both range updates and range queries Implement a segment tree with lazy propagation for range add and range sum. Constraints: up to , up to operations.