# chai-ming-yang/competitive-programming-muscle-memory architecture

> Architecture diagram of the GitHub repository chai-ming-yang/competitive-programming-muscle-memory, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chai-ming-yang/competitive-programming-muscle-memory
- Repository: https://github.com/chai-ming-yang/competitive-programming-muscle-memory

## Overview

This repository is a personal competitive-programming archive: standalone solutions for historical contest problems, reusable algorithm templates in C++ and Python, and a small set of programming notes. A solver takes problem input, applies its local algorithm, and prints an answer; templates are independent snippets rather than a shared runtime framework. Sampled code demonstrates graph algorithms, linear algebra, pathfinding, and offline dynamic connectivity. The tree supports the major branches, but no README explains organization or usage, and most solutions were not inspected.

Main entry points: [`past-competitions/ProSolve/2020_a/F.py`](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2020_a/F.py) (Max-flow solution), [`past-competitions/ProSolve/2026_a/F.py`](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2026_a/F.py) (Dynamic connectivity), [`past-competitions/ProSolve/2018_a/H.py`](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_a/H.py) (Linear systems), [`past-competitions/ProSolve/2018_b/E.py`](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_b/E.py) (Grid pathfinding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_solutions["Contest solutions"]
  node_contest["Standalone solutions"]
  node_maxflow_solver["Max-flow solution<br/>[F.py]"]
  node_rollback_solver["Dynamic connectivity<br/>[F.py]"]
  node_linear_solver["Linear systems<br/>[H.py]"]
  node_grid_solver["Grid pathfinding<br/>[E.py]"]
end

subgraph group_cpp["C++ templates"]
  node_cpp_graph["Graph algorithms"]
  node_cpp_structures["Search and structures"]
  node_cpp_math["Math and matrices"]
  node_cpp_tree["Tree algorithms"]
  node_cpp_base["C++ starter<br/>[template.cpp]"]
end

subgraph group_python["Python templates"]
  node_py_graph["Graph algorithms"]
  node_py_structures["Search and structures"]
  node_py_math["Math and matrices"]
  node_py_tree["Tree algorithms"]
end

subgraph group_notes["Programming notes"]
  node_notes_ref["Language references"]
  node_alg_notes["Algorithm notes<br/>[TODO - Math.py]"]
end

node_user(("Problem solver"))
node_input["Problem input"]
node_answer["Printed answer"]

node_user -->|"provides"| node_input
node_input -.->|"solves independently"| node_contest
node_input -->|"reads input"| node_maxflow_solver
node_maxflow_solver -->|"prints flow"| node_answer
node_input -->|"reads operations"| node_rollback_solver
node_rollback_solver -->|"prints counts"| node_answer
node_input -->|"reads matrix"| node_linear_solver
node_linear_solver -->|"prints solution"| node_answer
node_input -->|"reads grid"| node_grid_solver
node_grid_solver -->|"prints path"| node_answer
node_user -.->|"adapts template"| node_cpp_base
node_user -.->|"uses snippets"| node_cpp_graph
node_user -.->|"uses snippets"| node_cpp_structures
node_user -.->|"uses snippets"| node_cpp_math
node_user -.->|"uses snippets"| node_cpp_tree
node_user -.->|"uses snippets"| node_py_graph
node_user -.->|"uses snippets"| node_py_structures
node_user -.->|"uses snippets"| node_py_math
node_user -.->|"uses snippets"| node_py_tree
node_user -.->|"consults"| node_notes_ref
node_user -.->|"consults"| node_alg_notes

click node_contest "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/past-competitions/ProSolve"
click node_maxflow_solver "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2020_a/F.py"
click node_rollback_solver "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2026_a/F.py"
click node_linear_solver "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_a/H.py"
click node_grid_solver "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_b/E.py"
click node_cpp_graph "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template"
click node_cpp_structures "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template"
click node_cpp_math "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template"
click node_cpp_tree "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template"
click node_cpp_base "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/template/template.cpp"
click node_py_graph "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py"
click node_py_structures "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py"
click node_py_math "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py"
click node_py_tree "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py"
click node_notes_ref "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/notes"
click node_alg_notes "https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/TODO%20-%20Math.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_contest,node_maxflow_solver,node_rollback_solver,node_linear_solver,node_grid_solver toneBlue
class node_cpp_graph,node_cpp_structures,node_cpp_math,node_cpp_tree,node_cpp_base toneAmber
class node_py_graph,node_py_structures,node_py_math,node_py_tree toneMint
class node_notes_ref,node_alg_notes toneRose
class node_user,node_input,node_answer toneIndigo
```

## Components

### Contest solutions

- [Standalone solutions](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/past-competitions/ProSolve): `past-competitions/ProSolve`
- [Max-flow solution](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2020_a/F.py): `past-competitions/ProSolve/2020_a/F.py`
- [Dynamic connectivity](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2026_a/F.py): `past-competitions/ProSolve/2026_a/F.py`
- [Linear systems](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_a/H.py): `past-competitions/ProSolve/2018_a/H.py`
- [Grid pathfinding](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/2018_b/E.py): `past-competitions/ProSolve/2018_b/E.py`

### C++ templates

- [Graph algorithms](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template): `template`
- [Search and structures](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template): `template`
- [Math and matrices](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template): `template`
- [Tree algorithms](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template): `template`
- [C++ starter](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/template/template.cpp): `template/template.cpp`

### Python templates

- [Graph algorithms](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py): `template_py`
- [Search and structures](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py): `template_py`
- [Math and matrices](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py): `template_py`
- [Tree algorithms](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/template_py): `template_py`

### Programming notes

- [Language references](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/tree/main/notes): `notes`
- [Algorithm notes](https://github.com/chai-ming-yang/competitive-programming-muscle-memory/blob/main/past-competitions/ProSolve/TODO%20-%20Math.py): `past-competitions/ProSolve/TODO - Math.py`

### Other components

- **Problem solver**
- **Problem input**
- **Printed answer**

## Connections

- Problem solver → Problem input: provides
- Problem input → Standalone solutions: solves independently
- Problem input → Max-flow solution: reads input (evidence: `past-competitions/ProSolve/2020_a/F.py`)
- Max-flow solution → Printed answer: prints flow (evidence: `past-competitions/ProSolve/2020_a/F.py`)
- Problem input → Dynamic connectivity: reads operations (evidence: `past-competitions/ProSolve/2026_a/F.py`)
- Dynamic connectivity → Printed answer: prints counts (evidence: `past-competitions/ProSolve/2026_a/F.py`)
- Problem input → Linear systems: reads matrix (evidence: `past-competitions/ProSolve/2018_a/H.py`)
- Linear systems → Printed answer: prints solution (evidence: `past-competitions/ProSolve/2018_a/H.py`)
- Problem input → Grid pathfinding: reads grid (evidence: `past-competitions/ProSolve/2018_b/E.py`)
- Grid pathfinding → Printed answer: prints path (evidence: `past-competitions/ProSolve/2018_b/E.py`)
- Problem solver → C++ starter: adapts template
- Problem solver → Graph algorithms: uses snippets
- Problem solver → Search and structures: uses snippets
- Problem solver → Math and matrices: uses snippets
- Problem solver → Tree algorithms: uses snippets
- Problem solver → Graph algorithms: uses snippets
- Problem solver → Search and structures: uses snippets
- Problem solver → Math and matrices: uses snippets
- Problem solver → Tree algorithms: uses snippets
- Problem solver → Language references: consults
- Problem solver → Algorithm notes: consults
