Eight queens puzzle is a well-known problem. It can be solved by common depth-first backtracking algorithm. However, we can use bit manipulation skills to make the algorithm more efficient. In the following code, `row`

, `md`

and `cd`

reference to the restrictions about `row`

, `main diagonal`

and `counter diagonal`

respectively if we enumerate from 0 column to $(N-1)$ column. Specificialy, `row`

represents all the selected rows. And if we more from the current column to the next column from left to right, namely 0 to $N-1$, the rows `md`

selected on the main diagonal changed to $md << 1$ when it shows in bit level. Similarly, the rows `cd`

selected on the counter diagonal changed to $cd >> 1$. Below the code is the accurate runtime on my machine.