https://mirror.codeforces.com/contest/1335/problem/E1
When I run the test, it keeps going well, and suddenly it fails on test 10 data 596 or something, so I cannot see what test case is causing the problem. Im asking for help after 3+hours of coding ! Id really appreciate any help.
Source code below, with detail;
It works on almost all cases, but there seems to be a counterexample that I seem to be missing. Thanks :)