# endlesscheng/codeforces-go

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/endlesscheng-codeforces-go).**

8,541 stars · 810 forks · Go · MIT

## Links

- GitHub: https://github.com/EndlessCheng/codeforces-go
- Homepage: https://space.bilibili.com/206214
- awesome-repositories: https://awesome-repositories.com/repository/endlesscheng-codeforces-go.md

## Topics

`acm-icpc` `algorithm` `algorithms` `codeforces` `codeforces-go` `codeforces-golang` `codeforces-solutions` `competitive-programming` `data-structure` `data-structures` `go` `golang` `icpc` `leetcode` `leetcode-go` `leetcode-golang`

## Description

Codeforces-go is a competitive programming algorithm library written in Go, providing a collection of reusable code templates for solving algorithmic problems. It covers core areas including data structures, graph algorithms, dynamic programming, and mathematical computation, with pre-built implementations for segment trees, Fenwick trees, shortest paths, minimum spanning trees, knapsack DP, interval DP, and number theory routines.

The library organizes its templates by algorithmic pattern, grouping them into categories such as DP, graph, and math to match common contest question structures. It is designed for template-based code reuse, offering parameterized code blocks that users adapt by filling in problem-specific logic rather than rewriting from scratch. The project is a zero-dependency Go module that leverages only the standard library.

A test-case generation framework is included, which generates random inputs and compares solution output against a brute-force reference for correctness verification. The entire library is written in Go, utilizing its standard library and concurrency primitives for efficient algorithm execution.

## Tags

### Education & Learning Resources

- [Template Libraries](https://awesome-repositories.com/f/education-learning-resources/competitive-programming-solutions/template-libraries.md) — Organises reusable algorithm implementations as standalone templates for rapid copy-paste into contest solutions.
- [Dynamic Programming Patterns](https://awesome-repositories.com/f/education-learning-resources/dynamic-programming-patterns.md) — Ships ready-to-use templates for knapsack, interval, tree, and digit DP to solve optimization problems. ([source](https://cdn.jsdelivr.net/gh/endlesscheng/codeforces-go@master/README.md))
- [Graph Algorithm Routines](https://awesome-repositories.com/f/education-learning-resources/graph-theory-algorithms/graph-algorithm-routines.md) — Implements shortest paths, minimum spanning trees, maximum flow, and tree query routines for competitive programming. ([source](https://cdn.jsdelivr.net/gh/endlesscheng/codeforces-go@master/README.md))
- [Algorithmic Patterns](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/algorithm-data-structure-guides/algorithmic-patterns.md) — Groups templates by problem-solving patterns like DP, graph, and math to match contest question structures.

### Data & Databases

- [Data Structure Implementations](https://awesome-repositories.com/f/data-databases/data-structure-implementations.md) — Provides pre-built implementations of segment trees, Fenwick trees, and union-find for algorithmic problem-solving. ([source](https://cdn.jsdelivr.net/gh/endlesscheng/codeforces-go@master/README.md))

### Development Tools & Productivity

- [Competitive Programming Repositories](https://awesome-repositories.com/f/development-tools-productivity/competitive-programming-repositories.md) — Solves algorithmic problems in competitive programming contests with pre-written, optimized code templates.
- [Competitive Programming Templates](https://awesome-repositories.com/f/development-tools-productivity/template-based-code-generators/competitive-programming-templates.md) — Provides parameterised code blocks that users adapt by filling in problem-specific logic rather than rewriting from scratch.

### Scientific & Mathematical Computing

- [Mathematical Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/mathematical-algorithms.md) — Provides templates for GCD, FFT, matrix operations, and number theory algorithms for contest problem-solving. ([source](https://cdn.jsdelivr.net/gh/endlesscheng/codeforces-go@master/README.md))

### Programming Languages & Runtimes

- [Go Language Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/go-language-implementations.md) — Written entirely in Go, leveraging its standard library and concurrency primitives for efficient algorithm execution.

### Software Engineering & Architecture

- [Zero-Dependency Libraries](https://awesome-repositories.com/f/software-engineering-architecture/zero-dependency-libraries.md) — Operates as a standalone Go module with no external runtime dependencies beyond the standard library.

### Testing & Quality Assurance

- [Test Case Generators](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/test-execution-orchestration/test-case-generators.md) — Includes a harness that generates random inputs and compares solution output against a brute-force reference for correctness.
