Here is my solution for the problem 6B(https://codeforces.me/contest/6/problem/B): https://codeforces.me/contest/6/submission/71870236 On my machine when I enter the sample test case, I get the correct answer. However, codeforces shows answer as 3 for my code instead of 2. Help me with the issue.
You are looking at row $$$i+1$$$ before reading it, at line 18, that's undefined behavior and anything can happen.