Socializing Game around Pizza

here is my solution to above problem, i know it is different from most of the correct answers i went through but i could not find a case where the code is going wrong. HELP TO FIND ONE. i checked many test cases by running the accepted solutions in my pc all matched with my answers.

http://www.codechef.com/viewsolution/6400269