getting SIGABRT error please help

I have commented my algorithm in my code http://www.codechef.com/viewsolution/3777817 i am getting SIGABRT error cant find the error please help.I have no idea about illegal instrctusion in c language can u plz put a example of it.

link for qstn

Thank you