[HELP]HashTable spoj Hashit, help with the code.

I am practicing questions on hash table. I solved this question of spoj http://www.spoj.com/problems/HASHIT/ and here is my code http://ideone.com/iGsnkq

Whats wrong with this code. Its a hash table question and I think if it gives right answer for test case and my own test cases then why a “WA” ?

Any help is appreciated. thanks.