Блог пользователя susenyang

Автор susenyang, история, 9 месяцев назад, По-английски

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.

UPD: One feasible approach is to upload these templates to GitHub in advance. The commit history on GitHub can serve as evidence that the templates were prepared beforehand.

Spoiler
  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by susenyang (previous revision, new revision, compare).

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится +116 Проголосовать: не нравится

My personal view: I think that using AI in any form of preparation before the contest should be acceptable. However, during the contest, one should not seek help from AI in any way — even for templates.

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

AI use to generate templates is allowed. This is why my code is frequently mistaken as AI — I have generated a whole bunch of my templates using GPT lol

  • »
    »
    9 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    It is what I am worried about. Be mistaken as a cheater is annoyed.

    • »
      »
      »
      9 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      This is why my cheater database (cf-cheater-database.vercel.app) has an Appeals function where people who haven't cheated can tell us if they've been wrongly flagged.

      • »
        »
        »
        »
        9 месяцев назад, скрыть # ^ |
        Rev. 2  
        Проголосовать: нравится +3 Проголосовать: не нравится

        But to be fair, how is a wrongly flagged person supposed to defend themselves when they don't even know why they were accused of cheating? Burden of proof lies on accuser, not on the accused. Shouldn't you consider giving the proof of cheating?

        • »
          »
          »
          »
          »
          9 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится +3 Проголосовать: не нравится

          For the billionth time, the point of appeals is not for people to "prove innocence" for such a concept does not exist.

          The point of appeals is to get the (of course, infallible!) admin team to look back over the evidence and ensure that it was correct. In 99% of cases, such (rare) false positives are removed. If someone is wrongly flagged and their appeal does not go through, they can DM me, and people have done this in the past.

          I cannot publicly reveal cheating evidence because that would result in cheaters getting smarter and avoiding falling into the same traps.

          • »
            »
            »
            »
            »
            »
            9 месяцев назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            I'm sorry I didn't know you have answered this before. So you are saying if someone is still wrongly flagged, they have to DM you to ask for evidence? Can't every cheater do that though? I do understand the drawback of revealing cheating evidence, but this is a big issue too.

            • »
              »
              »
              »
              »
              »
              »
              9 месяцев назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              That's okay. It's incredibly rare and unlikely that such instances happen when an appeal is declined and a person resorts to DMing me. And I am fairly sure i have yet to have seen a case where I have had to remove a person from the database even AFTER they have appealed — and that is with over 2.1k cheaters currently in the database. So I'd say I'm doing pretty well.

              • »
                »
                »
                »
                »
                »
                »
                »
                9 месяцев назад, скрыть # ^ |
                 
                Проголосовать: нравится 0 Проголосовать: не нравится

                I think after appealing people just get annoyed and leave it, because it's not official after all. In particular, I know p1k4 who is like that.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  9 месяцев назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  I mean, the user clearly cheated, I have nothing more to say...

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  9 месяцев назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  Well, I'm pretty sure he isn't a cheater, since he is active on Errichto's server (discussing solutions to hard problems) and it is highly unlikely that he cheated. He also denied when I asked if he did (of course every cheater would say that). Would you like to send the evidence to me in DM?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  9 месяцев назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  There's nonzero cheaters active on this server lol

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  9 месяцев назад, скрыть # ^ |
                   
                  Проголосовать: нравится 0 Проголосовать: не нравится

                  I'm sorry for wasting your time, He just told me that he didn't know that what he did was cheating. So he didn't confess when I asked him.

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

a lot of my templates are generated with help of chat-GPT as C++ is not my main language so I use AI a lot to refactor / improve things ( but before the contest i mean )

  • »
    »
    9 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I think LLMs can serve as a decent teacher, so asking them questions or requesting code before the competition begins is reasonable-just like we’re allowed to use pre-written code. But once the competition starts, we can only use what we’ve prepared in advance, and of course, we can’t ask the "teacher" anymore.

    • »
      »
      »
      9 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      I have feeling that in future we should be able to use AI during contests. Contests might look different though.

      Like calculator is allowed in some of our exams in engineering courses.

      • »
        »
        »
        »
        9 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится +3 Проголосовать: не нравится

        A calculator can be allowed but in classes like calculus you're not allowed to use calculators that solve integrals. Even if you use it, you're most likely getting 0 score because you have no understanding of how to reach the answer and the exam's role is testing if you can go through the path to the answer.

        • »
          »
          »
          »
          »
          9 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          this is a classic theory vs application oriented perspective debate.

          I am an engineer so I incline more towards application side and I know lot of people who study theory and say same things like this , so totally understandable and thanks for sharing your perspective

          • »
            »
            »
            »
            »
            »
            9 месяцев назад, скрыть # ^ |
             
            Проголосовать: нравится +14 Проголосовать: не нравится

            I'm also an engineer. You have to take into consideration where you're posting: in the biggest competitive programming website. CP is mostly about solving these really specific math/computer science-ish problems through programming. If you take out the solving and coding part of it, then there's no meaning to it.

            I'd compare it to "well when playing counter-strike one of the goals is to hit bullets on the opposing team, so to optimize reaching that goal I should... of course, use an aim-bot to take the burden of aiming out of my hands!"

            • »
              »
              »
              »
              »
              »
              »
              9 месяцев назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              Can't agree more. In some engineering applications, if there are no confidentiality requirements, using LLMs for assistance is completely feasible. However, in competitive programming, it is against the rules.

            • »
              »
              »
              »
              »
              »
              »
              9 месяцев назад, скрыть # ^ |
              Rev. 2  
              Проголосовать: нравится +3 Проголосовать: не нравится

              thanks for clarifying that you are engineer.

              Just want to mention I am not advocating for anyone to use AI during the contest, if my comment was understood that way.

      • »
        »
        »
        »
        9 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        I think this would inevitably lead to unfairness. The fact is that different models come with very different pricing. Some of them are free, while others cost tens or even hundreds of dollars per month. Their performance in competitive programming also varies greatly. If we allow the use of AI during contests, then programming competitions would essentially turn into an arms race of AI models, which clearly deviates from their original purpose.

  • »
    »
    9 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Honestly, you're robbing yourself from a good chance to become a better programmer.

    • »
      »
      »
      9 месяцев назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Curious to know your definition of a better programmer

      • »
        »
        »
        »
        9 месяцев назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        In this case it's about your capacity of reading ideas from other people and being able to implement them well according to your understanding.

        • »
          »
          »
          »
          »
          9 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          thanks for sharing your perspective on this.

        • »
          »
          »
          »
          »
          9 месяцев назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          I think this issue can be divided into two different situations:

          • Practical preparation for a contest. For example, I need a segment tree template to prepare for tonight’s contest. I’m worried that I might realize during the contest that a segment tree is required, but I may not be able to implement it quickly. In this case, I think it is reasonable to use LLMs to assist in implementing the template, or even to directly generate one.

          • Learning and understanding the data structure. On the other hand, if my goal is to learn the segment tree, then I don’t think directly generating a template is the right way. A better approach is: try to write it out according to my own understanding first, and then compare it with a standard template. When I notice differences, I ask myself: " Could my version still be correct? If not, why ?" I believe this process deepens our understanding of the template, instead of just knowing how to use it.

          • »
            »
            »
            »
            »
            »
            9 месяцев назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            That's fair, but even in the first situation: when people ask me "what should I study a week before ICPC regionals?" my answer is always "nothing, you should've studied during the whole year to prepare for now" because of experiences with unfamiliar templates enticing people to waste time trying to understand the template instead of trying other doable problems.

            • »
              »
              »
              »
              »
              »
              »
              9 месяцев назад, скрыть # ^ |
               
              Проголосовать: нравится 0 Проголосовать: не нравится

              Yes. From my personal experience, the templates that can actually be used in official contests are always the ones that I have already mastered, not those prepared at the last minute in the first way.

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится -85 Проголосовать: не нравится

im just commenting for my contribution to go up

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by susenyang (previous revision, new revision, compare).

»
9 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i don't understand what you're talking about. AI use is forbidden DURING the contest. getting any code from any source before the contest is allowed, so I don't understand what is the problem with AI-generated templates if you created them in advance. what are we even talking about here?