Giter Site home page Giter Site logo

cpit's Introduction

CPIT (Competitive Programming Interface Tool)

Table of Contents

Background

I've been doing competitive programming for a few years now, and during that time, I've created a decent amount of command line tools to streamline certain processes in the terminal and make life easier. This repository is a collection of the tools that I've created, which I hope can help out others! I'd be happy to take any feedback or questions!

Summary of CPIT

This is a command line tool for competitive programming (mainly tested with the Codeforces platform, and for users who use C++). The main tools provided by this is the ability to automatically test your code against sample cases and parse sample cases from the Codeforces website to your local directory. A couple other smaller tools is the ability to get the rating for a problem, and estimate how much memory an array of certain length will take.

Set up

First, clone this repository. You can clone this repository anywhere on your computer, as later we will set up an alias to actually run this tool that can be called from anywhere.

git clone https://github.com/C1XTEEN/CPIT.git

This tool is ran with python3. Make sure to install the required libraries to run it.

pip install -r requirements.txt

To make this tool easier to use, I set up an alias. This can be put in /.bashrc to save the alias (or whatever equivalent file for your environment).

alias cpit='python3 [PATH_OF_REPO]/cpit.py' 

Below are the details to run specific commands. All commands should be ran in the terminal.

Checker

Automatically test your code against samples

One of the cool features about this tool is the ability to test your code on sample test cases. Specifically, this tool will automatically check all files with .in and .out extensions in the directory you are currently in, then run those samples against your code, and print out any differences between your code's output and the expected sample output.

Checker: Usage

To run this tool:

cpit checker [EXECUTABLE_NAME]

(Note: this command requires that the program is already compiled, then the name or path to the executable is passed as an argument to be ran)

Checker

Parser

Parse sample input/output files on Codeforces

To pair with this feature, I also created another feature to parse the sample input/outputs on a Codeforces webpage, then download them locally into .in and .out files that can then be used with the previous checker command. On top of an individual problem, this feature can also parse all the problems of a contest, creating a subdirectory for each problem, with the corresponding sample input/outputs in that subdirectory.

Parser: Usage

To parse a single problem:

cpit parse ['1' or 'o' or 'p'] [PROBLEM_LINK]

Parser

To parse a contest:

cpit parse c [CONTEST_ID]

(Note: The contest ID can be found in the URL of the contest page. For example, the contest ID of https://codeforces.com/contest/1993 is 1993)

Parser Contest

Rating

Get the rating of Codeforces problems

Another small tool is the ability to get the rating of a Codeforces problem in the terminal. Personally, I disable tags in Codeforces problems, which also includes the rating tag. This feature allows me to continue to disable tags, but be able to get the rating if I want to see it.

Rating: Usage

To run this tool:

cpit rating

You will then be prompted to enter a Codeforces problem link, which you can paste in to get the rating.

Parser

Memory

Estimate memory an array will take

Finally, the last small feature is a tool to help quickly estimate how much memory an array will take, which can be important to determine whether a solution will fall in the proper memory limits.

Memory: Usage

To run the tool:

cpit mem

You will first be prompted with the length of the array, which can be entered as an integer, like 5000, or in scientific notation, like 4.5e5.

Then, you will be prompted with the data type of the array. Currently, it only supports int, ll, and double.

Parser

Future Steps

I hope to continue improving CPIT and provide more features/tools to enhance convenience in competitive programming. Some future steps I have in mind are:

  • Add support for other platforms for parsing, such as AtCoder
  • Fix bugs where parser doesn't work if Cloudflare is in use
  • Potentially more features!

cpit's People

Contributors

c1xteen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.