Covered Points Count
MediumRating 1700CodeforcesIntervals & Sweep Line
Approach hintTry it first, then revealHide
Create a +1 event at l and a -1 event at r + 1, then sort and sweep. The gap between consecutive event coordinates adds that many points to the bucket of the current coverage count.