The Treasure of The Segments
HardRating 1800CodeforcesIntervals & Sweep Line
Approach hintTry it first, then revealHide
Fix the segment that must meet all the others. A segment misses it only by ending before its left border or starting after its right border, and both counts come from binary search on sorted endpoints.