WA in SPOJ problem AKBAR

Hello everyone,

I have been trying problem Akbar on SPOJ and It is giving WA even though I think my logic is correct can someone tell me what is the issue or which testcase I’m failing at

My code : akbar.cpp · GitHub
Problem Link : SPOJ.com - Problem AKBAR