Блог пользователя Jasperr

Автор Jasperr, история, 6 лет назад, По-английски

Hi! After releasing CHelper Companion as an alternative to the original CHelper extension six months ago, development has been ongoing and CHelper Companion has "evolved" into Competitive Companion.

Competitive Companion is a browser extension for Chrome and Firefox that can parse problems and contests and extract the useful data. This includes things like time/memory constraints and sample test cases. While CHelper Companion was only capable of sending this data to CHelper, Competitive Companion works with pretty much all popular tools. Next to that, Competitive Companion is also capable of sending the data to your private tools, without requiring a complex setup.

Using it is very simple. Just install the extension, make sure you got one of the supported tools open, navigate to a problem page and click on the green plus icon in the top-left of your browser. On websites where Competitive Companion is able to parse contests, navigating to the page with all the problems and clicking on the green plus icon will download and parse all problems in the contest at once. You can also use the shortcut Ctrl+Shift+U instead of the green plus icon.

At the moment, Competitive Companion can send parsed problem data to the following tools:
- acmX
- AI Virtual Assistant
- AutoCp
- Caide
- CHelper
- Competitive Programming Gradle Plugin
- Competitive Programming Helper
- CompetiTest.nvim
- CP Editor
- cpbooster
- cphelper.nvim
- Hightail
- JHelper
- Mind Sport
- Red Panda Dev-C++
- rust-competitive-helper
- Any other tool that can parse the data that is being sent, read more about that in the README on GitHub, and have a look at the example project here.

Competitive Companion includes parsers for the following websites:

Website Problem parser Contest parser
33OJ
A2 Online Judge
ACMP
AcWing
Aizu Online Judge
Algotester
AlgoZenith
Anarchy Golf
AtCoder
Baekjoon Online Judge
BAPS OJ
beecrowd
Bloomberg CodeCon
BUCTOJ
CodeChef
CodeDrills
Codeforces
CodeMarshal
COJ
Contest Hunter
CPython.uz
CS Academy
CSES
CSU-ACM Online Judge
CYEZOJ
Daimayuan Online Judge
Dimik OJ
DMOJ
DOMjudge
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
InfoArena
ITCoder HUTECH
Jutge
Kattis
Kilonova
Lanqiao
Le Quy Don Online Judge
Library Checker
LibreOJ
LightOJ
LSYOI
Luogu
Mendo
Meta Coding Competitions
MOI Arena
mrJudge
MSK Informatics
NBUT Online Judge
Neps Academy
NerdArena
Newton School
NOJ
NowCoder
NYTD Online Judge
oiClass
omegaUp
OpenJudge
OTOG
Panda Online Judge
PBInfo
PEG Judge
POJ
PTA
Public Judge
QBXTOJ
QDUOJ
QQWhale
RoboContest
SDUT OnlineJudge
SeriousOJ
Sort Me
SPOJ
SSOIER
TheJobOverflow
Timus Online Judge
TLX
Toph
uDebug
Universal Cup
UOJ
USACO
USACO Training
UVa Online Judge
Virtual Judge
VNOI Online Judge
Yandex
XXM
yukicoder
ZOJ
ZUFEOJ

Competitive Companion's source code can be found on GitHub. Releases are pushed to both the Chrome Web Store and Mozilla Add-Ons.

Feedback, bug reports and feature requests are all very welcome!

  • Проголосовать: нравится
  • +47
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Feature Request I think adding a keyboard shortcut for parsing problem would be great.

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Great idea, I released an update which adds the keyboard shortcut Ctrl+Shift+U to parse problems/contests, it should be available in a few minutes. Whenever the green plus icon is visible, that shortcut will work too.

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Forgive my ignorance but I'm new to this tool.

What exactly happens when we click on the Green Button on a contest page? I can see a green bar sliding across the top, guessing this is the page being parsed? But what now? How do we use it now?

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +10 Проголосовать: не нравится

I have just released version 2.3.0, which is one of the biggest updates so far. It includes several bug fixes and parsers for 11 more online judges, including two that I have been wanting to add for a long time: UVa Online Judge and ICPC Live Archive.

I do want to clarify two things regarding this update though:
1. The extension's size has gone up from 35kb to 660kb. This has to do with a new library, PDF.js, that I needed to add in order to be able to extract the sample testcases from the PDF files on UVa Online Judge and ICPC Live Archive.
2. The extension will now request permission to "access your data for all websites". This does not mean that the extension spies on you: it will never do that. If you don't trust me, feel free to take a look at the code on GitHub. This change was necessary in order to better support sites like HackerRank which use the browser's history api to let you navigate over their website instead of using normal links.

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For some reason using this extension with CHelper, it parses task fine. However when I run my code as I normally do, I get following:

Exception in thread "main" java.lang.ClassNotFoundException: my.ETrialForChief
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:339)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:265)
	at net.egork.chelper.tester.NewTester.test(NewTester.java:81)
	at net.egork.chelper.tester.NewTester.main(NewTester.java:34)

I do not have this issue with tasks created by the CHelper chrome plugin, however those do not parse the testcases correctly ...

Does anybody have any advice on what I am doing wrong? Thanks!

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you add LeetCode please their ide is very slow

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    Unfortunately, LeetCode cannot be added. This is because LeetCode forces solutions to be written in a pre-defined method with a pre-defined signature (method parameters and return type), which is something that Competitive Companion does not support. The chances of it being implemented in the future is pretty low, considering how none of the publically available tools that Competitive Companion sends data to are capable of handling such constraints at the moment.

    Besides that, LeetCode doesn't seem to have any structure in their problem descriptions, which makes it pretty much impossible to parse something like the sample testcases.

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you add vjudge.net problems and contests?

  • »
    »
    6 лет назад, # ^ |
    Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится

    I have just released version 2.5.0 which adds a problem parser for Virtual Judge. Your browser should auto-update within 24 hours.

    Unfortunately, I could not find a way to parse all problems in a contests at once due to how Virtual Judge renders contest problems dynamically. You can however parse all problems in a contest separately, just like how you would parse out-of-contest problems.

    It's also worth noting that while the problem parser can parse the sample testcases for a lot of problems, it will not work correctly for all of them. This is because Virtual Judge does not have a standarized format for problem descriptions, so the extension has to look for signs of sample testcases like <pre> and <span style="font-family: some-monospace-font;"> tags. This isn't a rock-solid solution, but it works for the majority of the problems. Feel free to create an issue on GitHub when you find a problem that isn't parsed correctly.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi Jasperr,

I think it would be nice if we can set the name of taskClass to the problem'ID, but not the actual name of the it. For example, for this problem, taskClass can be named "1A", but not "ATheatreSquare".

Thank you for this awesome tool.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Thanks for the suggestion, but I'm not planning on changing this. I think "AThreatreSquare" is better than "1A" when you're participating in a contest with multiple problems. Especially when having to differentiate between different problems having the full name instead of just the letter can be very helpful.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Does anybody know a similar extension for Safari on MacOS?

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

2 small issues: 1. USACO Training requires Java submissions to have the class name of the taskid. Could you implement that? 2. I think Competitive Companion is having troubles with parsing the sample input and output for UVa. Could you fix that? Thanks!

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I have just fixed the USACO Training issue you mentioned. I'll look into the UVa issue later this week because UVa seems to be down right now, and I'll publish a new release once that's done.

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Ok sure thanks! If UVa is giving you Joomla! This site is temporarily unavailable, it is an issue on their behalf. They seem to run a server check or something that causes their website to be down for around an hour at this time. Check again later. Thanks for your support though!

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I just tried using 2.17.2 on https://www.facebook.com/codingcompetitions/hacker-cup/2020/qualification-round/problems/A and it said there was an error.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    That's odd, I released 2.17.2 about a week ago to make the extension work with the Facebook Coding Competitions platform with the upcoming Qualification Round you linked. When I released it everything seemed to work fine on archived problems, so either the live problems are displayed somewhat differently or the platform as a whole got some last-minute updates in preparation of the Qualification Round.

    Either way, I am on vacation right now so I'll have a look at it at the beginning of next week.

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Sounds great, I hope you enjoy your vacation! Thanks for making Competitive Companion, it really makes problem-solving a lot more fun and frictionless.

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I'm also getting the same issue. Here's the error from my browser console:

        content.js:215 TypeError: Cannot read property 'querySelector' of null
            at common.js:5678
            at Array.map (<anonymous>)
            at FacebookCodingCompetitionsProblemParser.<anonymous> (common.js:5678)
            at Generator.next (<anonymous>)
            at common.js:5652
            at new Promise (<anonymous>)
            at push.__awaiter (common.js:5648)
            at FacebookCodingCompetitionsProblemParser.parse (common.js:5666)
            at content.js:211
            at Generator.next (<anonymous>)
        

        Nevertheless, enjoy your vacation! Thanks so much for such an amazing tool!

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Fixed in 2.17.3 which has just gone live. It has already been approved on Mozilla's AMO but is still pending approval in the Chrome Web Store, so depending on which browser you use it may take a few days until you receive the update.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hello Jasperr,
I believe there is an issue when trying to parse FHC problems with Competitive Companion.

When trying to parse this problem, Competitve Companion gave:

Spoiler

(I apologize for the quality, I had to take a screenshot of my terminal :P)

Nevertheless, notice the "input" category. It gives the type as file but it should be a regex expression. Please fix this, thanks.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    You're right, I forgot to change that when I switched it from fileName to pattern (I removed the regex type 1.5 years ago). This is fixed in 4904656 which will be released in the next few days.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi, I am using Competitive Companion in conjunction with Caide (VS extension). Normally this setup works very well, and thanks so much for maintaining the Companion.

However, I recently faced an issue when parsing any problem from Facebook Hacker Cup. I am getting the following error on Caide side: Could not parse input JSON: Error in $: key "result" not found

I am not sure if this is a problem on the Caide side or in the Competitive Companion, so I'll just report it in both threads.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone tell me how to use it. I am using sublime text. When i click on the + button on a problem page(after installing the chrome extension). A green arrow kind of thing passes from left to right and nothing happens. I would appreciate if someone can tell me what wrong am i doing?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Competitive Companion only parses problems and sends the extracted data to external tools like CHelper, JHelper, Hightail, acmX and others. If you don't have a tool that listens for Competitive Companion data running, then clicking on the + button does nothing.

    Because it's not clear from your comment whether you are already using a tool which listens for Competitive Companion data:
    - If you are using such a tool and nothing happens when you press on the + button, send a bug report to the developer of the tool you're using.
    - If you are not using such a tool you'll have to start using one if you want to make use of Competitive Companion. For Sublime Text the combination of FastOlympicCoding and FastOlympicCodingHook should work (note that neither of those tools are made by me so I can't provide support for them).

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

How to use this in Vim ?

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Hi Jasperr, I've noticed that Competitive Companion fails to parse old USACO problems (before the 2015-2016 contest season). Consider this problem, for example. The error message follows:

TypeError: Cannot read property 'textContent' of null
    at USACOProblemParser.<anonymous> (common.js:20082)
    at Generator.next (<anonymous>)
    at common.js:20054
    at new Promise (<anonymous>)
    at push.6785.__awaiter (common.js:20050)
    at USACOProblemParser.parse (common.js:20075)
    at content.js:58
    at Generator.next (<anonymous>)
    at content.js:15
    at new Promise (<anonymous>)
(anonymous) @ content.js:62
»
4 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Is it possible to add https://tlx.toki.id parsing?

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I think the extension bugs on Codeforces for importing test cases due to the recent changes in mutiple test cases display. Would be grateful if you could fix it please

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes please fix the extension for Codeforces. It was so helpful. Now it's quite painful to manually copy and match the outputs.

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Parsing a problem creates a new file in Vscode editor. It would be helpful if Problem name, OJ name, Time and Space limit etc. information is inserted in the file before i start writing code. CP Editor has this feature.

// Problem: F - Everyone Loves to Sleep
// Contest: Virtual Judge - implement_it [Cloned]
// URL: https://vjudge.net/contest/562163#problem/F
// Time Limit: 2000 ms Memory Limit: 256 MB
// Parsed at: 2023-06-07 07:50:14

Also, it would be great if we can change which info to be inserted and how they are displayed.

  • »
    »
    9 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    There is a setting to edit the information on CP Editor in the Extensions > Competitive Companion tab (i don't know how to use it though).

    I think the information being displayed or not is based on your IDE and extensions.

  • »
    »
    8 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    This is a feature request you should send to the developer(s) of the VS Code extension you're using. Competitive Companion only parses problem pages and sends the parsed data to external tools (like CP Editor and your VS Code extension), what these tools decide to do with it (like creating files with template code) is up to them.