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

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

Hello, Codeforces!

We've compiled a list of command lines that Codeforces uses to compile and run solutions in various languages and compilers.

It is up-to-date as of today (2023-10-06), and we will make efforts to keep it current in the future, but this is not guaranteed.

Language/Tool Bitness Compilation/Build Command Run Command
GNU GCC C11 5.1.0 32 gcc -std=c11 -static -DONLINE_JUDGE -fno-asm -lm -s -Wl,--stack=268435456 -O2 %1 run binary file
GNU G++14 6.4.0 32 g++ -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++14 %1 run binary file
GNU G++17 7.3.0 32 g++ -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++17 %1 run binary file
GNU G++20 11.2.0 (64 bit, winlibs) 64 g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++20 %1 run binary file
GNU G++23 14.2 (64 bit, msys 2) 64 g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++23 program.cpp -lstdc++exp %1 run binary file
Microsoft Visual C++ 2017 32 cl /std:c++17 /W4 /F268435456 /EHsc /O2 /DONLINE_JUDGE %1 run binary file
GNU G++17 9.2.0 (64 bit, msys 2) 64 g++ -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++17 %1 run binary file
C# 8, .NET Core 3.1 64 dotnet.exe build -c:release [+DefineConstants:TRACE;ONLINE_JUDGE] && editbin64.exe /stack:67108864 run binary file
C# 10, .NET SDK 6.0 64 dotnet.exe build -c:release [+DefineConstants:TRACE;ONLINE_JUDGE] && editbin64.exe /stack:67108864 run binary file
C# 13, .NET SDK 9 64 dotnet.exe build -c:release [+DefineConstants:TRACE;ONLINE_JUDGE] && editbin64.exe /stack:67108864 run binary file
C# Mono 6.8 32 mcs /r:System.Numerics.dll -sdk:4.7 -platform:x86 -define:ONLINE_JUDGE -o+ %1 run binary file
D DMD32 v2.105.0 32 dmd -L/STACK:268435456 -version=ONLINE_JUDGE -O -release -noboundscheck -i %1 run binary file
F# 9, .NET SDK 9 64 dotnet.exe build -c:release [+DefineConstants:TRACE;ONLINE_JUDGE] && editbin64.exe /stack:67108864 run binary file
Go 1.22.2 64 go build %1 run binary file
Haskell GHC 8.10.1 32 ghc -XSafe -rtsopts --make -O2 %1 run binary file +RTS -K256m -A8m -RTS
Java 11.0.6 32 javac %1 {JAVA11_32_HOME}\bin\java -XX:+UseSerialGC -XX:TieredStopAtLevel=1 -XX:NewRatio=5 -Xms8M -Xmx{MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -jar %1
Java 17 64bit 64 javac %1 {JAVA17_64_HOME}\bin\java -XX:+UseSerialGC -XX:TieredStopAtLevel=1 -XX:NewRatio=5 -Xms8M -Xmx{MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -jar %1
Java 21 64bit 64 javac %1 {JAVA21_64_HOME}\bin\java -XX:+UseSerialGC -XX:TieredStopAtLevel=1 -XX:NewRatio=5 -Xms8M -Xmx{MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -jar %1
Kotlin 1.7.20 64 kotlinc %1 {JAVA17_64_HOME}\bin\java -XX:NewRatio=5 -Xms8M -Xmx{MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -jar %1
Kotlin 1.9.21 64 kotlinc %1 {JAVA11_32_HOME}\bin\java -XX:NewRatio=5 -Xms8M -Xmx${MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -jar %1
Kotlin 2.2.0 64 kotlinc %1 {JAVA11_32_HOME}\bin\java -XX:NewRatio=5 -Xms8M -Xmx${MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -jar %1
OCaml 4.02.1 32 ocamlopt nums.cmxa str.cmxa -pp camlp4o -unsafe %1 run binary file
Delphi 7 32 dcc32 -Q -$M1048576,67107839 -DONLINE_JUDGE -cc %1 run binary file
Free Pascal 3.2.2 32 fpc -n -O2 -Xs -Sgic -viwn -dONLINE_JUDGE -Cs67107839 -Mdelphi -XS %1 run binary file
PascalABC.NET 3.8.3 32 pabcnetcclear %1 mono %1
Perl 5.20.1 32 perl -c %1 perl %1
PHP 8.1.7 64 php -l %1 php -n -d ONLINE_JUDGE=true -d display_errors=Off -d error_reporting=0 -d memory_limit=1G %1
Python 2.7.18 32 NA python %1
Python 3.12.2 64 NA python %1
PyPy 2.7.13 (7.3.0) 32 NA pypy %1
PyPy 3.6.9 (7.3.0) 32 NA pypy %1
PyPy 3.10 (7.3.15 64bit) 64 NA pypy %1
Ruby 3.2.2 64 ruby -c %1 export RUBY_THREAD_VM_STACK_SIZE=268435456 && ruby %1
Rust 1.89.0 (2021) 64 rustc --edition=2021 -O -C link-args=/STACK:268435456 --cfg ONLINE_JUDGE %1 run binary file
Rust 1.89.0 (2024) 64 rustc --edition=2024 -O -C link-args=/STACK:268435456 --cfg ONLINE_JUDGE %1 run binary file
Scala 2.12.8 32 scalac %1 {JAVA8_32_HOME}\bin\java -XX:NewRatio=5 -Xms8M -Xmx{MEMORY_LIMIT_MB}M -Xss64M -DONLINE_JUDGE=true -jar %s
JavaScript V8 4.8.0 32 NA d8 %1
Node.js 15.8.0 64 node -c %1 node %1

Changes

  • 2025-08-09 Rust 1.75.0 (2021) upgraded to Rust 1.89.0 (2021)
  • 2025-08-09 Rust 1.89.0 (2024) added
  • 2025-08-09 Kotlin 2.2.0 added
  • 2025-06-10 C# 13, .NET SDK 9 added
  • 2025-06-10 F# 9, .NET SDK 9 added
  • 2025-03-21 Python 3.8.10 upgraded to Python 3.12.2
  • 2024-08-23 GNU G++23 14.2 (64 bit, msys 2) added
  • 2024-04-22 PyPy 3.9.10 (7.3.9, 64bit) upgraded to PyPy 3.10 (7.3.15 64bit)
  • 2024-04-22 Go 1.19.5 upgraded to Go 1.22.2
  • 2024-01-16 Kotlin 1.9.21 added
  • 2024-01-16 Kotlin 1.6.10 removed
  • 2024-01-16 Java 1.8.0 removed
  • 2024-01-05 Python 3.12.1 reverted to 3.8.10
  • 2023-12-30 Python 3.8.10 upgraded to 3.12.1
  • 2023-12-30 Rust 1.72.0 upgraded to 1.75.0
  • 2023-11-10: Node.js upgraded to 15.8.0 64-bit
  • 2023-11-10: Free Pascal 3.0.2 upgraded to 3.2.2
  • 2023-10-06: Ruby 3 upgraded to 3.2.2 64-bit, added env. variable RUBY_THREAD_VM_STACK_SIZE=268435456
  • Проголосовать: нравится
  • +316
  • Проголосовать: не нравится

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

Hello, this is very useful, and I think it would be awesome to link to this on https://mirror.codeforces.com/help because that is where everyone used to look for this kind of information.

Other than that, I would politely ask for an increase in Ruby's stack size. Since a long time ago, Ruby's stack size has been bounded with the environment variable RUBY_THREAD_VM_STACK_SIZE. The default value is seemingly 1MiB, so using recursion in Ruby is a pain in the arse almost everywhere. By setting this environment variable (i.e. export RUBY_THREAD_VM_STACK_SIZE=268435456) this can be fixed. I hope you could consider this suggestion seriously.

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

Hello. May I ask when will C++20 be supported on Polygon? Sometimes I find out that testers write C++20 code but when added the solution to Polygon, I need to convert some of them manually.

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

    And C++23

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

      I am hoping that this also happens when there is much more support (if not complete) for C++23 by modern compilers — for both Codeforces and Polygon. C++20 was added when there were quite a few features still not implemented by major compilers (like std::format), and as a result, the current C++20 compiler on Codeforces is still stuck on a very old version which doesn't have many useful C++20 features. However, I do appreciate Mike's decision of adding C++20 support to Codeforces very promptly, a lot, since it allowed people to use the latest language features that were implemented at the time.

      I feel like now is a good time to do the following things:

      • Update the C++20 compiler to use the latest GCC version, since the latest version has essentially complete support for things that the Codeforces version is sorely missing. The only things missing from GCC 13.2 seem to be complete support for modules, calendar and timezone (there is partial support for all these things, and the lack of complete support for these should not alter a competitive programmer's experience on Codeforces).
      • Add a preliminary C++23 compiler, which should definitely be updated in the future, since currently compilers lack support for the following useful features (but still have cool functionality that is too good to pass up):
        • deducing this — this will make recursive lambdas and class definitions for pre-written code very easy
        • minor bugfixes
        • better consteval support
        • stacktraces (!)
        • better ranges support (ranges::to, newer kinds of ranges, more places to use ranges in the standard)
        • std::mdspan, flat_map, flat_set — these will make linear algebra and constant optimization (respectively) much easier
        • std::print (!)
        • better std::format

      Note: to enable experimental stacktrace support for the current GCC version, it is recommended to link with the library mentioned in this.

      A very useful link to keep track of which C++ language/library features are present in which compilers is this.

      The link to the latest GCC version (as of now) is here.

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

        In my opinion, the compiler "Microsoft Visual C++ 2022" and "Clang-cl 16" are nice to take the role of "preliminary C++23 compiler", or even, replace the 32-bit compiler "Microsoft Visual C++ 2017".

        The MSC++2022 compiler has implemented the full features of C++20 so early, far away from other compilers. What's more, it has built-in Signed128 and a precompile-header "__msvc_all_public_headers.hpp" just like those GNU compilers did, and of course, bugfixes and performance optimizations. It also supports legacy C++17 mode.

        Furthermore, upgrading MSC++ to the 2022 version will also benefit the compiler Clang-cl, which has the most stable support of C++20 and C++23 (see aforementioned support list). Currently, the clang-cl aka "Clang diagnostics" doesn't support any c++20 headers as the MSC++2017 lacks support for these headers, which makes it bearly usable.

        By the way, the winlibs.com build also has a Mingw64-clang version, packed up with latest stable GCC build (13.2), and it would be great if this clang compiler and the clang-cl compiler are set side-by-side; In that case, one participant can freely choose which STL that clang compiler using:

        • The clang using msSTL (clang-cl) would have the latest C++23 STL and language support. However, aside from VLAs, clang-cl doesn't support extended float types like float128, and other GNU dialects.

        • The clang using libstdc++ (mingw64) would be compatible with codes written for those GNUC++ compilers, and in many cases, would have a better runtime performance.

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

          Thanks for the suggestions! I would agree that having multiple compilers updated to the latest versions would be really cool, especially the ones with all language features.

          However, I believe that there is a fundamental issue in how compilers are managed on Codeforces. A new "rolling release" set of compilers being supported on Codeforces (to be more conservative about preserving verdicts, this set should be separate from the current compilers), auto-updating whenever there is a compiler update, would be the best solution for finding latest language features.

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

          Could you tell me more about signed int128 in Visual C++? As far as I know, they still don't even have non-trivial long double, and no int128 as well.

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

        Very well said sir

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

Perl is seriously out of date (the latest stable is v5.38). It is useful for regex-heavy problems, and it's really inconvenient if we want to use modern features (like signatures, etc.). Please consider upgrading Perl.

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

for java 21 , use

javac --release 21 --enable-preview

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

Thank you, this is very useful.

I have one question though, why -O2 instead of -O3? Does -O3 give some kind of unfair advantage to C/C++ folks?

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

Hi, thanks for the list! I'm wondering what's the status of F#? It was available at one time (https://mirror.codeforces.com/blog/entry/79), but looking at other old posts (https://mirror.codeforces.com/blog/entry/23311), it somehow disappeared. In terms of performance, it can be as fast as C#, so I believe it's more relevant to competitive programming than e.g. PHP and JavaScript.

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

Node.JS is really out-of-date, the latest is 20.8.0 and 21 is releasing soon. Please consider upgrade it, thanks!

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

I wonder if it is possible to "open" the process of language updates. Creating API for community to create their own runners (personal), and than have community vote to promote certain runners to "allowed in competition" level.

Docker comes to mind as most universal solution, but really any way to implement and "pack" a runner by community would be ok.

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

Recent changes:

  • 2023-11-10: Node.js upgraded to 15.8.0 64-bit
  • 2023-11-10: Free Pascal 3.0.2 upgraded to 3.2.2
»
2 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Recent changes:

  • 2023-12-30 Python 3.8.10 upgraded to 3.12.1
  • 2023-12-30 Rust 1.72.0 upgraded to 1.75.0
»
2 года назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

C++ 23

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

Hi! Can we get support for Common Lisp as well? There was a blog where a comment explains how to add it (and there is a relevant PR on the GitHub repo too).

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

Recent changes:

  • 2024-01-05 Python 3.12.1 reverted to 3.8.10
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Recent changes:

  • 2024-01-16 Kotlin 1.9.21 added
  • 2024-01-16 Kotlin 1.6.10 removed
  • 2024-01-16 Java 1.8.0 removed
  • »
    »
    2 года назад, скрыть # ^ |
    Rev. 7  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Hi, please, do not remove Kotlin 1.6.10.

    You can safely remove Kotlin 1.7 (and keep the previous 1.6 and 1.9) instead, if the decision is simply based on having three language versions are too much. (Previous) Kotlin 1.9 (as it currently stands on codeforces) is a strictly superior version of 1.7.

    It had serious implications about how competitive Kotlin is. It already got hit by TL occasionally, but this change may make it no longer safe to pass intended solutions in general, and I would be forced fluently code both C++ and Kotlin to remain competitive at this level.

    I wrote a whole blog here link, along with simple examples where 1.7/1.9 are slow.

    UPD: If the intention was to replace the old 1.6 by 1.9 using the exact same build method: It seems that 1.9 command is exactly same as the 1.6 command, except that somehow it stayed 64bits even though JAVA11_32 was used? I am just guessing that making sure Kotlin 1.9 runs on 32 bits would be enough to make it faster than the old 1.6.

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

"Pypy3.10" has been released for a while now, and there are lot of useful Python 3.10 features. When are we getting the upgrade?

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

Please consider adding support for Lua language.

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

Recent changes:

  • 2024-22-04 PyPy 3.9.10 (7.3.9, 64bit) upgraded to PyPy 3.10 (7.3.15 64bit)
  • 2024-22-04 Go 1.19.5 upgraded to Go 1.22.2
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Great, Go is updated

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

У вас Ruby стартует 450мсек, а в задаче лимит 500мсек. На случайном тесте сервер икает, и Time limit превышается.

https://mirror.codeforces.com/contest/16/submission/259850087

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

I believe something is wrong with pure C compiler.

I ran the following code using "Custom invocation":

#include <stdio.h>
int main() {
    for (int i = 0; i < 1000000; i++) {
        char ch = (char)('a' + i % 26);
        printf("%c", ch);
//        putchar(ch);
    }
    return 0;
}

It takes 3500 ms on "GNU GCC C11 5.1.0" !

If I replace printf("%c") with putchar, then 0 ms time is reported.

It takes 72 ms on "GNU G++17 7.3.0" with either function (printf/putchar does not matter).

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

Recent changes:

  • 2024-23-08 GNU G++23 14.2 (64 bit, msys 2) added
»
13 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Recent changes:

  • Python 3.8.10 upgraded to Python 3.12.2
»
12 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

OCaml update really needed :)

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

Can you update the C# 13 compilation command? Thank you! Kleidemos

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

I guess OCaml is not very popular on this platform, but the current version is very outdated. Could you please update it to 5.3.0 or at least 4.14.2 (64-bit)? Thank you!

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

Not really necessary but I would suggest updating to g++23 15.1 (msys2) would be better as it now fully supports C++23 (finalized) which also comes with flat_map and flat_set, comes with better optimizations and quite (very) stable atm.

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

Looks pretty strange that changes until 2024-01-16 have date in format YYYY-MM-DD, and changes after use date format of YYYY-DD-MM (e.g. 2024-22-04, 2025-10-06). I would vote to change all of them to YYYY-MM-DD.

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

Could you add GNAT (GNU Ada) compiler? It would be funny for one-language-contests!

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

Recent changes:

  • 2025-08-09 Rust 1.75.0 (2021) upgraded to Rust 1.89.0 (2021)
  • 2025-08-09 Rust 1.89.0 (2024) added
  • 2025-08-09 Kotlin 2.2.0 added
»
7 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Vladosiya could you please upgrade the Ocaml compiler, has been asked a fair bit on this post already and I've found a few other posts on the site requesting it as well.

The current version on CF (4.02.1) released over 11 years ago, it's severely outdated.

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

Please install the Data.Vector package for Haskell. This can be done with cabal install vector. Being able to use the vector package will make solutions much faster. It's already on AtCoder, is an official core library, and used by many. Not having it makes a lot of problems very difficult. Thank you Vladosiya!

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

Руддщ, is there a possibility to add the Dart programming language? I would appreciate it!

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

Please consider adding support for Raku language.

For e.g. text parsing heavy tasks — besides recent Perl — maybe also Raku could be a valid option?