Advertisement
erfanul007

CF API

Oct 28th, 2021
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. import requests
  2.  
  3. response1 = requests.get("https://codeforces.com/api/user.status?handle=erfanul007&from=1&count=2000")
  4. submission1 = response1.json()['result']
  5.  
  6. user1 = dict()
  7.  
  8. for val in submission1:
  9.     if val['verdict'] == 'OK' and 'rating' in val['problem']:
  10.         problemID = str(val['problem']['contestId']) + val['problem']['index']
  11.         user1[problemID] = val['problem']['rating']
  12.  
  13. # print(user1)
  14.  
  15. response2 = requests.get("https://codeforces.com/api/user.status?handle=el.duivel&from=1&count=2000")
  16. submission2 = response2.json()['result']
  17.  
  18. user2 = dict()
  19.  
  20. for val in submission2:
  21.     if val['verdict'] == 'OK' and 'rating' in val['problem']:
  22.         problemID = str(val['problem']['contestId']) + val['problem']['index']
  23.         user2[problemID] = val['problem']['rating']
  24.  
  25. # print(user2)
  26.  
  27. unqsub = list()
  28.  
  29. for subs in user1:
  30.     if subs not in user2 and user1[subs] >= 2000:
  31.         unqsub.append(subs)
  32.  
  33. print(unqsub)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement