Building blocks : IIT Bombay

I was trying the 6th question Building Blocks from the much maligned IIT Bombay contest which got cancelled yesterday. Problem link:

I’ve been trying to solve this problem for some time now but always end up with a WA.
I have even matched my output for all inputs with an AC code and found no differences.

My submission:

AC code with which i matched my output :

I can’t seem to understand whats wrong.
Any help would be appreciated.

1 Like

I tried matching output with all 3 AC codes, they were perfect. There must be a judge issue or some C++ issues in your code which I couldn’t find :frowning:

I have verified the outputs for n = 0 to 10^5. It is completely matching with the AC solutions, but I still end up with a WA. Submitting the other AC solutions fetches me a AC though :frowning:

Can’t understand the issue. Hope somebody can help me out here!