I was working on this problem: problem, when my first submission got a runtime error here: my first submission
At this point I had already been working on the problem on a while, so I looked at the editorial and my solution was exactly what the editorial was describing.
So what is wrong with my implementation? I have seen other people's AC on the same problem and their implementations look about the same as mine.
the equal sign in a sorting comparator causes undefined behavior
Thank you, it is working now.