Code getting TLE despite the algorithm listed to be working in n*log(n) (GFG link attached)

Problem Link- CodeChef: Practical coding for everyone
GFG algo idea I used- Find number of segments covering each point in an given array - GeeksforGeeks
My code- CodeChef: Practical coding for everyone
Please look at it.