{"problem":{"name":"Mod of XOR","description":{"content":"You are given positive integers $C$ and $X$ that are less than $2^{30}$. Determine whether there exists a positive integer $n$ that satisfies all of the following conditions, and if it exists, find on","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc208_c"},"statements":[{"statement_type":"Markdown","content":"You are given positive integers $C$ and $X$ that are less than $2^{30}$.\nDetermine whether there exists a positive integer $n$ that satisfies all of the following conditions, and if it exists, find one such $n$.\n\n*   $1\\le n < 2^{60}$\n*   $(n \\oplus C) \\bmod n=X$\n\nHere, $n \\oplus C$ denotes the bitwise $\\mathrm{XOR}$ of $n$ and $C$.\nYou are given $T$ test cases, solve each of them.\nWhat is bitwise $\\mathrm{XOR}$?The bitwise $\\mathrm{XOR}$ of non-negative integers $X$ and $Y$, $X \\oplus Y$, is defined as follows:\n\n*   When $X \\oplus Y$ is written in binary, the digit in the $2^k$ place ($k \\geq 0$) is $1$ if exactly one of the digits in the $2^k$ place of $X$ and $Y$ written in binary is $1$, and $0$ otherwise.\n\nFor example, $3 \\oplus 5 = 6$ (in binary: $011 \\oplus 101 = 110$).\n\n## Constraints\n\n*   $1\\le T\\le 2\\times 10^5$\n*   $1\\le C,X < 2^{30}$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\text{case}_2$\n$\\vdots$\n$\\text{case}_T$\n\nEach test case is given in the following format:\n\n$C$ $X$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc208_c","tags":[],"sample_group":[["3\n10 6\n2 3\n777 153","7\n-1\n208\n\nConsider the first test case.\n$n=7$ satisfies all conditions because $(n\\oplus C) \\bmod n = (7 \\oplus 10) \\bmod 7 = 13\\bmod 7 = 6=X$. Therefore, printing $7$ on the first line will be accepted.\nOther than this, printing $n=12,18,19$ etc. will also be accepted."]],"created_at":"2026-03-03 11:01:14"}}