You are given an integer \(C\) such that the XOR of two integers \((A, B)\) is \(C\). In short \(A ⊕ B = C\) (⊕ denotes the bitwise the XOR operation).
Out of all possible pairs of \(A\) and \(B\), you must find two integers such that their product is maximum.
Let us define \(L(A)\) as the length of \(A\) in its binary representation. Then, \(L(A) \le L(C)\) and \(L(B) \le L(C)\).
Input format
A single integer representing \(C\) (\(0⩽C⩽10^5\))
Output format
Print the maximum product you can achieve under the given conditions.
The binary representation of 13 is "1101".
We can use A=10 ("1010" in binary) and B=7 ("0111" in binary). This gives us the product 70. No other valid pair (A,B) can give us a larger product.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor