1846C - Rudolf and the Another Competition
I don't know why my code is not working even though the approach is correct, and I don't see anything wrong with my code. Even the 10th test case where it failed should give the right answer, according to me. I would be grateful if you could find out where the error is.