==================↵
↵
1. This [code](http://codeforces.net/contest/1650/submission/149197417) received verdict _WA on 4_.↵
2. This [code](http://codeforces.net/contest/1650/submission/149197065) received verdict _RTE on 3_.↵
3. This [code](http://codeforces.net/contest/1650/submission/149197365) received _AC_↵
↵
From 2 to 3, (RTE to AC) I only changed one thing, while looping over a vector in reverse order, I was using the following loop construct↵
↵
↵
~~~~~↵
for(ll i = v.size()-1; i >= 0; i--)↵
~~~~~↵
↵
But after I realized that the `v.size()` is unsigned, so I might have to convert to `(ll)` first. So changing the loop to the following code got me AC.↵
↵
~~~~~↵
for(ll i = (ll)v.size()-1; i >= 0; i--)↵
~~~~~↵
↵
Here is the [diff](https://www.diffchecker.com/Pdj8UY68) between the RTE code and AC code.↵
↵
Now, I had made the same mistake when I received WA on 4. That means without type casting to `ll`, my code passed the case 3. (Because it received WA on 4). But shouldn't the same code receive RTE on 3?? ↵
↵
Here is the [diff](https://www.diffchecker.com/wDAs6MM5) between the WA code and RTE code.↵
↵
Is it just undefined behavior? Or there is a specific reason behind this?↵
↵
Can anyone help me by explaining this?