Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
s = []
ac_list = []
wa_list = [0] * n
wa_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if input_p not in ac_list:
        if input_s == 'AC':
            ac_list.append(input_p)
            wa_count += wa_list[int(input_p)-1]
        else:
            wa_list[int(input_p)-1] += 1

        
print(len(ac_list), wa_count)

Fixed submission:
n, m = map(int, input().split())
ps = [[0, 0] for i in range(n)]  
wa_count = 0
ac_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if ps[int(input_p)-1][0] <= 0:
        if input_s == 'AC':
            ps[int(input_p)-1][0] += 1
        else:
            ps[int(input_p)-1][1] += 1
for i in ps:
    if i[0] == 1:
        ac_count += 1
        wa_count += i[1]

print(ac_count, wa_count)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    input_p, input_s = input().split()
    p.append(int(input_p))
    s.append(input_s)

ac_list = []
wa_list = [0] * n
wa_count = 0
for i in range(m):
    if p[i] not in ac_list:
        if s[i] == 'AC':
            ac_list.append(p[i])
            wa_count += wa_list[p[i]-1]
        else:
            wa_list[p[i]-1] += 1
        
print(len(ac_list), wa_count)

Fixed submission:
n, m = map(int, input().split())
ps = [[0, 0] for i in range(n)]  
wa_count = 0
ac_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if ps[int(input_p)-1][0] <= 0:
        if input_s == 'AC':
            ps[int(input_p)-1][0] += 1
        else:
            ps[int(input_p)-1][1] += 1
for i in ps:
    if i[0] == 1:
        ac_count += 1
        wa_count += i[1]

print(ac_count, wa_count)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    input_p, input_s = input().split()
    p.append(int(input_p))
    s.append(input_s)

ac_list = []
p_set = set(p)
wa_list = [0] * n
wa_count = 0
for i in range(m):
    if p[i] not in ac_list:
        if s[i] == 'AC':
            ac_list.append(p[i])
            wa_count += wa_list[p[i]-1]
        else:
            wa_list[p[i]-1] += 1
    if len(ac_list) == len(p_set):
        break
        
print(len(ac_list), wa_count)

Fixed submission:
n, m = map(int, input().split())
ps = [[0, 0] for i in range(n)]  
wa_count = 0
ac_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if ps[int(input_p)-1][0] <= 0:
        if input_s == 'AC':
            ps[int(input_p)-1][0] += 1
        else:
            ps[int(input_p)-1][1] += 1
for i in ps:
    if i[0] == 1:
        ac_count += 1
        wa_count += i[1]

print(ac_count, wa_count)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    input_p, input_s = input().split()
    p.append(int(input_p))
    s.append(input_s)

ac_list = []
wa_list = [0] * n
wa_count = 0
for i in range(m):
    if p[i] not in ac_list:
        if s[i] == 'AC':
            ac_list.append(p[i])
            wa_count += wa_list[p[i]-1]
        else:
            wa_list[p[i]-1] += 1
print(len(ac_list), wa_count)

Fixed submission:
n, m = map(int, input().split())
ps = [[0, 0] for i in range(n)]  
wa_count = 0
ac_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if ps[int(input_p)-1][0] <= 0:
        if input_s == 'AC':
            ps[int(input_p)-1][0] += 1
        else:
            ps[int(input_p)-1][1] += 1
for i in ps:
    if i[0] == 1:
        ac_count += 1
        wa_count += i[1]

print(ac_count, wa_count)