System of Equations 2
Limits: 2 sec., 256 MiB
You are given two non-negative integers \(a\) and \(b\).
Find the number of triples of non-negative integers \((x, y, z)\) such that
\(x+y+z=a\)
\(x \mbox{ XOR } y \mbox{ XOR } z = b\).
Input
The single line of the input contains two integers \(a\) and \(b\).
Output
Print the only integer — answer to the problem.
Constraints
\(0 \le a, b \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 74 44 | 27 |
| Input (stdin) | Output (stdout) |
|---|---|
| 4 7 | 0 |
Notes
Triples \((x_1, y_1, z_1)\) and \((x_2, y_2, z_2)\) are considered distinct if \(x_1 \ne x_2\) or \(y_1 \ne y_2\) or \(z_1 \ne z_2\).
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|