• Stars
    star
    695
  • Rank 65,093 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Browser extension which parses competitive programming problems

Competitive Companion

Build Status
Chrome Web Store Version Chrome Web Store Users Chrome Web Store Rating
Mozilla Add-on Version Mozilla Add-on Users Mozilla Add-on Rating

A browser extension which parses competitive programming problems from various online judges (like Codeforces and UVa Online Judge) and sends them to various tools (like CHelper and Hightail). Capable of parsing problems and contests and extracting data like the example testcases and the time and memory constraints.

Install

Supported tools

Supported websites

Website Problem parser Contest parser
A2 Online Judge
ACMP
AcWing
Aizu Online Judge
AlgoZenith
Anarchy Golf
AtCoder
Baekjoon Online Judge
beecrowd
Bloomberg CodeCon
BUCTOJ
CodeChef
CodeDrills
Codeforces
CodeMarshal
COJ
Contest Hunter
CS Academy
CSES
CSU-ACM Online Judge
DMOJ
Eolymp
ECNU Online Judge
FZU Online Judge
Google Coding Competitions
HackerEarth
HackerRank
HDOJ
HIT Online Judge
hihoCoder
HKOI Online Judge
Hrbust Online Judge
Hydro
ICPC Live Archive
Jutge
Kattis
Library Checker
LibreOJ
LightOJ
LSYOI
Luogu
Meta Coding Competitions
MOI Arena
mrJudge
MSK Informatics
Neps Academy
Newton School
NOJ
NowCoder
NYTD Online Judge
omegaUp
OpenJudge
OTOG
Panda Online Judge
PEG Judge
POJ
PTA
Public Judge
QDUOJ
RoboContest
SDUT OnlineJudge
Sort Me
SPOJ
SSOIER
Timus Online Judge
TLX
Toph
uDebug
UOJ
USACO
USACO Training
UVa Online Judge
Virtual Judge
Yandex
XXM
yukicoder
ZOJ
ZUFEOJ

Custom tools

Competitive Companion can send the parsed data in JSON format to your own tools. To do this, start a HTTP server listening for POST requests to / on any of the ports listed in ./src/hosts/hosts.ts. An example on how to accomplish this can be found in jmerle/competitive-companion-example.

If you want your own tool added to the released version of Competitive Companion, create an issue in this repository specifying the name and a link to the tool.

The format

Here's an example of the data sent when parsing this problem:

{
    "name": "G. Castle Defense",
    "group": "Codeforces - Educational Codeforces Round 40 (Rated for Div. 2)",
    "url": "https://codeforces.com/problemset/problem/954/G",
    "interactive": false,
    "memoryLimit": 256,
    "timeLimit": 1500,
    "tests": [
        {
            "input": "5 0 6\n5 4 3 4 9\n",
            "output": "5\n"
        },
        {
            "input": "4 2 0\n1 2 3 4\n",
            "output": "6\n"
        },
        {
            "input": "5 1 1\n2 1 2 1 2\n",
            "output": "3\n"
        }
    ],
    "testType": "single",
    "input": {
        "type": "stdin"
    },
    "output": {
        "type": "stdout"
    },
    "languages": {
        "java": {
            "mainClass": "Main",
            "taskClass": "GCastleDefense"
        }
    },
    "batch": {
        "id": "123e67c8-03c6-44a4-a3f9-5918533f9fb2",
        "size": 1
    }
}

It's not required for a tool to parse all these options, since some of them are tool/language-specific. However, it is required for all extensions/tools that send data via this format to fill all required options.

Explanation

  • name: The full name of the problem. Can be used for display purposes.
  • group: Used to group problems together, which can be useful for archiving purposes. Follows the format <judge> - <category>, where the hyphen is discarded if the category is empty.
  • url: A link to the problem on the judge's website.
  • interactive (optional): Whether this is an interactive problem or not.
  • memoryLimit: The memory limit in MB.
  • timeLimit: The time limit in ms.
  • tests: An array of objects containing testcase data. The JSON objects in the array all have two keys: input and output. Both the input and the output need to end with a newline character.
  • testType: The type of the tests. Supports two options: "single" and "multiNumber". Explanation of these two can be found on the JHelper wiki.
  • input: An object which is used to configure how to receive input. Supported types:
    • stdin: Receive input via stdin. No additional options required.
    • file: Receive input via a file. The file name has to be given via the fileName option.
    • regex: Receive input via a file. The file to use is selected by taking the most recently modified that matches the given regex. The regex pattern to use has to be given via the pattern option.
  • output: An object which is used to configure how to send output. Supported types:
    • stdout: Send output to stdout. No additional options required.
    • file: Send output to a file. The file name has to be given via the fileName option.
  • languages: An object with language specific settings. At the moment this only contains Java settings, but since I don't think putting language specific settings as top-level options is a good idea, I decided to put them in an object. This also allows for other languages to have custom configuration added later on. Required keys:
    • java: An object with Java specific settings. Required options:
      • mainClass: The name of the outer class containing the solution.
      • taskClass: The classname-friendly version of the problem's full name. Cannot be the same as mainClass. Can also be useful for non-Java tools because a classname-friendly string is also a filename-friendly string.
  • batch: An object containing information about the batch of problems that this problem belongs to. Required options:
    • id: A UUIDv4 string which uniquely identifies a batch. All problems in a batch have the same batch id.
    • size: The size of the batch, which is 1 when using a problem parser and the amount of problems in the contest when using a contest parser.

Running locally

The following commands can be used to start working on Competitive Companion locally. Additionally, make sure you got Node.js and PNPM installed.

# Clone the repository
git clone https://github.com/jmerle/competitive-companion.git

# cd into the extension folder
cd competitive-companion

# Install the dependencies
pnpm install

# Decide what you want to do next

# Build the code to the build/ directory
pnpm build

# Build the code automatically when the source changes
pnpm watch

# Lint the extension for possible mistakes
pnpm lint

# Package the extension to a zip file
pnpm package

# Launch a Firefox instance with Competitive Companion loaded into a temporary profile
# Automatically re-compiles the code when the source changes
# Automatically reloads the extension in the Firefox instance when the code is re-compiled
pnpm dev:firefox

# Does the same as dev:firefox but with Chrome, with the exception that the extension is not automatically reloaded
# You'll have to manually go to chrome://extensions and click on the reload button on the Competitive Companion entry
pnpm dev:chrome

Testing

To run the tests, use pnpm test, or pnpm test:no-headless to run tests with the Chrome instance visible. Append -- -t <pattern> to the command to only run tests with names matching the given pattern.

Mozilla reviewers

The information provided below is meant for Mozilla volunteers.

Software versions used:
Node.js: 18.16.0
PNPM: 8.6.0

Third-party libraries that can be found in the minified extension:

Package the extension by cd'ing into the source code submission directory, installing the dependencies with pnpm install and packaging with pnpm package. The result can be found in the dist/ directory.

More Repositories

1

node-icecream

🍦 Quick and easy variable and expression debugging
JavaScript
95
star
2

zeal-user-contrib

A convenient CLI to add Dash's User Contributed docsets to Zeal
TypeScript
63
star
3

imc-prosperity-2-backtester

Backtester for IMC Prosperity 2 algorithms
Python
49
star
4

imc-prosperity-2-visualizer

IMC Prosperity 2 algorithm visualizer
TypeScript
43
star
5

imc-prosperity-visualizer

IMC Prosperity 1 algorithm visualizer
TypeScript
35
star
6

imc-prosperity-2

My IMC Prosperity 2 code (9th place)
Jupyter Notebook
30
star
7

ai-bot-workspace

Graphical bot runner for Riddles.io bots
JavaScript
26
star
8

cg-local-app

A desktop application which helps in synchronizing the CodinGame IDE with a local file
Kotlin
21
star
9

inkdrop-table-editor

Improved table editor for Inkdrop
JavaScript
21
star
10

lux-eye-2022

Lux AI 2022 Beta episode visualizer
TypeScript
15
star
11

advent-of-code-2023

Advent of Code 2023 in Python (63rd place)
Python
14
star
12

cg-local-ext

A browser extension which helps in synchronizing the CodinGame IDE with a local file
TypeScript
12
star
13

png-to-box2d

A CLI to convert PNG images to Box2D shape data
TypeScript
11
star
14

koreye-2022

Kore 2022 episode visualizer
TypeScript
9
star
15

advent-of-code-2022

Advent of Code 2022 in Python (117th place)
Python
9
star
16

imc-prosperity-2-submitter

Command-line submitter for IMC Prosperity 2 algorithms
Python
9
star
17

traefik-docker-registry

A Docker Compose configuration to run a private Docker registry behind a Traefik reverse proxy
Shell
8
star
18

competitive-companion-example

An example on how to retrieve data from Competitive Companion
JavaScript
8
star
19

inkdrop-tray

Tray functionality for Inkdrop
JavaScript
7
star
20

inkdrop-snippets

Powerful snippets engine for Inkdrop
JavaScript
7
star
21

inkdrop-plantuml

Add PlantUML diagrams to Inkdrop notes
JavaScript
5
star
22

glo-web-clipper

A web clipper for GitKraken Glo boards
TypeScript
5
star
23

imc-prosperity-leaderboard

Improved IMC Prosperity 1 leaderboard
TypeScript
4
star
24

docker-compose-webserver

Traefik + Watchtower docker-compose configuration
Shell
3
star
25

lean-api-docs

Automatically updated API documentation for QuantConnect's Lean
Python
3
star
26

inkdrop-update-checker

Automatically check for Inkdrop plugin updates
JavaScript
3
star
27

hacker-experience-ip-checker

A little userscript for the Hacker Experience 1 game
JavaScript
3
star
28

deskdocs

A feature-rich desktop application for DevDocs.io
TypeScript
3
star
29

docker-compose-azure-pipelines-agent

A Docker Compose configuration to run a self-hosted Azure Pipelines Agent
Shell
3
star
30

inkdrop-export-as-gist

Export Inkdrop notes as GitHub gists
JavaScript
2
star
31

battlecode-2022-statistics

A website that displays some Battlecode 2022 statistics
TypeScript
2
star
32

traefik-jira

A Docker Compose configuration to run Jira behind a Traefik reverse proxy
2
star
33

html-batch-inliner

A CLI to easily and quickly inline all images, CSS stylesheets and JS scripts in multiple HTML files.
TypeScript
2
star
34

battlecode-2022

My Battlecode 2022 bots (13th-16th place)
Java
2
star
35

uspto-explainable-ai

My code for the USPTO - Explainable AI for Patent Professionals competition on Kaggle (13th place)
C++
1
star
36

code-weekend-1

My code for the Code Weekend 1 competition
Jupyter Notebook
1
star
37

hacker-experience-tools-helper

A small userscript that enables you to sync your Hacker Experience HDB with HETools
JavaScript
1
star
38

inkdrop-plugin-template

Template to quickly start working on a new Inkdrop plugin
JavaScript
1
star
39

ghost-in-the-cell

My CodinGame Ghost in the Cell submissions
Java
1
star
40

traefik-jenkins

A Docker Compose configuration to run Jenkins behind a Traefik reverse proxy
Dockerfile
1
star
41

inkdrop-center-on-top

Open new windows centered on top of the previously focused window
JavaScript
1
star
42

light-riders-workspace

Deprecated. Use https://github.com/jmerle/ai-bot-workspace instead.
Java
1
star
43

inkdrop-graphviz

Add Graphviz graphs to Inkdrop notes
JavaScript
1
star
44

pixel-5-checker

Automatically check whether the Pixel 5 is available in the German Google Store
JavaScript
1
star
45

battlecode-2023-statistics

A website that displays some Battlecode 2023 statistics
TypeScript
1
star
46

battlecode-2023

My Battlecode 2023 bots (9th-12th place)
Java
1
star
47

chelper-custom-parsers

Adds custom parsers to CHelper.
JavaScript
1
star
48

electron-testing

JavaScript
1
star
49

traefik-grafana

A Docker Compose configuration to run Grafana behind a Traefik reverse proxy
1
star
50

inkdrop-auto-reload

Automatically reload Inkdrop when a plugin is added/deleted/modified
JavaScript
1
star
51

battlecode-2024

My Battlecode 2024 bots (2nd place)
Java
1
star
52

icpc-2022-online-challenge-2

My C++ code for problem 2 of the ICPC 2022 Online Challenge competition on Codeforces
C++
1
star