SIGSEVG help

My solution on offline mode gets 30% AC and shows SIGSEGV
link https://www.codechef.com/viewsolution/20381209
Where do i made a mistake? . Can someone look into my code and please say that. Thanks in Advance

Thanks it have corrrected it and got 100% AC.