Git Product home page Git Product logo

cph's Introduction

Competitive Programming Helper (cph)

Build Status Downloads

Quickly compile, run and judge competitive programming problems in VS Code. Automatically download testcases , or write & test your own problems. Once you are done, easily your solutions directly with the click of a button!

Cph supports a large number of popular platforms like Codeforces, Codechef, TopCoder etc. with the help of competitive companion browser extension

Screenshot

Quick start

  1. Install cph in VS Code and open any folder.
  2. Install competitive companion in your browser.
  3. Use Companion by pressing the green plus (+) circle from the browser toolbar when visiting any problem page.
  4. The file opens in VS Code with testcases preloaded. Press Ctrl+Alt+B to run them.
  • (Optional) Install the cph-submit browser extension to enable submitting directly on CodeForces.
  • (Optional) Install submit client and config file from the Kattis help page after logging in.

You can also use this extension locally, just open any supported file and press 'Run Testcases' (or Ctrl+Alt+B) to manually enter testcases.

See detailed user guide

Features

  • Automatic compilation with display for compilation errors.
  • Intelligent judge with support for signals, timeouts and runtime errors.
  • Works with Competitive Companion.
  • Codeforces auto-submit integration.
  • Kattis auto-submit integration.
  • Works locally for your own problems.
  • Support for several languages.

Supported Languages

  • C++
  • C
  • Rust
  • Go
  • Haskell
  • Python
  • Java
  • JavaScript (Node.js)

Contributing

You can contribute to this extension in many ways:

  • File bug reports by creating issues.
  • Develop this extension further - see developer guide.
  • Spreading the word about this extension.

Before creating a Pull Request, please create an issue to discuss the approach. It makes reviewing and accepting the PR much easier.

Telemetry

The extension collects basic events defined in src/telmetry.ts. To disable, modify the setting telemetry.telemetryLevel (applies to all VSCode extensions).

License

Copyright (C) 2023 Divyanshu Agrawal

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

cph's People

Contributors

adarsh-sgh avatar ag-7219 avatar agrawal-d avatar apurv-patani avatar arcane810 avatar arnav-ag avatar chinesedfan avatar dakshkhetan avatar davidmcnamee avatar dependabot[bot] avatar do-ui avatar fcottet avatar haizs avatar itsniklas avatar kushagra1212 avatar linlexiao0 avatar m-prerna avatar mr2rm avatar pedrosorio avatar srnightmare09 avatar tesla59 avatar urparvezali avatar user202729 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cph's Issues

Option to collapse "passed" tests + Better background color of verdicts

Is your feature request related to a problem? Please describe.
When I have multiple tests and specially when I add some, the window becomes full of sometimes lengthy outputs, when I'm only interested in the verdict; Passed/Failed.
I tried many dark themes on vscode, and on every one of them the words "Passed" and "Failed" are not very clear, although they are colored in red and green.

Describe the solution you'd like
An option to always collapse passed tests so they will only take one line of space would be nice.

Having green and red background-colors behind the verdict will be much clearer.

I think you can add these things

  1. Add some more verdicts instead of Success and Failed
    -> AC: Accepted
    -> WA: Wrong Answer
    -> TLE: Time Limit Exceed
    -> MLE: Memory Limit Exceed
    -> ILE: Idleness Limit Exceed
    -> CPE: Compile Error
    -> RTE: Run Time Error
    -> Skipped: Don’t verdict for some reason

  2. Can you limit the time of a testcase ? Give them TLE with extra timer
    Add "Time limit", "Extra time" to each testcase that
    If it pass the limit, use the extra for continue output, but still give the result TLE

  3. Sometimes in the contest, it is allow to output with anycase but the extension isnt :<, can you add "Secondary Expected Output"

  4. Sometimes I slipped my hand or something and it delete a testcase, can you add "Undo Button"

  5. Sometimes I dont want to play a testcase. can you add "Skip Button"

  6. Sometimes I want to change the order of the testcase, can you add "Move up button", "Move down button", "Move first button", "Move last button", "Move to XXX button"

  7. Sometimes I want to compare 2 programs with the same testcase, can you add "Compare Button"

  8. Sometimes I want to save an output, are there any way to do that, or can you add "Save this output as default button ?"

About the judger

I wish it was like the other OJs, ignoring the line end blank characters and not ignoring the line breaks.
If the correct answer is.

1 1 2 3 5
The output is.

1
1
2
3
5

The judger will think it's right.

Does not detect test case in latest VSCode update

Description
After updating VSCode from version 1.42 to 1.43 the test case are not fetched via the Competitive Companion extension. Test case can be generated manually or by codeforces problem link.

To Reproduce
Steps to reproduce the behavior:

  1. Update VSCode from 1.42 to 1.43

Expected behavior
Test cases not fetched from the browser

Desktop :

  • OS: Windows 10
  • Browser: Mozzila firefox 74

How To Run Latest Branch?

This is kind of a basic question:

I've taken a fork and I'm making changes to the code in my local repository. But right now VSCode is running the version of Competitive Programming Helper that I installed from the VSCode Extensions store; how do I build and run the extension from my local repository?

[Bug] Stuck indefinitely on MinGW g++ with Windows 10

Describe the bug
Extension is stuck on "Running Next Testcase" on MinGW g++ with Windows 10

To Reproduce
Steps to reproduce the behavior:

  1. Windows 10 + MinGW Compiler (The one that comes bundled with this).
  2. Add the compiler to PATH Environment Variable.
  3. Get any codeforces problem via browser extension.
  4. .tcs file gets generated correctly.
  5. When you click on "Run Testcases", the extension is stuck on "Running next testcase" indefinitely.

Expected behavior
The extension should tell if the test cases were passed or not.

Screenshots
Problem

Desktop:

  • OS: Windows 10 Home 1909 (32-bit)
  • Microsoft Edge (Chromium)
  • Edge 81.0.416.53 (Official build) (32-bit)
  • VS Code Version: 1.44.1 (User)
  • This Extension's Version: 3.4.5
  • Browser Extension's Version: 2.15.0 (Chrome Web Store)

Smartphone:

  • N/A

Additional context
If it helps this is the codeforces problem I have added in the screenshot.

I believe it has something to do with the operating system or the compiler itself (The compiler is added to PATH), since this extension works with Ubuntu 19.10 & GNU g++ on same hardware.

Add relevant problem information

Is your feature request related to a problem? Please describe.
Sometimes we need to refer back to the problem for which we wrote the solutions to go back and
read the problem statement
Additional info like the problem link, name, contest name are beneficial

Describe the solution you'd like

// Problem : Life, the Universe, and Everything
// Contest : CodeChef - DSA Learning Series - Contest 1
// URL : https://www.codechef.com/LRNDSA01/problems/TEST
// Memory Limit : 256 MB
// Time Limit : 10000 ms

Something like this is appreciated

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Copy Paste issue

While pasting test cases the items are pasted twice
Screenshot (36)

Extension Version: <v4.1.0>
VS Code Version: <1.47.0>

What is the port number used ?? because after clicking the add-ons the file is not opening in vscode

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Template for faster coding

Many times we work on predefined template for competitive coding. Also there is not much time to copy paste very time .
There can be a way of creating a file called template.cpp and we can always create new prblem.cpp file with the same template already written in it,

I'm busy for a few months

Hey everyone,

Thanks a lot for creating the issues. I'm going to be busy for the next few months, and won't be able to work on this extension during this time. Please be rest assured that I will get to every issue filed when I have time again.

Thanks

Double '>' with vector in vector error

I get an error when i use vector<vector> instead of vector<vector >. I know it's due to old version of g++ being used as a compiler, starting g++-11 would solve the issue. Is there a way to control that? I see on the README screenshots that you declare vectors in the same way.

Feature Request

  1. Please delete the temporary files generated (.testcases, .bin) after execution.
  2. Add Theming option, Auto adapt to current color scheme or option to manually change the colors.
  3. Option to clean up files and remove the Codeforces URL 1st line from files after sucessful execution.

Really a great tool, saves up lots of time. Thanks!

New test case - Pasted text is duplicating

crtl+c/ctrl+v is duplicating the text.

For example if I ctrl+c in the text:
5 1 2000 8

Then I paste the text (ctrl+v) in any input box for a new test case is duplicating to:
5 1 2000 85 1 2000 8

detect Question URL automatically using file paths.

When solving codeforces problems I personally use the Question ID like 1234C, and I am very sure many people do it that way. So I think the Question's Url can be detected by the file name itself.

Maybe you can add another settings option to ask the user if they want automatic detection and in the Description you can tell them how they need to save the file.

You can even have users input a path format and then extract the url using this info. This would be very versatile and useful as Many users use custom paths and have their own preference about the path. For example in my case when I give actual contest the path to my solution are like ~/Documents/Compi/Forces/1234/C.cpp. So I can specify in settings in some way that my path is something like ~/Documents/Compi/Forces/XXXX/Z.cpp where XXXX is contest ID and Z is question .

Also maybe you can change by which name your extension saves the new file when it creates a source code (like when we use the green plus sign on the browser).

.tcs file in different directory

I use competitive companion along with competitive programming helper. Whenever I parse a question, it creates a .cpp and a .tcs in the same directory, which doesn't looks good. Is there a way in which only the .cpp files are created in the main directory and .tcs files somewhere else?

can't parse problem

have you updated this extension ? today , parse problem using competitive companion is not working properly . for example , it's create file like this => G_Secure_Password.undefined . here file extension should be .cpp but it's undefine now. and i can't select the language .
i am using vs code in ubuntu dde 20.04

Extension Version: 4.0.0
VS Code Version: 10.1.1

Testcases Disappear

Describe the bug
After adding 2nd Test Case, if I a new Test Case is created then the previous test Case disappears.

To Reproduce
Steps to reproduce the behavior:

  1. Click Run Testcases
  2. Choose "Add testcases manually"
  3. Add two Testcases
  4. Click new Testcase

Expected behavior
Previous Testcases disappear

Screenshots
testcases

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox
  • Version 3.4.5

Populate newly generated file from Competitive Companion with my default template

Is your feature request related to a problem? Please describe.
Currently, with Competitive Companion, it generates a new empty .cpp file.
However, I would like to populate it with my default template for cp.

Describe the solution you'd like
I would expect settings variable, where I will give the path of my .cpp file from which you can take contents and paste every time a new file is created.

Run Testcases Flow Issue

When I press "Run Testcases" It asks me to create new test cases or download from URL. If I choose URL option. It asks for URL, I entered the URL and hit Enter. Process Stops here, I have to press "Run Testcase" again to make it work and check for testcases and show result. Can you make this flow continuous, so that I don't have to press "Run Testcases" 2 times.

Empty "Received Output"

Extension Version: 4.0.3
VS Code Version: 1.46.1

Your program looks great, but it doesn't work on my vscode with Python.
empty_output
When I put "Run All", field "Received Output" is empty.
When I click "Run Testcases" still is empty.
When I put Ctrl+Shift+B I see "No bulid taks to run".

[Feature request] Python Support

Recently @karan221 had suggested in an issue to add Python support into competitive-programming-helper. Many people use Python to solve their daily programming challenges. I also needed to solve some problems in recent CodeForces contest using Python.
So I think add Python support is an awesome suggestion.

Copy-paste not working properly

Issue Type: Bug

When i copy paste testcases from codeforces/codechef it gets copied twice. I have checked and its not my pc's/codeforces issue. It would be great if its fixed asap. Thanks.

Extension version: 4.1.0
VS Code version: Code 1.47.0 (d5e9aa0227e057a60c82568bf31c04730dc15dcd, 2020-07-09T08:02:06.629Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.92GB (9.94GB free)
Process Argv
Screen Reader no
VM 50%

i want to load my template always and choose c++ as default langauge

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

To Ignore "Online_Judge" lines (C++)

Most online judges ignore the following lines written below :-

#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin) ;
freopen("output.txt", "w", stdout) ;
#endif

Currently "cph" throws an error when the following lines are present.
It would be really nice and convenient to have it fixed.

Thanks!

NOT parsing task

Before update it was working fine but after the latest update it's not parsing task idk why?

Enhancement

  1. It will be good if after clicking on the competitive companion button it will redirect to the VSCode directly.

  2. There should be a verdict which shows all test passed. It can be like All test Passed in visible green font. And if not it should show 1, 3 passed 2, 4 failed.

  3. There should be the visible green color for passed and visible red color for failed and visible yellow color.

  4. After clicking ctrl+alt+b it should make object file of that file name like It the file name is main.cpp, It should make object file of main so that we can externally run the code by the command ./main < input.txt

Most important make color visible. Green color should be like the Welcome button color on this repo homepage.

Wrong expected output and verdict

I am getting random expected result and hence random passed and failed verdicts with my code. I have checked that the output should pass for the given test case.
For no change in code I got these different outputs just by running testcases again.
test1
test2
test3
test4

Though I know there should not be any relation to what the code is yet I link it here
C_Adding_Powers.txt

Judging by the lack of issues, I believe there is some problem on my end so help me with that.

Random Test case generator

Can there be a way to generate testcases randomly as per the constraints given in the problem.
It will be very useful because sometimes there is not much time to generate manually and hence can save valuable time,
Also there can be a option to generate boundary conditions like n=0 or n is at extreme points,

Lower Performance

Extension Version: 4.10
VS Code Version: 1.47.2

There are some performance issues with this version. It has become slower than previous versions.

Longer Loading Time

Pasting large test cases of about 1e6 lines takes about 20 seconds. It wasn't this large in previous versions.

Judge Results tab takes longer time to load. With small test cases it can be observed but it's not significant. But with large test cases, it takes almost similar time as pasting. If there are multiple such testcases the loading time adds up. e.g If there are two large testcases it takes 2x time to load.

Again, on clicking Run All or the run again button there is a similar loading time more than the actual execution time of program.

Outputs and Verdicts disappear

While working with multiple files at the same time, outputs and verdicts disappear for the test cases when you open another file. If you open a file which is not associated with test cases, the Judge tab closes and on switching back it loads again without outputs. That is unwanted.
Frequently switching between files makes small load times significant.

c++ for msvc

as i press + button it creates file and when i run test case it runs for python but in c++ if i click on run test case nothing happens .

undefined reference to main

When I click run tests after parsing task, I get the error "in function _start undefined reference to main"
Extension Version: 2.17.0
VS Code Version: cd9ea648

how to increase time limit

sir after 10 seconds my programme stops.how to increase maximum time of execution

Extension Version:
VS Code Version:

Auto Focus back to code.

Is your feature request related to a problem? Please describe.
Whenever I run test cases the focus gets shifted from my code to the extension window!

Describe the solution you'd like
There should be a flag to run the test case and keep the focus in the code window.

Describe alternatives you've considered
A saw this feature implemented in Code Runner!

ctrl+alt+B Gives build error

Pressing ctrl+alt+B gives error main not found (program has main and run perfectly when independently run on terminal). But clicking on run button near testcase gives no error.
This happens before first run. Once file is run using "Run" button then next time ctrl+alt+B works fine for that file
Screenshot from 2020-07-08 17-40-39

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.