English | 日本語
A task-oriented quick reference: find what you want to do, copy the command, done. See the README for what each feature is, and spec.md for the fine details.
- One-time setup
- Every time you submit
- Tweaking the submission file
- After touching a library
- Tired of typing the same options
- When things go wrong
cargo install risundle(Requires the Rust toolchain and a C++ compiler such as g++.)
risundle library add mylib ~/cp/librarymylib is any ID you like; ~/cp/library is the library root (the directory your includes are relative to). No need to register the standard library — it is registered automatically on the first bundle.
Just add them the same way.
risundle library add ac-library ~/ac-libraryrisundle main.cpp > submission.cppYou get a submission.cpp where, out of your libraries, only the header files main.cpp actually uses remain. Paste it into the judge and you are done.
risundle main.cpp | clip.exe # Windows / WSL (ASCII-only sources)
risundle main.cpp | iconv -t cp932 | clip.exe # WSL on Japanese Windows (see below)
risundle main.cpp | pbcopy # macOS
risundle main.cpp | xclip -sel clip # Linux (X11)
risundle main.cpp | wl-copy # Linux (Wayland)Caution on WSL: clip.exe interprets its input in the Windows system code page, not UTF-8. If your code contains non-ASCII comments, they get garbled — and line breaks can even disappear, silently changing what the code means. Convert first with iconv -t <your code page> as shown above (cp932 on Japanese Windows).
To keep its responsibilities small, risundle itself has no test or submit features. Chain it with existing tools such as oj using &&.
# If the samples pass, bundle and submit right away
oj t && risundle main.cpp > submission.cpp && oj s submission.cpp&& runs the next command only if the previous one succeeded, so a failing sample never reaches the submit step.
Example: the judge provides AC Library, so you don't want it embedded.
risundle -k ac-library main.cpp > submission.cpp-k takes the ID you used at registration. -k is additive, so std stays kept by default. Also write the includes in your solution with angle brackets like #include <atcoder/dsu>, not #include "..." (with "..." the keep may not take effect).
risundle --no-keep ac-library main.cpp > submission.cpp--no-keep beats both the config file and -k, so the library gets expanded.
risundle -c clang++ main.cpp -- -std=gnu++20 -O2-c switches the compiler; everything after -- is passed to the compiler as is. Useful when your code branches on compilers or flags with #ifdef.
Tree-shaking is an approximation, so on rare occasions it can drop a needed definition. How to fall back on failure differs per person, so risundle itself has no automatic fallback — you compose it in the shell instead. To test-compile the bundle and switch to full expansion (--no-tree-shaking) when it fails, chain with || (which runs the next command only if the previous one failed).
risundle main.cpp > submission.cpp
g++ -std=gnu++20 -o /dev/null submission.cpp ||
risundle --no-tree-shaking main.cpp > submission.cppGoing all the way through linking also catches undefined references when only a definition got dropped (the binary itself is not needed, so it is discarded to -o /dev/null). Match the flags to your judge. Also, if you keep a library other than std, its #include is invisible to plain g++ — tell it where the library lives with -I ~/ac-library or similar (otherwise the check always fails and the fallback fires every time).
If that is too much to type every time, put a function in your shell config (~/.bashrc etc.).
bundle() {
risundle "$1" > submission.cpp &&
g++ -std=gnu++20 -o /dev/null submission.cpp ||
{ echo 'verification failed; falling back to full expansion' >&2 &&
risundle --no-tree-shaking "$1" > submission.cpp; }
}From then on, bundle main.cpp is all you need. When the fallback fires, check the g++ error printed right above it: a mistake in your own code means the fallback output won't compile either, while an undefined reference to a dropped definition means tree-shaking missed something — a report in the issues would be much appreciated.
risundle -e main.cpp > submission.cppFor judges that publish submissions, when you want readers to see the source exactly as you wrote it. If your config file sets embed = true, cancel it for one run with --no-embed.
risundle library update mylib # just one
risundle library update # everything registeredEven if you forget, bundling stops with a "library changed" error to remind you — just run it then.
risundle library list # IDs, kinds, and paths
risundle library show mylib # details
risundle library show mylib -v # down to which file defines which identifiersWhen tree-shaking output is not what you expected, -v tells you which file each identifier comes from.
risundle only supports libraries with reasonably well-behaved file layouts. See compatibility.md for the exact conditions. For example, splitting a scope across files or generating declaration names with macros (X-macros) is unsupported.
risundle library delete mylibrisundle library add-std clang++Each call adds another compiler to the set, so register both g++ and clang++ and switch with -c.
Put a .risundlerc.toml in the directory of your solutions (or a parent, e.g. the project root) and it applies to every bundle underneath.
[compiler]
path = "g++"
options = ["-std=gnu++20", "-O2", "-DONLINE_JUDGE", "-DATCODER"]
[library]
keep = ["std", "ac-library"]CLI options take precedence when both are given (-k adds to the configured keeps, and options after -- are appended to the configured ones). Add --no-config to ignore the file entirely.
When you write keep yourself, list "std" alongside the rest. Forget it and the standard library gets expanded too (risundle prints a warning when that happens).
The library contents changed after registration. Reflecting the change is the proper fix; skip verification if you are in a hurry.
risundle library update # proper fix
risundle -n main.cpp # quick and dirty (skips verification)Turn off tree-shaking (everything except kept libraries gets expanded) — that gets you something submittable for now.
risundle --no-tree-shaking main.cpp > submission.cppIf this fixes it, tree-shaking dropped a needed definition. The known gap is implementation files whose target cannot be determined statically (e.g. files defining only free-function operators); anything else would be much appreciated as a report in the issues. To automate this switch, see "Verify it compiles before submitting". If it still fails, the cause lies outside tree-shaking — trace it directly from the compiler error message.
If a warning about unregistered libraries is printed, the ID does not match any registered name — check with risundle library list (or register it with risundle library add if you haven't yet).
If there is no warning, are you writing the include as #include "atcoder/dsu"? Switch to the angle-bracket form #include <atcoder/dsu>.
std is missing from the effective keeps. The typical cause is a config file whose keep forgets to list "std" (writing keep yourself replaces the default). Add "std" to keep in .risundlerc.toml. risundle also prints a warning in this situation.
The bundled file contains #line directives, so compiler diagnostics point at the original files. Read error line numbers on the judge as referring to your original file too.