I submitted the following two codes, which are essentially the same but one gives WA, the other got accepted.
(compare the two solutions to see the differences)
UPD: Perhaps this is not something just random, repeating the submissions still gives the same verdicts. I am unsure how assertions are affecting the code.