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

Автор huikang, история, 3 года назад, По-английски

I used OpenAI API to translate Python code written by Kiri8128 in the recent combined division contest. These are the results.

How to use the translation tool

  • You will need an email and a phone number to sign up for the OpenAI Beta.
  • Create a new code translation Playground.
  • Press "Submit" to see an example of how the code is generated for Haskell.
  • Change Haskell to C++ in the starting prompt and at the stop sequence. You can see how C++ code is generated as well.
  • Insert the Python code you want to translate.
  • Change the maximum length to a larger number so that you generate the code all at once. The total number of tokens in the input and output is limited to 4000.
  • Copy code from Kiri8128.
  • Press "Submit" to generate the code.
  • Copy the C++ code and submit to Codeforces.

Kiri8128 is the first to reach Grandmaster with python3/pypy3 without ever switching to C++. Kiri8128 writes clean code which probably made it easier for the model to translate.

I am curious to see if this tool can produce code that resolves the various instances where Kiri8128's Python code TLE or MLE. I haven't been successful, as the code that seem to TLE/MLE because of the language is usually the more complicated ones.

Feel free to share your thoughts and findings!

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

»
3 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

Why there was CE before the accepted solution? Does the program generates code differently each time

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

    There is a temperature parameter, and its default value is 0.7. The lower the temperature, the more deterministic the code generation.

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Did it translate Python deque to vector even though C++ has its own deque?