Every coder at some stage has run into this, right? - A bug that disappears when you try to add some cout - Everything looks correct in debug, where (as mentioned) the variables are initialised to nice values like 0. When you compile with -O3, you get really large values instead. - A bug that is rare enough that you have to run the program for a long while before it happens. And when it does, you haven't logged the r…
Uninitialized variable. Turn on warnings.