Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = []

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if p in ac_done:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done.append(p)
        else:
            l[p-1] = 1 + l[p-1]

print(ac,wa)

Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = []

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if p not in ac_done:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done.append(p)
        else:
            l[p-1] = 1 + l[p-1]

print(ac,wa)

Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = []

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and p not in ac_done:
        ac += 1
        wa += l[p-1]
        ac_done.append(p)
    else:
        l[p-1] = 1 + l[p-1]

print(ac,wa)

Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = []
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and p not in ac_done:
        ac += 1
        wa += l[p-1]
        ac_done.append(p)
    elif s =='WA' and p not in ac_done:
        l[p-1] = 1 + l[p-1]

print(ac,wa)



Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = []
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and p not in ac_done:
        ac += 1
        wa += l[p-1]
        ac_done.append(p)
    elif s =='WA':
        l[p-1] = 1 + l[p-1]

print(ac,wa)

Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
p,q= input().split()
a,b =(int(p), int(q))
wa_count =0
ac_count = 0
pro_num = 0
input_list = [input().split() for i in range(b)]

for i in range(a+1):
    wa_count_f=0
    
    for j in range(b):
        if int(input_list[j][0]) == i:
            if input_list[j][1] == 'WA':
                wa_count_f += 1
            elif input_list[j][1] == 'AC':
                ac_count+= 1
                wa_count += wa_count_f
                break
            
print(ac_count, wa_count)

Fixed submission:
n,m = map(int, input().split())
l = [0] * n

ac = 0
wa = 0
ac_done = [False] * n

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if ac_done[p-1]:
        continue
    else:
        if s == 'AC':
            ac += 1
            wa += l[p-1]
            ac_done[p-1] = True
        else:
            l[p-1] += 1 

print(ac,wa)