Running this code locally gives Runtime Error on test 3 due to this:
s.erase(s.find(cnt));
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)?
Actually this is not guaranteed to be runtime error, as this operations causes undefined behavior. And undefined behavior is just that, undefined. You could have got any verdict
This same problem happened to me on pretest 3 and I thought my solution was too slow because of the judge's verdict. It is unfortunate that it gave me TLE because if it had given me RTE, I might've had a better idea of what to debug. It was simply my fault for not understanding the STL and the undefined behavior :(.