I am looking for a data structure that would maintain an integer table $t$ of size $n$, and allowing the following operations in time $O(\log n)$.
- $\text{increase}(a,b)$, which increases $t[a],t[a+1],\ldots,t[b]$.
- $\text{decrease}(a,b)$, which decreases $t[a],t[a+1],\ldots,t[b]$.
- $\text{support}()$, which returns the number of indices $i$ such that $t[i]\neq 0$.
You have the promise that every call to decrease can be matched to a previous call to increase with the same parameters $a,b$. The application I have in mind is a sweepline algorithm to compute in time $O(n\log n)$ the area of the union of n given rectilinear rectangles.
A quad-tree would have size $\Theta(n^2)$, so it is not a solution. Fenwick or Interval trees have the right flavor, but I don't see how to extend them to support the operations above.