~/algor $ cat problems/bit-grey-kodi
Gray code
Easy
1000 ms
128 MB
30%
The Gray code of a non-negative integer $x$ is the number $x \oplus \lfloor x / 2 \rfloor$ ($\oplus$ is bitwise XOR). For example, the Gray code of $6 = 110_{2}$ is $110_{2} \oplus 011_{2} = 101_{2} = 5$. A number $n$ is given. Find two numbers: the Gray code of $n$ and the number whose Gray code is $n$ (it is unique).
Input
One integer $n$.
Output
Two integers separated by a space: the Gray code of $n$ and the number whose Gray code is $n$.
Note
$0 \le n \lt 2^{60}$
Examples
Input #1
5
Output #1
7 6
Input #2
0
Output #2
0 0