A powerful Go-based tool that automatically creates organized directory structures and files for competitive programming contests using Competitive Companion browser extension.
- Automatic Directory Structure: Creates organized folders by site β contest β problem
- Template Support: Use your favorite code templates for any programming language
- Test Case Management: Automatically generates input/output files from sample test cases
- Multi-file Support: Add helper files like Makefiles, debug scripts, or library files
- Problem Metadata: Saves problem information (time limits, memory limits, URLs) as JSON
- Cross-platform: Works on Windows, macOS, and Linux
- Real-time Logging: Detailed logs for debugging and monitoring
The tool creates a clean, organized structure:
contests/
βββ Codeforces/
β βββ 2142/
β β βββ A/
β β β βββ A.cpp # Your code file
β β β βββ 1.in # Sample input 1
β β β βββ 1.out # Sample output 1
β β β βββ 2.in # Sample input 2
β β β βββ 2.out # Sample output 2
β β β βββ problem.json # Problem metadata
β β β βββ Makefile # Extra files
β β βββ B/
β β βββ ...
β βββ 1959/
β βββ ...
βββ AtCoder/
β βββ abc335/
β β βββ abc335_a/
β β β βββ abc335_a.cpp # Your code file
β β β βββ ...
β βββ ...
βββ CodeChef/
β βββ START115A/
β β βββ PROBLEM_NAME/
β β β βββ PROBLEM_NAME.cpp # Your code file
β β β βββ ...
βββ ...
- Go to Releases
- Download the appropriate binary for your OS
- Add to your PATH
git clone https://github.com/Kaushal-26/Competitive-Companion-Helper-In-Go.git
cd Competitive-Companion-Helper-In-Go
go install- Make sure GOBIN is set with PATH
# ~/.bashrc or ~/.zshrc export GOBIN=$HOME/bin export PATH=$PATH:$GOBIN
- Now we can use
Competitive-Companion-Helper-In-Gobinary anywhere inside our terminal.
Install the browser extension:
Set the port in Competitive Companion to your custom port if require, 27121 (default).
# Basic usage
Competitive-Companion-Helper-In-Go
# With custom settings
Competitive-Companion-Helper-In-Go --port 27121 --path ./my-contests --template template.cpp
# Check all flags
Competitive-Companion-Helper-In-Go --help- Navigate to any competitive programming problem
- Click the Competitive Companion extension icon
- Files are automatically created in your specified directory!
Competitive-Companion-Helper-In-Go --path ./contestsCompetitive-Companion-Helper-In-Go --template ~/templates/template.cpp --path ./contestsCompetitive-Companion-Helper-In-Go \
--template template.cpp \
--extra-files Makefile,debug.h,testlib.h \
--path ./contestsCompetitive-Companion-Helper-In-Go \
--input txt \
--output ans \
--template solution.pyCompetitive-Companion-Helper-In-Go --port 12345 --path ./competitive-programming| Flag | Short | Default | Description |
|---|---|---|---|
--port |
-p |
27121 |
Server port for Competitive Companion |
--path |
. |
Base directory for contest folders | |
--template |
-t |
Template file for code submissions | |
--input |
in |
File extension for input test cases | |
--output |
out |
File extension for output test cases | |
--extra-files |
Additional files to include in each problem |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define all(x) x.begin(), x.end()
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// Your code here
return 0;
}import sys
from collections import defaultdict, deque
from math import gcd, lcm
def solve():
# Your solution here
pass
if __name__ == "__main__":
solve()import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Your code here
sc.close();
}
}Create a Makefile to include as an extra file:
CXX = g++
CXXFLAGS = -std=c++17 -O2 -Wall -Wextra -Wshadow
TARGET = $(shell basename $(CURDIR))
SOURCE = $(TARGET).cpp
$(TARGET): $(SOURCE)
$(CXX) $(CXXFLAGS) -o $@ $<
test: $(TARGET)
./$(TARGET) < 1.in
clean:
rm -f $(TARGET)
.PHONY: test clean#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = [", _debug(x)
#else
#define debug(x...)
#endif
void _debug() { cerr << "]" << endl; }
template<class T, class... U>
void _debug(T a, U... b) {
cerr << a;
if(sizeof...(b)) cerr << ", ";
_debug(b...);
}- Codeforces (all contest types)
- AtCoder (ABC, ARC, AGC, etc.)
- CodeChef (all contest formats)
- TopCoder (SRMs, TCO)
- HackerRank (contests and practice)
- LeetCode (contests)
- Google Code Jam / Kick Start
- Facebook Hacker Cup
- And many more supported by Competitive Companion!
# Use a different port
Competitive-Companion-Helper-In-Go --port 12345
# Don't forget to update Competitive Companion settings# Make the binary executable
chmod +x Competitive-Companion-Helper-In-Go
# Or run with appropriate permissions
sudo Competitive-Companion-Helper-In-Go --path /usr/local/contests# Use absolute path
Competitive-Companion-Helper-In-Go --template /home/user/templates/template.cpp
# Or relative path from current directory
Competitive-Companion-Helper-In-Go --template ./templates/template.cpp- Check that Competitive Companion is installed and enabled
- Verify the port matches between CP Helper and the extension
- Ensure CP Helper is running before parsing problems
- Check browser console for errors
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
git clone https://github.com/Kaushal-26/Competitive-Companion-Helper-In-Go.git
cd Competitive-Companion-Helper-In-Go
go mod tidy
go run main.go --helpThis project is licensed under the MIT License - see the LICENSE file for details.
- jmerle for the amazing Competitive Companion extension
- The competitive programming community for inspiration and feedback
- Go community for excellent libraries and tools