This is my solution: http://www.codechef.com/viewsolution/2531226
I have read many articles. Everywhere I read this:
Usually, returning non-zero values
from main() will cause this error. It
helps telling crash from WA (Wrong
Answer) with interpreted languages.
Typically this would happen if you
omit a return 0; from main() in C. For
interpreted languages or Java/C++,
this could happen if your program
threw an exception which was not
caught (e.g. Trying to allocate too
much memory in a vector).
However I am still not able to figure out what is wrong. Please can some one look into this