Using the Constant time formula for Maximum bishops on a chessboard, which is:
int maxBishops(N) return 2*(N-1);
Implemented for the value of N lesser than 10^100, as follows: https://ideone.com/lvuiXW
Verified using Wolfram|Alpha but getting wrong answer on SPOJ's BISHOPS submission.
Am I missing something in the algorithm or is it an implementation issue?
A long sequence of all '0' will make your program fail.
Maybe you should also check for inputs not being a number.
EDIT: The input case 500000000000001 seems to fail also. I guess it will just print the carry.