Open-source project
aaryansamanta/usaco-tripple-perfect avatar
aaryansamanta/usaco-tripple-perfect

usaco-tripple-perfect works a single USACO contest through all three divisions

USACO 2026 Second Contest: Bronze, Silver and Gold problems explained, with verified C++17 solutions.

667 stars1 forksC++MIT

At a glance

What is it?
This repository takes the USACO 2026 Second Contest and walks its nine problems from Bronze to Gold, pairing a one insight explanation with a C++17 solution and a documented verification process. It suits a competitor working up the divisions, and it is not a substitute for the official statements and analyses.
Who is it for?
usaco-tripple-perfect is worth working through if you are a competitor moving from Bronze to Silver to Gold and want one contest analysed at all three levels rather than a pile of unrelated solutions, since the same contest lets you compare what each division actually rewards.
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?
Yes. The repository last received commits 33 days 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 October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What triple perfect means and why one contest is enough

The phrase is community slang rather than an official USACO title, and the README defines it precisely. It means scoring 1000 out of 1000 in Bronze, Silver and Gold, all three divisions, by solving every problem in each. The reason that is achievable in a single sitting comes from a USACO rule the README highlights. A strong contestant can move up within the same contest, so once you reach the promotion score in a division you can accept the promotion and start the next division's problems, and a single contest can carry you from Bronze through Gold if you keep scoring high. The repository's stated aim is to be a guide to that goal rather than a pile of code, and the framing difference is the point. Most contest repositories give you a solution and stop. This one gives you, for each problem, the one key insight that opens it up, the reasoning behind the algorithm, the pitfalls that cost points, and a short commented solution you can read in a few minutes. The stated audience is students moving between divisions, coaches looking for worked examples, and anyone who wants to see how to test a solution properly.

Nine problems, one per slot, each with a named key idea

The problem table is the spine of the repository, and it lists all nine problems of the contest with the technique, the complexity, a write-up link and a solution link for each. The Bronze set covers suffix XOR, bitmask enumeration with subset-sum dynamic programming, and a greedy algorithm over normalised prices. The Silver set covers a claim that reduces to a cyclic bit string, amortised repair chains with monotone pointers, and a circle walk solved with two pointers and deques. The Gold set covers a binary search with an inner convex search needing 128-bit arithmetic, a greedy over vertex sets with at most 26 phases, and a rotating frame argument on a cycle. Each row is a promise about difficulty, and the table of techniques practised gives the mapping from idea to slot, from parity and XOR identities through subset-sum dynamic programming, offline processing and amortised analysis, to binary search on the answer, automata style simulation, parity breadth-first search and functional graphs. The stated time complexities are in the table too, which is useful, since the Gold 1 solution is O(N log squared N), and knowing that before you start is part of the lesson.

The learning method is the actual product here

The README devotes a numbered roadmap to method, and the sequence is opinionated in a way that is worth reading on its own. Master the fundamentals until they are automatic, covering sorting, prefix sums, breadth-first and depth-first search, binary search and bitmasks, with the claim that Bronze and Silver points are lost to bugs far more often than to missing ideas. Practise on past contests under the time limit, then read the write-ups here and the official analysis. Learn to test, by writing a brute force and a random generator for every problem, which is what tools/stress.py demonstrates. Grab partial credit deliberately, since every problem has subtasks and a correct slower solution beats an unfinished perfect one. Think about overflow and edge cases before submitting, with concrete reminders that Gold 1 needs 128-bit arithmetic, Gold 3 needs iterative traversals and Silver 1 has a tiny-circle edge case. And review every problem you miss, writing down the one insight you lacked, which is exactly the format the write-ups use. That last point is what ties the repository together. The write-ups are not a separate artefact from the method, they are the method applied nine times.

Verification is the part that separates this from a solution dump

The README describes two independent checks for every solution, and the badges in the header advertise the results as all nine problems passing the official tests and brute force stress tested. The first method is the official test data, with a tool called tools/check_official.py that runs a solution against a folder of input and expected-output files. The second is stress testing against a brute force, which is the technique the roadmap pushes students toward, and tools/stress.py is the reference implementation. The second check is the more interesting one, because it can find a wrong answer that passes the official tests, and the README says the solutions were checked in both ways. The repository layout backs the claim up. There are top level bronze/, silver/ and gold/ directories, each problem living in a numbered folder, with a notes subdirectory for the write-up and a solution.cpp, and a tools/ directory holding the scripts. So the code, the explanation and the verification tooling sit side by side per problem rather than in separate trees. For a learner, that layout matters, because the brute force is right there next to the clever solution it is checking.

Running the samples yourself takes a compiler and Python

The quick start is three commands, and the repository makes no attempt to hide the boilerplate:

bash
git clone https://github.com/<your-username>/<this-repo>.git
cd <this-repo>

# compile and run one solution
g++ -O2 -std=c++17 -o moo bronze/2-moo-hunt/solution.cpp
./moo < bronze/2-moo-hunt/samples/1.in

# run every solution on the bundled samples
./tools/run_samples.sh

The stated requirements are a C++17 compiler, g++, and Python 3.8 or newer for the tools, and nothing else. That is a refreshingly small dependency list for a repository whose whole argument is about verification tooling. The compile command is the ordinary one, with optimisation and the C++17 standard flag, and the run command reads a sample input from standard input, which is the shape every USACO solution uses. The run_samples.sh script does the same thing for every solution in the repository, which is the fastest way to confirm that your toolchain works before you start reading. The scripts in tools/ are where the verification story lives, and they are written in Python, so the same interpreter that runs the stress tests runs the sample checks.

The rule that matters most is the one about not competing with it

The README includes a boxed warning that is the single most important line for anyone considering using this repository, and it is about the rules rather than the algorithms. USACO requires you to compete alone, to use only language documentation, and not to use AI tools, prewritten code or templates, or more than one account. The README states that a score only means something if it is earned this way, and that violations can lead to disqualification, then gives the guidance to use the repository to learn before or after a contest, never during one. This is a constraint the article has to state plainly, because a repository of complete verified solutions is exactly the kind of resource that could be misused under time pressure. There is also a second, softer boundary. The official contest page is the source of truth, and the README links to the USACO 2026 Second Contest results page for the statements, the analyses and the test data, which means the problem text and the official test data live outside this repository. The write-ups here are explanations and solutions, and the authoritative source for what a problem actually asks remains USACO itself. The official analyses are also part of the recommended reading, listed alongside the write-ups in the roadmap, not replaced by them.

Editorial conclusion

usaco-tripple-perfect is worth working through if you are a competitor moving from Bronze to Silver to Gold and want one contest analysed at all three levels rather than a pile of unrelated solutions, since the same contest lets you compare what each division actually rewards. It is the wrong tool for someone who needs a general problem archive, and the README itself says to use it to learn before or after a contest, never during one, because USACO forbids AI tools and prewritten code. Verify first that the solutions you copy match the current official statements, since problem text and test data live on the USACO site rather than in the repository, and that the sample runner works with the compiler you have. The last push was on 2026-09-20 and the repository publishes no GitHub releases.

Frequently asked questions

What does triple perfect mean in USACO terms?

It is community slang for scoring 1000 out of 1000 in Bronze, Silver and Gold in the same contest. USACO lets a contestant be promoted within a contest once they reach the promotion score, so a single contest can take you through all three divisions.

Which problems are covered in usaco-tripple-perfect?

Nine problems from the USACO 2026 Second Contest, three per division. The Bronze set covers suffix XOR, bitmask enumeration with subset-sum DP and a greedy over normalised prices, while the Gold set covers binary search with convexity, a greedy over vertex sets and a rotating frame on a cycle.

How are the solutions in usaco-tripple-perfect verified?

The README describes two independent checks. Every solution passes all official test cases, checked with tools/check_official.py, and the solutions are also brute force stress tested, with tools/stress.py showing how the random generator approach works.

Can I use usaco-tripple-perfect during a USACO contest?

No. The README states that USACO requires competing alone with only language documentation, and forbids AI tools, prewritten code or templates, and multiple accounts, with disqualification as the consequence. The repository is meant for learning before or after a contest.

What do I need to build the solutions in usaco-tripple-perfect?

A C++17 compiler, g++, and Python 3.8 or newer for the tools, and nothing else. The README says no other dependencies are required.

Official sources

  1. aaryansamanta/usaco-tripple-perfect on GitHub
  2. Issues
  3. License: MIT
  4. README
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.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/aaryansamanta-usaco-tripple-perfect.svg)](https://hysenlabs.com/projects/aaryansamanta-usaco-tripple-perfect)

Was this useful?