peterverebics/CodeNet_Python_118 huggingface dataset:
N,M=map(int,input().split())
S=[list(input().split()) for i in range(M)]

C=[0]*(N+1)
L=[0]*(N+1)
W=0

for x,y in S:
    if y=="AC":
        L[int(x)]=1

for x,y in S:
    x=int(x)
    if L[x]==0:
        continue

    if y=="AC":
        C[x]=1

    if C[x]==0 and y=="WA":
        W+=1

print(sum(L),W)
P,M = map(int,input().split())
dac = {}
dwa = {}
for _ in range(M):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if p not in dac:
      dac[p] = 1
  else:
    if p not in dac:
      if p not in dwa:
        dwa[p] = 1
      else:
        dwa[p] += 1

score = len(dac)
penalty = sum([val for k,val in dwa.items() if (k in dac)])
print(score,penalty)
N, M = map(int, input().split())
rec = [[0,0] for _ in range(N)]
AC = 0
pe = 0

for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        rec[p-1][1] = 1
    else:
        if rec[p-1][1] == 0:
            rec[p-1][0] += 1

for i in range(N):
    if rec[i][1] == 1:
        AC += 1
        pe += rec[i][0]

print(AC,pe)
N, M = list(map(int, input().split()))

WAs = [0] * (N + 1)
ACs = [0] * (N + 1)
for m in range(M):
  key, value = input().split()
  key = int(key)
  if value == 'WA' and ACs[key] == 0:
    WAs[key] += 1
  if value == 'AC':
    ACs[key] = 1

countWAs, countACs = 0, 0
for n in range(N + 1):
  if ACs[n] >= 1:
    countACs += ACs[n]
    countWAs += WAs[n]

#print(ACs)
#print(WAs)
print(str(countACs) + ' ' + str(countWAs))
n, m = map(int, input().split())
ac = [0] * n
wa = [0] * n

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

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

ac = sum([item>0 for item in ac])
wa = sum(wa)
print(ac, wa)
N,M = list(map(int,input().split()))
X = []
for i in range(M):
  tmp = [i for i in input().split()]
  X.append(tmp)

WAs = [0]*(N+1)
flags = [0]*(N+1)

AC = 0
WA = 0

for i in range(M):
  if X[i][1] == 'AC':
    if flags[int(X[i][0])] == 0:
      AC += 1
      WA += WAs[int(X[i][0])]
      flags[int(X[i][0])] = 1
  if X[i][1] == 'WA':
    if flags[int(X[i][0])] == 0:
      WAs[int(X[i][0])] += 1
      
print(AC,WA,sep=' ')
N, M = map(int, input().split())
p, S = [0]*M, [0]*M
for i in range(0,M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])
s, t = 0, 0
res = []
for i in range(0,N):
    res.append([i,0])
for i in range(0,M):
    if S[i] == "WA":
        res[p[i]-1][1] = res[p[i]-1][1]+1
    elif res[p[i]-1][0] != -1:
        s, t = s+1, t+res[p[i]-1][1]
        res[p[i]-1][0] = -1
print(s, t)
n,m=map(int,input().split())
counter = {}
for i in range(n):
  counter[i] = [0,0]

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

crt = 0
pen = 0
for i in range(n):
  if counter[i][1] == 1:
    crt+=1
    pen+=counter[i][0]

print(crt,pen)
n,m=map(int,input().split())
l=[[0 for i in range(2)]for j in range(n+1)]
wa,ac=0,0
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="WA" and l[p][1]==0:
    l[p][0]+=1
  elif s=="AC" and l[p][1]==0:
    l[p][1]+=1
    ac+=1
    wa+=l[p][0]
print(ac,wa)
N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)
n, m = map(int,input().split())
success = [0] * (n+1)
penalty = [0] * (n+1)


for ind in range(m):
    p, s = input().split()
    p = int(p)
    if s == "WA" and success[p] == 0:
        penalty[p] += 1
    elif s == "AC":
        success[p] = 1
penalty = [penalty[ind] * success[ind] for ind in range(n+1)]
print("{} {}".format(sum(success), sum(penalty)))
n,m=map(int,input().split())
aa=[[] for i in range(n)]
for x in range(m):
  a,b=input().split()
  d=int(a)-1
  aa[d].append(b)
  
ans_ac=0
ans_wa=0
for y in range(n):
  ans1=0
  ans2=0
  for z in range(len(aa[y])):
    if aa[y][z]=='WA':
      ans1+=1
    else:
      ans2+=1
      break
  if ans2==1:
    ans_wa+=ans1
    ans_ac+=1
    
print(str(ans_ac)+' '+str(ans_wa))
N, M = list(map(int, input().split()))

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

P, S = [], []
solved = set({})
counter = {i: 0 for i in range(1, N + 1)}
value1 = 0
value2 = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    P.append(p)
    S.append(s)

    if p in solved:
        continue

    if s == 'AC':
        solved.add(p)
        value1 += 1
        value2 += counter[p]

    else:
        counter[p] += 1

print(value1, value2)
N, M = map(int, input().split())

wa_stock = [0] * N
ac = 0
wa = 0
stat = ['NA'] * N

for _ in range(M):
    p, S = input().split()
    key = int(p) - 1
    if S == 'WA':
        wa_stock[key] += 1
    elif stat[key] != 'AC' and S == 'AC':
        stat[key] = 'AC'
        ac += 1
        wa += wa_stock[key]

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

acl=[0]*n
wal=[0]*n

for i in range(m):
    p,s=input().split()
    p=int(p)-1
    
    if s=="AC":
        if acl[p]==0:
            acl[p]=1
            wa+=wal[p]
            ac+=1
        
    else:
        wal[p]+=1
        
print(ac, wa)
import sys
N,M = map(int, input().split())
A = [tuple(input().split()) for _ in range(M)]
a_cnt = 0
p_cnt = 0
wa = [0] * N
flg = [0] * N

for i in range(M):
  no = int(A[i][0])-1
  if A[i][1] == "AC" and flg[no] == 0:
    a_cnt += 1
    p_cnt += wa[no]
    flg[no] = 1
    continue
  else:
    wa[no] += 1
print(a_cnt, p_cnt)
n,m = map(int, input().split())

flag = [False]*n
nums = [0]*n
for _ in range(m):
  p,s = input().split()
  p = int(p)-1
  if s == "AC": flag[p] = True
  elif flag[p] == False: nums[p] += 1
ac = flag.count(True)
wa = 0
for i in range(n):
  if flag[i]: wa += nums[i]
print(ac, wa)
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num={}
#辞書
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)
    if result[1]=="AC":
        num[result[0]]=0

for x in ps:
    if not x[0] in num:
        continue
    if x[1]=="WA" and num[x[0]]==0:
        pena+=1
    if x[1]=="AC" and num[x[0]]==0:
        ac+=1
        num[x[0]]=1

print(ac,pena)
n, m = map(int, input().split())
# ps = [list(map(int, input().split())) for _ in range(m)]
ans = [0 for _ in range(n)]
pe = [0 for _ in range(n)]
accnt = 0
pecnt = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if ans[p - 1] == 0 and s == "WA":
        pe[p - 1] += 1
    elif ans[p - 1] == 0 and s == "AC":
        ans[p - 1] = 1

for i in range(n):
    if ans[i] == 0:
        pe[i] = 0

print(sum(ans), end = " ")
print(sum(pe), end = "")
print()
import numpy as np

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

result = [0] * N
wa = [0] * N



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

    if s == 'AC':
        result[p-1] = 1
    elif s == 'WA' and result[p-1] == 0:
        wa[p-1] += 1

ac = np.sum(np.array(result))
wa = np.sum(np.array(result)*np.array(wa))

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

lac = [0] * n
lwa = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if lac[p] == 0:
        if s == 'WA':
            lwa[p] += 1
        if s == 'AC':
            lac[p] = 1

lwa = [x * y for x, y in zip(lac, lwa)]
print(sum(lac), sum(lwa))
n, m = map(int, input().split())
dic = dict()
li = list()
for i in range(m):
    x1, y1 = input().split()
    if x1 not in dic.keys():
        dic[x1] = [0,0]
    if dic[x1][0] == 0:
        if y1 == "AC":
            dic[x1][0] = 1
        else:
            dic[x1][1] += 1
ac = 0
wa = 0
for key in dic.keys():
    if dic[key][0] == 1:
        ac += 1
        wa += dic[key][1]
print(ac, wa)
n,m=map(int,input().split())
a=[0]*n
w=[0]*n
ac=0
wc=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=='AC':
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)
n,m= list(map(int, input().split()))
ans_box=[0]*n
wa=[0]*n
ac=0
wa_cnt=0
for j in range(m):
    k,l=input().split()
    h=int(k)-1
    if ans_box[h]==0:
        if l=="AC":
            ac+=1
            ans_box[h]+=1
            wa_cnt+=wa[h]
        else:
            wa[h]+=1
print(ac,wa_cnt)
N, M = map(int, input().split())
WA = [0] * N
AC = [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
        else:
            WA[p-1] += 1
wa = 0
for j in range(N):
    if AC[j] == 1:
        wa += WA[j]
print(sum(AC),wa)
n,m=map(int,input().split())
a=[]
c=[0]*n
cnt=0
b=[0]*n
for _ in range(m):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=="AC":
    a.append(p)
    if c[p]==0:
          c[p]=1
  else:
        if c[p]==0:    
          b[p]+=1
a=list(set(a))
for i in a:
  cnt+=b[i]
print(len(set(a)),cnt)
n,m=map(int,input().split())
x=[list(input().split()) for i in range(m)]
a=0
p=0
x.sort(key=lambda x:x[0])
t='a'
for i in range(m):
  if t!=x[i][0]:
    w=0
    t=x[i][0]
    f=1
  if f:
    if x[i][1]=='AC':
      a+=1
      p+=w
      f=0
    else:
      w+=1
print(a,p)
n,m = list(map(int,input().split()))
lis = [[] for _ in range(n)]
for i in range(m):
    pc,s = input().split()
    p = int(pc)
    if s=='AC':lis[p-1].append(1)
    else:      lis[p-1].append(0)

a=w=0
for i in range(n):
    tempwa=0
    for j in lis[i]:
        if j==0:tempwa+=1
        elif j==1:
            a+=1
            w += tempwa
            break
print(a,w)
N, M = map(int, input().split(" "))

ac_flag = [0 for _ in range(N)]
wa = ac_flag.copy()

for i in range(M):

    question, result = input().split(" ")
    question = int(question)

    if not ac_flag[question-1] and result == 'WA':
        wa[question - 1] += 1
    
    if result == 'AC':
        ac_flag[question-1] = 1

wa = [x*y for x, y in zip(ac_flag, wa)]
print(sum(ac_flag), sum(x*y for x, y in zip(wa, ac_flag)))
(N,M),*ps = [s.split() for s in open(0)]

ps = [(int(p),s=='WA') for p,s in ps]

from collections import Counter
cnt = Counter()
acs = set()

for p,s in ps:
    if p not in acs:
        if s:
            cnt[p] += 1
        else:
            acs.add(p)
a = len(acs)
b = sum(cnt[ac] for ac in acs)
print(a,b)
n,m=map(int,input().split())
sub=[ input().split() for i in range(m)]
sub=[[int(i[0]),i[1]] for i in sub]

mis=[[0,0] for i in range(n)]

for i in range(m):
  if sub[i][1]=='AC':
    mis[sub[i][0]-1][0]=1
  elif sub[i][1]=='WA' and mis[sub[i][0]-1][0]!=1:
    mis[sub[i][0]-1][1]+=1
    
ans=[0,0]
for i in range(n):
  if mis[i][0]==1:
    ans[0]+=1
    ans[1]+=mis[i][1]
print(ans[0],ans[1])
N, M = (int(x) for x in input().split())
B = [False]*N
cnt = [0]*N
ans = 0
pena = 0
for i in range(M):
  p, S = (str(x) for x in input().split())
  p = int(p)
  if S=="AC" and B[p-1]==False:
    B[p-1]=True
    ans+=1
  elif S=="WA" and B[p-1]==False:
    cnt[p-1]+=1
for i in range(N):
  if B[i]==True:
    pena+=cnt[i]
print(ans, end=" ")
print(pena)
n,m = map(int, input().split())

flag = [False]*n
wa = [0]*n
for _ in range(m):
  p,s = input().split()
  p = int(p)-1
  if not flag[p]:
    if s == "WA":
      wa[p] += 1
    else: flag[p] = True

count = 0
for i in range(n):
  if flag[i]: count += wa[i]

print(flag.count(True), count)
n, m = map(int, input().split())
wa = [0] * n
cnt = [0] * n
for i in range(m):
    p, s = input().split()
    if s == "WA" and cnt[int(p) - 1] == 0:
        wa[int(p) - 1] += 1
    elif s == "AC" and cnt[int(p) - 1] == 0:
        cnt[int(p) - 1] += 1

for i in range(n):
    if cnt[i] == 0:
        wa[i] = 0
print(sum(cnt), sum(wa))
def main():
    n, m = [int(i) for i in input().split()]
    wa = [0]*n
    ac = [0]*n
    
    for _ in range(m):
        p, s = input().split()
        if s == "WA":
            if ac[int(p)-1] == 0:
                wa[int(p)-1] += 1
        else:
            ac[int(p)-1] += 1
    
    print(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))


if __name__ == "__main__":
    main()
n, m = map(int, input().split(" "))
nac = 0
npe = 0
cp = 0
is_ac = [False]*n
np_list = [0]*n
for i in range(m):
  p_s, s = input().split(" ")
  p = int(p_s)-1
  cis_ac = is_ac[p]
  
  if cis_ac:
    continue
  if s == "AC":
    nac += 1
    is_ac[p]=True
  else:
    np_list[p] += 1

for i, a in enumerate(is_ac):
  if a:
    npe += np_list[i]
print(str(nac)+" "+str(npe))
n, m = [int(x) for x in input().split()]
lst = [0]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and lst[p] is not None:
    a += 1
    b += lst[p]
    lst[p] = None
  elif s == 'WA' and lst[p] is not None:
    lst[p] += 1
print(a,b)
n,m=map(int,input().split())
aa=[[] for i in range(n)]
for x in range(m):
  a,b=input().split()
  d=int(a)-1
  aa[d].append(b)
  
ans_ac=0
ans_wa=0
for y in range(n):
  ans1=0
  ans2=0
  for z in range(len(aa[y])):
    if aa[y][z]=='WA' and ans2==0:
      ans1+=1
    elif aa[y][z]=='AC' and ans2==0:
      ans2+=1
      
  if ans2==1:
    ans_wa+=ans1
    ans_ac+=1
    
print(str(ans_ac)+' '+str(ans_wa))
N, M = map(int, input().split())
problems = [False] * (N+1)
penalty = [0]*(N+1)

for i in range(M):
    p, S = input().split()
    if S == 'AC':
        problems[int(p)] = True
    if S == 'WA' and problems[int(p)] is False:
        penalty[int(p)] += 1

ans_AC, ans_pena = 0, 0
for i in range(1, N+1):
    if problems[i] is True:
        ans_AC += 1
        ans_pena += penalty[i]


print(ans_AC, ans_pena)
#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)
for i in range(n):
    if probrem[i] == 0:
        warn[i] = 0
print(sum(probrem),sum(warn))
N, M = map(int, input().split())
AC = [False] * (N + 1)
WA = [0] * (N + 1)
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S =='AC':
        AC[p] = True
    elif S == 'WA' and AC[p] == False:
        WA[p] += 1
print(sum(AC), sum([WA[i] for i, boo in enumerate(AC) if boo]))
import numpy as np
import sys
input = sys.stdin.readline

N, M = list(map(int, input().split()))
ac = np.zeros(N, dtype=np.int)
wa = np.zeros(N, dtype=np.int)
for n in range(M):
    p, S = input().split()
    p = int(p)
    if ac[p - 1] == 1:
        continue
    if S == 'AC':
        ac[p - 1] = 1
    else:
        wa[p - 1] += 1
wa = str(sum(wa * ac))
ac = str(sum(ac))
ans = ac + ' ' + wa
print(ans)
n,m=map(int,input().split())

cnt=0
l=[0 for i in range(n)]

for i in range(m):
  p,s=input().split()
  p=int(p)
  p-=1
  if l[p]!=-1:
    if s=='AC':
      cnt+=l[p]
      l[p]=-1
    else:
      l[p]+=1

ac_cnt=l.count(-1)
print(ac_cnt,cnt)
n,m=map(int, input().split())
res = [0]*n
wa = [0]*n
pena = 0
for i in range(m):
    p,s = map(str, input().split())

    if s == "AC":
        res[int(p)-1]=1
    if s == "WA" and not res[int(p)-1]:
        wa[int(p)-1]+=1
for i in range(n):
    if res[i]:
        pena += wa[i]
print(sum(res), pena)
n, m = map(int, input().split())
P = []
S = []
for i in range(m):
    p, s = input().split()
    P.append(p)
    S.append(s)
V = [[0] * 2 for i in range(n)]
for i in range(m):
    j = int(P[i]) - 1
    if V[j][0] != 1:
        if S[i] == 'AC':
            V[j][0] = 1
        else:
            V[j][1] += 1
a = 0
w = 0
for i in range(n):
    if V[i][0] == 1:
        a += 1
        w += V[i][1]
print(a, w)
n, m = map(int, input().split())
wa = [0 for _ in range(n)]
ac = [0 for _ in range(n)]

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

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

print(ac_ans, wa_ans)
#coding:utf-8
from collections import defaultdict
dd = defaultdict(int)
N,M = map(int, input().split())
ans = 0
ac = 0
for m in range(M):
    p, s = input().split()
    p = int(p)
    if dd[p] != -1:
        if (s=="WA"):
                dd[p]+=1
        else:
            ans += dd[p]
            ac += 1
            dd[p] = -1
print (ac,ans)
N,M = map(int,input().split())
S = [input().split() for i in range(M)]
cntAC = [0] * N
cntWA = [0] * N

for p,s in S:
    if cntAC[int(p)-1] == 0:
        if s == "AC":
            cntAC[int(p)-1] = 1
        elif s == "WA":
            cntWA[int(p)-1] += 1

sumWA = sum([cntWA[p] for p in range(N) if cntAC[p]==1])

print(sum(cntAC),sumWA)
n, m = map(int, input().split())
ac = [False] * n
wa = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC" and ac[p-1] == False:
        ac[p-1] = True
    elif s == "WA" and ac[p-1] == False:
        wa[p-1] += 1
a = 0
w = 0
for i in range(n):
    if ac[i]:
        a += 1
        w += wa[i]
print(a, w)
N,M=[int(i) for i in input().split(" ")]
plog={}
for i in range(M):
    p,S=input().split(" ")
    if p in plog:
        plog[p]+=[S]
    else:
        plog[p]=[S]

WA_Count=0
AC_Count=0
for pl in plog:
    _WA_Count=0
    for res in plog[pl]:
        if res=="WA":
            _WA_Count+=1
        elif res=="AC":
            AC_Count+=1
            WA_Count+=_WA_Count
            break
print("%d %d"%(AC_Count,WA_Count))
N, M = map(int, input().split())
S = [[0 for j in range(2)] for i in range(M)]
for i in range(M):
  X = input().split()
  S[i][0] = int(X[0])
  S[i][1] = str(X[1])
A = [0] * N
p = 0
s = 0
for i in range(M):
  if S[i][1] == "WA":
    if A[S[i][0]-1] != "x": 
      A[S[i][0]-1] += 1
  if S[i][1] == "AC":
    if A[S[i][0]-1] != "x":
      p +=  A[S[i][0]-1]
      A[S[i][0]-1] = "x"
      s += 1
arr = [s, p]
print(*arr)
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 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())
p = [None]*M
S = [None]*M
for i in range(M):
  p[i], S[i] = input().split()

ac_flag = [0]*N
wa_count = [0]*N

penalty = 0
for i in range(M):
  j = int(p[i])-1
  if S[i] == 'AC':
    if ac_flag[j]:
      pass
    else:
      ac_flag[j] = 1
      penalty += wa_count[j]
  else:
    wa_count[j] += 1
print(*[sum(ac_flag), penalty])
n, m = map(int, input().split())
sub = [list(input().split()) for _ in range(m)]

ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]

for s in sub:
    if s[1] == 'AC':
        ac[int(s[0])-1] += 1
    elif ac[int(s[0])-1] == 0:
            wa[int(s[0])-1] += 1

ac_sum = 0
wa_sum = 0
for i in range(n):
    if ac[i] != 0:
        wa_sum += wa[i]
        ac_sum += 1
print(ac_sum, wa_sum)
n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)
N,M=map(int,input().split())
t=[0]*(N+1)
e=[0]*(N+1)
for i in range(M):
  p,s=input().split()
  if t[int(p)]==0 and s=="WA":
    e[int(p)]+=1
  if t[int(p)]==0 and s=="AC":
    t[int(p)]=1
for i in range(N+1):
  if t[i]==0:
    e[i]=0
print(sum(t),sum(e))
N, M = map(int,input().split())

if M == 0:
  print(0,0)
  exit()
  
a = [0]*(N + 1)
p = [0]*(N + 1)
wa = [0]*(N + 1)

for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "WA":
    wa[P] += 1
  elif a[P] == 0:
    a[P] += 1
    p[P] = wa[P]

print(sum(a),sum(p))
n, m = map(int, input().split())

pena = [0 for x in range(n + 1)]

clear = [False for i in range(n + 1)]

for i in range(m):
    p, c = input().split()
    p = int(p)
    if clear[p] is False:
        if c == "AC":
            clear[p] = True
        else:
            pena[p] += 1

ans_ac = 0
ans_pena = 0

for pe, cl in zip(pena, clear):
    if cl:
        ans_ac += 1
        ans_pena += pe

print(ans_ac, ans_pena)
N, M = map(int, input().split())
res = [[0 for i in range(2)] for j in range(N)]
ac = 0
wa = 0

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

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

print(ac, wa)
#!python3.4.3

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

penalty = [0 for _ in range(n)]
result = [0 for _ in range(n)]

for i in range(m):
    p, s = input().split(' ')
    p = int(p)
    if s == 'AC':
        result[p-1] = 1
    elif s == 'WA' and result[p-1] != 1:
        penalty[p-1] += 1
    
penalty = [x * y for (x, y) in zip(penalty, result)]

print(sum(result), sum(penalty))
N,M = map(int, input().split())
ac = [0]*N
wa = [0]*N
for i in range(M):
	p,s = input().split()
	if s == 'AC':
		if ac[int(p) - 1] != 0:
			continue
		else:	
			ac[int(p) - 1] = 1
	else:
		if ac[int(p) - 1] != 0:
			continue
		else:
			wa[int(p) - 1] += 1
AC,WA = 0,0

for i in range(N):
  AC += ac[i]
  if ac[i] >= 1:
    WA += wa[i]
print(AC,WA)
N,M = map(int,input().split())
ok = 0
ng = 0
Q = [0]*N
for _ in range(M):
    p,s = map(str,input().split())
    if Q[int(p)-1] != -1 and s == "AC":
        ok += 1
        ng += Q[int(p)-1]
        Q[int(p)-1]= -1
    elif Q[int(p)-1] != -1 and s == "WA":
        Q[int(p)-1] += 1
print(ok,ng)
import numpy as np
from collections import Counter
n, m = map(int, input().split())
mistake = [0] * (n + 1)
done = [False] * (n + 1)
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if done[p] == False:
            mistake[p] += 1
    else:
        done[p] = True
counter = Counter(done)
print(counter[True], sum(np.multiply(mistake, done)))
# -*- coding: utf-8 -*-
import numpy as np
iNum, iM = map(int, input().split())
naB = np.zeros(iNum, dtype = "bool")
naW = np.zeros(iNum, dtype = int)
iC = 0
iW = 0
for _ in range(iM):
  l = input().split()
  iP = int(l[0]) - 1
  if not(naB[iP]):
    if l[1][0] == "A":
      naB[iP] = True
      iC += 1
      iW += naW[iP]
    else:
      naW[iP] += 1
print(iC, iW)
N,M=map(int,input().split())
ac,wa=0,0
task=[0]*N
for m in range(M):
    p,S=input().split()
    p=int(p)-1
    if task[p]!=-1 and S=="WA":
        task[p]+=1
    elif task[p]!=-1 and S=="AC":
        ac+=1
        wa+=task[p]
        task[p]=-1
print(ac,wa)
n,m=map(int,input().split())
sub=[tuple(input().split()) for j in range(m)]
ac=[False for i in range(n)]
wa=[0 for i in range(n)]
for p,s in sub:
    p=int(p)
    if s=='AC':
        ac[p-1]=True
    else:
        if ac[p-1]==False:
            wa[p-1]+=1
# print(ac)
# print(wa)
ans=0
pena=0
for AC,WA in zip(ac,wa):
    if AC:
        ans+=1
        pena+=WA
print(ans,pena)
l = dict()
t, f = 0, 0
n, m = map(int, input().split(" "))
for _ in range(m):
  p, s = input().split(" ")
  if not p in l:
    l[p] = [None, 0]
  if s == "WA":
    if l[p][0] != True:
      l[p][1] += 1
  elif s == "AC":
    if l[p][0] != True:
      l[p][0] = True
      t += 1

for _, v in l.items():
  if v[0]:
    f += v[1]
print(t, f)
n,m=map(int,input().split())
p=[]
s=[]
for c in range(m):
    k=input().split()
    p.append(int(k[0])-1)
    s.append(k[1])
a=[0]*n
w=[0]*n
for c in range(m):
    if a[p[c]]==1:
        continue
    if s[c]=="AC":
        a[p[c]]=1
    else:
        w[p[c]]+=1
u=0
for c in range(n):
    if a[c]==1:
        u+=w[c]
print(sum(a),u)
n,m=map(int,input().split())
a=0
p=0
L=[0 for _ in range(n)]
for _ in range(m):
  num,s = input().split()
  num=int(num)-1
  if not L[num] == -1:
    if s == "AC":
      a+=1
      p+=L[num]
      L[num]=-1
    else:
      L[num]+=1
print(a,p)
n,m= map(int, input().split()) 
judge=[0]*n
cor=0
pen=0
inf=10**6

for i in range(m):
  a,s = input().split()
  a=int(a)
  if s=='WA':
    judge[a-1]+=1
    
  else:
    if judge[a-1]>-1:
      cor+=1
      pen+=judge[a-1]
      judge[a-1]=-inf

print(cor,pen)