I used OpenAI API to translate Python code written by Kiri8128 in the recent combined division contest. These are the results.
- Problem A: Source, AC
- Problem B: Source, CE AC
- Problem C: Source, WA WA WA RE CE
- Problem D: Source, AC
- Problem E: Source, AC
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
toC++
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!
Why there was CE before the accepted solution? Does the program generates code differently each time
There is a temperature parameter, and its default value is 0.7. The lower the temperature, the more deterministic the code generation.
Did it translate Python deque to vector even though C++ has its own deque?