getting WA in AKBAR spoj

SPOJ question :SPOJ.com - Problem AKBAR
solution:AonT8k - Online C++0x Compiler & Debugging Tool - Ideone.com