Compiler Options

Revised: Dec. 17, 2022.

The judge system use the following commands internally to compile and run the submitted programs. These commands are also available on your workstation.

C compilegcc​(no “run” command)
C++ compileg++​(no “run” command)
Java compilejava / runjava
Python3 compilepython3 / runpython3
Kotlin compilekotlin / runkotlin

For your reference, below are how your programs will be compiled and run. ​”$@” is substituted with your source file(s); ​”$DEST” is the name of the binary (which is “​./a.out”​ by default) and is chosen arbitrarily by the system.

C
Compile gcc -g -O2 -std=gnu11 -static -o”$DEST” “$@” -lm
Run “$DEST” < infile > outfile
C++
Compile g++ -g -O2 -std=gnu++17 -static -o”$DEST” “$@”
Run “$DEST” < infile > outfile
Java
Compile javac -encoding UTF-8 -sourcepath . -d . “$@”
Run1 java -Dfile.encoding=UTF-8 -XX:+UseSerialGC -Xss64m -Xms1920m -Xmx1920m MainClass < infile > outfile
Python 3 (PyPy)
Compile2 /usr/local/py3-venv/bin/pypy3 -m py_compile “$@”
Run /usr/local/py3-venv/bin/pypy3 “$@” < infile > outfile
Kotlin
Compile kotlinc -d . “$@”
Run1 kotlin -Dfile.encoding=UTF-8 -J-XX:+UseSerialGC -J-Xss64m -J-Xms1920m -J-Xmx1920m MainClass < infile > outfile

Note:
1:  DOMjudge will detect the main class automatically; you do not have to name it ​Main​. See the DOMjudge team manual for details.
2: Python’s “Compile” command only verifies the syntax. ​*.pyc​files will ​not​ be used in the real run.

History

  • Dec. 17, 2022: Changed Python3 compilation to use pypy in venv.
  • Nov. 23, 2022: Initial version.