Puzzle 3, optimized