I'm a Pascal writer. I can't solve B then I go read the solution of problem B in FPC and saw about 6 A/C by the same code: https://codeforces.net/contest/1730/submission/173489911 https://codeforces.net/contest/1730/submission/173487790 https://codeforces.net/contest/1730/submission/173487187 https://codeforces.net/contest/1730/submission/173486665 https://codeforces.net/contest/1730/submission/173482185 https://codeforces.net/contest/1730/submission/173454097