#P9451. [ZSHOI-R1] 新概念报数

[ZSHOI-R1] 新概念报数

Background

What background does Div.2 A need?

Problem Description

Now Xttttr and his npy are playing a counting game, but they really like the number 22, so they made the following rules:

  • If a number aa satisfies popcount(a)3\operatorname{popcount}(a) \geq 3, then this number is illegal, and the other person must answer No,Commander.
  • Otherwise, this number is legal, and the other person must answer the next legal number.

As someone sitting nearby, you of course do not know the fun of this game. You only want to know what the other person should answer after a certain count.

Input Format

The first line contains a positive integer TT, which indicates the number of queries.

The next TT lines each contain a natural number aa, which indicates the number called out by one person in this query.

Output Format

Output TT lines. Each line contains a positive integer or a string, indicating what the other person should answer for this query.

3
1
4
6
2
5
8
1
7
No,Commander

Hint

For 20%20\% of the testdata, T100T \leq 100 and a104a \leq 10^4.

For another 20%20\% of the testdata, aa is a legal number.

For another 20%20\% of the testdata, aa is uniformly random within the value range.

For 100%100\% of the testdata, 1T1051 \leq T \leq 10^5 and 0a<2630 \leq a < 2^{63}.

Translated by ChatGPT 5