Finding cbnumbers

question-https://hack.codingblocks.com/contests/c/587/100
code-https://ide.codingblocks.com/s/66772
i’ve implemented the concept but still getting wrong answer in 3 testcases(2,3,4). please inform the error asap