CP-Coach: CP Coach: The Graph That Turns Competitive Programming Into a Prerequisite Map
An open-source coach that blends knowledge tracing, topic dependencies, and fallback rules to recommend the next problem a programmer is actually ready to solve.
- CP Coach argues that competitive programming is a dependency graph, not a flat feed of tags.
- Its Graph-DKT layer turns submissions into topic mastery estimates that can propagate across related concepts.
- The recommender does not just rank problems. It gates them by prerequisites, then bands them by difficulty, then falls back when the narrow path is empty.
- The project feels unusually production-minded because it keeps a rule-based escape hatch when the model is unavailable.
Why Competitive Programming Needs a Map, Not a Feed
Competitive programming practice usually breaks in one of two ways. You either scroll through problem lists until choice paralysis wins, or you follow a static sheet that ignores where you are stuck. CP Coach takes a harder line: the next problem should be the one that unlocks the next concept, not just the one that matches a rating band.
That is why the project is interesting. It does not treat skill as a flat score. It treats skill as a set of dependencies, where topics become available only after the prerequisites are strong enough.
Stop guessing what to practice. Let AI tell you.
The repo's own pitch is blunt: "CP Coach analyzes your Codeforces profile and uses Groq AI to detect your weakest topics, then builds a personalized practice roadmap." That is the product story in one sentence. The more interesting story is how the code makes that roadmap feel less like a guess and more like a curriculum.
The Topic Graph Is the Real Product
At the center of the system is a 29-node topic graph. This is the pedagogical backbone of the app. Topics such as implementation, math, number theory, combinatorics, graphs, flows, and dynamic programming are connected as prerequisites, so the model can reason about what should come before what.
This matters because the graph is not decoration. It is the structure the model reasons over. If the graph says one topic depends on another, CP Coach can avoid recommending a problem that is technically matched to the user's rating but pedagogically too early.
How Graph-DKT Makes Mastery Student-Aware
The model layer is a graph-augmented version of Deep Knowledge Tracing. Standard DKT tracks how likely a learner is to solve future problems from past attempts. CP Coach adds a graph convolutional layer so the model can spread signals across related topics, which is a better fit for a domain where one weak concept often leaks into another.
The implementation also makes a sharp practical choice. For a small 29-node graph, the project uses a dense GCN path that favors CPU performance over textbook sparse message passing. That is a telling detail. This is not a demo that only works in a notebook. It is tuned like software meant to run reliably for real users.
There is also an internal fix that matters conceptually. A graph only helps if node features differ by student. The code injects per-topic mastery estimates into the node features, so the graph is not just passing around identical embeddings. It becomes student-aware.
What the model is doing
- It reads submission history and applies recency weighting so recent performance counts more than old noise.
- It estimates mastery per topic instead of collapsing the user into one global score.
- It pushes those mastery signals through the prerequisite graph so related concepts can influence one another.
- It uses the result to identify weak areas that are ready to be trained, not just weak areas in the abstract.
That is the subtle shift. The model is not asking, "What is this user bad at?" It is asking, "What is this user ready to fix next without wasting time?"
The average competitive programmer plateaus because they repeat what they're already good at. CP Coach forces deliberate practice on your weakest tags.
The Recommender Does More Than Rank Problems
This is where the project becomes operational. The recommender does not just score problems and hand back the top result. It follows a sequence: weak topic detection, prerequisite gating, difficulty banding, and stretch fallback.
| Practice mode | Personalization | Prerequisite awareness | Feedback loop | Fallback behavior | Best use case |
|---|---|---|---|---|---|
| Static problem sheets | Low | None | Manual | None | Structured self-study when you already know your gaps |
| Rule-based filters | Medium | Weak | Limited | Basic | Fast searching by rating or tag |
| Generic recommenders | Medium to high | Usually none | Model-driven | Varies | Broad personalization without pedagogy |
| CP Coach | High | Strong | Model plus rules | Explicit stretch fallback | Deliberate practice with a safer next step |
The difference is not just technical. It is editorial. A normal filter says, "Here are problems that match your tag and rating." CP Coach says, "Here are the problems that are most likely to move your skill forward without dumping you into a concept you have not unlocked yet."
That is why the fallback matters. If the narrow band produces no candidates, the system expands into stretch goals instead of leaving the learner stranded. A good coach does not only find the perfect drill. It always has a next drill.
Why the App Still Works Without the Model
A lot of ML products are brittle in the wrong place. If the weights are missing, the experience collapses. CP Coach takes the opposite approach. The application includes a rule-based recommender path so the system can keep functioning even when the learned model is unavailable.
That is a strong signal of maturity. It means the author is building for continuity, not just for an impressive demo. The model improves the coach, but it is not the only thing holding the app together.
In practice, that gives the product a useful property: graceful degradation. The AI layer can fail, and the user still gets a recommendation path. For a tool built around practice habits, that matters more than a flashy architecture slide.
How It Fits Into the CP Tool Landscape
Compared with static sheets, CP Coach is adaptive. Compared with simple rating filters, it is prerequisite-aware. Compared with generic recommenders, it tries to model learning rather than only preference.
| Tool type | Strength | Weakness | Where CP Coach differs |
|---|---|---|---|
| Static sheets | Clear structure | No personalization | CP Coach reorders around your current mastery |
| Rule-based search | Fast and familiar | Ignores topic dependencies | CP Coach gates recommendations by prerequisites |
| Generic AI recommender | Feels personalized | Can be pedagogically shallow | CP Coach ties suggestions to a learning graph |
| Manual progress tracker | Good visibility | Still requires user judgment | CP Coach automates the judgment step |
That niche is narrow but real. The project is not trying to replace every CP resource. It is trying to solve the part that most tools skip: the transition from knowing your weak spots to choosing the right next problem.
Why This Feels Like Research, Not Just a Hack
The codebase reads like a small research-to-production effort. It includes cross-validation scripts, ablation work, and deployment plumbing. The graph layer was not just bolted on for style. It was tested as a hypothesis.
That is what makes CP Coach compelling. It treats competitive programming as a learning system with structure, dependencies, and failure modes. The result is a coach that is less random, less brittle, and more honest about how skill actually compounds.