WA in BOBERT

I’m getting WA in 9th Test Case of SPOJ PROBLEM BOBERT

Here’s a link to my implementation-IDEONE

Help me Please!

Have you tried testing it with custom input? What cases have you tried?

no I haven’t checked with any custom inputs

Will be one of those trick or border cases triggering something in your code. This line cought my eye: 1<<n That will overflow for n larger than 63. Probably not doing what you intent, but doesn’t seem like the cause for WA.