Need help in chef and pepperoni pizza

can any one suggest me where i am going wrong i can’t figure out in which test case my code is not giving write answer i anyone helps me i would be thankful to him\her.
problem link.
https://www.codechef.com/problems/PEPPERON
my solution link.
https://www.codechef.com/viewsolution/26782910