<gh_stars>0
import pickle

data = pickle.load(open('../data/record.pk', 'rb'))
namedict = pickle.load(open('../data/namedict.pk', 'rb'))
rndict = {v:k for k, v in namedict.items()}
pickle.dump(rndict, open('../data/rndict.pk', 'wb'))
cnt_name = {v:[0, 0, 0] for v in namedict.values()}
for record in data:
    for a in record[2]:
        cnt_name[a][0] += 1
        cnt_name[a][1] += 1
    for a in record[4]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1
    for a in record[6]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1
    for a in record[8]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1

a = [[v[2], k] for k, v in cnt_name.items()]
a.sort(reverse=True)
good_list = []
for cnt, id in a:
    name = rndict[id]
    ok = True
    if name.find('@') != -1: ok = False
    if name.upper().find('HACKINGTEAM') != -1: ok = True
    if ok: good_list.append(id)
temp = []
for id in good_list:
    if (cnt_name[id][1] >= 3 and cnt_name[id][2] >= 5):
        print(cnt_name[id], id, rndict[id])
        temp.append(id)
# print(len(temp))
# print(len(good_list))

# inf = open('../data/list.txt', 'r')
# lines = inf.readlines()
# print(len(lines))
# cnt = 0
# for line in lines:
#     [idf, idt, time] = line.split(' ')
#     idf = int(idf)
#     idt = int(idt)
#     time = int(time)
#     if idf in temp and idt in temp:
#         cnt += 1
# print(cnt)


#	3d display for initial list
tempf1 = open('../data/temp1.txt', 'w')
tempf2 = open('../data/temp2.txt', 'w')
tempf3 = open('../data/temp3.txt', 'w')
for k, v in cnt_name.items():
    if k in temp:
        tempf1.write('%d %d %d\n' % (v[0], v[1], v[2]))
    elif k in good_list:
        tempf3.write('%d %d %d\n' % (v[0], v[1], v[2]))
    else:
        tempf2.write('%d %d %d\n' % (v[0], v[1], v[2]))
        print([rndict[k]] + v)
print(len(temp))
import pickle

data = pickle.load(open('../data/record.pk', 'rb'))
namedict = pickle.load(open('../data/namedict.pk', 'rb'))
rndict = {v:k for k, v in namedict.items()}
pickle.dump(rndict, open('../data/rndict.pk', 'wb'))
cnt_name = {v:[0, 0, 0] for v in namedict.values()}
for record in data:
    for a in record[2]:
        cnt_name[a][0] += 1
        cnt_name[a][1] += 1
    for a in record[4]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1
    for a in record[6]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1
    for a in record[8]:
        cnt_name[a][0] += 1
        cnt_name[a][2] += 1

a = [[v[2], k] for k, v in cnt_name.items()]
a.sort(reverse=True)
good_list = []
for cnt, id in a:
    name = rndict[id]
    ok = True
    if name.find('@') != -1: ok = False
    if name.upper().find('HACKINGTEAM') != -1: ok = True
    if ok: good_list.append(id)
temp = []
for id in good_list:
    if (cnt_name[id][1] >= 3 and cnt_name[id][2] >= 5):
        print(cnt_name[id], id, rndict[id])
        temp.append(id)
# print(len(temp))
# print(len(good_list))

# inf = open('../data/list.txt', 'r')
# lines = inf.readlines()
# print(len(lines))
# cnt = 0
# for line in lines:
#     [idf, idt, time] = line.split(' ')
#     idf = int(idf)
#     idt = int(idt)
#     time = int(time)
#     if idf in temp and idt in temp:
#         cnt += 1
# print(cnt)


#	3d display for initial list
tempf1 = open('../data/temp1.txt', 'w')
tempf2 = open('../data/temp2.txt', 'w')
tempf3 = open('../data/temp3.txt', 'w')
for k, v in cnt_name.items():
    if k in temp:
        tempf1.write('%d %d %d\n' % (v[0], v[1], v[2]))
    elif k in good_list:
        tempf3.write('%d %d %d\n' % (v[0], v[1], v[2]))
    else:
        tempf2.write('%d %d %d\n' % (v[0], v[1], v[2]))
        print([rndict[k]] + v)
print(len(temp))
# print(len(temp)) # print(len(good_list)) # inf = open('../data/list.txt', 'r') # lines = inf.readlines() # print(len(lines)) # cnt = 0 # for line in lines: #     [idf, idt, time] = line.split(' ') #     idf = int(idf) #     idt = int(idt) #     time = int(time) #     if idf in temp and idt in temp: #         cnt += 1 # print(cnt) #	3d display for initial list