Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    y+=WA[i]
print(sum(AC.values()),y)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
wa={}
ac=[]
key=[]

    
for i in range(M):
    p,s=input().split()
    if p not in ac:
        if p not in key:
            key.append(p)
            wa[p]=0

        if s=="WA":
            wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in key:
    if i in ac:
        ans+=wa[i]
print(len(ac),ans)




Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
wa={}
ac=[]
key=[]

    
for i in range(M):
    p,s=input().split()
    if p not in ac:
        if p not in key:
            key.append(p)
            wa[P[i]]=0

        if s=="WA":
            wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in key:
    if i in ac:
        ans+=wa[i]
print(len(ac),ans)



Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    if s=="WA":
      S.append(0)
    else:
      S.append(1)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=np.unique(P[S==1])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i==0:
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)


Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=np.unique(P[S=="AC"])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i=="WA":
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)


Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(p)
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=np.unique(P[S=="AC"])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i=="WA":
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)



Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
N,M=map(int, input().split())
A = np.array([input().split() for i in range(M)])


if M>0:
    P=A[:,0]
    S=A[:,1]
    wa={}
    ac=[]
    key=[]
    for i in range(M):
        if P[i] not in ac:
            if P[i] not in key:
                key.append(P[i])
                wa[P[i]]=0
                
            if S[i]=="WA":
                wa[P[i]]+=1
            else:
                ac.append(P[i])
    ans=0
    for i in key:
        if i in ac:
            ans+=wa[i]
    print(len(ac),ans)
else:
    print(0,0)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Runtime Error):
%%time
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=P[S=="AC"]

    wa=0
    ac=[]
    for i in range(M):
        if P[i] in ans and P[i] not in ac and S[i]=="WA":
            wa+=1
        else:
            ac.append(P[i])
    
    
    print(len(ans),wa)
else:
    print(0,0)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M=map(int, input().split())
A = np.array([input().split() for i in range(M)])


P=A[:,0]
S=A[:,1]

if M>0:
    ans=np.unique(P[S=="AC"])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i=="WA":
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=np.unique(P[S=="AC"])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i=="WA":
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

ans=np.unique(P[S=="AC"])

wa=0
for j in ans:
    for i in S[P==j]:
        if i=="WA":
            wa+=1
        else:
            break

print(len(ans),wa)

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)