Here is the question link which I solved-:https://codeforces.net/contest/1617/problem/A Here is my submission code-:https://codeforces.net/contest/1617/my After going to this link plz go to the latest submission to see my code.
This code works fine in all other IDE (CodeChef,VsCode,Hackerrank) .But when I submit my code on codeforces running contest it gives me errors. Plz, anybody help me out.
If you have such problems, it means your code contains undefined behavior. To figure out where, compile your code with sanitization flags. Here, I did it for you:
Signed integer overflow on line 29. Oh look, you never initialize the variables
cnt1
,cnt2
,cnt3
. They are NOT guaranteed to be initialized to 0. They are filled with garbage so you get nonsense output.