I got the same error with another problem, so I figured out!!!
[cpp]pp = fgets(s,100,stdin);
if (pp== NULL) return 0;
sscanf (s,"%ld",&n);[/cpp]
That was the problem... I didn't break the rutine if there was no input...
Thank you all...
I found an easy way to calculate the answer... BUTTTT... Your program output is greater (4236247 bytes) than the maximum allowed for any problem by this judge (4194304 bytes). You must interprete this as a Wrong Answer (in fact, is wrong!). By some reason your program is writing an unlimited output....