Boston number problem

For test case 2 and 3 , it is showing run-error , for all other test cases my code is working fine.
I have checked all the boston numbers like 4,22 ,27 ,58 ,85 ,94 and 121 myself and it is working fine.
Please see my code and tell the error.

https://ide.codingblocks.com/#/s/16564

Heyy ! actually your code is not working for larger nos like 2147483646 . So just need to take care of this and dat’s it , others part of ur code is fine .
for further help , i modified ur code , u can go through this
https://ide.codingblocks.com/#/s/16569

hey!
i have made all the variables as long long but still i am failing test case 3, can’t seem to find the problem.
Please help. Thanks in advance.
here is the code

https://ide.codingblocks.com/#/s/16612