Running this code locally gives Runtime Error on test 3 due to this:
Which I replaced by this:
auto itr = s.find(cnt); if (itr != s.end()) s.erase(itr);
And it passed all test.
It took me less than a minute to figure out that deletion might be causing RE.
But during the contest, I spent more than an hour thinking about why it was giving TLE.
Is this normal behaviour on Codeforces compilers or is it a bug. If it's normal, then how do we deal with such verdicts (a TLE which actually is just a RE)?