Here is the problem: 1793D - Moscow Gorillas
and my submission: 210771147
After taking a peek at the editorial, it looks like pretty much the same thing they are saying so I am not sure what I am missing at the moment.
A quick summary of my logic:
Logic
Implementation bug:
should be
Thank you so much! I can't believe I didn't catch that.