peterverebics/CodeNet_Python_118 huggingface dataset:
n,m = map(int,input().split())
wa = [0]*n
flag = [False]*n
count = 0
for i in range(m):
  p,s = input().split()
  p = int(p)
  if s=='AC' and flag[p-1]==False:
    count += 1
    flag[p-1] = True
  if s=='WA' and flag[p-1]==False:
    wa[p-1] += 1
print(count,' ',sum(wa))
N,M = map(int,input().split())
P = []
S = []
for i in range(M):
    p,s = input().split()
    p = int(p)
    P.append(p)
    S.append(s)
#print(P)
#print(S)
AC = 0
WA = 0
AC_f = [0] * (N + 1)
WA_f = [0] * (N + 1)
#print(AC_f)
for i in range(M):
    if AC_f[P[i]] == 0:
        if S[i] == "AC":
            AC += 1
            AC_f[P[i]] = 1
        else:
            WA += 1
print(AC,WA)
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
ll=[l[i][0] for i in range(m)]
import itertools
lll=[]
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
ans=0
re=0
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)
n,m=map(int,input().split())
a=[[0,0] for _ in range(n+1)]
x=[]
for i in range(m):
    x.append(list(input().split()))
    x[i][0]=int(x[i][0])
for i in range(m):
    if x[i][1]=="AC":
        a[x[i][0]][1]=1
    else:
        if a[x[i][0]][1]==1:
            continue
        else:
            a[x[i][0]][0]+=1
c=0
d=0
for i in range(1,n+1):
    c+=a[i][0]
    d+=a[i][1]
print(d,c)
n,m = (int(x) for x in input().split())
memo = [0]*n
pena = 0
for i in range(m):
    p,s = (str(x) for x in input().split())
    p = int(p)
    if s=="AC":
        memo[p-1] = 1
    else:
        if memo[p-1]==0:
            pena += 1
print("{} {}".format(sum(memo),pena))
N,M = map(int,input().split())
AC = {}
WA = {}
for i in range(M):
    prb ,ans = input().split()
    if ans == "AC":
        AC[prb] = 1
    else:
        if (prb in WA) == False and (prb in AC) ==  False:
            WA[prb] = 1
        else:
            if (prb in AC) ==  False:
                WA[prb] +=1
wa = 0
for i,v in WA.items():
    if prb in AC:
        wa += v
print("{} {}".format(len(AC),wa))
n, m = map(int, input().split())
flags = [False]*n
num_ac = 0
num_wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if flags[p-1]:
        continue
    else:
        if s=='WA':
            num_wa += 1
        else:
            flags[p-1] = True
            num_ac += 1

print(num_ac, num_wa)
n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in set(ac)) == False:
      wa += 1
    
print(len(set(ac)),wa)
n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]

ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    if(l[i][0] in ac) == False:
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
    

    
print(len(ac),wa)
N,M =map(int,input().split())

score=[]
for i in range(M):
  pS = list(map(str, input().split()))
  score.append(pS)

AC = 0
WA = 0
  
for i in range(1,N+1):
  for j in range(M):
    if score[j][0]==str(i):
      if score[j][1]=='WA':
        WA+=1
      elif score[j][1]=='AC':
        AC+=1
        break
      
print(AC,WA)
n,m=map(int,input().split())
L=[]
AC=0
WA=0
for i in range(m):
    p,s=input().split()
    if p not in L and s=="WA":
        WA+=1
    if p not in L and s=="AC":
        AC+=1
        L.append(p)
print(AC,WA)
N,M = map(int, input().split())

seito = [0] * (N+1)
pena  = 0
teisyutu = [''] * (M+1)

for i in range(1, M+1) :
    teisyutu[i] = input().split()

    if seito[int(teisyutu[i][0])] == '1' :
        continue

    if teisyutu[i][1] == 'AC' :
        seito[int(teisyutu[i][0])] = '1'
    else :
        pena += 1

cnt = 0
for s in seito :
    if s == '1' :
        cnt += 1

print('%s %s' % (cnt, pena))
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	i = int(a)-1
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)
n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    pi,si=input().split()
    p[i]=int(pi)
    s[i]=si
judge=[0]*(n+1)
ac=0
wa=0
for i in range(m):
    if judge[p[i]]==-1:
        continue
    if judge[p[i]]==0:
        if s[i]=='WA':
            judge[p[i]]+=1
        else:
            wa+=judge[p[i]]
            judge[p[i]]=-1
            ac+=1
print(ac,wa)
"""
author : dokueki
"""
n,m = map(int,input().split())
d = dict()
AC,WA = 0,0
if m == 0:
    print(0,0)
else:
    for i in range(m):
        a, b = input().split()
        if a not in d:
            d[a] = []
            d[a].append(b)
        else:
            if d[a].count("AC") == 0:
                d[a].append(b)

    for k,v in d.items():
        WA += v.count("WA")
        AC += v.count("AC")
    print(AC,WA)
n, m = list(map(int, input().split()))
p, s = [], []
a = [False] * n
cor = 0
fai = 0

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if a[p - 1] == False:
            a[p - 1] = True
            cor += 1
    else:
        if a[p - 1]:
            pass
        else:
            fai += 1
print(cor, end=' ')
print(fai)
# input
N, M = map(int, input().split())

# check
AC_cnt = 0
WA_cnt = 0
AC_questions = {}
for i in range(M):
    P, S = map(str, input().split())

    if P not in AC_questions:
        AC_questions[P] = False

    if AC_questions[P] is True:
        continue
    elif S == "AC":
        AC_cnt += 1
        AC_questions[P] = True
    # S == "WA"
    else:
        WA_cnt += 1

print(AC_cnt, WA_cnt)
import math
n, m = map(int, input().split())
ans = {}
ac = "AC"
wa = "WA"
ac_num = []
wa_num =  [] 
for _ in range(m):
  p, s = input().split()
  if s == ac:
    ac_num.append(p)
  elif not(p in set(ac_num)):
    wa_num.append(p)
print(len(set(ac_num)), len((wa_num)))
import numpy as np
DEB = False
N,M = map(int, input().split())
res = np.zeros((N+1,2))


for i in range(M):
    p, s = input().split()
    p = int(p)
    if res[p][0] == 0:
        if s == 'AC':
            res[p][0] += 1
        elif s == 'WA':
            res[p][1] += 1
    
if DEB:
    for r in res:
        print(r)

print(int(res[:,0].sum()), int(res[:,1].sum()))
n,m=map(int,input().split())
a=0
b=0
x=[]
for i in range(m):
  s,t=input().split()
  s=int(s)
  if s in x:
    continue
  else:
    if t=='AC':
      a+=1
      x.append(s)
    else:
      b+=1
print(a,b)
N, M = [int(i) for i in input().split()]
P = []
S = []
for _ in range(M):
    p, s = [x for x in input().split()]
    P.append(int(p))
    S.append(str(s))

AC_list = []
penalty = 0
for i in range(M):
    if S[i] == "AC":
        AC_list.append(P[i])
    if S[i] == "WA" and P[i] not in AC_list:
        penalty +=1

correct = len(set(AC_list))
print(correct, penalty)
N,M = map(int,input().split())

AC = [0]*N
WA = [0]*N
AC_cnt = 0
WA_cnt = 0
p = [0]*M
S = [0]*M

for i in range(M):
    p[i],S[i] = map(str, input().split())

for i in range(M):
    q_num = int(p[i])
    if AC[q_num-1] == 0:
        if S[i] == "AC":
            AC[q_num-1] = 1
        else:
            WA[q_num-1] += 1

for i in range(N):
    WA_cnt += WA[i]

print(sum(AC),WA_cnt)
N,M=map(int,input().split())
ST=['WA'] * N
WA=[0] * N
OK=0
NG=0
for i in range(M):
  c,s = map(str,input().split())
  c = int(c)
  if s == 'WA':
    if ST[c-1] != 'AC':
      #WA[c-1] += 1
      NG += 1
  else:
    if ST[c-1] != 'AC':
      ST[c-1] = 'AC'
      OK += 1
  if OK == N:
    break
print("{} {}".format(OK,NG))
H, W = map(int, input().split())
A = [input().split() for _ in range(W)]

a=0
b=0
c=0
for i in range(W):
    if A[i][0]!=c:
        c=A[i][0]
        b+=1
        if A[i][1]=="WA":
            a+=1
print(b,a)
N, M = map(int, input().split())

penalty = 0
a = [[False, 0] for i in range(N)]
count = 0

for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if a[p][0] == False:
        if S == 'WA':
            a[p][1] += 1
        else:
            a[p][0] = True
            count += 1
    else:
        pass

print(count, sum([a[i][1] for i in range(N)]))
n, m = map(int,input().split())
pS = [tuple(input().split()) for _ in range(m)]
pena = 0
correct = 0
flag = [False] * (10**6)
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        else:
            correct += 1
            flag[p-1] = True
print(correct, pena)
def main():
    N, M = [int(x) for x in input().split()]

    accepted = set()
    ans = 0
    for i in range(M):
        p, s = input().split()
        if p in accepted:
            continue
        if s == "WA":
            ans += 1
        else:
            accepted.add(p)
    print(len(accepted), ans)


if __name__ == '__main__':
    main()
n, m = map(int, input().split())
ac = set()
wa = 0
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        ac.add(p)
    elif not p in ac:
        wa += 1
print(len(ac), wa)
N,M = map(int,input().split())
AC = {}
WA = {}
for i in range(M):
    prb ,ans = input().split()
    if ans == "AC":
        AC[prb] = 1
    else:
        if (prb in WA) == False:
            WA[prb] = 1
        else:
            if (prb in AC) ==  False:
                WA[prb] +=1
wa = 0
for i,v in WA.items():
    if prb in AC:
        wa += v
print("{} {}".format(len(AC),wa))
import math

def main():
    N, M = map(int, input().split())

    ans = [False for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)

        if ans[i-1] == False:
            if result == "AC":
                ac += 1
                ans[i-1] = True
            elif result == "WA":
                wa += 1
    print(sum(ans), wa)
    return 0
if __name__ == '__main__':
    main()
N,M=map(int,input().split())
# print(N)
# print(M)
L=[]

for i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    L.append([p,S])

# print(L)

Pcount=0
Acount=0

for i in range(N):
    for j in range(M):
        if L[j][0]==i+1:
            if L[j][1]=="WA":
                Pcount+=1
            else:
                Acount+=1
                break

print(Pcount,Acount)
n,m=map(int,input().split())
l=[input().split() for _ in range(m)]
arr=[False for _ in range(n)]
ac,wa=0,0

for r in l:
  if r[1]=='AC' and arr[int(r[0])-1]==False:
    ac+=1
    arr[int(r[0])-1]=True
    continue
  elif r[1]=='WA' and arr[int(r[0])-1]==False:
    wa+=1
    continue
print(ac,wa)
N,M=map(int,input().split())
flag=[False]*(N+1)
ac=0
wa=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if flag[p]==False:
        if s=='AC':
            flag[p]=True
            ac+=1
        else:
            wa+=1
print(ac,wa)
n, m = map(int, input().split())

cw = 0
ca = 0
d = {}
for i in range(m):
    p, s = input().split()
    if d.get(p) == "AC":
        continue
    if s == "WA":
        cw += 1
    else:
        ca += 1
    d[p] = s

print(ca, cw)
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  else:
    AC[int(p[i])]=1
    i = i+1
print(sum(AC),sum(WA))
n,m=map(int,input().split())
l1=[list(input().split()) for i in range(m)]
l2=["WA"]*n
account=0
wacount=0
for i in range(m):
  if l1[i][1]=="WA" and l2[int(l1[i][0])-1]=="WA":
    wacount+=1
  if l1[i][1]=="AC":
    l2[int(l1[i][0])-1]="AC"

for i in range(n):
  if l2[i]=="AC":
    account+=1
print(account,wacount)
import sys
a,b=map(int,input().split())
account=0
wacount=0
acbox=[0]*(a+1)
wabox=[0]*(a+1)
for i in range(b):
  p,q=input().split()
  p=int(p)
  if q=="WA":
    if acbox[p]==0:
      wabox[p]+=1
  else:
    if acbox[p]!=0:
      account+=1
      wacount+=wabox[p]
      acbox[p]=+1
print(account,wacount)
n, m = map(int,input().split())
list_ac = []
count_wa = 0

for i in range(m):
    p, s = map(str,input().split())
    if s =='AC':
        list_ac.append(int(p))
    else:
        if int(p) not in list_ac:
            count_wa +=1
print(len(set(list_ac)), count_wa)
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            wa += 1
        if s == 'AC':
            ac += 1
            used[p] = True
    print(ac, wa)


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = ''
res = False
for m in range(M):
    if cnt != L[m][0]:
        res = False
    cnt = L[m][0]
    if L[m][1] == 'AC':
        if res:
            continue
        AC += 1
        res = True
    elif L[m][1] == 'WA':
        if res:
            continue
        WA += 1
print('{} {}'.format(AC, WA))
import sys
input()
d={}
nc=np=0
for ln in sys.stdin:
    p,S=ln.split()
    if p not in d:
        d[p]=0
    if not d[p]:
        if S=='AC':
            d[p]=1
            nc+=1
        else:
            np+=1

print(nc,np)
n,m=map(int,input().split())
wa=0
ac=0
ig=[]

for i in range(m):
  c,r=input().split()
  if c in ig:
    continue
  
  if r == 'WA':
    wa+=1
  elif r == 'AC':
    ac+=1
    ig.append(c)
    
print(ac,wa)
N, M = list(map(int, input().split()))

solved = {}
failed = {}
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        if p in solved:
            pass
        else:
            solved[p] = 1
    else:
        if not (p in solved):
            if p in failed:
                failed[p] += 1
            else:
                failed[p] = 1

print(sum(solved.values()), sum(failed.values()))
import sys
n, m = map(int, sys.stdin.readline().split())
li = [[] for _ in range(n)]
for _ in range(m):
  i, k = map(str, sys.stdin.readline().split())
  k = k.strip()
  i = int(i)
  li[i-1].append(k)
wa = 0
ac = 0
for i in li:
  for k in i:
    if k == 'WA':
      wa += 1
    if k == 'AC':
      ac += 1
      break
print(ac, wa)
#C
n,m=map(int,input().split())
f=False
ps=[]
AC=[0]*n
WA=[0]*n
for i in range(m):
    ps.append(list(input().split()))
for i in range(m):
    if ps[i][1]=='AC'and AC[int(ps[i][0])-1]==0:
        AC[int(ps[i][0])-1]=1
    if ps[i][1]=='WA'and WA[int(ps[i][0])-1]==0:
        WA[int(ps[i][0])-1]+=1
wasum=0
for i in range(n):
    if AC[i]==1:
        wasum+=WA[i]
print(sum(AC),wasum)
n, m = map(int, input().split())
inp = []
ans = [(0, False) for _ in range(n)]

for _ in range(m):
    inp.append(input().split())

for i in inp:
    q, r = int(i[0]) - 1, i[1]
    count = ans[q][0]
    flag = ans[q][1]
    if r == 'WA' and not flag:
        ans[q] = (count+1, False)
    if r == 'AC':
        ans[q] = (count, True)

print(len(list(filter(lambda x: x[1], ans))), sum(map(lambda x: x[0], ans)),)
n,m=map(int,input().split())

a={}
for i in range(1,n+1):
    a[str(i)]='WA'
    
ans=0
pen=0
d=0
for i in range(m):
    p,s=input().split()
    if s == 'WA' and a[p] == s :
       d+=1 
    if s == 'AC' and a[p] != s:
        ans+=1
        pen+=d
        a[p]=s
        d=0
        
print(ans,pen)
N, M = map(int, input().split())

P = list()
for m in range(M):
    n, rst = input().split()
    n = int(n)
    P.append( (n, rst) )


ck = [False for _ in range(N+1)]

ret_cor, ret_pen = 0, 0

for n, rst in P:
    if rst == 'AC':
        if not ck[n]:
            ck[n] = True
            ret_cor += 1

    else: # rst == 'WA'
        if not ck[n]:
            ret_pen += 1

print(ret_cor, ret_pen)
from collections import defaultdict
N, M = map(int, input().split())
P = [input().split() for _ in range(M)]
X = defaultdict(int)
ac = 0
wa = 0
for pi in P:
    i = int(pi[0])
    s = pi[1]
    if X[i-1] == 0:
        if s == 'WA':
            wa += 1
        else:
            ac += 1
            X[i-1] = 1

print(ac, wa)
N,M = map(int,input().split())
P = []
s = []
sekai = 0
wrong = 0

for i in range(M):
  p,S = map(str,input().split())
  P.append(int(p))
  s.append(S)

print(P,s)
#problem = list(range(1,N+1))
problem = []

for j, ans in zip(P,s):
  if (j not in problem) and (ans == "AC"):
    problem.append(j)
    sekai += 1
  elif (j not in problem) and (ans == "WA"):
    wrong += 1
print(sekai, wrong)
n,m = map(int,input().split())
q = []
ac = 0
wa = 0
for i in range(m):
    p,s = input().split()
    if p in q:
        continue
    else:
        if s=="AC":
            ac += 1
            q.append(p)
        else:
            wa += 1
print(ac,wa)
n,m = map(int, input().split())
num_ac = 0
num_wa = 0
tmp_num_wa = 0
answerd = []

for i in range(m):
  p,s = input().split()
  if p in answerd:
    continue
  if s == 'WA':
    tmp_num_wa += 1
  if s == 'AC':
    num_ac += 1
    num_wa += tmp_num_wa
    tmp_num_wa = 0
    answerd.append(p)
    
print(num_ac, num_wa)
N, M = map(int, input().split())
right = set()
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        right.add(p)
    elif S == 'WA':
        if p not in right:
            penalty += 1
print(len(right), penalty)
n,m = map(int,input().split())
ac = 0
wa = 0
aclist = {}
for i in range(n):
    aclist[i + 1] = 0

for i in range(m):
    a,b = input().split()
    a = int(a)
    if aclist[a] == 1:
        continue
    elif b == 'WA':
        wa += 1
    else:
        aclist[a] += 1
        ac += 1
print(int(ac), int(wa), end="")
n,m=map(int,input().split())
wa=[0 for _ in range(n)]
ac=[0 for _ in range(n)]
for i in range(m):
	ps,s = input().split()
	p = int(ps)
	if s == "WA":
		if ac[p-1] == 0:
			wa[p-1] += 1
	if s == "AC":
		if ac[p-1] == 0:
			ac[p-1] = 1
print(sum(ac),sum(wa))
N, M = map(int,input().split())
yes = []
no = []

for i in range(M):
    pS = list(input().split())
    if pS[1] == 'AC':
        if pS[0] not in yes:
            yes.append(pS[0])
    else:
        if pS[0] not in yes:
            no.append(pS[0])
            

x = len(yes)
y = len(no)
print(x, y)
n, m = map(int, input().split())

mapAC = [False]*(n+1)
#mapWA = [True]*(n+1)
countWA = [0]*(n+1)

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        mapAC[p] = True
#        mapWA[s] = False
    else:
        countWA[p] += 1*(not mapAC[p])
print(mapAC.count(True), sum(countWA))
N,M = map(int, input().split())
t = [[0]*N for _ in range(2)]
for _ in range(M):
  p,s = input().split()
  if t[0][int(p)-1] == 0:
    if s == "AC":
      t[0][int(p)-1] = 1
    else:
      t[1][int(p)-1] += 1
print(sum(t[0]),sum(t[1]))
n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    p[i],s[i]=input().split()
    p[i]=int(p[i])
sum_ok,sum_miss=0,0
former_ok=[0]*n
for p_,s_ in zip(p,s):
    if p_ in former_ok or p_>n:continue
    elif s_=='AC':
        former_ok[sum_ok]=p_
        sum_ok+=1
        if sum_ok==n:break
    else:sum_miss+=1
print(sum_ok, sum_miss)
params = input().split(' ')
n = eval(params[1])
 
acfoundfor = []
 
penalties = 0
points = 0
 
for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])
    status = submission[1]
    
    if p in acfoundfor:
        continue
 
    if status == 'AC':
        points += 1
        acfoundfor.append(p)
    else:
        penalties += 1
print(points, penalties)
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
aclist = [0 for i in range(n)]
for i in range(m):
    if aclist[c[i][0] - 1] == 0:
        if c[i][1] == 'AC':
            aclist[c[i][0] - 1] += 1
            AC += 1
        else:
            WA += 1
print(AC, WA)
n, m = [int(i) for i in input().split()]
ac = 0
wa = 0
answers = [False] * n
for i in range(m):
    inp = input().split()
    p, s = int(inp[0]), inp[1]
    index = p - 1
    if not answers[index] and s == "AC":
        ac += 1
        answers[index] = True
    if not answers[index] and s == "WA":
        wa += 1
print(ac, wa)
N, M = map(int, input().split())
Alist = [[]]*M
for i in range(M):
  Alist[i] = list(map(str, input().split()))
collect = [False]*N
NP = 0
NAC = 0
for j in range(M):
  if collect[int(Alist[j][0])-1] == False and Alist[j][1] == 'WA':
    NP += 1
  elif collect[int(Alist[j][0])-1] == False and Alist[j][1] == 'AC':
    NAC += 1
    collect[int(Alist[j][0])-1] = True
print(collect)
print(NAC, " ", NP)
n, m = map(int, input().split())
ps = []
for i in range(m):
    ps.append(list(map(str, input().split())))

ac = 0
wa = 0
prob = [0]*n

for i in range(m):
    if ps[i][1] == "AC" and prob[int(ps[i][0]) - 1] == 0:
        ac += 1
        prob[int(ps[i][0]) - 1] = 1
    
    if ps[i][1] == "WA" and prob[int(ps[i][0]) - 1] == 0:
        wa += 1

print(str(ac) + " " + str(wa))
n,m = map(int,input().split(" "))

l = [0] * n
wa = 0
ac = 0

for i in range(m):
    o,p = input().split(" ")
    if(p=="WA" and l[int(o)-1] ==0):
        wa += 1
    if(p=="AC"):
        if(l[int(o)-1] ==0):
            l[int(o)-1] = 1
            ac += 1

print(str(ac) + " " + str(wa))
n , m = map(int,input().split())
if m == 0:
    print(0,0)
    exit()
ps = [0] * m
ss = [0] * m
for i in range(m):
    p,s = map(str,input().split())
    ps[i],ss[i] = int(p),s

ac = [0] * (n + 1)
wa = [0] * (n + 1)

for i in range(m):
    if ac[ps[i]] == 1:
        continue
    if ss[i] == 'AC':
        ac[ps[i]] = 1
    else:
        wa[ps[i]] += 1

for i in range(n):
    if ac[i] == 0:
        wa[i] = 0

print(sum(ac),sum(wa))
N, M = map(int, input().split(' '))
ac_set = set()
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    if num not in ac_set:
        if res == 'AC':
            ac_cnt += 1
            ac_set.add(num)
        else:
            wa_cnt += 1
print(ac_cnt, wa_cnt)
n,m = map(int,input().split())
memo2 = [False for i in range(n)]
count1,count2 = 0,0
for i in range(m):
    p,l = input().split()
    p = int(p)-1
    if memo2[p]:
        continue
    else:
        if l == 'WA':
            count1+=1
        else:
            count2+=1
            memo2[p] = True
print(count2,count1)
N,M = map(int, input().split())
answer_p = set()
submit_p= set()
count_pena=0
count_wa=0

for _ in range(M):
  p,S= input().split()

  if p in answer_p:
    continue
  else:
    if p not in submit_p:
      count_wa = 0
    submit_p.add(p)

    if S=='WA':
      count_wa += 1
    elif S=='AC':
      count_pena += count_wa
      answer_p.add(p)

print(len(answer_p), count_pena)
n, m = map(int, input().split())
sub = [list(input().split()) for j in range(m)]
li = [[0 for i in range(n)]for j in range(2)]
for i in range(m):
    x = int(sub[i][0])-1
    if sub[i][1] == 'AC':
        if li[0][x] == 0:
            li[0][x] += 1
    elif li[0][x] == 0:
        li[1][x] += 1
    else:
        break

ac = sum(li[0])
wa = 0
for i in range(n):
    if li[0][i] == 1:
        wa += li[1][i]

print('{} {}'.format(ac,wa))
N,M = map(int,input().split())
p = [0]*M
S = [0]*M
ans_AC = [0]*10**5
ans_WA = [0]*10**5
for i in range(M):
    p[i],S[i] = map(str,input().split())


for i in range(M):
    if S[i] == "AC":
        if ans_AC[int(p[i])] != 1:
            ans_AC[int(p[i])] = 1
    else:
        if ans_AC[int(p[i])] != 1:
            ans_WA[int(p[i])] += 1
print(sum(ans_AC),sum(ans_WA))
n, m = map(int, input().split())
lst = [input().split() for i in range(m)]

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

for i in range(m):
    p_i = int(lst[i][0])
    if lst[i][1] == 'AC':
        ac[p_i-1] = 1
    else:
        if ac[p_i-1] == 0:
            wa[p_i-1] += 1

num_ac = sum(ac)
pnlt = sum(wa)

print(num_ac, pnlt)
N, M = [int(i) for i in input().split()]
corrects = []
wrongs = 0
for m in range(M):
  p, s = input().split()
  if p not in corrects:
    if s == "WA":
      wrongs += 1
    elif s == "AC":
      corrects.append(p)
      
print(len(corrects), wrongs)
n,m=map(int,input().split())
ac,wa=0,0
t=0
flg=True
for i in range(m):
  p,s=input().split()
  if t!=p:
    flg=True
    t=p
    wa_t=0
    if s=="WA":
      wa_t+=1
    else:
      ac+=1
      wa+=wa_t
      flg=False
  else:
    if s=="WA":
      wa_t+=1
    elif s=="AC" and flg:
      ac+=1
      wa+=wa_t
      flg=False
print(ac,wa)