ShahjalalShohag/code-library: A Competitive Programming Template Collection in C++
Templates, algorithms and data structures implemented and collected for programming contests.
At a glance
- What is it?
- A personal C++ library of contest templates and data structures, organised by topic and shared under the MIT licence. It is a reference to copy from, not a package to install, and the repository has not been pushed to since 2026-03-03.
- Who is it for?
- Adopt it if you compete in C++ and want a topic-organised reference to copy templates from, and read Guidelines.md before submitting anything. Skip it if you need a versioned dependency, a documented API, or bindings outside C++.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Activity is slowing. The repository last received commits 7 months ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What the repository is, and the problem it addresses
Contest programmers rewrite the same segment tree, the same modular arithmetic helpers, and the same string algorithms every few weeks. ShahjalalShohag/code-library is one competitor's answer to that repetition: a personal collection of templates, algorithms and data structures in C++, grouped into directories such as Basics/, Data Structures/, Dynamic Programming Optimizations/, Game Theory/, Geometry/, Graph Theory/, Math/, Miscellaneous/, Number Theory/ and Strings/. The README describes it as a personal code library where the author compiled "almost all" the important templates needed in competitive programming, with most codes written by the author and some collected from others and modified.
The intended reader is a contest participant who already knows what a Fenwick tree is and wants a working implementation to adapt. It is not a library in the software engineering sense: there is no build system described, no package manifest, no versioned API. The README points readers to an external topic list that pairs topics with relevant problems and tutorials, and notes that problem links are attached to most of the codes. That pairing is the real value proposition. A template without a practice problem is hard to trust; a template with a link to a judge problem is something you can verify in an afternoon.
How the library is organised and how code flows into your solution
The mechanism is deliberately plain. Each topic is a top-level directory, and the files inside hold self-contained C++ implementations. The repository layout shows no shared header, no namespace wrapper and no build target, so the expected workflow is to open a file, read it, and paste the parts you need into your own submission. The README states that the coding style is intended to be clean and readable, and that a few problem links accompany most codes.
That design has a direct consequence: there is no dependency graph to resolve and no include path to configure, but there is also no guarantee that two files compose. If a geometry routine defines a point struct and a graph routine defines its own, you are the one merging them. A single translation unit is the norm in contests anyway, and the collection is built for that norm. The README frames the library as a learning aid first and a copy source second, which matches the file-per-topic layout. Someone expecting a header-only library with a stable interface will be disappointed; someone who wants to read a clean implementation and retype it will not.
The README also mentions that the collection took around four years to complete. That is context for scale, not a quality signal, and the README does not present any verification or test suite for the templates.
Getting the code and using a first template
There is no install step, because there is no package. The README does not document a package manager, a CMake target or a release artifact, and the repository has no releases. The way to get the code is to clone the repository, then compile the file you want with a C++ compiler. The command below clones the repository; substitute the actual path of the template you are reading.
git clone https://github.com/ShahjalalShohag/code-library.git
cd code-libraryAfter cloning you get the topic directories listed above. Pick a file, for example one under Data Structures/, and compile it on its own. The repository does not ship a main function with every template, so a file that is only a class definition will fail to link as an executable until you add your own driver code. If the file has no main, expect a linker error about an undefined entry point, which tells you the file is a component rather than a program. That is the expected shape for most of the collection.
Guidelines.md and the contribution path
The repository carries a Guidelines.md at the top level alongside LICENSE.txt and README.md. The README does not summarise its contents, so anyone opening a pull request should read that file directly rather than infer conventions from the existing files. The repository topics include hacktoberfest, which suggests outside contributions have been welcomed at some point, and the README's badge row links to a contributors graph. None of that substitutes for reading the guidelines before you submit.
For consumers rather than contributors, the practical point is that the collection is a mix. The README says most codes are originally written by the author and some are collected from others and modified in a cleaner way. That means provenance varies from file to file, and the README does not attach a per-file source note. If you need to know where a particular algorithm came from, the file itself is the only place to look, and it may not say.
Where this library is the wrong tool
The MIT licence makes reuse easy, but the repository is not a dependency. There is no versioning, so you cannot pin a commit and expect a stable interface across updates; the last push was on 2026-03-03, and before that the collection evolved as a personal project rather than under a release cadence. If your project needs a maintained, versioned algorithm library with semantic versioning and a changelog, this is not it.
There is also no documented test suite. The README does not claim that every template is verified against a judge, and the presence of problem links on most codes is a study aid, not a proof of correctness. A template copied from here and submitted without local testing is a risk you are taking on yourself. Finally, the collection is C++ only. The primary language is C++, and the README describes nothing for other languages, so a Python or Rust contestant gets nothing directly usable.
One more boundary: the name is easy to confuse with unrelated things. Searches for this repository's name also return results about municipal code libraries, legal codes, and a game, none of which have anything to do with this project.
Alternatives and how their approach differs
The closest general comparison is a maintained algorithm library distributed as a package, where you add a dependency and call a documented function. That approach gives you versioning, tests and an upgrade path, and it gives you none of the contest-specific framing: no problem links, no single-file templates sized for a judge submission, and often a heavier interface than a contest needs. The difference is not quality, it is purpose. A package is built to be depended on across a codebase; this collection is built to be read and retyped under time pressure.
A second alternative is a personal snippet folder or an editor's snippet system. That is the same idea with no sharing and no topic list. The advantage here is that someone else has already organised the material by topic and attached practice problems, which shortens the search when you meet an unfamiliar technique. The disadvantage is that you inherit someone else's coding style and naming, which is exactly what a personal snippet folder avoids.
Neither alternative is a drop-in replacement, and the README does not position the project against any of them.
Licence, maintenance and upgrade cost
The repository is MIT licensed, with LICENSE.txt at the top level and an MIT badge in the README. For copying a template into a contest submission or into your own project, that is permissive, and it does not require you to publish your changes. This is a description of the licence as stated in the repository, not legal advice; read LICENSE.txt yourself if the terms matter to your use.
Upgrade cost is close to zero and also close to meaningless. There are no releases, so there is no version to bump. If you copy a file, you own that copy and its bugs. If you track the repository, you get whatever changed in the latest commit, and the README does not describe a changelog or a deprecation policy. Maintenance status should be read from the repository facts: it is not archived, and the last push was on 2026-03-03. Beyond that, the README says nothing about a support commitment.
Editorial conclusion
Adopt it if you compete in C++ and want a topic-organised reference to copy templates from, and read Guidelines.md before submitting anything. Skip it if you need a versioned dependency, a documented API, or bindings outside C++. Before you rely on any file, compile it yourself, because the README does not claim the whole collection is verified.
Frequently asked questions
What is ShahjalalShohag/code-library?
It is a personal C++ code library of templates, algorithms and data structures for competitive programming, grouped into topic directories such as Graph Theory, Strings and Number Theory. The README describes it as a collection of almost all the important templates needed in contests, with most codes written by the author.
Is code-library a package I can install?
No. The README documents no package manager, build target or release artifact, and the repository has no releases. You clone it and copy the template you need into your own submission.
What licence does ShahjalalShohag/code-library use?
The repository is MIT licensed, with LICENSE.txt at the top level and an MIT badge in the README. That is permissive for copying templates into your own work, but read the licence file for the exact terms.
Does code-library work for languages other than C++?
The primary language is C++, and the README describes nothing for other languages. A contestant working in Python or Rust would have to translate the algorithms themselves.
Are the templates in code-library tested?
The README does not claim a test suite or that every template is verified against a judge. It says problem links are attached to most of the codes, which supports practice rather than proving correctness, so compile and test anything you copy.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/shahjalalshohag-code-library)