peterverebics/CodeNet_Python_118 huggingface dataset:
n,m=map(int,input().split())
li=[input().split() for i in range(m)]
 
ac=set()
wa=0
 
q=[[0,-1] for i in range(n+1)]
 
for x,y in li:
  if y=="AC" and q[int(x)][1]==-1: #AC出したらこれまでのwaを答えに足して、それ以降はカウントされないようにする
    wa+=q[int(x)][0]
    q[int(x)][1]=0
    ac.add(x)
  elif y=="WA" and q[int(x)][1]==-1:
    q[int(x)][0]+=1
 
print(len(ac),wa)
N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

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

penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))
n, m = [int(i) for i in input().split()]
ac = [0] * n
wa = [0] * n

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

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

print(sum(ac), wa_sum)
n, m = map(int, input().split())
ac = [0] * (n+1)
pena = 0

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

    else:
        if ac[p] != -1:
            ac[p] += 1


print(ac.count(-1), pena)
n,m = map(int, input().split())

wa_l = [0]*(n+1)
ac_l = [False]*(n+1)
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not ac_l[p]:
        wa_l[p] += 1
    elif s == 'AC':
        ac_l[p] = True


ans_a = 0
ans_w = 0
for wa,ac in zip(wa_l,ac_l):
    if ac:
        ans_a+=1
        ans_w += wa

print(ans_a,ans_w)
# ABC 151C
n, m = map(int, input().split())
ac = 0
wa = 0
cnt = [0]*n
for i in range(m):
    p, s = input().split()
    p = int(p)
    p -= 1
    if cnt[p] == -1:
        continue
    elif s == 'AC':
        ac += 1
        wa += cnt[p]
        cnt[p] = -1
    else:
        cnt[p] += 1
print(ac, wa)
n, m = map(int, input().split())

problem = [False] * n
count_wa = [0] * n


for _ in range(m):
    num, res = input().split()
    num = int(num) - 1

    if res == 'AC':
        problem[num] = True

    else:
        if problem[num] == False:
            count_wa[num] += 1
        else:
            continue

a = sum(problem)
b = 0

for i in range(n):
    if problem[i] == True:
        b += count_wa[i]

print(a, b)
N,M=map(int,input().split())
ac=[0]*(N+1)
wa=[0]*(N+1)
for i in range(M):
    p,s=input().split()
    if ac[int(p)]==1:
        continue
    if s=='AC':
        ac[int(p)]=1
    elif s=='WA':
        wa[int(p)]+=1

ac_ans,wa_ans=0,0
for a,w in zip(ac,wa):
    if a==0:
        continue
    ac_ans+=a
    wa_ans+=w

print(ac_ans,wa_ans)
n,m=map(int,input().split())
d={}
for i in range(m):
    p,s=map(str,input().split())
    if p not in d:
        d[p]=[s,1]
    elif d[p][0]=="WA":
        d[p][0]=s
        d[p][1]+=1
ans=[0,0]
for i in d:
    if d[i][0]=="AC":
        ans[0]+=1
        ans[1]+=d[i][1]-1
print(*ans)
n,m = map(int, input().split())

accurate = [0] * n
correct = 0
wrong = [0] * n
penalty = 0

for i in range(m):
    p,s = input().split()
    num = int(p) - 1 
    if s == 'AC' and accurate[num] == 0:
        accurate[num] += 1
        correct += 1
        penalty += wrong[num]
    elif s == 'WA':
        wrong[num] += 1 

print('{} {}'.format(correct,penalty))
N,M = list(map(int,input().split()))
ac = [0]*N
wa = [0]*N
for i in range(M):
    p,s = list(map(str,input().split()))
    p = int(p)
    if s == 'AC':
        ac[p - 1] = 1
    elif s == 'WA':
        if ac[p - 1] == 0:
            wa[p - 1] += 1
for i in range(N):
    if ac[i] == 0:
        wa[i] = 0
print(sum(ac),sum(wa))
n, m = map(int, input().split())

total_ac = 0
total_wa = 0
results = {}
for _ in range(m):
  pi, si = input().split()
  if results.get(pi) == None:
    results[pi] = {
      "AC": False,
      "CumWA": 0
    }
  if not results[pi]["AC"] and si == "AC":
    results[pi]["AC"] = True
    total_ac += 1
    total_wa += results[pi]["CumWA"] 
  elif not results[pi]["AC"] and si == "WA":
    results[pi]["CumWA"] += 1

print(total_ac , total_wa )
n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n#ペナ数
rig=[0]*n#ACorWA

for i in range(m):
    if ps[i][1]=="AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1]==0:
            pen[int(ps[i][0])-1]+=1
cnt1,cnt2=0,0
for i in range(n):
    if rig[i]==1:
        cnt1+=rig[i]
        cnt2+=pen[i]

print(str(cnt1)+" "+str(cnt2))
N,M = map(int,input().split())

AC = [0 for i in range(N+1)]
WA = [0 for i in range(N+1)]

for i in range(M):
    a,b=input().split()
    a2 = int(a)
    if b == 'AC':
      AC[a2 - 1] = 1
    elif b == 'WA' and AC[a2 - 1] == 0:
      WA[a2-1]+= 1

ans_WA = 0
for i, j in zip(WA, AC):
  ans_WA += i * j
  
print(sum(AC), ans_WA)
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(a):
  if list[i] ==0:
    f_cnt[i] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))
n, m = map(int, input().split())
answer = [[False, 0] for _ in range(n)]
for i in range(m):
    number, result = input().split()
    number = int(number)
    if result == 'AC':
        answer[number-1][0] = True
    elif answer[number-1][0] != True:
        answer[number-1][1] += 1

ret = [ans[1] for ans in answer if ans[0] == True]
print(len(ret), sum(ret))
import numpy as np
N,M=map(int,input().split())
wa=np.zeros(N+1)
ac=np.zeros(N+1)
for _ in range(M):
    p,S=input().split()
    if S=='AC' and ac[int(p)]==0:
        ac[int(p)]+=1
    elif S=='AC' and ac[int(p)]>0:
        pass
    elif ac[int(p)]==0:
        wa[int(p)]+=1
print(int(sum(ac)), int(np.dot(ac>0,wa)))
N, M = map(int, input().split())
ans = 0
pen = 0
w = [0]*(N+1)
ac = [False]*(N+1)
for _ in range(M):
    p, s = input().split()
    if s == "AC" and not ac[int(p)]:
        pen += w[int(p)]
        ac[int(p)] = True
        ans += 1
    elif s == "WA":
        w[int(p)] += 1
print(ans, pen)
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+1):
    if ac[i] == 0:
        wa[i] = 0

print(sum(ac),sum(wa))
N, M = map(int, input().split())
isAC = [False for _ in range(N)]
correct = 0
penalty = [0 for _ in range(N)]
for _ in range(M):
    tmp = input().split()
    pi, Si = int(tmp[0]), tmp[1]
    if not isAC[pi-1]: # すでにAC
        if Si == 'AC':
            isAC[pi-1] = True
            correct += 1
        else:
            penalty[pi-1] += 1
pnl = 0
for idx in range(N):
    if isAC[idx]:
        pnl += penalty[idx]
print(correct, pnl)
N, M = map(int, input().split())
PS = [[0, 0] for i in range(N)] 
for i in range(M):
  p, s = input().split()
  if s == "AC":
    PS[int(p) - 1][0] = 1
  elif s == "WA" and PS[int(p) - 1][0] == 0:
    PS[int(p) - 1][1] += 1
ac = 0
wa = 0
for ps in PS:
  if ps[0] == 1:
    ac += 1
    wa += ps[1]
print(ac, wa)
from collections import OrderedDict
n, m = map(int,input().split())
 
aclist = [0]*n
walist = [0]*n
wa = 0
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC':
    if not aclist[p]:
      aclist[p] = 1
      wa += walist[p]
  else:
    if not aclist[p]:
      walist[p] += 1
"""
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC' and not aclist[p]:
    aclist[p] = 1
    ac += 1
    wa += walist[p]
  else:
    walist[p] += 1
"""
print(sum(aclist), wa)
#N=int(input())
#N,M=map(int, input().split())
#L=list(map(int, input().split()))
N,M=map(int, input().split())
ifACL=[0]*N
cWAL=[0]*N
psL=[]
AC=0
WA=0
p=0
s=0
for _ in range(M):
  p,s=map(str, input().split())
  p=int(p)
  if ifACL[p-1]==0 and s=="WA":
    cWAL[p-1]+=1
  elif ifACL[p-1]==0 and s=="AC":
    AC+=1
    WA+=cWAL[p-1]
    ifACL[p-1]=1

print(AC,WA)
import numpy as np
n,m = map(int, input().split())

ac_ques = np.array([0]*n)
count = np.array([0]*n)

for _ in range(m):
    p,s = map(str, input().split())
    if ac_ques[int(p)-1] == 0:
        if s == "WA":
            count[int(p)-1] += 1
        else:
            ac_ques[int(p)-1] = 1

print(sum(ac_ques),sum(ac_ques * count))
N, M = map(int,input().split())
accepted = [0]*N
wrong_ans =[0]*N 
for i in range(M):
    p,s = input().split()
    p = int(p)-1
    if s =="AC":
        accepted[p] = 1
    elif s == "WA" and accepted[p]==0:
        wrong_ans[p] = wrong_ans[p]+1

AC = 0
penalty = 0
for i in range(N):
    if accepted[i] == 1:
        AC = AC+1
        if wrong_ans[i]>=1:
            penalty = penalty+wrong_ans[i]
print(AC,penalty)
n,m=map(int,input().split())
p=[True]*n
y=[0]*n
i=0
l=0
for  _ in range(m):
    k,o=input().split()
    k=int(k)-1
    if p[k]==True:
        if o=="AC":
            i+=1
            p[k]=False
        else:
            y[k]+=1
for e in range(n):
    if p[e]==False:
        l+=y[e]
print(i,l)
n, m = map(int, input().split())

ans = 0
flag = [0] * n

for _ in range(m):
    P, s = input().split(' ')
    p = int(P) - 1
    if s == 'AC':
        if flag[p] != -1:
            ans += flag[p]
            flag[p] = -1
    elif flag[p] != -1:
        flag[p] += 1

print(flag.count(-1), ans)
n, m = map(int, input().split())
pss = [input().split() for _ in range(m)]

import array; ### print(array.typecodes) ###
wacounts = array.array("l", [0] * (n+1))
acflags = array.array("b", [0] * (n+1))

for pi, si in pss:
    pi = int(pi)
    if acflags[pi] == 0:
        if si == "WA": wacounts[pi] += 1
        if si == "AC": acflags[pi] = 1
    ### print(pi, si, wacounts, acflags) ###

print(acflags.count(1), end=" ")
print(sum(x*y for x,y in zip(wacounts, acflags)))
N,M=map(int,input().split())

ans=[0]*N
pen=[0]*N
AC=[0]*N

for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        pen[p-1]+=1
    else:
        if AC[p-1]==0:
            ans[p-1]+=pen[p-1]
        AC[p-1]=1

print(AC.count(1),sum(ans))
n, m = [int(x) for x in input().split()]
ac = [0] * (n + 1)
wa = [0] * (n + 1)

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

print(sum(ac), sum([p for a, p  in zip(ac, wa) if a == 1]))
N, M = map(int, input().split())
pena= 0
ac = [0]*(10**5)
for _ in range(M):
  tmp = input().split()
  if ac[int(tmp[0])-1] < 1:
    if tmp[1] == "AC":
      pena -= ac[int(tmp[0])-1]
      ac[int(tmp[0])-1] = 1
    else: ac[int(tmp[0])-1] -= 1 #penalty
print(ac.count(1), pena)
N,M=list(map(int, input().split()))
P=[0]*M
S=[0]*M
for i in range(M):
    P[i],S[i]=list(input().split())
    P[i]=int(P[i])

flagac=[False]*N
pnlt=[0]*N
for i in range(M):
    p=P[i]-1
    s=S[i]
    if s=='AC':
        flagac[p]=True
    else:
        pnlt[p]+=(flagac[p]+1)%2
# print(flagac)
# print(pnlt)

ctac=0
ctwa=0
for i in range(N):
    if flagac[i]:
        ctac+=1
        ctwa+=pnlt[i]
print(ctac, ctwa)
N, M = map(int, input().split())
accepted = [0] * N
penalties = [0] * N
for _ in range(M):
    p, ac = input().split()
    p, ac = int(p) - 1, ac == "AC"
    accepted[p] |= ac
    penalties[p] += not accepted[p]
print(sum(accepted), sum(p for ac, p in zip(accepted, penalties) if ac))
n, m = map(int, input().split())
ps = [(input().split()) for _ in range(m)]

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

for p, s in ps:
    i = int(p)
    if s == "WA":
        if ac[i] != 1:
            wa[i] += 1
    else:
        if ac[i] != 1:
            ac[i] = 1

print(sum(ac), sum(wa[i] * ac[i] for i in range(n + 1)))
n,m = map(int,input().split())
q = [0]*n
wa = [0]*n
for _ in range(m):
    pp,s = input().split()
    p = int(pp)

    if q[p-1] == 0:
        if s == "WA":
            wa[p-1] += 1
        else:
            q[p-1] = 1
qq = 0
wawa = 0
for i in range(n):
    if q[i] > 0:
        wawa += wa[i]
    qq += q[i]
print(qq,wawa)
N, M = map(int, input().split())

ac_chk = [0]*(N+1)
wa_chk = [0]*(N+1)
wa = 0
ac = 0

for i in range(M):
	p, S = input().split()
	p = int(p)
	if ac_chk[p] == 0:
		if S == "AC":
			ac_chk[p] = 1
			ac += 1
			wa += wa_chk[p]
			continue
		if S == "WA":
			wa_chk[p] += 1
			continue
	else:
		continue
print(ac, wa)
n,m = map(int,input().split())
acli = [0]*n
wali = [0]*n
acsi = 0
wasi = 0
for i in range(m):
    p,s = map(str,input().split())
    if acli[int(p)-1] == 0:
        if s == 'AC':
            acli[int(p)-1] = 1
            acsi += 1
        elif s == 'WA':
            wali[int(p)-1] += 1
for j in range(n):
    if acli[j] == 1 and wali[j] != 0:
        wasi += wali[j]
print(acsi,wasi)
N, M = map(int, input().split())
AC = set()
wa = [0] * (N+1)

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa[p] += 1

wa_ans = 0
for i in range(1,N+1):
    if i in AC:
        wa_ans += wa[i]

print(len(AC), wa_ans)
n, m = map(int, input().split())
d = {}
cnt_ac = 0
cnt_wa = 0
for _ in range(m):
    p, s = input().split()
    if p not in d:
        d[p] = [s]
    else:
        d[p].append(s)
for i in d:
    if 'AC' in d[i]:
        cnt_ac += 1
        cnt_wa += d[i].index('AC')
print(cnt_ac, cnt_wa)
N, M = map(int, input().split())
ans1 = 0
ans2 = 0
Q = [0] * N
wrong = [0] * N
for i in range(M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans1 += 1
    ans2 += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans1,ans2)
import numpy as np

N, M = map(int, input().split())

ac = 0
wa = 0
test = [0] * N
count = [0] * N
for i in range(M):
    p_i, s_i = input().split(" ")
    p_i = int(p_i) - 1
    if s_i == "AC":
        test[p_i] = 1
    elif test[p_i] != 1:
        count[p_i] += 1

test = np.array(test)
count = np.array(count)

score = np.sum(test)
pena = np.sum(test * count)
print(str(int(score)) + " " + str(int(pena)))
from operator import itemgetter

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

an = [0]*n

sc = 0
er = 0

for i in range(m):
    t, s = map(str, input().split())
    p = int(t)-1
    if (an[p] != m+1 and s == "AC"):
        sc += 1
        er += an[p]
        an[p] = m+1
    elif (an[p] != m+1 and s == "WA"):
        an[p] += 1


print("{} {}".format(sc, er))
n,m = map(int,input().split())
ac,wa = 0,0
number=[0]*n

for i in range(m):
  p,s = input().split()
  p = int(p) - 1
  if number[p]!=-1:
    if s == "WA":
      number[p]+=1
    elif s == "AC":
      ac+=1
      wa+=number[p]
      number[p]=-1
print(ac,wa)
n, m = map(int, input().split())
problem = [0] * n
ac = 0
penalty = 0
for i in range(m):
    p, s = map(str, input().split())
    if s == "AC":
        temp = problem[int(p) - 1]
        if temp >= 0:
            ac += 1
            penalty += temp
            problem[int(p) - 1] = -1
    else:
        if problem[int(p) - 1] >= 0:
            problem[int(p) - 1] += 1
print(ac, penalty)
# -*- coding: utf-8 -*-
import numpy as np

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

ac = np.zeros(n)
wa = np.zeros(n)

for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if ac[p] == 1:
        continue
    if s == "WA":
        wa[p] += 1
    else:
        ac[p] = 1

acc = 0
wac = 0
for a, w in zip(ac, wa):
    if a == 1:
        acc += 1
        wac += w

print(acc, int(wac))
n, m = map(int,input().split())
result = []
for _ in range(m):
    a, b = input().split()
    a = int(a)
    result.append([a, b])
problems = [0] * (n+1)
ac = 0
wa = 0
for i in range(m):
    if problems[result[i][0]-1] != -1:
        if result[i][1] == "AC":
            ac += 1
            wa += problems[result[i][0]-1]
            problems[result[i][0]-1] = -1
        else:
            problems[result[i][0]-1] += 1

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

flag_ac = [0]*n
cnt_wa = [0]*n
cnt_penalty = 0

for _ in range(m):
    p, s = input().split()
    if s == "WA":
        cnt_wa[int(p)-1] += 1
    elif s == "AC" and flag_ac[int(p)-1] == 0:
        flag_ac[int(p)-1] = 1
        cnt_penalty += cnt_wa[int(p)-1]
        
print(sum(flag_ac), cnt_penalty)
import numpy as np

# 入力
N,M = map(int,input().split())

Check_AC = np.zeros(N)
WA_Counter = np.zeros(N)

for i in range(M):
    pi,Si = input().split()
    pi = int(pi)
    # まだ正解していない問題
    if Check_AC[pi-1] == 0:
        if Si == "AC":
            Check_AC[pi-1] = 1
        else:
            WA_Counter[pi-1] += 1
    
print(str(int(sum(Check_AC))) + " " + str(int(np.dot(Check_AC,WA_Counter))))
N, M = map(int, input().split())
isAC = [False] * (N+1)
penalties = [0] * (N+1)
ac, penalty = (0, 0)
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == "AC":
    if not isAC[p]:
      isAC[p] = True
      ac += 1
      penalty += penalties[p]
  else:
    penalties[p] += 1
print(ac, penalty)
n,m = map(int,input().split())
li = [[0,0] for _ in range(n)]
t1,t2 = 0,0
for i in range(m):
    a,b = input().split()
    if li[int(a)-1][0] != 1:
        if b == "WA":
            li[int(a)-1][1] += 1
        if b == "AC":
            li[int(a)-1][0] += 1
for i in range(n):
    t1 += li[i][0]
    t2 += li[i][1]*li[i][0]
print(t1,t2)
N,M=map(int,input().split())
ac=0
wa=0
a=[0]*N
w=[0]*N
for i in range(M):
    P,S=input().split()
    P=int(P)
    if S=="WA":
        w[P-1]+=1
    else:
        if a[P-1]==0:
            a[P-1]+=1
            ac=ac+1
            wa+=w[P-1]
        else:
            pass
print(ac,wa)
n,m = list(map(int, input().split()))

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

for i in range(m):
  ques, state = input().split()
  ques = int(ques)-1
  
  if (state=="AC") and (ac[ques]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (state=="WA") and (ac[ques]==0):
    wa[ques] += 1
    
print(sum(ac), pena)
N,M = map(int,input().split())
D = [[]for i in range(N)]
AC = 0
WA = 0
for i in range(M):
  plobNum,res = input().split()
  D[int(plobNum)-1].append(res)

for prob in D:
  wa_ = 0
  for submit in prob:
    if submit == "WA" :
      wa_+=1
    elif submit == "AC":
      AC+=1
      WA +=wa_
      break

print("{} {}".format(AC,WA))
N , M = map(int,input().split())
lst = []
AC_list = [False] * N
WA_cnt_list = [0] * N
for _ in range(M):
    r , judge = input().split()
    question_num = int(r) - 1
    if AC_list[question_num]:
        continue
    elif judge == "WA":
        WA_cnt_list[question_num] += 1
    elif judge == "AC":
        AC_list[question_num] = True
wa_cnt = 0
for i in range(N):
    if AC_list[i]:
        wa_cnt += WA_cnt_list[i]
print(sum(AC_list) , wa_cnt)
n,m = map(int,input().split())
a = [0]*n
ac = 0
wa = 0
for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s == "AC" and a[p-1] != -1:
        ac +=1
        wa += a[p-1]
        a[p-1] = -1
    elif s == "WA" and a[p-1] != -1:
        a[p-1] += 1
print(ac,wa)
N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [0] * N
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)
N, M = map(int, input().split())

AC = 0
pena = 0

lst = [0] * N
for _ in range(M):
    a, b = map(str, input().split())
    a = int(a) - 1
    if lst[a] < 0:
        continue
    else:
        if b == 'WA':
            lst[a] += 1
        else:
            AC += 1
            pena += lst[a]
            lst[a] = -1

print (AC, pena)
n, m = map(int, input().split())

ac_check = [0 for _ in range(n)]
wa_check = [0 for _ in range(n)]

for i in range(m):
    i, judge = input().split()
    i = int(i)-1
    if judge == 'AC':
        if ac_check[i] == 0:
            ac_check[i] = 1

    elif judge == 'WA':
        if ac_check[i] == 0:
            wa_check[i] += 1
wa = 0
for i in range(n):
    if ac_check[i] == 1 and wa_check != 0:
        wa += wa_check[i]

print(sum(ac_check), wa)
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
ac, wa = [0] * n, [0] * n
wa_sum = 0
for i in ps:
    p, s = int(i[0]), i[1]
    if ac[p - 1] == 0 and s == "AC":
        ac[p - 1] += 1
        wa_sum += wa[p - 1]
    else:
        wa[p - 1] += 1
print(sum(ac), wa_sum)
n,m=map(int,input().split())
num=[0]*n
wa=0
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA" and num[p-1]!=-1:
        num[p-1]+=1
    elif s=="AC" and num[p-1]!=-1:
        ac+=1
        wa+=num[p-1]
        num[p-1]=-1
print(ac,wa)
n,m = list(map(int, input().split()))
ps = [input().split() for _ in range(m)]

acCount = 0
penaltyCount = 0
wa = [0]*n
aced = [False]*n

for i in ps:
    ind = int(i[0])-1
    if i[1]=='WA' and not aced[ind]:
        wa[ind] += 1
    elif i[1]=='AC' and not aced[ind]:
        aced[ind] = True
        acCount += 1
        penaltyCount += wa[ind]

print(acCount, penaltyCount)
n,m = map(int, input().split())
AC = [False]*n
WA = [0]*n

for i in range(m):
    p,s = input().split()
    p = int(p)-1

    if AC[p] == False:
        if s == 'WA':
            WA[p] += 1
        else:
            AC[p] = True

wa = 0

for i in range(n):
    if AC[i]:
        wa += WA[i]
        

print(AC.count(True),wa)
a,b=map(int, input().split())
c=[0]*a
d=[0]*a
e=0
for i in range(b):
    p, s=input().split()
    p=int(p)-1
    if c[p]==0 and s=='AC':
        c[p]=1
        e+=d[p]
    d[p]+=1
print(sum(c),e)
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

cnt = 0; correct = 0
for v in d.values():
    if "AC" not in v:
        continue
    correct += 1
    cnt += v.index("AC") 

print(correct, cnt)
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

WA = 0

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if ac[p] == 0 and s == 'AC':
        ac[p] = 1
        WA += wa[p]

    wa[p] += 1

print(sum(ac), WA)
N,M=map(int,input().split())
ac=[False]*N
wa=[0]*N
for _ in range(M):
  p,S=input().split()
  p=int(p)-1
  if S=='AC':
    ac[p]=True
  else:
    if not ac[p]:
      wa[p]+=1
a=0
b=0
for i in range(N):
  if ac[i]:
    a+=1
    b+=wa[i]
print(*[a,b])
n,m = map(int, input().split())

wc = [0 for i in range(n)]
ac = [0 for i in range(n)]

n_wc = 0
n_ac = 0

for i in range(m):
    num,j = input().split()
    num = int(num)

    if j == 'AC' and ac[num-1] == 0:
        n_ac += 1
        ac[num-1] = 1
        n_wc += wc[num-1]
    else:
        wc[num-1] += 1

print(n_ac,n_wc)
N, M = map(int, input().split())
ac = [False] * N
wa_cnt = [0] * N
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p_i = int(p) - 1
    if s == 'WA':
        if not ac[p_i]:
            wa_cnt[p_i] += 1
    else:
        if not ac[p_i]:
            ac[p_i] = True
            ac_cnt += 1

wa_cnt_sum = 0
for i in range(N):
    if ac[i]:
        wa_cnt_sum += wa_cnt[i]

print(ac_cnt,wa_cnt_sum)
N, M = map(int, input().split())
wa = [0]*N
ac = [0]*N

for i in range(M):
  p, s = map(str, input().split())
  p = int(p)
  if (s=='WA') and (ac[p-1]==0):
    wa[p-1] += 1
  else:
    ac[p-1] = 1
    
    
ans_ac = 0
ans_wa = 0
for i in range(N):
  if ac[i] == 1:
    ans_ac += 1
    ans_wa += wa[i]
    
print(str(ans_ac), str(ans_wa))
n, m = map(int, input().split())
ps = [[0, 0] for i in range(n)]  
wa_count = 0
ac_count = 0
for i in range(m):
    input_p, input_s = input().split()
    if ps[int(input_p)-1][0] <= 0:
        if input_s == 'AC':
            ps[int(input_p)-1][0] += 1
        else:
            ps[int(input_p)-1][1] += 1
for i in ps:
    if i[0] == 1:
        ac_count += 1
        wa_count += i[1]

print(ac_count, wa_count)
N, M = map(int, input().split())
ac = [False] * N
wa = [0] * N

for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if S == 'AC':
        ac[p] = True
    else:
        if not ac[p]:
            wa[p] += 1

a = 0
b = 0

for i in range(N):
    if ac[i]:
        a += 1
        b += wa[i]

print(*[a, b])