Why is this solution giving WA? August starters Div 2 CRDFLP

Here’s my solution for CRDFLP question from august starters div 2. I saw the video editorial and understood their solution. However, I am not able to figure out what’s going wrong with my solution. Please help. https://www.codechef.com/viewsolution/50397993

The reason is because the greedy Algorithm doesn’t work here,just because a solution gives the maximum bitwise and for one step,it doesn’t mean that the resultant number will be maximised.

Do watch the editorial of this question.

I had made the same mistake in this question,hence got WA.

I am not able to figure out for which test case it might be failing. Can you give one example?