GetSum(l, r) // return accumulate(a + l, a + r, 0)
Add(l, r, x) // while (l <= r) a[l++] += x;
log n
Points : x[n], y[n]
Rectangles : lx, rx, ly, ry [m]
Стороны параллельны осям
{ <= rx, [ly..ry] } - { <= lx-1, [ly..ry] }
lx-1 : open -= GetSum(ly, ry)
rx : close += GetSum(ly, ry)
point x : a[y]++
------------------------
Points : x[n], y[n]
point x : a[y]++
x возрастают
Online: lx, rx, ly, ry
i : max x <= lx-1
j : max x <= rx
Answer = GetSum(root[j], ly, ry) - GetSum(root[i], ly, ry)