You are given an array $$A$$ containing $$N$$ integers. You can do the following operation at most $$K$$ times:
- Choose any index $$i$$ and increase the value of $$A_i$$ by $$1$$.
Your task is to find the maximum bitwise OR of the array.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- The first line of each test case contains two space-separated integers $$N$$ and $$K$$.
- The second line of each test case contains $$N$$ space-separated integers denoting array $$A$$.
Output format
For each test case, print the maximum possible bitwise OR of the array after performing at most $$K$$ operations in a new line.
Constraints
It is guaranteed that the sum of $$N$$ over $$T$$ test cases does not exceed $$1e6$$.
For the first testcase, we can increase the value of $$5$$-th index by $$2$$. Thus the $$A$$ becomes {\(1,3,7,0,8,1\)}. The bitwise OR of the array $$A$$ becomes $$15$$.
For the second testcase, we can increase the value of $$1$$-th index by $$1000000000$$. Thus the $$A$$ become {$$1000000000$$}. The bitwise OR of the array $$A$$ becomes $$1000000000$$.
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