4 2 1 2 2 1 7 20250126 191
2
3
-1
20381694
Consider the case $N=2$.
* When $X=1$, $X\ \mathrm{XOR}\ N = 3$ and the remainder of $X$ when divided by $N$ is $1$. Therefore, $1$ is not compatible with $N$.
* When $X=2$, $X\ \mathrm{XOR}\ N = 0$ and the remainder of $X$ when divided by $N$ is $0$. Therefore, $2$ is compatible with $N$.
* When $X=3$, $X\ \mathrm{XOR}\ N = 1$ and the remainder of $X$ when divided by $N$ is $1$. Therefore, $3$ is compatible with $N$.
Hence, among the numbers that are compatible with $2$, the smallest is $2$ and the second smallest is $3$. Therefore, the answer to $\text{case}_1$ is $2$ and the answer to $\text{case}_2$ is $3$.{
"problem": {
"name": "XOR = MOD",
"description": {
"content": "You are given two positive integers $N$ and $K$. A positive integer $X$ is called **compatible with $N$** if it satisfies the following condition: * The bitwise XOR of $X$ and $N$ is equal to the r",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc191_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given two positive integers $N$ and $K$. A positive integer $X$ is called **compatible with $N$** if it satisfies the following condition:\n\n* The bitwise XOR of $X$ and $N$ is equal to the r...",
"is_translate": false,
"language": "English"
}
]
}