[problem link](https://codeforces.me/problemset/problem/1461/B)
I am getting the right answer when running the testcases locally however codeforces when running the code on their servers gives a different output. Can anyone explain what's happening here. Any help is appreciated. Thanks.