CodeChef Rating Predictor using Python3

Hello Everyone, me and thenewguy39 have been working on this CodeChef Rating Calculator/Predictor. So, if you do not want to wait for a day before rating changes get reflected you may give this a try.

Also we are still working on improving the accuracy. Presently we still have around 5-15% relative error for the changes. Feel free to go through the code and do suggest improvements.


P.S This is quite slow because CodeChef doesn’t have an API and we have to scrape each user in the rank-list once. So for a contest(except Div 2 Long Challenge) initial loading time is ~15mins even in a stable network. After that changes in rankings can be updated quite fast.


Does it also gives expected rank ? Like last rating predictor used to give the rank that you should score to get 0 rating change.

No it does not print it in the .csv file that it generates but it does calculate expected rank for every user. You can print it if you want by calling the DB.ERank(string user) function in


Why don’t you host it on a platform instead ?
Why does everyone needs to use it locally when we can keep it on a online platform and everyone else can just directly have a look at generated .csv file ?
This will decrease load on Codechef server as well as will be convenient for everyone.

1 Like

Yes we can do that but I do not know how I am supposed to automate the process.
Like to run it for every rated contest. I will be glad if someone can help with that.


A simple hack would be keeping a button to run it. And don’t do anything on click if its already running.

1 Like

Add a function to scrap the current running contests and then, I think you should do modification to take contest ID as input or put an option to select contest from scraped data. And even u can add GUI to automate above tasks easily.

Maybe you can add that in csv file ( if it is not too time consuming and tough to implement ) ?
Also, can it give me my predicted rank before contests as well ? for example, I want to know now what is my predicted rank to get 0 rating change ? Is that possible as well ?

No Expected Rank depends on others in the ranklist

1 Like

Ever tried Heroku?


@noob77777 imagine you have access to codechef api. Can u explain how will you calculate rating changes?

If i have a list with ranks and user handle, what else you need? To calculate rating changes

So, at the time of contest, it can tell ?
If yes, how ?

1 Like

It will show the rating changes according to the ranklist at the time of scraping during the contest

1 Like

@anon96721856 i have something which might prove useful for this project . Can we talk?

shall we contact you through codeforces?

Sure ! My CF Handle is @SummerPark

I was thinking of working on same project and I found this

No I meant the rank that one should have to get 0 rating change. Can this be shown during the contest even without participating ?

Just to make things light,
you can use API’s to fetch live contests by CodeChef,
for instance

For the scheduling part, I think APS (Advanced Python Scheduler) should have a workaround for such cases.
I’d be happy to help.