https://school.programmers.co.kr/learn/courses/30/lessons/92334
def solution(id_list, report, k):
report=set(report)
check={}
result=[0]*len(id_list)
for i in report:
a,b=i.split()
if b not in check:
check[b]=a
else:
c=check[b]
check[b]=c+" "+a
for i in check:
d=check[i]
if d.count(" ")>=k-1:
e=list(d.split())
for i in e:
f=id_list.index(i)
result[f]+=1
return result
def solution(id_list, report, k):
answer = [0] * len(id_list)
reports = {x : 0 for x in id_list}
for r in set(report):
reports[r.split()[1]] += 1
for r in set(report):
if reports[r.split()[1]] >= k:
answer[id_list.index(r.split()[0])] += 1
return answer