Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # from dust i have come, dust i will be
- import urllib.request
- import json
- you = input("what is your cf handle?\n")
- other = input("what is the handle of the user you want to follow?\n")
- # from the first submission to 5k th submission
- # number of total submission is unknown, therefore we take 5k
- # =============================================================================
- url = "https://codeforces.com/api/user.status?handle=" + you + "&from=1&count=5000"
- res = urllib.request.urlopen(url)
- res_body = res.read()
- j = json.loads(res_body.decode("utf-8"))
- X = set()
- m1 = 0
- for subs in j["result"]:
- if subs["verdict"] == "OK":
- temp = subs["problem"]
- try:
- s = str(temp["contestId"]) + temp["index"] + ". " + temp["name"]
- X.add(s)
- except:
- m1 += 1
- # =============================================================================
- # =============================================================================
- url = "https://codeforces.com/api/user.status?handle=" + other + "&from=1&count=5000"
- res = urllib.request.urlopen(url)
- res_body = res.read()
- j = json.loads(res_body.decode("utf-8"))
- Y = set()
- m2 = 0
- for subs in j["result"]:
- if subs["verdict"] == "OK":
- temp = subs["problem"]
- try:
- s = str(temp["contestId"]) + temp["index"] + ". " + temp["name"]
- Y.add(s)
- except:
- m2 += 1
- cnt = 0
- f = open("output.txt", "w")
- for key in Y:
- if key not in X:
- f.write(key + "\n")
- cnt += 1
- # =============================================================================
- '''
- you may want to solve those problems that an user have solved but
- you haven't. just enter your handle, handle of that user, and this code will generate
- a txt file with the list of the problems
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement