Point Set Range Composite

Problem -Library Checker
More Applications of Segment Tree

Can anyone explain the solution?