8VC Venture Cup 2016 - Final Round
A
XOR Equation
Codeforces
1700
原题
←B →
翻译中…

Two positive integers $*a*$ and $*b*$ have a sum of $*s*$ and a bitwise XOR of $*x*$. How many possible values are there for the ordered pair $(*a*, *b*)$?

翻译中…

Input

翻译中…

The first line of the input contains two integers $*s*$ and $*x*$ ($2 ≤ *s* ≤ 10^{12}$, $0 ≤ *x* ≤ 10^{12}$), the sum and bitwise xor of the pair of positive integers, respectively.

翻译中…

Output

翻译中…

Print a single integer, the number of solutions to the given conditions. If no solutions exist, print $0$.

翻译中…

Note

翻译中…

In the first sample, we have the following solutions: $(2, 7)$, $(3, 6)$, $(6, 3)$, $(7, 2)$.

翻译中…

In the second sample, the only solutions are $(1, 2)$ and $(2, 1)$.

翻译中…

样例

Input #1
9 5
Output #1
4
InputCopy OutputCopy
Input #2
3 3
Output #2
2
InputCopy OutputCopy
Input #3
5 2
Output #3
0
InputCopy OutputCopy
题目信息
题号
627A
时间限制
2 s
内存限制
256 MB
标签
动态规划
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。