Facing problem in STUPMACH

I am getting wrong answer after submitting and I am not able to find my mistake.
(https://www.codechef.com/viewsolution/33139665)

Why are you outputting v.size()?

That was only for checking. Even after removing that line i am getting wrong answer.