Tool for local debugging of problems

yc-invoke is a tool for running problems from Yandex Contest locally on the developer's device. It allows you to:

  • Run local solution files for verification, including running with a limited number of tests.
  • Debug solutions using remote debugging mechanisms.
  • Access the container terminal at various stages of problem verification.

Warning

The yc-invoke tool is not a full replica or replacement for the Yandex Contest system on a local computer. We recommend using it only as an additional tool for creating and debugging problems on our platform.

For more information about the tool's limitations, see below.

System requirements and installation

System requirements

  • Windows 10 or 11.
  • x86-64 processor.
  • 4 GB of free RAM.
  • Docker Desktop, if the license terms allow its use, with WSL Backend.
  • It is also possible to use Docker Engine inside a Linux distribution installed using WSL. In this case, yc-invoke is installed inside WSL according to the instructions for Linux.
  • GNU/Linux with a kernel version 5.0 or newer.
  • x86-64 processor.
  • 2 GB of free RAM.
  • Docker Engine.
  • curl.
  • macOS 13 or newer.
  • Intel or Apple Silicon processor.
  • 4 GB of free RAM.
  • Installed Docker (one of the installation options):
  • curl.

Installing and updating

Run the following command in the terminal to install the latest version of the tool:

powershell -ExecutionPolicy ByPass -c "irm https://yastatic.net/s3/contest/yc-invoke/install.ps1 | iex"
curl -fsSL https://yastatic.net/s3/contest/yc-invoke/install.sh | sudo sh -

To update, run the installation command again.

Configuration and uninstallation

To configure the local debugging tool, run the following command in the terminal:

yc-invoke configure

After you run it, a browser window opens automatically. Confirm access and enter the code from the browser into the terminal to authenticate.

Uninstalling

rmdir /s /q %appdata%/yc-invoke
rmdir /s /q %localappdata%/yc-invoke
sudo rm /usr/local/bin/yc-invoke
rm -rf "~/.config/yc-invoke"
rm -rf "~/.cache/yc-invoke"
sudo rm /usr/local/bin/yc-invoke
rm -rf "~/Library/Application Support/yc-invoke"
rm -rf "~/Library/Caches/yc-invoke"

Local debugging

To perform local debugging, you will need:

  • An installed and configured local debugging tool;
  • The ID of the problem configured in Yandex Contest with edit permissions;
  • The ID of the compiler that will be used to submit the solution to the problem.

Running the tool for debugging:

yc-invoke run PROBLEM_ID COMPILER_ID PATH_TO_SOLUTION
  • PROBLEM_ID — the problem ID consisting of three alphanumeric segments separated by /.
  • COMPILER_ID — the compiler ID.
  • PATH_TO_SOLUTION — the path to your solution file.

Example command: yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp.

For help selecting the problem and compiler, see the Tests and Solutions section.

Local files for the problem

You can specify a directory that contains part or all of the problem file system. If a file necessary for launching (test, checker, etc.) is found in this directory, it will be used instead of the file from the server.

To do this, use the --problem-files flag when running the tool and specify the path to the directory:

yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp --problem-files ./some-problem-files

Running on specific tests

If you need to run a problem on a limited number of tests, you can specify a mask to select them.

To do this, use the --tests flag when running the tool and specify the desired tests:

yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp --tests tests/{01-05,07}

The syntax for writing masks matches the expressions used when setting up the input file template in Test Sets.

Network access

To enable internet access during the local problem launch, use the --network flag:

yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp --network

Warning

Running the tool in this mode is recommended only for debugger operation or debugging your scripts. During the normal launch of a solution in Yandex Contest, there is and will be no network access due to platform restrictions.

Container terminal

You can connect to the container terminal to check which files and environment are available to you. To do this, add the --pause flag to the yc-invoke run command.

After creating an isolated container, but before starting each process (compilation, execution, checker), the testing process will be suspended and the tool will provide you with a command to connect to the container:

$ yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp --pause

⏸︎ Compiling solution
Open container shell: docker exec -it debbfc022e6b2ea2ade2806ef458c904d6e3ff3a72163c01ee64916903be4d99 bash
'c' to continue • Ctrl-C to abort

Run this command in another terminal to connect to the container. You can press the c key to start the corresponding process. The container will terminate immediately after the process is completed — the terminal will be closed at that moment.

Note

Please note that your actions in the terminal are also subject to the general limit on the number of processes available in the system. Usually, this is not an issue for Make compilers, but you may encounter errors like fork: Resource unavailable in regular problems.

Debugging the solution

You can connect to the container with a debugger to find an error in the solution or in additional files.

It is recommended to use remote debugging mechanisms in your programming language. You can add additional compilation flags only in Make problems where you can manage compiler flags.

To make a network port accessible, use the --expose flag when running the tool. For example, --expose 8000 will provide access to container port 8000 on your PC's port 8000.

You can also:

  • Open multiple ports: --expose 8000,9000;
  • Map a port to a different port on your PC: --expose 8000:9000 will provide access to container port 9000 on your PC's port 8000;
  • Map a UDP port: --expose 8000/udp

When running Java, pass the flag -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000. For example, java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 -cp main.jar ru.your.solution.MainClass.

Add the --expose 8000 flag to yc-invoke run.

Connect your IDE or debugger to the remote server at 127.0.0.1:8000. The solution will only run after you explicitly confirm it in the debugger.

Add the --inspect-brk=0.0.0.0:9229 flag when running Node.js.

Add the --expose 9229 flag to yc-invoke run.

You can connect to the debugger using the developer tools in Chrome and your IDE, using the IP address 127.0.0.1 and port 9229. For more details, see the Node.js documentation.


For other programming languages, debugging is similar. Use the developer's guide for the corresponding language to find the necessary settings.

If your language does not support remote debugging, you can output data to the standard error stream (stderr). This output is displayed in the terminal during execution. The -v flag when running the tool will prevent the output from being cleared after the process completes.

If you encounter issues

If an error occurs in the tool, rerun it with the -v flag. This flag increases the amount of information displayed in the terminal:

yc-invoke run 12345/2000-01-01/abCdefGjkL gcc_cpp20 solution.cpp -v

Detailed logs are stored in the system directory of the application:

  • Windows: %AppData%\yc-invoke\yc-invoke.log.
  • Linux: ~/.config/yc-invoke/yc-invoke.log.
  • macOS: ~/Library/Application Support/yc-invoke/yc-invoke.log.

Errors and unsolvable problems during local launch

If you cannot resolve the error on your own, run the yc-invoke debug command. It will save debugging information in a text file in your current directory.

After that, contact us at Support Service. In your message, describe your issue in detail and:

  • Attach the full output of the tool or a screenshot that shows the launch command and everything the tool output before the error.
  • Attach the file generated by the yc-invoke debug command.

Limitations of the tool

  • The time it takes to execute a problem through the tool is measured with less accuracy than when running the problem normally in the Yandex Contest system. Running the same problem with the same settings can lead to different results.

    When running on ARM processors, the solution is launched using software virtualization, which can lead to a large difference in comparison with execution time on Yandex Contest.

  • The tool incorrectly determines memory usage of less than 10 MB.

  • When approaching the memory limit and allocating memory in small fragments, instead of immediately setting the ML verdict, the solution may hang before crashing (in particular, getting TL/IL instead of ML). This is a feature of Linux and cgroups.

    Similarly, when the limit on the number of processes is exceeded, the Yandex Contest system aborts the solution; and the tool instead returns an error to system calls fork(..) and similar, due to which the solution may crash with a different error or even continue to work.

  • Only TESTLIB_EXITCODE_CHECKER, EJUDGE_EXITCODE_CHECKER and standard checkers are supported. There is no support for checkers of the TESTLIB_CHECKER type (XML output based on testlib.pas).

  • Checkers without specifying a compiler (Legacy launch with shebang) are not supported.

  • "Non-Docker" compilers and compilers built on top of Ubuntu 18.04 and 20.04 are not supported.

  • Isolation of running processes from the host system is not guaranteed: it is not recommended to run untrusted code.

Limitations that will be eliminated in next releases

  • A limited number of compilers are supported: GCC (C17, C23, C++20, C++23), Clang (C++20, C++23), C# (.NET 8), Bash 5, Golang, JDK 22, Node.JS 20, Node.JS 22, PyPy 3, Python 3.13, Swift 6, TypeScript 5.8 and their Make versions.
  • The post-processor does not run.
  • Only the PROBLEM_WITH_CHECKER type is supported.
  • The output volume limit is not supported.
  • Incorrect counting of the number of threads is possible when there are fewer than 10 of them.
Write to Support
Previous