Gediminas's blog

By Gediminas, history, 7 years ago, In English

Hello! It's the end of the year and I have a lot of free time so I decided to play with CF api and create some statistical tables. (Sorry for mistakes)
In 2017 CF hosted 151 official contests, 106 of them were rated. Each rated contest on average attracted 2700 participants.
Currently there are 121957 rated users. In 2017 about 20000 users joined this amazing community! 372 of them now are in Div. 1. We have:

Rank#%
newbies1321910,84%
pupils4349635,67%
specialists4136833,92%
experts1725114,15%
candidate masters53774,41%
masters5270,43%
international masters3020,25%
grandmasters2670,22%
international grandmasters1230,10%
legendary grandmasters270,02%
Thanks for MikeMirzayanov for maintaining this site!
And happy New Year!

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

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice job, Sir!

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi I believe that your statistics are wrong! A lot of people became legendary grandmasters today for no reason and no one knows it why, maybe Magic? At least 10% is legendary grandmaster today.

»
7 years ago, # |
  Vote: I like it -6 Vote: I do not like it

I hate pupils

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

My Python 3 code to do queries:

import requests, hashlib, time, random, string, urllib, collections, json
import pickle, os.path
import sys, time
from time import sleep

class CFApi:
	key = 'ApiKey'
	secret = 'ApiSecret'
	apiurl = '//codeforces.com/api/'

	def CreateUrl(method, parameters = {}):
		seed = ''.join(random.choice(string.ascii_lowercase) for x in range(6))
		parameters['apiKey'] = CFApi.key
		parameters['time'] = str(int(time.time()))
		parameters['lang'] = 'en'
		param = collections.OrderedDict(sorted(parameters.items()))
		parameters['apiSig'] = seed + hashlib.sha512((seed+'/'+method + '?' + urllib.parse.urlencode(param)+'#'+CFApi.secret).encode()).hexdigest()
		return CFApi.apiurl + method + '?' + urllib.parse.urlencode(parameters)

	def GetJsonResult(method, parameters={}):
		try:
			t = (requests.get(CFApi.CreateUrl(method, parameters))).json()
			CFApi.lastcall = time.time()
			if t['status']!='OK':
				print(t)
				return None
			r = t['result']
			return r
		except Exception as e:
			print('{}: {}'.format(e.__class__.__name__, e), file=sys.stderr)
#Usage:
contests = CFApi.GetJsonResult('contest.list', {'gym': 'false'})