Hello. Does the C compiler SPOJ uses manages the C long long type? The problem http://www.spoj.com/problems/IITKWPCB supposes integers may go up to 10^12.
What happens when you submit code using long long? If the judge does not give you a compiler error, then I would assume that it does.