Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
w=[]
count=0

for j in range(M):
    if ps[j][1]=="WA":
        if ps[j][0] not in a:
            w.append(ps[j][0])
    elif ps[j][1]=="AC":
        if ps[j][0] not in a:
            a.append(ps[j][0])
            count+=w.count(ps[j][0])


print(len(a),count)

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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
w=[]
count=0

for j in range(M):
    if ps[j][1]=="WA":
        if ps[j][0] not in a:
            w.append(ps[j][0])
    elif ps[j][1]=="AC":
        if ps[j][0] not in a:
            a.append(ps[j][0])

for i in range(len(a)):
    count+=w.count(a[i])

print(len(a),count)

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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
b=[]
count=0

for j in range(M):
    if ps[j][1]=="WA":
        if ps[j][0] not in b:
            a.append(ps[j][0])
    elif ps[j][1]=="AC":
        if ps[j][0] not in b:
            b.append(ps[j][0])

for i in range(len(b)):
    count+=a.count(b[i])

print(len(b),count)

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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
b=[]
count=0
count_1=0

for i in range(M):
    if ps[i][1]=="AC" and ps[i][0] not in a:
        a.append(ps[i][0])

for j in range(M):
    if ps[j][0] not in a:
        pass
    elif ps[j][0] not in b:
        if ps[j][1]=="WA":
            count+=1
        elif ps[j][1]=="AC":
            b.append(ps[j][0])

print(len(a),count)


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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
b=[]
count=0
count_1=0

for i in range(M):
    if ps[i][1]=="AC" and ps[i][0] not in a:
        a.append(ps[i][0])

for j in range(M):
    if ps[j][0] not in a:
        pass
    elif ps[j][0] not in b:
        if ps[j][0] in a and ps[j][1]=="WA":
            count+=1
        elif ps[j][0] in a and ps[j][1]=="AC":
            b.append(ps[j][0])

print(len(a),count)


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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
ps=[list(input().split()) for _ in range(M)]

a=[]
b=[]
count=0
count_1=0

for i in range(M):
    if ps[i][1]=="AC" and ps[i][0] not in a:
        a.append(ps[i][0])

for j in range(M):
    if ps[j][0] in b and ps[j][0] not in a:
        pass
    elif ps[j][0] not in b:
        if ps[j][0] in a and ps[j][1]=="WA":
            count+=1
        elif ps[j][0] in a and ps[j][1]=="AC":
            b.append(ps[j][0])

print(len(a),count)


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

AC=[0]*N
WA=[0]*N
ac=0
wa=0

for i in range(M):
    p,s=map(str,input().split())
    P=int(p)
    if s=="AC":
        if AC[P-1]!=P:
            AC[P-1]+=P
            ac+=1
            wa+=WA[P-1]
    else:
        if AC[P-1]!=P:
            WA[P-1]+=1

print(ac,wa)