Giving Different Results for Different Languages

Hello , I tried to solve the problem CodeChef: Practical coding for everyone
in both c++ and python , but only my c++ solution gives AC , why is it so ?

c++ solution : CodeChef: Practical coding for everyone
python solution : CodeChef: Practical coding for everyone