Discussion: Should We Allow the Use of AI-Generated Templates on Codeforces?

Revision en5, by susenyang, 2025-08-27 13:24:00

Recently, I’ve been reorganizing my algorithm templates, which include some data structures and graph algorithms. Since my coding style tends to favor using std::vector instead of C-style arrays, I want my templates to be more encapsulated. I admit I’m not very familiar with this style of templates, so I thought of using AI to help me refine them. Below is a template for finding the LCA using Heavy-Light Decomposition:

LCA (Now)

My previous templates looked like this:

LCA (Old)

Meanwhile, I also directly generated the following template using ChatGPT-5:

LCA (by ChatGPT)

As we can see, this template doesn’t really have any issues. In fact, in terms of readability, it is already better than most beginners’ code — or at least easier to maintain.

The above examples illustrate that AI has indeed proven to be very effective in maintaining algorithm templates (perhaps partly because such templates already appear in its training data). Whether it is using AI to polish existing templates, assist in modifying them, or directly generate a new one, AI shows strong usability.

Of course, in theory, using AI-generated code during contests is clearly not allowed. But my real question lies in the boundary of using such “templates generated by AI in advance.” On one hand, they are indeed produced by AI; on the other hand, they are prepared before the contest, just like how most participants maintain their own template libraries to bring into competitions.

As a beginner, I would also like to emphasize that AI has lowered the barrier to learning. With AI tools, we can more easily obtain high-quality reference code, and even detect and correct subtle mistakes we might otherwise overlook. At the very least, outside of contests, they can serve as effective learning tools.

Therefore, I started this discussion to hear opinions from the Codeforces community:

Should we allow the use of AI-generated templates?

  • Absolutely not
  • Allow polishing or debugging templates with AI
  • Allow directly using AI-generated templates

If AI templates are allowed, in which scenarios should they be acceptable?

  • Only in pre-contest preparation (AI-assisted template maintenance)
  • Also during contests (AI-generated or AI-debugged templates)

Should templates indicate when they are generated or refined by AI?

  • No, treat them the same as normal templates
  • Yes, explicitly state AI assistance in the template

For options not covered above, share it in the comments.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English susenyang 2025-08-29 15:18:37 482 Tiny change: 'ublime).\nAddition' -> 'ublime).\n\nAddition'
en8 English susenyang 2025-08-28 20:42:09 60
en7 English susenyang 2025-08-27 13:26:51 0 (published)
en6 English susenyang 2025-08-27 13:24:40 28
en5 English susenyang 2025-08-27 13:24:00 28
en4 English susenyang 2025-08-27 13:22:41 7
en3 English susenyang 2025-08-27 13:21:09 83 Tiny change: 's:q1)\n\n-- Allow po' -> 's:q1)\n\n- Allow po'
en2 English susenyang 2025-08-27 13:17:37 6841
en1 English susenyang 2025-08-27 12:58:53 2769 Initial revision (saved to drafts)