Import LeetCode problems with usaco new <link> / usaco daily
Test and publish the site / test (push) Successful in 35s
Test and publish the site / publish (push) Successful in 29s

usaco new <leetcode-link> (alias: from) and usaco daily fetch a problem
from LeetCode's GraphQL API and write problem.md, main.cpp (template
header + LeetCode's C++ starter), a generated driver.h that runs the
solution on LeetCode-format input, and the examples as tests with the
expected outputs from the statement. leetcode.h holds ListNode/TreeNode
and the parse/print helpers; everything local sits behind #ifdef LOCAL
so main.cpp stays submittable.

reset re-fetches the starter code for LeetCode problems, the REPL's new
selects the imported problem, and usaco.zsh turns off globbing so a
pasted ?envType=... link works unquoted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-19 21:12:16 +01:00
co-authored by Claude Opus 5.5
parent 995b44a57a
commit e821df15f4
9 changed files with 813 additions and 9 deletions
+2
View File
@@ -19,6 +19,8 @@ const sections = [
["usaco new <name>", "Create solving/<name>/ with main.cpp from the template and an empty .in file, then open it in $EDITOR."],
["usaco new <name> <io>", "Same, when the USACO file name differs from the problem name."],
["usaco new <name> --url <link>", "Also save the problem link, for usaco open."],
["usaco new <leetcode-link>", "Import a LeetCode problem (also usaco from): the statement as problem.md, LeetCode's C++ starter code in main.cpp, a generated driver.h that runs it on LeetCode-format input, and the examples as tests with their expected outputs."],
["usaco daily", "The same, for today's LeetCode daily question."],
],
},
{