Package Control

The Sublime Text package directory, recompiled.

Algorithm Competition Assistant

一个基于FastOlympicCoding插件的优化插件,适用于Sublime Text

OctSepAugJulJunMayAprMarFebJan Dec2025 Nov 2026-W48 | installs: 4 | removals: 0 | upgrades: 5 2026-W48 | installs: 4 | removals: 0 | upgrades: 5 2026-W48 | installs: 4 | removals: 0 | upgrades: 5 2026-W47 | installs: 2 | removals: 0 | upgrades: 10 2026-W47 | installs: 2 | removals: 0 | upgrades: 10 2026-W47 | installs: 2 | removals: 0 | upgrades: 10 2026-W46 | installs: 2 | removals: 1 | upgrades: 8 2026-W46 | installs: 2 | removals: 1 | upgrades: 8 2026-W46 | installs: 2 | removals: 1 | upgrades: 8 2026-W45 | installs: 14 | removals: 6 | upgrades: 6 2026-W45 | installs: 14 | removals: 6 | upgrades: 6 2026-W45 | installs: 14 | removals: 6 | upgrades: 6 2026-W44 | installs: 4 | removals: 1 | upgrades: 10 2026-W44 | installs: 4 | removals: 1 | upgrades: 10 2026-W44 | installs: 4 | removals: 1 | upgrades: 10 2026-W43 | installs: 8 | removals: 2 | upgrades: 3 2026-W43 | installs: 8 | removals: 2 | upgrades: 3 2026-W43 | installs: 8 | removals: 2 | upgrades: 3 2026-W42 | installs: 6 | removals: 3 | upgrades: 1 2026-W42 | installs: 6 | removals: 3 | upgrades: 1 2026-W42 | installs: 6 | removals: 3 | upgrades: 1 2026-W41 | installs: 0 | removals: 0 | upgrades: 0 2026-W41 | installs: 0 | removals: 0 | upgrades: 0 2026-W41 | installs: 0 | removals: 0 | upgrades: 0 01020 WeeklyInstalls 01020 WeeklyUpgrades 2026-11-27 | upgrades: 5 | 2 on that day 5.0.0 2026-11-22 | upgrades: 10 | 3 on that day 4.0.0 2026-11-19 | upgrades: 10 | 3 on that day 3.0.14 2026-11-18 | upgrades: 10 | 0 on that day 3.0.13 2026-11-14 | upgrades: 8 | 1 on that day 3.0.10 2026-11-07 | upgrades: 6 | 3 on that day 3.0.9 2026-11-06 | upgrades: 6 | 0 on that day 3.0.8 2026-W44 | upgrades: 10 3.0.7 / 3.0.6 / ... 3.0.7 / 3.0.6 / 3.0.5 / 3.0.4 2026-W43 | upgrades: 3 2.9.2 / 2.9.1 / ... 2.9.2 / 2.9.1 / 2.9.0 2026-W42 | upgrades: 1 2.8.0 / 2.6.0 / ... 2.8.0 / 2.6.0 / 2.5.0 / 2.4.13 / 2.4.12 / 2.4.11 2026-W41 | upgrades: 0 2.4.10 / 2.4.9 / ... 2.4.10 / 2.4.9 / 2.4.8 / 2.4.6 / 2.4.5 / 2.4.4 / 2.4.3 / 2.4.2 / 2.4.1 / 2.4.0 / 2.3.0 / 2.2.0 2026-W40 2.1.1 / 2.1.0 / ... 2.1.1 / 2.1.0 / 2.0.1 / 1.4.19 / 1.4.18 / 1.4.17 / 1.4.16 / 1.4.15 / 1.4.14 / 1.4.13 / 1.4.12 / 1.4.11 / 1.4.10 / 1.4.9 / 1.4.8 / 1.4.7 / 1.4.6 / 1.4.5 / 1.4.4 / 1.4.3 / 1.4.2 / 1.4.1 / 1.4.0 / 1.3.2 2026-W39 1.3.1 / 1.3.0 / ... 1.3.1 / 1.3.0 / 1.2.2 / 1.2.1 / 1.2.0 / 1.1.0 / 1.0.7 2026-W36 1.0.6 / 1.0.5 / ... 1.0.6 / 1.0.5 / 1.0.4 / 1.0.3 / 1.0.2 / 1.0.1 / 1.0.0
Installations: recent average 5 per week, 40 in total
Installations minus removals
Upgrades

Links

Versions

5.0.0 (ST4095+) ·
2026-11-27 04:50

More

Algorithm Competition Assistant

A local test runner for competitive programming in Sublime Text 4 (build 4095 or newer). Open a source file, press Ctrl+Alt+B, and it runs your configured compile and run commands over the test cases, then reports a verdict, a runtime and a memory figure for each one. The detail tab holds the input, the expected output, the actual output, stderr and a line-by-line diff.

Who it is for: competitive programmers who work in Sublime Text and want the whole compile → run → diff loop without leaving the editor. Most of the work went into judging: memory and time limits are measured from the real process, runtime errors are located in your source when the information exists, compiles are cached, and file I/O problems (NOI / CSP-S) run locally. It does not solve problems and it does not submit anything.

Five-minute start: open a source file → press Ctrl+Alt+B → click detail. The full walkthrough is in Quick start below.

This is a fork of FastOlympicCoding. The run panel, the test editor and the shortcut layout come from that project. The way results are displayed follows VSCode's cph-ng, and the browser import follows FastOlympicCodingHook.

Chinese manual: README_CN.md. Version history: RELEASE_NOTES_CN.md (Chinese). Note that GitHub's auto-generated source archives (zip / tar.gz) drop RELEASE_NOTES_CN.md and tests/ through the export-ignore rules in .gitattributes; if you downloaded an archive, read the notes at that online address.

Install

Folder install (use this if you want to edit the code)

  1. Clone or download the repository.
  2. Put the folder into Sublime's Packages directory. Any folder name works.
  3. Restart Sublime.

Sublime does not hot reload plugins, so a .py change needs a restart.

Package Control

Ctrl+Shift+P → Package Control: Install Package → search Algorithm Competition Assistant. Upgrades use Package Control: Upgrade Package.

Package Control installs a zip under Installed Packages/; there is no package folder to browse. Configure it through Preferences → Package Settings → Algorithm Competition Assistant → Settings: the left pane is the read-only default, the right pane is your Packages/User/Algorithm Competition Assistant.sublime-settings, which survives upgrades.

Do not use both at once. If a folder of the same name sits in Packages/ while the zip is installed, installing or upgrading the zip empties that folder, and the only symptom is "nothing changed after I edited the code". Startup prints a notice, and Ctrl+Alt+Shift+D reports whether the loaded copy is a folder or a zip.

Quick start

  1. Open a C++ source file. The default settings cover C++ only. The compiler has to be on PATH.
  2. Press Ctrl+Alt+B. Each test gets a card in the panel on the right.
  3. Click detail for input, expected, actual, stderr and the diff. Click edit to open the input and answer tabs; saving the answer rejudges the test.
  4. The command palette (Algorithm) and View → Algorithm Competition Assistant expose the same commands.

The top menu bar also has an ACA menu (next to Preferences) that gathers the common run, fetch and tool entries; beginners can start there.

The shipped C++ command uses -std=c++17 -O2. Keep -O2: without it a correct program can look like a TLE locally.

Judging

Verdicts

Verdict Meaning
AC passed
WA output differs from the answer
TLE past the time limit, process terminated
MLE peak memory over the limit
RE non-zero exit, crash or failed assertion
PE same tokens, different whitespace
PC partially correct (checker verdict, exit code 7)
CE compilation failed
SK stopped by hand
UKE no verdict, for example the program never started

CE behaves differently from the rest: a compile failure is panel-level state. It shows on the compile bar of the run panel and is never written into <name>__tests, so it does not survive a restart; every other verdict is saved with the test and restored.

After a run each card offers accept and decline: the first stores the current output as a correct answer, the second marks it wrong. A test can keep several accepted answers, and a run that matches any of them passes.

Time and memory

The clock starts when the process is created and stops the first time it is seen to have exited. Plugin work sits outside that window: Popen, draining the pipes, reading stderr and stopping the memory sampler. Feeding stdin does count, because the program is reading it on a judge too. Serial and parallel runs use the same rule, so one binary cannot be TLE in one mode and AC in the other. Limits are still compared strictly; the only slack is up to 50 ms that decides when the watchdog acts, not how long the program may run.

Peak memory is taken per process: GetProcessMemoryInfo on Windows, VmHWM from /proc/<pid>/status on Linux, libproc.proc_pid_rusage on macOS. Over the limit is MLE.

The watchdog terminates the process tree, so a loop that forks children does not survive it.

A passing run that used 90-99% of the limit gets a status bar note. It does not change the verdict.

Runtime errors

When the program crashes, the output is searched for a position first: a sanitizer diagnostic or a gdb backtrace gives file:line, shown on the card and in the status bar, and the link jumps to the source. A bare C++ segfault carries no line, so the plugin replays the crash under gdb and looks for your frame in the backtrace. The default Release build already carries -g, so that backtrace locates the line even in Release; Ctrl+Alt+G (Debug) is for turning otherwise non-crashing undefined behaviour into RE, not for getting a line number.

Debug adds -g -fsanitize=undefined -fsanitize-trap=undefined -fno-omit-frame-pointer -D_GLIBCXX_ASSERTIONS. The trap form needs no sanitizer runtime, which matters because MSYS2's mingw ships neither libubsan nor libasan. Signed overflow, stack array overrun and division by zero become a non-zero exit (RE); std::vector overruns come from the assertion macro. Heap overruns are not covered by default; add -fsanitize=address yourself if your toolchain has libasan.

Compilation

Compilation is cached: unchanged sources (including local #include "...") and an unchanged command skip the compiler. Ctrl+Alt+Shift+R forces a rebuild.

The -std ladder is idle by default. It is controlled by auto_std_switch (on by default) and std_floor (c++17), but it only engages when your compile_cmd asks for a higher standard than std_floor. In the default settings both are c++17, the ladder is empty, and nothing is upgraded out of the box — the code compiles at the standard your command names, and the plugin never tries C++20/23 on its own.

The ladder serves users who wrote a high -std into compile_cmd (say -std=c++23): compilation starts at std_floor and only moves up when the compiler itself says a feature needs C++NN (or the source includes a header only a newer standard provides), never past the standard the command asked for, remembering the tier in <name>__tests.std next to the test data. The reason is measurable: parsing <bits/stdc++.h> costs 1.29 s at c++17, 2.43 s at c++20 and 2.53 s at c++23 on the author's machine with -fsyntax-only, so a hard-coded c++23 adds a second to every recompile. Ordinary syntax errors are reported as they are, without a retry.

Multi-file builds use extra_sources (glob) and include_dirs, referenced in the command as {extra_sources} and {include_dirs}.

The detail tab

detail opens a real editor tab, so the text can be selected and copied. It contains:

Per-test history is still written to <name>__tests.hist (last 20 runs); the page does not display those derived numbers.

Click a section name to fold or unfold it. A rejudge keeps the fold state.

Colour is applied with regions and card headers, not by changing the buffer. Select, copy and paste give exactly the text on screen. Set "detail_rich": false for a plain, colourless page; "detail_style": "phantom" is the old embedded panel, where the text cannot be selected.

The detail tab shares the right column with the run panel, and that column is sized by the run panel cards. Those follow their content automatically between a floor of 8% of the window and max_panel_width_ratio (half the window by default): the column widens as the cards grow and narrows as they shrink. You can drag the divider yourself, but the next panel refresh or switch back to the run tab re-fits the width to the content; the only exception is that the column is not narrowed while the detail view is in the foreground.

File input/output (NOI / CSP-S)

Problems that read add.in and write add.out through freopen cannot use the pipe-based runner. Set the mode per problem from View → Algorithm Competition Assistant → Problem → This problem reads/writes files. Both names are prefilled from the source file (add.cpp gives add.in / add.out), so two Enter presses usually finish it. The choice is stored in <name>__tests.io beside the test data and follows that one problem across restarts.

At run time the sample is written as add.in inside a temporary directory, and the program starts in that directory, so freopen finds it. The answer is read back from the add.out your program writes. Your problem directory is not written to. When the program writes no file, the report says so instead of turning an empty read into a WA.

Limits: stress testing refuses to start in file mode, because it feeds data through pipes and none of the three programs would see it; every round would "agree". Convert the programs to stdin/stdout for that. The gdb replay also feeds pipes, so a line number still works but file reads fail.

If run_cmd calls the binary through a relative path (./a.out), file mode cannot find it, because the program starts in the temporary directory. The shipped settings use the absolute {source_file_dir} form.

Stress testing

Three files in the same directory: your program (the open file), a reference solution (std.cpp by default) and a generator that prints random data to stdout (gen.cpp by default).

Press Ctrl+Alt+S in the source view. Where the pair comes from is controlled by stress_file_source:

Picking the same file twice is refused: a program compared with itself agrees every round.

Results scroll in a <file> -stress view. On a mismatch it stops and prints the input, both outputs and the differing lines; after the last round it reports a pass. Ctrl+Alt+Shift+S stops the session in the current view and takes effect immediately. Several files can run at once, each with its own view.

The generator has its own limit (stress_generator_time_limit_seconds, 10 s by default), because generating data is usually slower than solving. A timeout skips the round; three in a row stop the run.

With a checker configured, the checker decides, so multi-answer and floating point problems are not reported as mismatches. Without one, float_tolerance applies.

Competitive Companion

With the browser extension installed, Sublime starts listening on port 12345 about 1.2 seconds after startup (companion_auto_listen, on by default). No file needs to be open first. Add 12345 to the extension's port list; that part happens in the browser.

Two targets:

companion_target picks the default; the context menu and the palette offer both. In new_file mode a pinned target is ignored.

A problem list page is not one problem. AtCoder and Luogu send the whole set in one click (7 requests measured), so use Ctrl+Alt+L there: one click sends several different problems, which Ctrl+Alt+F would all merge into the file you are standing in. Re-grabbing the same problem (matched by title + URL), however, clears that problem's old samples before writing the new ones. Repeated auto-runs of the same file are debounced into one (2 s), so that does not become seven compiles.

New files land in the first usable place: auto_create_dir, then the directory of the cpp from which the command was invoked, then the current file's directory, then the first workspace folder. auto_create_header customises the comment header with {problem}, {url}, {time} and {memory}.

When a click does nothing, enable companion_debug_log and click again; the log is Data/Log/aca-companion.log. A refused 403 origin=… line means the request arrived and was rejected; an unchanged log means the browser never sent it, usually because 12345 is not in the extension's port list.

Interactive problems

Besides the automatic interactor mode, Ctrl+Alt+Shift+X opens a scratch view that runs the current program with live output. Enter sends a line, Ctrl+D sends EOF, Ctrl+X stops the program. This is for the cases where you are the interactor.

interactor follows the testlib convention: interactor <input> <output> <answer>, reading the contestant's output from stdin and writing replies to stdout, with the exit code as the verdict.

Other tools

Tool Entry What it does
Benchmark Ctrl+Alt+Shift+K runs the current test N times (benchmark_runs, 5 by default) and reports min, average and max.
Calibrate machine palette: Calibrate this machine's speed estimates this machine's speed factor and shows the equivalent judge limit in the status bar. Judging still uses the limit you set.
Practice statistics palette: Show practice statistics overview, total solved, overall verdict distribution, per-day stats, total stress rounds and total time, plus a "needs practice" list showing each problem's attempts, first AC and stress rounds. The data lives in the plugin's own files.
Contest timer Ctrl+Alt+Shift+T counts down in the status bar, with notes at 30, 10 and 5 minutes left. Default length contest_duration_minutes (120 minutes); 0 asks every time.
Template snippets Ctrl+Alt+T expand after a keyword. Lookup order: the algorithms_base directory → the templates dict → built-ins (fastio / main / bf / debug / testlib).
Environment check Ctrl+Alt+Shift+D compiler, port, paths and resources, plus a Markdown report you can paste into an issue.

Key bindings

The bindings ship in the package's own keymap, so they load and unload with it and nothing is written into your personal keymap. Ctrl and Alt are literal: on macOS that is Control and Option, and no super+ binding ships. Set "enable_keybindings": false to release them all. The exception is the keys inside the plugin's own test editor view (Enter, Ctrl+D, Ctrl+X, Ctrl+Alt+B): those are gated by the view's selector / edit_mode, not by this setting, so they keep working.

Key Action
Ctrl+Alt+B run the tests
Ctrl+Alt+Shift+B run all, keep going after failures
Ctrl+Alt+R re-run failed tests only
Ctrl+Alt+Shift+R recompile and run
Ctrl+Alt+Shift+P run all in parallel (parallel_workers, default 4)
Ctrl+Alt+Shift+X interactive terminal
Ctrl+Alt+I import tests from a file
Ctrl+Alt+V add a test from the clipboard
Ctrl+Alt+E export .in / .out pairs
Ctrl+Alt+C / Ctrl+Alt+Shift+C copy expected / actual output
Ctrl+Alt+M pick a test, then an action
Ctrl+Alt+S start a stress test
Ctrl+Alt+Shift+S stop the current stress view
Ctrl+Alt+L Companion: one new file per problem
Ctrl+Alt+F Companion: fill the current file and run
Ctrl+Alt+Shift+L stop the Companion listener
Ctrl+Alt+Shift+F fetch a problem from its URL
Ctrl+Alt+Shift+V open the statement as Markdown
Ctrl+Alt+Shift+K benchmark the current test
Ctrl+Alt+Shift+T contest timer
Ctrl+Alt+G switch Debug / Release
Ctrl+Alt+Shift+D environment check
Ctrl+Alt+J jump to the first error
Ctrl+Alt+T expand a template snippet
Ctrl+Alt+P / Ctrl+K, Ctrl+P collapse / restore the run panel
Ctrl+Alt+Shift+H hide / show the test cards

Ctrl+Alt+T is bound only in C++ files (source.c++); in other file types call the command from the palette.

Inside the plugin's own test editor view (source.TestSyntax): Enter inserts a line, Ctrl+Enter adds a test, Ctrl+V pastes, Ctrl+X kills the process, Ctrl+D deletes the test, Ctrl+Shift+Up/Down swaps tests.

Settings

Five panels edit the keys in the settings file and take effect immediately; they live in View → Algorithm Competition Assistant (the first four under Settings, the last one under Problem):

Panel What it controls
Verdict rules float tolerance, PE as AC, stop on first failure, ignore stderr
Stress test options where std / gen come from, file picker, saving counterexamples, rounds, per-round limit
Competitive Companion options default target, auto listen, click log
Panel width options whether the run panel column auto-fits its content, the maximum width ratio, and the card style (full judging cards / classic the original plugin's plain cards without a verdict)
This problem reads/writes files stdin or file I/O for this problem, and the file names

companion_auto_listen is the one item that only takes effect the next time the listener starts; the port is read at the same moment.

{
	"language": "en",
	"run_settings": [
		{
			"name": "C++",
			"extensions": ["cpp"],
			"compile_cmd": "g++ \"{source_file}\" {extra_sources} {include_dirs} -std=c++17 -O2 -o \"{file_name}.exe\"",
			"run_cmd": "\"{source_file_dir}/{file_name}.exe\" {args}",
			"time_limit_ms": 2000,
			"memory_limit_mb": 256
		}
	],
	"float_tolerance": 0,
	"max_output_bytes": 8388608
}

The remaining keys are documented in Algorithm Competition Assistant.sublime-settings.

Interface language

Chinese is the default ("language": "zh"). To switch to English, use View → Algorithm Competition Assistant → Settings → Switch language (中/EN) (with Switch to English right next to it) or the palette's Algorithm Competition Assistant: Switch to English. The status bar, dialogs and panel text follow the language. In the command palette, only the descriptions of the five settings-panel commands and the run-modes command are localized; the other command titles are fixed English. Menu items are static JSON and stay English — with three deliberate exceptions carrying Chinese labels (the two language-switch entries and the Chinese manual entry) so Chinese users can find them.

Once the interface is English, the verdict notes the plugin writes into the detail tab's [Message] section (the RE location, the truncation notice, the TLE explanation) can stay in Chinese: set "message_language": "zh" (default "auto", follows the interface). Those lines tell you what to look at next, and misreading them costs more than reading them slowly. Text printed by a checker itself is never touched.

Known limits

Development

Credits

Built on FastOlympicCoding by Jatana. The verdict display follows cph-ng by langningchen, and the Companion integration follows FastOlympicCodingHook by DrSchwad. MIT licensed, see LICENSE.

Importing a folder of .in/.out samples

Open the problem source file first, then run Algorithm Competition Assistant: Import tests from file... and choose Import from folder. Select the directory that directly contains pairs such as `1.in` / `1.out`, `2.in` / `2.out`. The importer also recognizes `.ans`, `.in.txt`, `.out.txt` and `.ans.txt`; an answer file may be absent. It merges imported samples with existing tests and does not overwrite manually accepted answers.

On Windows, paste the folder path copied from Explorer, including quotes if Explorer adds them. A folder accidentally entered in the single-file flow is now routed to batch folder import. The cph-ng option is different: it looks for `in.txt` or `input.txt` in that format's folder; use Import from folder for ordinary numbered `.in/.out` files.

Build profiles, large samples and regression tools

Use Select build profile on a source file to choose Release, Debug, ASan or a custom profile. The default compiler preference is automatic GCC/Clang detection; set `compiler_preference` to `gcc` or `clang` to force one. Profiles are configured under the language's `run_settings` entry as `build_profiles`, and stress testing now uses the same selected profile as normal Run.

Large sample details are preview-limited by `large_sample_preview_chars` (default 65536), but the complete input is still passed to the program. Program output is separately capped by `max_output_bytes` (default 8 MB).

After judging, run Export failed tests with diagnostics to export non-AC cases with input, expected/actual output, stderr and a manifest. After stress testing finds a mismatch or crash, use Minimize last stress counterexample on the `-stress` page. The reducer tries line deletion and integer simplification, re-running each candidate. It currently skips custom-checker (SPJ) problems because the generic output comparator cannot safely preserve checker-specific validity rules.

Results

Packages