A question about competetive programming.code forces

Hi, I think my question have gone bottom and no one can see it and no one would answer it so I just copy the link.

check this https://ide.codingblocks.com/s/63009

Ok Thanks but i want to know why my code gets wrong answer in test case 8 .my code is in the link.