getting wrong answer on spoj but getting right answer on ideone.com

here is my code. I am getting right answer of the question. But SPOJ is saying that it is wrong answer. So please guide me through it or suggest me anything so that it can get accepted on SPOJ.
m054A2 - Online C Compiler & Debugging Tool - Ideone.com

What is the question?