Mysterious sequence (MYSARA) - March Cook-off 2020 | WA

I can’t find what’s wrong with my solution. I used simple approach that when there is 1 on a particular bit in cur number and was 0 in pre number then on all the numbers following it would have two options for that bit either 1 or 0. And there was a corner case if there is 0 on a particular bit in cur number and was 1 in pre number which is not possible with any combination so answer would be zero in that case.
Link of my submitted solution is:
https://www.codechef.com/viewsolution/30663119