CHEFHACK RUNTIME ERROR (SIG SEGV)

my code gives sigsegv error on submission. Please help my code is here http://www.codechef.com/viewsolution/5211099
thanx

Would you paste it into pastebin.com and give us the link.
It would be much more readable.
Thanks.

the link for my solution on pastebin is here
http://pastebin.com/gBGqzvcj