I want to share my a bit weird experience with you guys. I was solving Tavas in Kansas and had some serious problems with debugging my solution. In the end, it was clear that the idea was correct, I just needed to focus on the implementation. I rewrote a small chunk of code and was astonished by the fact that it was equivalent, but it got accepted. I tried to play with my implementations a little. And guess what? I found out that assert() on an obvious condition can make your code work!
I generally do not have great knowledge of compilators and stuff like that. But maybe someone has the idea what the hell happened? :D