Chef team Sigsev error

qstn http://www.codechef.com/problems/CHEFTEAM
I am getting sigsegv error please check http://www.codechef.com/viewsolution/4599164

//