[Tip] 3 small habits that cut my silly WA in Div. 2 A–C

Revision en1, by gautrang2474165, 2026-11-29 09:26:33

Hey everyone,

I used to lose rating mainly due to silly bugs in Div. 2 A–C rather than lacking algorithm knowledge. Three small habits helped me fix this:

  1. Test $$$N = 1$$$, $$$N = 2$$$, and all-equal arrays before submitting. Pretests often miss these edge cases, and a 20-second dry run saves a 10-minute debug penalty.
  2. Default to long long for sums and products. Even if $$$a_i \le 10^9$$$, intermediate calculations overflow int easily.
  3. Write a 1-line proof before coding greedy. If I can't explain in one comment line why swapping two elements doesn't improve the answer, the greedy idea is likely wrong.

Nothing groundbreaking, just simple guardrails that cleaned up my contests. What's one small habit that helped you reduce silly bugs?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English gautrang2474165 2026-11-29 09:26:33 821 Initial revision (published)