Polyman
Polyman is a CLI tool that will allow codeforces problem setters to never get out of their coding environment to create a new problem. You can create, test, or update your problems and then submit them to polygon directly from your terminal.
Install / Use
/learn @HamzaHassanain/PolymanREADME
Polyman
CLI tool for Codeforces problem setters to automate the complete workflow for creating, testing, and verifying competitive programming problems.
Quick Links | Why? • Installation • Quick Start • Commands • Tags • Checkers • Structure • Config • Docs • Workflow • Issues • Support • Contributing • License
</div>Why Polyman?
Stop switching between environments. Create competitive programming problems entirely in your terminal:
- Problem Templates – Generate complete folder structures in one command
- Test Generation – Automate test case creation with C++ generators
- Validation – Validate inputs against problem constraints
- Multi-Solution Testing – Test correct, wrong, TLE, and RE solutions simultaneously
- Smart Checkers – Use standard checkers or write custom ones
- Complete Verification – Full workflow in a single
verifycommand - Polygon Sync – Pull problems, work locally, push changes back
- Multi-Language – C++, Java, and Python support
Polyman eliminates manual testing and syncing, letting you focus on problem design.
Installation
System Requirements
- Node.js ≥ 14
- C++ Compiler (g++ with C++17+)
- Python 3 (optional - for Python solutions)
- Java JDK (optional - for Java solutions)
Quick Install
npm install -g polyman-cli
Build from source:
git clone https://github.com/HamzaHassanain/polyman.git
cd polyman && npm install && npm run build && npm link
Verify: polyman --version
Quick Start
Create & Test a Problem
# Create new problem
polyman new my-problem
cd my-problem
# Download testlib (required for validators/generators)
polyman download-testlib
# Run complete verification
polyman verify
Work with Polygon
# Setup (one-time)
polyman remote register
# Pull problem
polyman remote pull 123456 ./my-problem
# Work locally, then push back
polyman remote push . .
polyman remote commit . "Updated solutions"
Commands
Essential Commands
| Command | Purpose |
| ------------------------------ | ------------------------------- |
| polyman new <dir> | Create new problem template |
| polyman download-testlib | Download testlib.h header |
| polyman generate --all | Generate all test cases |
| polyman validate --all | Validate test inputs |
| polyman run <solution> --all | Run solution on all tests |
| polyman test <component> | Test validator/checker/solution |
| polyman verify | Complete verification workflow |
Polygon Commands
| Command | Purpose |
| ------------------------------------ | -------------------- |
| polyman remote register | Save API credentials |
| polyman remote list | List your problems |
| polyman remote pull <id> <dir> | Download problem |
| polyman remote push <id> <dir> | Upload changes |
| polyman remote commit <id> "msg" | Commit changes |
| polyman remote package <id> <type> | Build package |
For detailed usage, see GUIDE.md.
Solution Tags
Every solution needs a tag indicating its expected behavior:
| Tag | Meaning | Purpose |
| ---- | ------------------ | -------------------------------------- |
| MA | Main Correct | Required - Reference solution |
| OK | Correct | Alternative correct approach |
| WA | Wrong Answer | Should fail on some tests |
| TL | Time Limit | Should timeout on some tests |
| TO | Time/OK | May TLE but is algorithmically correct |
| ML | Memory Limit | Should exceed memory |
| RE | Runtime Error | Should crash |
| PE | Presentation Error | Wrong format |
| RJ | Rejected | Should fail for any reason |
For full details, see GUIDE.md - Solution Types.
Standard Checkers
Polyman includes testlib checkers for common output formats:
polyman list checkers
Common checkers:
ncmp- Sequence of numbers (most problems)wcmp- Sequence of tokens/wordsdcmp/rcmp*- Floating-point numbersyesno- Yes/No answerslcmp- Exact line comparison
For details, see GUIDE.md - Standard Checkers.
Project Structure
After polyman new my-problem, you get:
my-problem/
├── Config.json # Problem configuration
├── solutions/ # Solution files (main + WA/TL/etc)
├── generators/ # Test generators
├── validator/ # Input validator
├── checker/ # Custom checker (if needed)
├── statements/ # Problem statements
└── tests/ # Generated test files
See GUIDE.md - Directory Structure for full details.
Configuration
The Config.json file defines your problem:
{
"name": "problem-name",
"timeLimit": 2000,
"memoryLimit": 256,
"inputFile": "stdin",
"outputFile": "stdout",
"solutions": [
{
"name": "main",
"source": "./solutions/main.cpp",
"tag": "MA",
"sourceType": "cpp.g++17"
}
],
"generators": [
{
"name": "gen",
"source": "./generators/gen.cpp"
}
],
"checker": {
"name": "ncmp",
"isStandard": true
},
"validator": {
"name": "validator",
"source": "./validator/validator.cpp"
},
"testsets": [
{
"name": "tests",
"generatorScript": {
"commands": [
{
"type": "generator",
"generator": "gen",
"range": [1, 50]
}
]
}
}
]
}
See GUIDE.md - Configuration Reference for complete documentation.
Documentation
Choose your learning path:
For Beginners
Complete User Guide - Comprehensive reference with configuration examples, validators, generators, checkers, and best practices.
Step-by-Step
Step-by-Step Tutorial - Learn by creating a simple "Sum of Two Numbers" problem from scratch.
For Developers
Technical Documentation - Architecture overview, type system, API reference, and implementation details.
Platform-Specific
Windows Notes - Important considerations for Windows users regarding line endings and process cleanup.
API Reference
TypeDoc Documentation - Generated API documentation for developers.
Workflow Summary
- Create →
polyman new my-problem - Setup →
polyman download-testlib+ edit Config.json - Implement → Write solutions, validator, generator, checker
- Generate →
polyman generate --all - Verify →
polyman verify - Sync →
polyman remote push .+polyman remote commit . "msg"
Detailed walkthrough: GUIDE.md - Workflow
Common Issues
Q: My test times out. How do I debug?
See GUIDE.md - Troubleshooting for performance tips and debugging strategies.
Q: Do I need a custom checker?
For most problems, a standard checker like wcmp or ncmp is sufficient. See GUIDE.md - FAQ.
Q: Windows users: Process not killed on TLE?
Check NOTES.md for cleanup instructions.
Support
- Issues: GitHub Issues
- Documentation: https://hamzahassanain.github.io/polyman/
- Codeforces: https://codeforces.com/ • Polygon
Contributing
Contributions welcome! To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make changes with clear commit messages
- Push and open a Pull Request
Please ensure code follows the existing style and includes tests.
License
MIT License. See LICENSE for details.
Acknowledgments
- testlib by Mike Mirzayanov - Validators, generators, and checkers
- Codeforces - Platform and community
- Contributors - All who have helped improve Polyman
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
110.9kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
review-duplication
100.6kUse this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing project best practices and shared utilities.
