Hackerrank - Save the prisoner

{CM} I stumbled in this one, and had to get help - the solution is a simple one-liner with boolean logic.