Skip to content
 
 

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

cpship

Competitive programming workflow for Sublime Text. Parse problems straight from your browser via Competitive Companion, auto-open them in a 3-pane layout (code / sample input / expected output), and compile + test against every sample with one keypress. Real clangd-powered autocomplete for the C++ standard library included.

What it does

  • Click the Competitive Companion extension on a Codeforces problem -> a .cpp file appears, named after the problem (A_halloumi_boxes.cpp), with sample input/output files alongside it, and Sublime opens a 3-pane split automatically.
  • Ctrl+B compiles and runs your code against every sample case, reporting pass/fail per case with a line-by-line diff on failure.
  • Optional daily-practice mode: route problems from different contests into one folder instead of scattering them across per-contest folders.

Platforms

OS Install Setup script
macOS / Linux cross-platform/README.md · download zip bash setup.sh
Windows windows/README.md · download zip .\setup.ps1

Each install script asks where your CP folder should live, auto-detects your compiler and Sublime Text, and writes every config file for you - nothing needs hand-editing.

Quick start

  1. Download the zip for your OS from the table above (or clone this repo) and unpack it.
  2. Open the folder for your OS and run its setup script (see table above).
  3. Open a new terminal window.
  4. In Sublime Text install Package Control, then LSP and LSP-clangd; restart.
  5. Install the Competitive Companion browser extension, set its port to 1327.
  6. Try it:
settarget        # optional: route problems into one daily-practice folder
parse            # start listening; Ctrl+C to stop
# click Competitive Companion on any Codeforces problem...
runsample A      # compile + test problem A against every sample

Usage

parse [N]            # listen for problems; optional auto-stop after N
cf <contest>         # jump to the cf<contest> folder
goto <folder>        # jump to any folder
settarget [name]     # route problems into one folder (daily practice)
cleartarget          # back to normal per-contest folders
runsample <letter>   # compile + test against every sample
runsample <letter> -Manual   # feed your own input by hand
runsample <letter> -Test 0   # run just test case 0

In Sublime: Ctrl+B to test the open file, Ctrl+Shift+B for manual input or a specific test case.

Layout

  • cross-platform/ - macOS / Linux version (setup.sh, templates/)
  • windows/ - Windows version (setup.ps1, templates/)
  • A*.cpp / A*.in* / A*.out at the repo root - test artifacts from the sample runner, not part of the project

How it works

  • parse.py - a small local server Competitive Companion posts problem data to; creates the .cpp/.in/.ans files and launches Sublime
  • dbg.py / dbg.ps1 - compiles with g++ and diffs your output against every sample, order-sensitive and whitespace/case-tolerant
  • AutoLayoutProblem.py - Sublime plugin for the 3-pane layout
  • CompetitiveProgramming.sublime-build - wires Ctrl+B to the test runner
  • ProfileFunctions.* - the parse / runsample / cf / goto / settarget / cleartarget shell commands
  • compile_flags.txt - tells clangd where your compiler's headers live, so autocomplete actually works

License

MIT

About

A sublime text plugin that automates compilation and output testing for codeforces contests.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages