Algovault: Reusable Templates With Tests for Their Tests

Revision en3, by sgtlaugh, 2026-12-02 07:45:14

Greetings Codeforces community!

Since 2020 I've kept a repository of competitive programming templates, and I finally cleaned it up enough to share: algovault.

What it is

Most of it is my personal collection of algorithms and templates I have learned and used in programming contests over the years. The library consists of about 270 C++ templates, plus a few in Python. There are also 2000+ practice problems from various online judges linked to each problem. Here is an example from the Linear Algebra section.

Motivation

Granted that there are many good libraries already like the KACTL for ICPC handbook and cp-algorithms based on http://e-maxx.ru. There are also some good personal template collections online. My personal favorites being codelibrary by indy256 and algorithmic-library by zimpha.

However, most libraries and personal collections suffer from some common problems, specifically when it comes to copy-pasting and reusing online. KACTL has great implementation, but it's optimized to serve as ICPC handbook. cp-algorithms is mostly educational, and it's often not easy to copy-paste and reuse a working template. Personal template collections also suffer from similar problems.

What's different

As a contestant, I personally prefer templates that are simple, well-tested, fast, and most importantly, easy to reuse. So here's why algovault is different.

  • Readable: a one-minute header and plain code with no macros.
  • Reusability: every template includes main(), which only holds self-tests and a worked example.
  • Drop-in: every file compiles on its own, no dependencies
  • Fast: tuned and benchmarked with documented speed tricks
  • Verified: checked against brute force, stress tests, and planted bugs in mutation testing
  • Practiced: 2,000+ solved problems linked to their templates
  • Guarded: asserts instead of silent wrong answers
Tags library, collection, algorithms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English sgtlaugh 2026-12-02 08:51:57 35 (published)
en8 English sgtlaugh 2026-12-02 08:49:20 236
en7 English sgtlaugh 2026-12-02 08:38:19 206
en6 English sgtlaugh 2026-12-02 08:30:33 1086 Tiny change: '^{12}$ in 0.05 s, with Mei' -> '^{12}$ in `0.05 s`, with Mei'
en5 English sgtlaugh 2026-12-02 08:15:49 1975 Tiny change: '_hash.cpp) - two strin' -> '_hash.cpp): two strin'
en4 English sgtlaugh 2026-12-02 08:00:17 6182
en3 English sgtlaugh 2026-12-02 07:45:14 609 Tiny change: 'ent.\n\n- Readable: a one-min' -> 'ent.\n\n- **Readable:** a one-min'
en2 English sgtlaugh 2026-12-02 06:55:23 1313
en1 English sgtlaugh 2026-12-02 06:31:37 585 Initial revision (saved to drafts)