Good time of a day, Codeforces community :)
I actually was a little bit uncertain if I have the right (well not right but if my question is eligible for asking) to ask help in this problem. The tag on the problem says that it can be solved with Segment/Interval Tree but I tackled the problem and was unable to solve it. I had some ideas of solutions that used the Linked List, but well, you know it was too slow :) I browsed the web for the solution but was unable to find it. Finally, I found the bravery and am asking the help from you :) The task is HERE.
I am very grateful to anyone that found the time to read this.
Thank you very much in advance! :)