My solution get partial submit

problem : CodeChef: Practical coding for everyone
solution : CodeChef: Practical coding for everyone

My solution is not fully correct. Please someone check my approach. Where I got stuck?