Codeforces and Polygon may be unavailable between Aug. 17, 19:00 (UTC) to Aug. 17, 22:00 (UTC) due to planned power outages. ×

WillTheBill's blog

By WillTheBill, history, 2 months ago, In English

Hey everyone!

With inspiration from

I proudly present cfscripts. cfscripts is a collection of scripts for Codeforces that uses the cf-API to do different things.

For instance, cfscripts includes a script named What If? (yes, very fancy), which allows you to simulate Codeforces contest rating changes over time, but including virtual and unofficial contests. You can choose to include only positive rating changes (this feature is dedicated to galen_colin).
   You may ask: Why would I want to simulate Codeforces virtual ra....
   And to that I answer: It's good fun and possibly motivating. But.. if you want high cf rating, I've heard it's much better to solve a LOT of difficult problems rather than gazing upon your rating.

I should mention that even though the web-requests to the cf-API gets cached (yes, I spend the time caching requests...), it's a pretty heavy tool in terms of API usage. So.. think about the cf API before simulating your entire contest history (It should be fine ;)).

As many other cf users, I have made several scripts using the wonderful API, and I finally thought my own collection was worthy of being shared here on Codeforces. cfscripts currently includes the following scripts:

  • Comulative AC count
    • Count how many problems were solved since a specific date.
  • Daily ACs
    • Finds problems solved on each day along with their rating.
  • Range rank
    • In an official contest, where did you rank among the contestants within a given rating range around your rating (the rating at the time of participating).
  • Unsolved Contest Problems
    • Find unsolved problems from contests, where you have made at least one submission in the contest. Why? Because you don't want to spoil nice unsolved virtuals, when you just solve problems from the problemset. It handles div1/div2 contests where a problem occurs in both.
  • Virtual Performance
    • Calculate rank/delta/performance of virtual/unofficial/official contests.
  • What if?
    • What If Codeforces virtual contests / unofficial participations were official? Calculates new ratings using deltas and simulates the past $$$n$$$ contests.

Additionally, there is also a (currently) small "library" for interfacing with the cf API.

I will update this post, when more scripts are added.

cfscripts is available on github: https://github.com/willthbill/cfscripts
On the releases page you can find executables for linux/macos and windows, which should be run in a terminal.
Check out the repository for more details (ex. running with pipenv).

I will try to implement bug-fixes and other wishes you may have (to a certain extend), especially if you create an issue about it or comment on this post :D
Feel free to contribute a script (preferably in python3) or bug-fixes, by submitting a pull request (don't forget to give yourself credit).

I hope some of you may find cfscripts entertaining / useful.

Best
William

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

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

The windows application is crashing while it is fetching data.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Could you provide the error message? :)

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Do anyone else experience the application crashing?

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

      Yes. I just tried to run script number 1&2 in the Windows version, but it threw a KeyError :(

      error message
      • »
        »
        »
        »
        2 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Thanks. I believe I have fixed the issue. Would you mind trying again? The new exe is on the latest release :) Edit: Apparently, some problems are not associated with a contest.

        • »
          »
          »
          »
          »
          2 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I ran the latest exe file and ran script 4, after providing handle and rating range, it fetches some data and start displaying the problems, but before the complete list is displayed, the window closes. I am not getting any errors.

          • »
            »
            »
            »
            »
            »
            2 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I think this is because you need to run the script directly in a terminal. If you just double-click the executable from the file-explorer it will open a temporary "terminal", which will close right after it has finished. Instead you need to run a command prompt or Powershell (a terminal program) in the directory where the exe file is located and type "./cfscripts.exe" in this terminal. Hope it helps, otherwise just ask again :)

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

If you experience a crash / a bug, then I would really like to know. You can post error messages (also, it would be nice to know the things you typed before receiving the error, ex. handle, contestid...) as a reply to this comment :)