AliBaba and Crisis
Time: 1 s
Memory: 125 MB
Memory: 125 MB
Alibaba has recently been facing financial difficulties. To recover from them, he decided to loot another hidden cave.
Although the mission was successful, depositing a large amount of money at once could attract unwanted attention from the government. So, Alibaba decided to deposit money gradually.
On the first day, he deposits \(1\) taka. After that, the deposit amount for each day is defined based only on the previous day's deposit:
Later, Alibaba starts playing with the deposited amounts by choosing any subset of them and computing their bitwise \(XOR\) value.
Your task is to determine the maximum possible \(XOR\) value he can obtain.
Although the mission was successful, depositing a large amount of money at once could attract unwanted attention from the government. So, Alibaba decided to deposit money gradually.
On the first day, he deposits \(1\) taka. After that, the deposit amount for each day is defined based only on the previous day's deposit:
- on even-numbered days, the deposit is twice the previous day's deposit;
- on odd-numbered days, the deposit is twice the previous day's deposit plus \(1\).
Later, Alibaba starts playing with the deposited amounts by choosing any subset of them and computing their bitwise \(XOR\) value.
Your task is to determine the maximum possible \(XOR\) value he can obtain.
Input
The first line contains a single integer \(t \space (1 \le t \le 10^5)\) — the number of test cases.Each test case contains a single integer \(X \space (1 \le X \le 10^{18})\) — the maximum allowed deposit amount
Output
For each test case, print a single integer — the maximum possible value Alibaba can obtain using the bitwise \(XOR\) operation on the selected deposit amounts.
Examples
| Input | Output |
|---|---|
|
3
1 2 700 |
1
3 1023 |
Problem Info
| Problem ID | 990 |
| Time Limit | 1000 ms |
| Memory Limit | 128000 KB |
| Moderators | ali_hussain , mahdi_talukder , muhimin , Royboy01 , AhsanSaif |
Statistics
Submit
You need to Login or Registration for submit your solution