Coder Social home page Coder Social logo

lucario387 / compe.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phattd15/compe.js

0.0 0.0 0.0 7.15 MB

A CLIxLibrary for Competitive Programming with JavaScript/Node.js

Home Page: https://www.npmjs.com/package/compe

License: MIT License

TypeScript 8.56% JavaScript 91.44%

compe.js's Introduction

Compe.js

A CLIxLibrary for Competitive Programming with JavaScript/Node.js

Requirements

  • Node v12.x or higher (preferably v16.x+)
  • Set node modules to path variable to use cli

Installation

For the package:

npm i compe

For the cli, you can:

npm i -g compe minify

You can add the prefix npx after every command as an alternative where you want to avoid installing global package. Enable intellisense to get the best experience.

Compe commands

Add npx prefix incase you don't have CLIs installed.

$ compe i <source-file.js> <input-file.txt>: Initialize the source file at source-file.js and the input file at input-file.txt (if input-file is empty then the default is 'input.txt')
$ compe s <source-file.js>: Save the source file directory as default
$ compe i s <source-file.js> <input-file.txt>: Initialize the file and then save to config
$ compe r <source-file.js>: If the config has default source file, source-file can be ignored. Run the source file and build it at source-file-build.js and fully compressed to submit on Online Judges at source-file-comp.js

Getting your first AC

Make a txt (by default from template, it is "input.txt") file in the same directory with the one you want to run for stdin. The main function takes in rd and wr as a function to read and write. Sample code for printing sum of an array at demo.js after init:

const {
  Reader, proc,                                     // IO & Processor
  multiArray, vectorArray,                          // Fast array generators
  TreeSet, Deque, DisjointSetUnion, PriorityQueue,  // Data structures
  Graph, dfs, bfs, minimumSpanningTree, dijkstra    // Graph Algorithms
} = require('compe');
// DO NOT EDIT THIS LINE //
function main(rl, wr) {
  let rd = new Reader(rl);
  // write your code from here
  let x = rd.readArray();
  let sum = 0;
  for (let y of x) {
    sum += y;
  }
  wr(y);
}
proc(main, 'input.txt');

Documentation

  • This project uses TSTL's TreeSet where their documentation is here.
  • To Be Updated...

Platforms supported

  • Leetcode
  • Codeforces
  • TBA: Atcoder, Hackerrank, ...

Built with

Resources

compe.js's People

Contributors

phattd15 avatar polarity-ac 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.