How to verify error in my hash function ?

I was solving this problem link text
and my solution is link text

I solved this using hashing and binary search technique , but it shows WA .
Not sure what is the problem with my hash function , Can anyone plz help me in this ?

Found the solution using double hashing