peterverebics/CodeNet_Python_118 huggingface dataset:
n,m=map(int,input().split())
ac=0
wa=0
ans=[True]*n
wa=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=="AC" and ans[p]:
        ans[p]=False
        ac+=1
    elif s=="WA" and ans[p]:
        wa[p]+=1
cnt=0
for i in range(n):
    if not ans[i]:
        cnt+=wa[i]
print(ac,cnt)
def main():
  import sys
  input = sys.stdin.buffer.readline
  n,m=map(int,input().split())
  ac,wa,l,k=0,0,[0]*n,[0]*m
  for _ in k:
    p,s=input().split()
    p=int(p)
    if type(l[p-1])==int:
      if s==b'AC':
        ac+=1
        wa+=l[p-1]
        l[p-1]=''
      else:
        l[p-1]+=1
  print(ac,wa)
  
if __name__ == '__main__':
    main()
n,m = (int(i) for i in input().split())

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

for _ in range(m):
    p,s = (i for i in input().split())
    score[int(p)].append(s)

for v in score.values():
    if "AC" in v:
        wa += len(v[:v.index("AC")])
        ac += 1

print(ac,wa)
n,m=map(int,input().split())
l=[0]*(n+1)
miss=[0]*(n+1)
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if l[p]==0:
        if s=='AC':
            l[p]+=1
        else:
            miss[p]+=1
for i in range(1,n+1):
    if l[i]==0 and miss[i]!=0:
        miss[i]=0
a=l.count(1)
b=sum(miss)
print(a,b)
N, M = map(int, input().split())
PS = [list(input().split()) for x in range(M)]

question = [0]*(N+1)
wrong = [0]*(N+1)

for i in range(M):
    if PS[i][1] == 'AC':
        if question[int(PS[i][0])] == 0:
            question[int(PS[i][0])] = 1
    else:
        if question[int(PS[i][0])] == 0:
            wrong[int(PS[i][0])] += 1

WA = 0
for i in range(N+1):
    if question[i] == 1:
        WA += wrong[i]

print(sum(question), WA)
N, M = map(int, input().split())
isAC = [0]*N
ac = 0
WA = [0]*N
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not isAC[p-1]:
        if s == 'AC':
            isAC[p-1] = 1
            ac += 1
        else:
            WA[p-1] += 1
    
wa = sum([i*j for i, j in zip(isAC, WA)])
print(ac, wa)
n, m = map(int, input().split())
wa = [0]*(n+1)
ac = [0]*(n+1)
for i in range(m):
    p, s = input().split()
    p = int(p)
    if ac[p]:
        continue
    if s == 'WA':
        wa[p] += 1
    else:
        ac[p] = 1

a, b = 0, 0
for c, w in zip(ac, wa):
    if c == 0:
        continue
    a += 1
    b += w
print(a, b)
n,m = map(int,input().split())

ans = 0
clear = 0

chk = [0]*(n+1)

for i in range(m):
    p,s = input().split()
    p = int(p)
    if chk[p] >=0:
        if s=="WA":
            chk[p]+=1
        elif s =="AC":
            ans += chk[p]
            chk[p]=-1
            clear+=1

print(str(clear)+" "+str(ans))
N, M = map(int, input().split())
p = [list(map(str, input().split())) for _ in range(M)]
aclst = [0] * (N + 1)
walst = [0] * (N + 1)
cntw = 0
cnta = 0
for i in range(M):
    if aclst[int(p[i][0])] == 0:
        if p[i][1] == 'WA':
            walst[int(p[i][0])] += 1
        else:
            cnta += 1
            cntw += walst[int(p[i][0])]
            aclst[int(p[i][0])] = 1


print(cnta, cntw)
N, M = map(int, input().split())
result = []
ans = dict((s, False) for s in range(1, N+1))
pen = dict((s, 0) for s in range(1, N+1))

for _ in range(M):
    s, d = input().split()
    if d == "AC":
        ans[int(s)] = True
        continue

    if d == "WA" and not ans[int(s)]:
        pen[int(s)] += 1

ans_result = 0
for _, v in ans.items():
    if v:
        ans_result += 1

pen_result = 0
for k, v in pen.items():
    if ans[k]:
        pen_result += v

print(ans_result, pen_result)
import math

n, m = map(int, input().split(" "))

d = {}
for i in range(1, n + 1):
    d[i] = {"AC": False, "WA": 0}

acc, wac = 0, 0
for _ in range(m):
    q, m = input().split(" ")
    q = int(q)

    if not d[q]["AC"]:
        if m == "WA":
            d[q]["WA"] += 1
        elif m == "AC":
            d[q]["AC"] = True
            acc += 1
            wac += d[q]["WA"]

print(acc, wac)
N,M=map(int,input().split())
LIST=[0]*(10**5+1)
PLIST=[0]*(10**5+1)

C=0
P=0
for i in range(M):
    A=list(map(str,input().split()))
    if(A[1]=="WA"):
        if(LIST[int(A[0])]==0):
            PLIST[int(A[0])]+=1
    else:
        if(LIST[int(A[0])]==0):
            C+=1
            LIST[int(A[0])]=1

for i in range(len(LIST)):
    P+=LIST[i]*PLIST[i]

print(C,P)
N, M = map(int, input().split())
ls = tuple([] for i in range(N))
for _ in range(M):
    p, S = input().split()
    p = int(p)
    ls[p - 1].append(S)
    
cnt_crr = 0
cnt_pnt = 0

for e in ls:
    if "AC" in e:
        for _e in e:
            if _e == "AC":
                cnt_crr += 1
                break
            cnt_pnt += 1

print(cnt_crr, cnt_pnt)
from collections import defaultdict
N,M = map(int,input().split())
dic = defaultdict(list)
for i in range(M):
    p,s = input().split()
    dic[p].append(s)
nAC = 0
nWA = 0
for k in dic.keys():
    if 'AC' in dic[k]:
        for s in dic[k]:
            if s == 'AC':
                nAC += 1
                break
            nWA += 1
print(nAC,nWA)
N,M = map(int,input().split())
Nstate = {str(i):0 for i in range(1,N+1)}
WAstate = {str(i):0 for i in range(1,N+1)}
AC = 0
for _ in range(M):
    n,m = map(str,input().split())
    if Nstate[n] == 0:
        if m == 'AC':
            Nstate[n] = 1
            AC += 1
        elif m == 'WA':
            WAstate[n] += 1
WA = 0
for i in range(1,N+1):
    if Nstate[str(i)] == 1:
        WA += WAstate[str(i)]
print(AC,WA)
N,M=map(int,input().split())
P=[]
A=[]
for i in range(M):
    n,a=input().split()
    P.append(int(n))
    A.append(a)

D=['0']*N
Z=[0]*N
a=0
p=0
for i in range(M):
  if D[P[i]-1]!='AC'and A[i]=='WA':
    Z[P[i]-1]+=1
    D[P[i]-1]='WA'
  elif D[P[i]-1]!='AC' and A[i]=='AC':
    a+=1
    p+=Z[P[i]-1]
    D[P[i]-1]='AC'

print(a,p)
n,m=map(int,input().split())
ac = 0
wa = 0
ac_list = [0]*n
wa_list = [0]*n

for _ in range(m):
    p,s=input().split()
    p = int(p) - 1
    if ac_list[p] == 'AC': continue
    ac_list[p] = s
    if s == 'AC':
        ac += 1
        wa += wa_list[p]
    else:
        wa_list[p] += 1
print(ac,wa)
n, m = map(int, input().split())

submit = []
for i in range(m):
    temp = [x for x in input().split()]
    submit.append(temp)

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

for i in range(m):
    result = submit[i][1]
    question = int(submit[i][0])

    if result == 'AC' and ac[question] == 0:
        ac[question] = 1
    elif result == 'WA' and ac[question] == 0:
        wa[question] += 1

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

print(sum(ac), sum(wa))
N, M = map(int, input().split())
lis = [[] for _ in range(N)]
for _ in range(M):
  question, result = input().split()
  question = int(question)
  lis[question-1].append(result)  

AC_times = 0
WA_times = 0
for i in range(N):
  pre_WA_times = 0
  for j in lis[i]:
    passed = False
    if not passed:
      if j == "AC":
        passed = True
        WA_times += pre_WA_times
      elif j == "WA":
        pre_WA_times += 1
    if passed:
      AC_times += 1
      break
      
print(AC_times, WA_times)
n,m=map(int,input().split())
ac_count=[0]*n
wa_count=[0]*n
ac=0
wa=0
for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if s=="AC" and ac_count[p]==0:
    ac_count[p]=1
    ac+=1
    wa+=wa_count[p]
  elif s[0]=="W":
      wa_count[p]+=1
print(ac,wa)
from sys import stdin
import sys
import math
from functools import reduce
import itertools

n,m = [int(x) for x in stdin.readline().rstrip().split()]

check = [0 for i in range(n)]
count = [0 for i in range(n)]

for i in range(m):
    p, q = [x for x in stdin.readline().rstrip().split()]
    p = int(p)

    if q == 'AC':
        check[p-1] = 1

    if q == 'WA' and check[p-1] == 0:
        count[p-1] = count[p-1] + 1

for i in range(n):
    if check[i] == 0: count[i] = 0

print(sum(check), sum(count))
n,m = map(int,input().split())
wa = [0 for _ in range(n)]
ac = [0 for _ in range(n)]
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        ac[p-1] = 1
    else:
        if ac[p-1]==1:continue
        wa[p-1] += 1

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

print(ans1,ans2)
n, m = map(int, input().split())

seikai = set()
pena_num = 0
pena = [0] * (n + 1)

for i in range(m):
    p, s = map(str, input().split())
    if s == 'WA':
        if p not in seikai:
            pena[int(p)] += 1
        else:
            continue
    else:
        if p not in seikai:
            pena_num += pena[int(p)]
            seikai.add(p)
        else:
            continue
print(len(seikai), pena_num)
N,M = map(int,input().split())

if M == 0:
  print(0,0)
  exit();

x = {}  
for _ in range(M):
  a,w = map(str,input().split())
  x.setdefault(int(a),[]).append(w)
  
ac = at = wa = wt = 0  
for k,v in x.items():
  for j in v:
    if j == 'AC':
      at += 1
      break
    elif j =='WA':
      wt += 1
  if at == 0:
    wt = 0
  else:
    ac += at
    wa += wt
    at = 0
    wt = 0
      
print(ac,wa)
n,m = map(int,input().split())

d = [False for _ in range(n)]
w = 0
a = 0
for i in range(m):
    P,S = input().split()
    P = int(P)
    if(S == 'WA'):
        if(d[P-1] >= 0):d[P-1] += 1
    elif(S == 'AC'):
        if(d[P-1] >= 0):
            a += 1
            w += d[P-1]
            d[P-1] = -1

print(a,w)
from collections import defaultdict
N, M = map(int, input().split())
done = set()
ac = defaultdict(int)
wa = defaultdict(int)
# ACを一回以上出した問題のみ
for _ in range(M):
    p, s = map(str, input().split())
    if s == "WA":
        if p not in done:
            wa[p] += 1
    elif s == "AC":
        if p not in done:
            ac[p] += 1
            done.add(p)

a = len(ac)
w = 0
for k, v in wa.items():
    if k in done:
        w += v

print(a, w)
N, M = map(int, input().split())
P = [0] * M
S = ["a"] * M
flg = [0] * N
C = 0
D = 0
E = [0] * N

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

	if S[i]=="AC":
		if flg[P[i]-1]==0:
			C += 1
			flg[P[i]-1] = 1
			E[P[i]-1] = 0
	elif S[i]=="WA":
		if flg[P[i]-1]==0:
			D += 1
			E[P[i]-1] += 1

print(C, D-sum(E))
n,m = map(int,input().split())
WA = [0]*n
AC  = [0]*n
wa = 0
for i in range(m):
    x = input().split()
    x[0] = int(x[0])
    if x[1] == 'WA' and AC[x[0]-1] == 0:
        WA[x[0]-1] += 1
    elif x[1] == 'AC' and AC[x[0]-1] == 0:
        AC[x[0]-1] += 1
        wa += WA[x[0]-1]
print(sum(AC),wa)
n,m=map(int,input().split())

x=[True]*n
cnt=[0]*n
y=0
z=0

for i in range(m):
    p,s=input().split()
    if s=="AC":
        x[int(p)-1]=False
    elif x[int(p)-1]:
        cnt[int(p)-1]+=1


for i in range(n):
    if x[i]==False:
        z+=cnt[i]
        y+=1

print(y,z)
N,M = map(int,input().split())

#AC,WA
P = [0]*N
Penalty = 0
Accepted = 0

for i in range(M) :
    p,S = input().split()
    p = int(p)
    
    if S == "AC" and P[p-1] != -1:
        Penalty += P[p-1]
        Accepted += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        P[p-1] += 1

print(Accepted,Penalty)
n,m=map(int,input().split())
l=[]
ansac=0
answa=0
a=[0]*(n)
d=dict()
for i in range(m):
  p,s=input().split()
  l.append([int(p),s])
for i in range(m):
  if l[i][1]=='AC':
    if l[i][0] not in d:
      ansac+=1
      answa+=a[l[i][0]-1]
      d[l[i][0]]=0
  else:
    a[l[i][0]-1]+=1
print(ansac,answa)
N,M = map(int, input().split())
WL = [0]*(N+1)
AL = [0]*(N+1)
WLsum = 0
for _ in range(M):
    xx = input().split()
    p = int(xx[0])
    if xx[1]=='AC':
        if AL[p] == 0:
            AL[p] = 1
            WLsum += WL[p]
    else:
        WL[p] += 1

print(str(AL.count(1)) + ' ' + str(WLsum))
n, m = map(int, input().split())
ac = [0]*n
wa = [0]*n

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac[p-1] = 1
    elif s == "WA":
        if ac[p-1] != 1:
            wa[p-1] += 1

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

print(sum(ac), sum(wa))
import math

N, M = map(int, input().split())
wa_list = [0] * N
ac_list = [False] * N
for i in range(M):
    p, s = map(str, input().split())
    p = int(p) - 1
    if s == 'AC':
        ac_list[p] = True
    else:
        if not ac_list[p]:
            wa_list[p] += 1
for i in range(N):
    if not (ac_list[i]):
        wa_list[i] = 0

print(sum(i == True for i in ac_list), sum(wa_list))
N, M = tuple(map(int, input().split()))
P, S = [], []
for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

accepted = [False] * N
wrong = [0] * N
AC, WA = 0, 0
for p, s in zip(P, S):
    if s == "WA":
        if not accepted[p-1]:
            wrong[p-1] += 1
    elif s == "AC" and accepted[p-1] is False:
        accepted[p-1] = True
        AC += 1
        WA += wrong[p-1]
print(AC, WA)
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)
n, m = map(int, input().split())
flg = [0]*n
ac = 0
pe = [0]*n

for i in range(m):
    p, s = input().split()
    if flg[int(p)-1] == 0:
        if s == "WA":
            pe[int(p)-1] += 1
        else:
            flg[int(p)-1] = 1
            ac += 1
spe = 0
for i in range(n):
    if flg[i] == 1:
        spe += pe[i]

print(ac, spe)
n,m = map(int,input().split())
toi=[0 for i in range(n)]
ac=0
wa=0
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if s=="AC":
    if toi[p-1]!=-1:
      wa+=toi[p-1]
      ac+=1
      toi[p-1]=-1
  else:
    if toi[p-1]!=-1:
      toi[p-1]+=1
print(ac,wa)
N,M=map(int,input().split())
PS=[]
for i in range(M):
  x,y=input().split()
  PS.append((int(x),y))
ac=[0]*N
wa=[0]*N
for i in range(M):
  if PS[i][1]=="AC" and ac[PS[i][0]-1]==0:
    ac[PS[i][0]-1]=1
  elif PS[i][1]=="WA" :
    if ac[PS[i][0]-1]!=1:
      wa[PS[i][0]-1]+=1
sac=sum(ac)
swa=sum(wa)
print(sac,swa)
N, M = map(int, input().split())
count = [0]*N
ans = 0
ok = 1
for _ in range(M):
    p, s = input().split()
    if count[int(p)-1] >= 0 and s == "WA":
        count[int(p) - 1] += 1
    elif count[int(p)-1] >= 0 and s == "AC":
        ans += count[int(p)-1]
        count[int(p)-1] = -1
        ok += 1
print(ok, ans)
n,m = map(int,input().split())
ls = []
for i in range(m):
    p,m = map(str,input().split())
    ls.append([p,m])
    
ac = 0
wa = 0
now = ""
for i in ls:
    if now == i[0]:
        continue
    if i[1] == "AC":
        now = i[0]
        ac += 1
    elif i[1] == "WA":
        wa += 1
        
print(ac,wa)
from sys import stdin 
n,m = [int(x) for x in stdin.readline().rstrip().split()]
a = []
for i in range(m):
    a.append([x for x in stdin.readline().rstrip().split()])
ac = [0] * n
wa = [0] * n
WA = 0
for i in range(m):
    if a[i][1] == 'WA':
        wa[int(a[i][0])-1] += 1
    if a[i][1] == 'AC':
        ac[int(a[i][0])-1] = 1
        WA += wa[int(a[i][0])-1]
print(sum(ac),WA)
N, M = map(int, input().split())

ans_list = []
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if not (p_i in ans_list and p_i<=N):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list.append(p_i)
      
print("{} {}".format(cor_num,pen_num))
N,M = map(int,input().split())
AC_flag = [False]*N
WA_count = [0]*N
for m in range(M):
    P,S = map(str,input().split())
    p = int(P)
    if AC_flag[p-1] == False and S == "AC":
        AC_flag[p-1] = True
    if AC_flag[p-1] == False and S == "WA":
        WA_count[p-1] += 1
print(*[sum(AC_flag),sum(WA_count)])
N, M = map(int, input().split())

ac = 0
wa = 0

l = [0] * (N + 1)

for num in range(M):
    p, s =  input().split()
    p = int(p)
    if s == "AC":
        if l[p] == 0:
            ac += 1
        
        l[p] = 1
    else:
        if l[p] == 0:
            wa += 1
        
print(*[ac, wa])
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
PM = [stdin.readline().rstrip().split() for _ in range(M)]
AC = set()
WA = {}
for pm in PM:
    if pm[1] == "AC":
        AC.add(pm[0])
    elif pm[1] == "WA":
        if pm[0] in AC:
            continue
        if pm[0] not in WA:
            WA[pm[0]] = 0
        WA[pm[0]] += 1  
print(len(AC), sum(WA.values()))
mondaisu , teisyutukaisu = map(int,input().split())

flag = []
penalog = []

for i in range(mondaisu):
  flag.append(0)
  penalog.append(0)



for i in range(teisyutukaisu):
  bango , kekka = input().split()
  bango = int(bango)
  if flag[bango-1] == 1:
    continue
  if kekka == 'WA':
    penalog[bango-1] = penalog[bango-1] + 1
  if kekka == 'AC':
    flag[bango-1] = 1
  
print(sum(flag),sum(penalog))
N, M = map(int, input().split())
solve_problem = []
penalty = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC' and p not in solve_problem:
        solve_problem.append(p)
    if S == 'WA' and p not in solve_problem:
        penalty += 1

print('{} {}'.format(len(solve_problem), penalty))
n, m = map(int, input().split())
check = {'AC' : [],
        'WA' : 0}

for i in range(m):
    q, result = input().split()
    q = int(q)
    if result == 'AC':
        if q not in check['AC']:
            check['AC'].append(q)
    else:
        if q not in check['AC']:
            check['WA'] += 1

print(str(len(check['AC'])) + " " + str(check['WA']))
n, m = map(int, input().split())
resultList = [0 for i in range(n)]
#print(resultList)
ansAC = 0
ansWA = 0
for i in range(m) :
    result = input().split()
    prob = int(result[0]) - 1
    if result[1] == 'AC' and resultList[prob] == 0 :
        resultList[prob] = 1
        ansAC += 1
    if result[1] == 'WA' and resultList[prob] == 0 :
        ansWA += 1

print(ansAC, ansWA)
n, m = map(int, input().split())
ans = []
ans_0 = []
for i in range(m):
    ans_0 = list(map(str, input().split()))
    ans.append(ans_0)
list0 = []
for j in range(n):
    list0.append(0)
sei = 0
pen = 0
for lis in ans:
    if list0[int(lis[0])-1] == 0:
        if lis[1] == "AC":
            sei += 1
            list0[int(lis[0])-1] = 1
        else:
            pen += 1
    else:
        pass
print(str(sei)+" "+str(pen))
n,m=map(int,input().split())
cnt1=0
cnt2=0
flag=[-1]*(n+1)
for _ in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if flag[p]==1:
    continue
  else:
    if s=='AC':
      cnt1+=1
      flag[p]=1
    else:
      cnt2+=1
print(cnt1,cnt2)
x=input().split()
n=int(x[0])
m=int(x[1])
p=[]
ref=[]
for k in range(m):
  x=input().split()
  p.append(int(x[0]))
  ref.append(x[1])
first=[-1]*(n+1)
penalties=[0]*(n+1)
for k in range(m):
  prob=p[k]
  outcome=ref[k]
  if first[prob]==-1:
    if outcome=='AC':
      first[prob]=k
    else:
      penalties[prob]+=1
pb=0
pen=0
for k in range(n+1):
  if first[k]!=-1:
    pb+=1
    pen+=penalties[prob]
print(pb,pen)
# N問出題
# M回提出

ans = []
pena = 0
N, M = map(int, input().split())
for m in range(M):
    p, s = input().split()
    # 次の問題へ
    if s == "AC":
        ans.append(p)
    if s == "WA" and (p not in ans):
        pena +=1

print(len(set(ans)), pena)
N,M = map(int, input().split())

wa_counter = [ 0 for i in range(N)]
ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "AC":
      ac_flag[int(P_num)-1] = 1
    else:
      wa_counter[int(P_num)-1] += 1
  else:
    pass
    
print(sum(ac_flag), sum(wa_counter))
n,k=map(int,input().split())
c=[]
d=[]
co=0
wr=0
for i in range(k):
    a,b=map(str,input().split())
    c.append(int(a))
    if b=='AC':
        d.append(a)
        co+=1
    if b=='WA' and a not in d:
        wr+=1
print(co,wr)
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    b = b.rstrip()
    a = int(a) - 1
    if b == 'WA':
        li[a][0] += 1
    elif li[a][1] == 0:
        li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)
n,m=map(int,input().split())
l=list(input().split() for i in range(m))
l=[[int(i[0]),i[1]] for i in l]

count=[[i+1,0,0,1] for i in range(n)]
ans=0
pen=0

for i in l:
  for j in count:
    if i[0]==j[0]:
      if j[3]==1:
        if i[1]=='WA':
          pen+=1
        else:
          ans+=1
          j[3]*=0

print(ans,pen)
n, m = map(int, input().split())
A = []

fls = 0
tr = 0
for i in range(m):
    a, b = input().split()
    a = int(a)
    if b == "WA" and a not in A:
        fls += 1
    elif b == "AC" and a not in A:
        A.append(a)
        tr += 1

print(tr, fls)
N,M = map(int,input().split())
P = [input().split() for m in range(M)]
S = []
a = 0

for p,s in P:
  if p not in S:
    if s=="AC":
      S.append(p)
    else:
      a+=1

print(len(S),a)
n, m = map(int, input().split())
list_num = list([] for i in range(n))
test = [input().split() for i in range(m)]
check = [0] * n
for i in test:
  list_num[int(i[0]) - 1].append(i[1])
count = 0
count_ac = 0
count_wa = 0
check = 0
for i in list_num:
  for j in range(len(i)):
    if(i[j] =='WA'):
      count += 1
    else:
      count_ac += 1
      check = 1
      break
  if(check == 1):
    count_wa += count
    count = 0
    check = 0 

print(count_ac , count_wa)
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if not p in d:
            d[p] = s
        if d[p] == 'WA':
            scores[0 if s == 'AC' else 1] += 1
            d[p] = s
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

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

ans_list = []

for i in range(M):
    ans_list.append(input().split())

wa = 0
ac = 0
flag = 0

for n in range(1,N+1):

    for t in range(M):
        if ans_list[t][0] == str(n) and ans_list[t][1] == "AC":
            ac += 1
            break

        elif ans_list[t][0] == str(n) and ans_list[t][1] == "WA":
            wa += 1

print(ac, wa)
n, m = list(map(int, input().split()))
S = [input().split() for _ in range(m)]
S = [[int(s[0]), s[1]] for s in S]
acf = [0] * n
p = 0
for s in S:
    if s[1] == 'AC':
        acf[s[0] - 1] = 1
        continue
    elif acf[s[0] - 1] == 0:
        p += 1
        continue
ans = ' '.join(list(map(str, [sum(acf), p])))
print(ans)
n, m = map(int, input().split())
answered = [False] * n
ans = 0
pena = 0
for _ in range(m):
    p, s = input().split()
    pidx = int(p) - 1
    if answered[pidx]:
        continue
    if s == "AC":
        ans += 1
        answered[pidx] = True
    else:
        pena += 1
print("{} {}".format(ans, pena))
n,m = map(int,input().split())
score_list = [2]*m
for i in range(m):
    score_list[i] = input().split()

wa_num = 0
ac_q = []
for i in range(m):
    if score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
        wa_num = wa_num + 1
    elif score_list[i][1] == "AC" and score_list[i][0] not in ac_q:
        ac_q.append(score_list[i][0])

ac_num = len(ac_q)

print(ac_num,wa_num)
#C
n, m = map(int, input().split())
probrem = [0] * n
warn = [0] * n
for i in range(m):
    a, b = map(str, input().split())
    a=int(a)
    if probrem[a - 1] == 0 and b == 'AC':
        probrem[a - 1] = 1
    if probrem[a - 1] == 0 and b == "WA":
        warn[a - 1] += 1
# print(probrem,warn)
print(sum(probrem),sum(warn))
N, M = map(int, input().split())
wa, ac = [0]*(N+1), [0]*(N+1)
for i in range(1, M+1):
  pi, Si = input().split()
  pi = int(pi)
  if Si == 'WA' and ac[pi] == 0: 
    wa[pi] += 1
  elif Si == 'AC' and ac[pi] == 0:
    ac[pi] += 1

print('{} {}'.format(sum(ac), sum(wa)))
n,m = map(int,input().split())
count_ac = 0
count_wa = 0
l = [('','')]*m
memo_n = []
idx = 0
for i in range(m):
    t = tuple(input().split())
    l[i] = t
    if t[1] == 'AC' and t[0] not in memo_n:
        memo_n.append(t[0])
        count_ac += 1
        count_wa += l[idx:i+1].count((t[0],'WA'))
        idx = i

print(str(count_ac) + " " + str(count_wa))