Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0

ac_prolst = []
for i in range(len(ps_lst)):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]
    if answer=='AC':
        ac_prolst.append(number)
ac_lst = list(set(ac_prolst))

ps_dic = {}
for i in range(m):
    number = ps_lst[i][0]
    if number in ac_lst:
        tmp_dic = {number: 'WA'}
        ps_dic.update(tmp_dic)

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if number in ac_lst:
        if answer == 'AC' and ps_dic[number] == 'WA':
            ac_count += 1
            tmp_dic = {number: 'AC'}
            ps_dic.update(tmp_dic)
        elif answer == 'WA' and ps_dic[number] == 'WA':
            wa_count += 1

print('{} {}'.format(ac_count, wa_count))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ps_lst = [list(map(str, input().split())) for _ in range(m)]
    judge_lst = [0] * n
    penalty_lst = [0] * n
    correct = 0
    penalty = 0

    for i in range(m):
        problem = int(ps_lst[i][0]) - 1
        result = ps_lst[i][1]
        
        if judge_lst[problem] == 0:
            if result == 'AC':
                judge_lst[problem] = 1
            else:
                penalty_lst[problem] += 1

    for i in range(n):
        if judge_lst[i] == 1:
            correct += 1
            penalty += penalty_lst[i]
            
    print(correct, penalty)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0

ac_prolst = []
for i in range(len(ps_lst)):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]
    if answer=='AC':
        ac_prolst.append(number)
ac_lst = list(set(ac_prolst))

ps_dic = {}
for i in range(m):
    number = ps_lst[i][0]
    if number in ac_lst:
        tmp_dic = {number: 'WA'}
        ps_dic.update(tmp_dic)

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if number in ac_lst:
        if answer == 'AC' and ps_dic[number] == 'WA':
            ac_count += 1
            tmp_dic = {number: 'AC'}
            ps_dic.update(tmp_dic)
        elif answer == 'WA' and ps_dic[number] == 'WA':
            wa_count += 1

print('{} {}'.format(ac_count, wa_count))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ps_lst = [list(map(str, input().split())) for _ in range(m)]
    judge_lst = [0] * n
    penalty_lst = [0] * n
    correct = 0
    penalty = 0

    for i in range(m):
        problem = int(ps_lst[i][0]) - 1
        result = ps_lst[i][1]
        
        if judge_lst[problem] == 0:
            if result == 'AC':
                judge_lst[problem] = 1
            else:
                penalty_lst[problem] += 1

    for i in range(n):
        if judge_lst[i] == 1:
            correct += 1
            penalty += penalty_lst[i]
            
    print(correct, penalty)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0


ps_dic = {}
for i in range(m):
    number = ps_lst[i][0]
    tmp_dic = {number:'WA'}
    ps_dic.update(tmp_dic)

wa_dic = {}
for i in range(m):
    number = ps_lst[i][0]
    tmp_dic = {number:0}
    wa_dic.update(tmp_dic)

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if answer=='AC' and ps_dic[number]=='WA':
        ac_count += 1
        tmp_dic = {number:'AC'}
        ps_dic.update(tmp_dic)
    elif answer=='WA' and ps_dic[number]=='WA':
        wa_dic[number] += 1

for i in range(len(ps_dic)):
    pslst = list(ps_dic.items())
    walst = list(wa_dic.items())
    if pslst[i][1]=='AC':
        wa_count += walst[i][1]

print('{} {}'.format(ac_count, wa_count))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ps_lst = [list(map(str, input().split())) for _ in range(m)]
    judge_lst = [0] * n
    penalty_lst = [0] * n
    correct = 0
    penalty = 0

    for i in range(m):
        problem = int(ps_lst[i][0]) - 1
        result = ps_lst[i][1]
        
        if judge_lst[problem] == 0:
            if result == 'AC':
                judge_lst[problem] = 1
            else:
                penalty_lst[problem] += 1

    for i in range(n):
        if judge_lst[i] == 1:
            correct += 1
            penalty += penalty_lst[i]
            
    print(correct, penalty)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ps_lst = [list(map(str,input().split())) for _ in range(m)]
ac_count = 0
wa_count = 0

pc_dic = {}
for i in range(m):
    number = ps_lst[i][0]
    tmp_dic = {number:'WA'}
    pc_dic.update(tmp_dic)

for i in range(m):
    number = ps_lst[i][0]
    answer = ps_lst[i][1]

    if answer=='AC' and pc_dic[number]=='WA':
        ac_count += 1
        tmp_dic = {number:'AC'}
        pc_dic.update(tmp_dic)
    elif answer=='WA' and pc_dic[number]=='WA':
        tmp = 0
        for j in range(m):
            if ps_lst[j][0]==number and ps_lst[j][1]=='AC':
                tmp = 1
                break
        if tmp==1:
            wa_count += 1

print('{} {}'.format(ac_count, wa_count))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ps_lst = [list(map(str, input().split())) for _ in range(m)]
    judge_lst = [0] * n
    penalty_lst = [0] * n
    correct = 0
    penalty = 0

    for i in range(m):
        problem = int(ps_lst[i][0]) - 1
        result = ps_lst[i][1]
        
        if judge_lst[problem] == 0:
            if result == 'AC':
                judge_lst[problem] = 1
            else:
                penalty_lst[problem] += 1

    for i in range(n):
        if judge_lst[i] == 1:
            correct += 1
            penalty += penalty_lst[i]
            
    print(correct, penalty)


if __name__ == '__main__':
    main()