Need help in UVA problem

I don’t know why I get WA in this problem

my code