whatisgithub

What is codeforces-go?

endlesscheng/codeforces-go — explained in plain English

Analysis updated 2026-06-24

8,394GoAudience · developerComplexity · 4/5Setup · moderate

In one sentence

A personal collection of ready-to-use algorithm templates and Codeforces problem solutions in Go, covering data structures, graphs, strings, and math for competitive programmers.

Mindmap

mindmap
  root((codeforces-go))
    Templates
      Data structures
      Graph algorithms
      String algorithms
      Math and number theory
    Problem Solutions
      By contest number
      By problem ID
    Study Guides
      LeetCode topic lists
      Binary search
      Dynamic programming
    Audience
      Competitive programmers
      Go developers
      Contest participants
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Copy ready-made Go templates for segment trees, shortest paths, or suffix automata directly into your contest solution.

USE CASE 2

Look up the author's Codeforces solutions by contest and problem number to check your own approach.

USE CASE 3

Follow the curated LeetCode topic lists organized by algorithm type as a structured study guide for improving your rating.

What is it built with?

Go

How does it compare?

endlesscheng/codeforces-goboyter/sccgobuffalo/buffalo
Stars8,3948,3858,383
LanguageGoGoGo
Setup difficultymoderateeasymoderate
Complexity4/51/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Documentation is entirely in Chinese, code templates are in Go and can be copied without reading the docs.

So what is it?

This repository is a personal collection of algorithm templates and solved problems for competitive programming, written in the Go programming language. It is maintained by a Chinese programmer known as Lingcha Shanaifu, and the documentation is written entirely in Chinese. The library targets people who participate in online coding contests, particularly on platforms like Codeforces and LeetCode. The core of the repository is a folder called copypasta, which contains ready-to-use code templates organized by algorithm category. These categories cover a very wide range: data structures like segment trees, union-find sets, and various types of heaps, string algorithms like KMP and suffix automata, graph algorithms covering shortest paths, minimum spanning trees, maximum flow, and topological sorting, and mathematical topics including number theory, combinatorics, fast Fourier transforms, and computational geometry. Each template file is a self-contained Go source file named after the algorithm it implements. Alongside the templates, the repository contains the author's actual solutions to problems submitted on Codeforces. The directory structure mirrors Codeforces contest and problem identifiers, so each solution file corresponds to a specific contest problem. This means someone browsing the repository can look up solutions by contest number. The README also includes a curated set of problem lists on LeetCode, grouped by topic such as sliding window, binary search, dynamic programming, and graph algorithms. These lists serve as a structured study guide for people working to improve their rating in competitive programming. This is not a tutorial or a beginner's learning resource in the typical sense. It assumes the reader already understands competitive programming and is looking for reference implementations or solutions to check their own work against. The README is in Chinese throughout, so readers who do not read Chinese will find the documentation difficult to follow even though the code itself is in Go.

Copy-paste prompts

Prompt 1
Show me a Go segment tree template from codeforces-go's copypasta folder and adapt it to answer range sum queries on an array.
Prompt 2
Using the codeforces-go template style, write a Go solution for a problem requiring Dijkstra's single-source shortest path on a weighted graph.
Prompt 3
Explain the KMP string matching implementation from codeforces-go and show me how to use it to find all occurrences of a pattern in a text.
Prompt 4
Walk me through the dynamic programming templates in codeforces-go and apply one to solve a sliding window maximum problem on LeetCode.

Frequently asked questions

What is codeforces-go?

A personal collection of ready-to-use algorithm templates and Codeforces problem solutions in Go, covering data structures, graphs, strings, and math for competitive programmers.

What language is codeforces-go written in?

Mainly Go. The stack also includes Go.

How hard is codeforces-go to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is codeforces-go for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.