Help in removing TLE - Room Allocation (java solution)

Problem link : CSES - Room Allocation
solution link (java) : https://cses.fi/paste/93c93ad5e9b46a4f143f6e/

Getting TLE in last few subtask only when n is max (2*1e5).
Is this due to Priority queue ? I’ve also used TreeSet but still getting TLE.
Any suggestion to improve time complexity!!
Thanks.