-is-this-fft-'s blog

By -is-this-fft-, history, 3 years ago, In English

Hi!

I like doing virtual contests. As it stands, I am quickly running out of contests (especially non-ancient ones) on Codeforces, Atcoder and CSAcademy. So, CodeChef would be the next logical place.

However, it seems that there is no option to do that on CodeChef. Since there are always new blogs about tools for competitive programming, I was wondering if someone had already made this or if someone knows of a service like this.

Some things I have looked into:

  • vjudge doesn't really fit the bill, it seems that it is intended more as a "create cross-platform mashups" type of thing. My issues:
    • You need to manually create the contest unless someone else has already done it.
    • Can't look at "the number of people who solved the problem up to this point in time" — this part is important to me.
    • Can't look at "scoreboard at this point in time" — this part is less important.
  • This project seems to be exactly what I'm looking for. However, 149.129.139.145 is down. I'm thinking about hosting this myself (probably not publicly), but I'm not sure I can. They use OAuth to authenticate (and use the bearer token in all subsequent requests to the CodeChef API), and I don't have valid credentials to do that. They do actually have an OAuth client secret pushed to the repo (:O), but when I try using that, the client id is invalid.
  • Writing one myself — it probably wouldn't be very hard to do, but I kind of run into the same problem as above: I can't access the CodeChef API. Web-scraping is also an option, but it isn't exactly pleasant, especially on CodeChef.

To summarize, I have two questions:

  • Does anyone know of such a service?
  • Does anyone have experience with getting access to CodeChef API? Do they just give access to anyone who asks? Do they reply to emails if I write?

Update

Thanks to the recommendation of vjudge, I have found a solution: to fetch ranklists from Codechef and upload them as replays on vjudge. As proof of concept, I have uploaded replays of the last contest:

I tried participating in Div. 1 this morning and was satisfied.

The Div. 2 and Div. 3 ranklists are truncated, featuring only the top 2000 participants. This is a vjudge limitation. Maybe it is better to randomly sample the participants, to get a better feel of "number of solvers"? Let me know what you think.

To participate in them virtually, you need to press the clone button on vjudge: you can then set the start date of the clone to the future and participate. You will be able to see the ranklist as it was at that point, any time during your participation, just like you can on Codeforces gyms and virtuals.

I will try to upload all Cook-Offs to vjudge in the coming days.

  • Vote: I like it
  • +127
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +28 Vote: I do not like it

API. Codechef just killed their API a year ago. Then they introducing captcha literally everywhere. Eventually, codechef rating predictors were also killed. Scrapping their ranklist would be difficult.
Ranting predictor blog

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

I wrote a CodeChef problem scraper for cp-notes so I have a tiny bit of experience with the 2nd question.

It's possible to access all contests and problems via CodeChef's private API. For example, this endpoint will give all problems for a given contest code: https://www.codechef.com/api/contests/LTIME21

On the other hand, I believe all submission information is rendered server-side, so it's likely that they don't have an API endpoint for this information. But it looks fairly easy to scrape, it's in a large nicely paginated table. For example: https://www.codechef.com/status/KTTREE?page=1

cp-notes also has an API which sends very basic problem and contest info for a bunch of platforms lol, so you could use this to get the problem codes. It updates every 2 hours.

https://5ktb1hi8c7.execute-api.us-east-1.amazonaws.com/prod/contests?platform=CodeChef https://5ktb1hi8c7.execute-api.us-east-1.amazonaws.com/prod/problems?platform=CodeChef

To get the problems present in a particular contest, you'll have to use my self-created contest IDs tho. For example, https://5ktb1hi8c7.execute-api.us-east-1.amazonaws.com/prod/problems?platform=CodeChef&contestId=369@MAY21C

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    That endpoint is not working for all https://www.codechef.com/api/contests/LTIME95

    It is not returning Problems.

    Their Architecture is weak I guess!!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It's possible to access all contests and problems via CodeChef's private API. For example, this endpoint will give all problems for a given contest code: https://www.codechef.com/api/contests/LTIME21

    Yeah, I figured that out, there is a similar API for ranklist which is more or less what I need (I can kind of reconstruct status at any given moment from that, although I lose access to "when were WA submissions made" :/). If I make too many requests in a row, I get a CAPTCHA (from a json endpoint!), but hopefully if I take things slower, it can actually work. Luckily, I can keep all data locally, so there is no need to make frequent requests frequently.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +38 Vote: I do not like it

      In fact I've implemented your idea.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        Oh, thank you, this is perfect! Now I can just fetch CodeChef ranklists and upload them to your site. I was already preparing to write my own virtual contest engine.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          If you have a script to export Codechef ranklists, do share.

»
3 years ago, # |
  Vote: I like it +27 Vote: I do not like it

Is there a way to give kickstarts as virtual contests?

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Auto comment: topic has been updated by -is-this-fft- (previous revision, new revision, compare).