Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = 0
wa = 0
end = []

wa_candidate = [0 for i in range(N)]
for _ in range(M):
    p_i, s_i = input().split()
    if p_i not in end:
        if s_i == "AC":
            ac += 1
            wa += wa_candidate[int(p_i) - 1]
            end.append(p_i)
        if s_i == "WA":
            wa_candidate[int(p_i) - 1] += 1

print(ac, wa)

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = []
wa = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and int(p_i) not in ac:
        ac.append(int(p_i))
    if s_i == "WA" and int(p_i) not in ac:
        wa[int(p_i) - 1] += 1
        
ac = set(ac)
wa_num = 0
for i in range(N):
    if i + 1 not in ac:
        continue
    else:
        wa_num += wa[i]

print(len(ac), wa_num)

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

ac = []
wa = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and p_i not in ac:
        ac.append(p_i)
    if s_i == "WA" and p_i not in ac:
        wa[p_i - 1] += 1
        
ac = set(ac)
wa_num = 0
for i in range(N):
    if i + 1 not in ac:
        continue
    else:
        wa_num += wa[i]

print(len(ac), wa_num)

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

ac = []
wa = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and p_i not in ac:
        ac.append(p_i)
    if s_i == "WA" and p_i not in ac:
        wa[p_i - 1] += 1
        
ac = set(ac)                
wa = [count for i, count in enumerate(wa) if i + 1 in ac]

print(len(ac), sum(wa))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac_num = 0
ac = []
wa = {str(i): 0 for i in range(1, N + 1)}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and p_i not in ac:
        ac_num += 1
        ac.append(p_i)
    if s_i == "WA" and p_i not in ac:
        wa[p_i] += 1
                
wa = [count for p_i, count in wa.items() if p_i in ac]

print(len(ac), sum(wa))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = []
wa = {str(i): 0 for i in range(1, N + 1)}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    elif s_i == "WA" and p_i not in ac:
        wa[p_i] += 1
                
ac = set(ac)
wa = [count for p_i, count in wa.items() if p_i in ac]

print(len(ac), sum(wa))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = []
wa = {}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    elif s_i == "WA":
        if p_i not in ac:
            if p_i not in wa.keys():
                wa[p_i] = 1
            else:
                wa[p_i] += 1
                
ac = set(ac)
wa = [count for p_i, count in wa.items() if p_i in ac]

print(len(ac), sum(wa))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = []
wa = {}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
        ac = list(set(ac))
    elif s_i == "WA":
        if p_i not in ac:
            if p_i not in wa.keys():
                wa[p_i] = 1
            else:
                wa[p_i] += 1
                
ac = set(ac)
wa = {p_i: count for p_i, count in wa.items() if p_i in ac}

print(len(ac), sum(wa.values()))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ac = []
wa = {str(i): 0 for i in range(1, N + 1)}

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC":
        ac.append(p_i)
    elif s_i == "WA":
        if p_i not in ac:
            wa[p_i] += 1

ac = set(ac)
wa = {p_i: count for p_i, count in wa.items() if p_i in ac}

print(len(ac), sum(wa.values()))

Fixed submission:
N, M = map(int, input().split())

ac = 0
wa = 0
ac_status = [0 for i in range(N)]
wa_status = [0 for i in range(N)]

for _ in range(M):
    p_i, s_i = input().split()
    if s_i == "AC" and ac_status[int(p_i) - 1] == 0:
        ac += 1
        ac_status[int(p_i) - 1] += 1
        wa += wa_status[int(p_i) - 1]
    if s_i == "WA":
        wa_status[int(p_i) - 1] += 1

print(ac, wa)