SPOJ- AMR12G. Code not being accepted

Question - https://www.spoj.com/problems/AMR12G/

I tried to solve the above question via arrays and here is my solution -
https://ide.codingblocks.com/s/70628

May I know why is my code not being accepted albeit it works fine on my compiler.
Thank you.

Try Spoj Tool Kit for getting wrong test cases for above code