[Community Puzzle] Paper soccer

https://www.codingame.com/multiplayer/bot-programming/paper-soccer

Send your feedback or ask for help here!

Created by @jacek1,validated by @trictrac,@BenjaminUrquhart and @Deltaspace.
If you have any issues, feel free to ping them.

If I don’t include this code
for(int i=0; i<WIDTH; ++i) { for(int j=0; j<HEIGHT; ++j) { cerr<<(int)b.mainBoard[i][j]<<"\t"; } cerr<<"\n"; }
Which only prints cerr stuff my code data representation goes wild… I think because it doesn’t work as it should. Could there be some behind the scenes optimization that if I don’t check the data it’s invalidated?
Regards

It is difficult to give a specific answer in this case.
Standard advice - you need to make sure that all variables and data structures are initialized before use.
Implicit optimizations are possible if you used something like “pragma GCC …”.