peterverebics/CodeNet_Python_118 huggingface dataset:
N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls = [0] * N
wa_cnt = 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not s in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(s)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)
N,M=map(int, input().split())
p=[]
S=[]
for i in range(M):
    P,s=input().split()
    p.append(int(P))
    S.append(s)
A=set()
W=[0 for i in range(0,N)]
w=0
for i in range(0, M):
    if S[i]=='AC':
        w+=W[p[i]-1]
        if p[i]-1 not in A:
            A.add(p[i]-1)
    elif S[i]=='WA':
        if p[i]-1 not in A:
            W[p[i]-1]+=1
print(len(A), w)
n,m=map(int,input().split())
lis=[]
for i in range(n):
  lis.append([0,0])
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)-1
  if s=="AC":
    lis[p][0]=1
  else:
    if lis[p][0]==0:
      lis[p][1]+=1
  
ac=0  
wa=0
for i in range(0,n):
  ac+=lis[i][0]
  wa+=lis[i][1]
print(ac,wa)
n,m = map(int,input().split())

C={}
acc=0
wac=0
for i in range(m):
    p0,s = input().split()
    
    p = int(p0)
    if p in C :
        if C[p]!=-1:
            C[p]+=1
    else:
        C[p]=1

    if s=="AC" and C[p]!=-1:
        acc+=1
        C[p]=-1
    elif s=="WA" and C[p]!=-1:
        wac+=1

print( acc, wac )
'n(問題数), m(提出数)を抽出'
n, m = (int(x) for x in input().split())
d = {}
p = 0

'Siが新規かつ、Piが"AC"の場合辞書に追加, Piが"WA"の場合はペナルティをカウント'
for _ in range(m):
  a, b = (input().split())
  if a in d:
    continue
  elif b == 'WA':
    p += 1
  else:
    d[a] = b

'辞書の要素数をカウントして正答数を計算、ペナルティはそのまま出力'
print(len(d), p)
N,M = map(int,input().split())
AC = 0
WA = 0
lis = []
for i in range(M):
  A = list(input().split())
  if A[0] not in lis:
    if A[1] == 'AC':
      lis.append(A[0])
      AC += 1
    else:
      WA += 1
print(AC, WA)
n,m=map(int,input().split())
AC = [0] * n
WA = [0] * n

for i in range(m):
    x = input().split()
    num = int(x[0]) - 1
    if x[1]=='AC':
        AC[num]+=1
    elif x[1]=='WA' and AC[num]==0:
        WA[num]+=1
print(sum(AC), sum([w for i, w in enumerate(WA) if AC[i]]))
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
    elif 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())
wa = [0] * (N+1)
ac = set()
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if p in ac:
        continue
    if S == "AC":
        ac.add(p)
    else:
        wa[p] += 1
print(len(ac),sum(wa))
n, m = map(int, input().split())

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

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

r1 = sum(ac)
r2 = sum(ac[i] and wa[i] for i in range(n))

print(r1, r2)
N,M=map(int,input().split())

not_AC_ls=[i for i in range(1,N+1)]

ac_num=0
pn_num=0

for _ in range(M):
    
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        if pi in not_AC_ls:
            ac_num+=1
            not_AC_ls.remove(pi)
    if Si=='WA':
        if pi in not_AC_ls:
            pn_num+=1

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

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
	elif S[i]=="WA":
		if flg[P[i]-1]==0:
			D += 1


print(C, D)
N,M = map(int,input().split())
ok = 0
ng = 0
Q = [False]*N
for _ in range(M):
    p,s = map(str,input().split())
    if Q[int(p)-1]==False and s == "AC":
        ok += 1
        Q[int(p)-1]= True
    elif Q[int(p)-1]==False and s == "WA":
        ng += 1
print(ok,ng)
n,m = map(int,input().split())
ps = [input().split() for i in range(m)]

ans_ac = 0
ans_wa = 0
flag = 0
number = 0
ok = []
for i in range(m):
    if ps[i][0] not in ok:
        if ps[i][1] == "WA":
            ans_wa += 1
        else:
            ans_ac += 1
            ok.append(ps[i][0])
    
print(ans_ac,ans_wa)
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':
        flag[p] = 1
    elif flag[p] == 0:
        ans += 1

print(sum(flag), ans)
n,m = map(int,input().split())
A = []
for _ in range(m):
    a,b = input().split()
    tmp = [int(a),b]
    A.append(tmp)
dict = {}
for a in A:
    dict.update({a[0]:False})
ac = 0
wa = 0
for a in A:
    if dict[a[0]] == False:
        if a[1] == "WA":
            wa += 1
        else:
            dict[a[0]] = True
            ac += 1
print("{} {}".format(ac,wa))
# N問出題
# M回提出

ans = []
pena = 0
N, M = map(int, input().split())
for _ in range(M):
    p, s = input().split()
    # 正解
    if s == "AC" and int(p) <= N:
        ans.append(p)
    # WAかつ未正解
    elif s == "WA" and (p not in ans):
        pena +=1
    else:
        continue

print(len(set(ans)), pena)
N,M = map(int,input().split())
bl = [True]*N
ac,wa = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if bl[p-1]:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            bl[p-1] = False
print(ac,wa)
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
pena_cnt = 0
penalty = 0
no = [0] * n

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

    if no[int(p) - 1] == 1:
        continue

    if s == 'WA':
        pena_cnt += 1
    else:
        point += 1
        penalty += pena_cnt
        pena_cnt = 0
        no[int(p) - 1] = 1

print(str(point) + " " + str(penalty))
N, M = list(map(int, input().split()))
sum_a = 0
tmp = []
test_cnt = []
false_cnt = 0
for index in range(M):
    A = input().split()
    if int(A[0]) not in test_cnt:
        if len(test_cnt) <= N:
            test_cnt.append(int(A[0]))
        else:
            continue
    if A[0] not in tmp:
        if A[1] == 'WA':
            false_cnt += 1
        elif A[1] == 'AC':
            tmp.append(A[0])

print(len(test_cnt))
print(false_cnt)
N, M = map(int, input().split(' '))
ac_list = []
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    if num not in ac_list:
        if res == 'AC':
            ac_cnt += 1
            ac_list.append(num)
        else:
            wa_cnt += 1
print(ac_cnt, wa_cnt)
N, M = map(int, input().split())
A = [False] * N
cnt = 0
_cnt = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC' and not A[int(p) - 1]:
        cnt += 1
    if S == 'WA' and not A[int(p) - 1]:
        _cnt += 1
    A[int(p) - 1] = A[int(p) - 1] or S == 'AC'
print(cnt, _cnt)
import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1

print(sum(q),sum(t))
import numpy as np
N, M = map(int, input().split())
l = np.zeros((N, 2), dtype = int)
for i in range(M):
    p, S = map(str, input().split())
    if S == 'AC':
        l[int(p) - 1, 0] = 1
    else:
        l[int(p) - 1, 1] += 1
print(np.sum(l[:, 0]), np.sum(l[l[:, 0] == 1, 1]))
N,M= map(int,input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]
for i in range(M):
    p, s = input().split()
    if s == "WA" and S[int(p)] != 1:P[int(p)] += 1
    if s == "AC":S[int(p)] = 1
print(sum(S),sum(P))
N , M = map(int , input().split(" "))

solve_problem = [0] * N 
ans = [0,0]

for i in range(0,M):
    ps = input().split(" ")
    if ps[1] == "AC":
        if solve_problem[ int(ps[0]) -1] == 0:
            solve_problem[int(ps[0])-1] = 1
            ans[0] += 1
    elif ps[1] == "WA":
        if solve_problem[ int(ps[0])-1] == 0:
            ans[1] += 1

print(ans[0],ans[1])
n,m=map(int,input().split())
info=[]
for i in range(m):
    p,s=input().split()
    info.append([int(p),s])
ac,wa=0,0
plob=[0 for i in range(n+1)] 
for i in range(m):
    if plob[info[i][0]]==0:
        if info[i][1]=="WA":
            wa+=1
        else:
            ac+=1
            plob[info[i][0]]=1
print(str(ac)+" "+str(wa))
n,m = (int(x) for x in input().split())
p = [0]*m
s = [0]*m
penal = [0]*105000
clear = [0]*105000
for i in range(m):
    p[i],s[i] = (x for x in input().split())
    p[i] = int(p[i])
    if s[i] == 'AC':
        clear[p[i]-1] = 1
    elif clear[p[i]-1] == 0:
        penal[p[i]-1] += 1
print(str(sum(clear)) + " " + str(sum(penal)))
n=list(map(int,input().split()))
x=[list(input().split())for i in range(n[1])]
wwa,wa,ac=0,0,0
notused=[]
for i in range(n[1]):
  if(x[i][0] not in notused):
    if(x[i][1]=="WA"):
      wwa+=1
    else:
      ac+=1
      wa=wa+wwa
      notused.append(x[i][0])
print('{0} {1}'.format(ac, wa))
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
PS=[list(input().split()) for _ in range(m)]

AC=[]
WA=[0 for i in range(n)]
for i in range(m):
  if PS[i][1] == "AC":
    if  int(PS[i][0]) in AC:
      continue
    AC.append(int(PS[i][0]))
  elif PS[i][1] == "WA" and not(int(PS[i][0]) in AC):
    WA[int(PS[i][0])-1]+=1

sum_WA=0
for i in range(len(WA)):
  sum_WA+=WA[i]
print(len(AC), sum_WA)
n, m = map(int, input().split())
ac = [0] * n
pen = 0
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if ac[p] == "AC":
        continue
    elif s == "AC":
        ac[p] = "AC"
    else:
        pen += 1

print(ac.count("AC"), pen)
N, M = map(int, input().split())

ac, wc = [0]*N, [0]*N

for i in range(M):
    p, s = input().split()
    if s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1
    elif s == 'WA' and ac[int(p)-1] == 0:
            wc[int(p)-1] += 1
print('%d %d' % (sum(ac), sum(wc)))
n, m = map(int, input().split(" "))

ans = []
for i in range(m):
  ans.append(input().split(" "))


cc = 0
pc = 0

for i in range(n):
  for j in range(m):
    if int(ans[j][0]) == i+1:
      if ans[j][1] == "WA":
        pc = pc + 1
      elif ans[j][1] == "AC":
        cc = cc + 1
        break

print(cc, pc)
n, m = map(int, input().split(" "))
nac = 0
npe = 0
cp = 0
is_ac = {}
for i in range(m):
  p_s, s = input().split(" ")
  p = int(p_s)
  cis_ac = False
  if p in is_ac:
    cis_ac = is_ac[p]
  if cis_ac:
    continue
  if s == "AC":
    nac += 1
    is_ac[p]=True
  else:
    npe += 1
print(str(nac)+" "+str(npe))
N, M = map(int, input().split())
submit = [list(input().split()) for _ in range(M)]
acflag = [False]*N
AC = 0
WA = 0

for i in range(M):
    if (not acflag[int(submit[i][0])-1]) and submit[i][1] == "AC":
        acflag[int(submit[i][0])-1] = True
        AC += 1
    elif (not acflag[int(submit[i][0])-1]) and submit[i][1] == "WA":
        WA += 1

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

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

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

print(sum(ac), sum(wa))
n,m=map(int,input().split())
a=0
p=0
L=[False for _ in range(n)]
for i in range(m):
  num,s = input().split()
  num=int(num)-1
  if not L[num]:
    if s == "AC":
      L[num]=True
      a+=1
    else:
      p+=1
print(a,p)
n, m = map(int, input().split())

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

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

for i in range(m):
    if submit[i][1] == 'AC' and done[int(submit[i][0])] == 0:
        done[int(submit[i][0])] = 1
        ac += 1
    if submit[i][1] == 'WA' and done[int(submit[i][0])] == 0:
        wa += 1

print(ac, wa)
n, m = map(lambda x: int(x), input().split())
s_list = [input().split() for _ in range(m)] 

ac = 0
wa = 0
q_nums = []
for s in s_list:
  if s[0] in q_nums:
    break
  elif s[1] == 'AC':
    ac += 1
    q_nums.append(s[0])
  elif s[1] == 'WA':
    wa += 1

print('{} {}'.format(ac, wa))
# AtCoder Beginner Contest 151: C (2020/01/12)
N, M = map(int, input().split())
A = [0 for i in range(N)]
p = [0 for i in range(M)]
S = ['' for i in range(M)]
for i in range(M):
    l = input().split()
    p[i] = int(l[0])
    S[i] = str(l[1])
ans = 0
pnlt = 0
for i in range(M):
    if A[p[i]-1] != 0:
        continue
    if S[i] == 'AC':
        ans = ans + 1
        A[p[i]-1] = 1
    else:
        pnlt = pnlt + 1
print(ans, pnlt)
n, m = map(int, input().split())

acline = [0]*n
wanum = [0]*n

for i in range(m):
    num, acwa = map(str, input().split())
    
    num = int(num) -1
    
    if acwa == "AC":
        acline[num] = 1
    else:
        if acline[num] == 1:
            continue
        else:
            wanum[num] += 1
            
print(sum(acline), sum(wanum))
n, m = map(int, input().split())
WA = [0] * n
AC = [0] * n

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

print(sum(AC), sum(WA))
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    input1, input2 = input().split()
    p.append(int(input1))
    s.append(input2)

correct = [0] * n
penalty = [0] * n
for i in range(m):
    target_problem = p[i] - 1
    if correct[target_problem] == 1:
        continue
    if s[i] == 'AC':
        correct[target_problem] += 1
    else:
        penalty[target_problem] += 1

print('{0} {1}'.format(sum(correct), sum(penalty)))
#!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

print(sum(result), sum(penalty))
a = input()
a,b = a.split(" ")
N= int(a)
M= int(b)

temp=[]
for i in range(M):
    temp.append(input())

tc=[0]*(N+1)
tr=[0]*(N+1)
for i in temp:
    _1, _2 = i.split(" ")
    if _2 == "WA":
        if tc[int(_1)] == 1:
            pass
        else :            
            tr[int(_1)] += 1
    elif _2 == "AC":
        tc[int(_1)] = 1
export = str(sum(tc))+" " + str(sum(tr))
print(export)
n,m = map(int, input().split())
la = []
lw = []
for i in range(n):
  la.append(0)
  lw.append(0)
for _ in range(m):
  q,a = input().split()
  if a == "WA" and la[int(q)-1] != 1:
    lw[int(q)-1] += 1
  else:
    la[int(q)-1] = 1
print(sum(la), sum(lw))
N,M=map(int, input().split())
wa={}
ac=[]
key=[]
for i in range(M):
    p,s=input().split()
    if p not in ac:
        
        if s=="WA":
            if s not in key:
                wa[p]=1
                key.append(p)
            else:
                wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in ac:
    if i in key:
        ans+=wa[i]
print(len(ac),ans)
from collections import defaultdict
import sys
input = sys.stdin.readline

m = defaultdict(int)
ac = defaultdict(int)


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

ans = 0
penalty = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    s = s.strip()
    if s == "AC":
        if p not in ac:
            penalty += m[p]
            ans += 1
        ac[p] = 1

    else:
        if p not in ac:
            m[p] += 1


print(str(len(m.keys())) + " " + str(penalty))
N, M = map(int, input().split())
progress = {}
# initialize
for i in range(N):
  progress[str(i+1)] = "notCorrect"
correct = 0
penalty = 0
for i in range(M):
  question, result = map(str, input().split())
  if (progress[question] == "notCorrect"):
    if (result == "WA"):
      penalty += 1
    else:
      progress[question] = "correct"
      correct += 1
  else:
    continue
print(str(correct)+" "+str(penalty))
import os

def main():
	wa_result = []
	ac_result = []
	num,count = map(int, input().split())
	for i in range(count):
		n,m = map(str, input().split())
		if m == "WA":
			if n in wa_result:
				continue
			else:
				wa_result.append(n)
		else:
			if n in ac_result:
				continue
			else:
				ac_result.append(n)
	print(len(ac_result), len(wa_result)) 

if __name__ == '__main__':
	main()
N, M = map(int, input().split())
right = 0
wrong = 0
now = 1
for i in range(M):
    p, S = list(input().split())
    if S == 'AC':
        if p == now:
            now += 1
            right += 1
    else:
        if p == now:
            wrong += 1

print(right, wrong, sep=' ')
n,m=map(int,input().split())
l=[0]*n
d=[0]*n
for i in range(m):
    s=input().split()
    x=int(s[0])
    if(s[1]=='AC'):
        l[x-1]=1
    else:
        if(l[x-1]==1):
            continue
        else:
            d[x-1]+=1
print(sum(l),sum(d))
N,M = map(int,input().split())
X = [list(map(str,input().split())) for i in range(M)]

p = []
d = []
a = {}
for i in range(M):
    if X[i][1] == 'AC':
        a[X[i][0]] = 'AC'
        p.append(d.count([X[i][0],'WA']))
    elif X[i][1] == 'WA':
        d.append([X[i][0],X[i][1]])

print(len(a),sum(p))
N,M = list(map(int,input().split()))

m = [0]*(N+1)
r = [0]*(N+1)
for i in range(M):
    p,S = input().split()
    p = int(p)
    if r[p] == 0:
        if S == "WA":
            m[p] += 1
        else:
            r[p] = 1
print(sum(r),sum(m))
N,M = map(int, input().split())
AC = [0]*N
WA = [0]*N
for _ in range(M):
    p,s = input().split()
    if AC[int(p)-1] == 0:
        if s == "WA":
            WA[int(p)-1] += 1
        elif s == "AC":
            AC[int(p)-1] = 1
print(sum(AC),sum(WA))
n,m = map(int,input().split())
seikai = 0
matigai = 0
oklist = []
for i in range(m):
    if len(oklist) == n:
        break
    a,b=input().split()
    if b == "WA" and a not in oklist:
        matigai += 1
    elif b == "AC" and a not in oklist:
        seikai += 1
        oklist.append(a)
            
print(str(seikai)+" "+str(matigai))
n, m = map(int, input().split())
cntAC = 0
cntWA = 0
listAW = ['WA'] * n
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if listAW[p - 1] == 'AC':
        continue
    if s == 'AC':
        cntAC += 1
        listAW[p - 1] = 'AC'
        continue
    cntWA += 1

print(cntAC, cntWA)
import sys

i = list(map(int, input().split()))
N = i[0]
M = i[1]
already_ac = []
ac_count = 0
wa_count = 0
for i in range(M):
    line = sys.stdin.readline().split()
    if int(line[0]) not in already_ac:
        if line[1] == 'AC':
            ac_count += 1
            already_ac.append(int(line[0]))
        else:
            wa_count += 1

print(str(ac_count) + " " + str(wa_count))
input1 = input().split()
problem = int(input1[0])
num_sub = int(input1[1])
list_sub = set()
for i in range(num_sub):
  input2 = input().split()
  list_sub.add((input2[0], input2[1]))
right = 0
for i in list_sub:
  if(i[1] == "AC"):
    right = right + 1
print(str(right) + " " + str(len(list_sub)-right))
from collections import defaultdict
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
  p, s = input().split()
  P.append(int(p))
  S.append(s)
d = defaultdict(int)
d1 = defaultdict(int)
for i in range(M):
  if S[i] == "WA":
    if d[P[i]] != 1:
      d1[P[i]] += 1
  elif S[i] == "AC":
    d[P[i]] = 1
for i in range(len(d)+1):
  if d[i] == 0 and d1[i] > 0:
    d1[i] = 0
print(sum(d.values()), sum(d1.values()))
number,submit=input().rstrip().split()
result=[input().rstrip().split() for i in range(int(submit))]
#print(result)
good=[]
bad=[]
stocK=[]
for i in range(int(submit)):
    if result[i][1]=='WA':       
        bad.append(result[i][0])
    elif result[i][1]=='AC':
        good.append(result[i][0])
        stocK.append(bad.count(result[i][0]))


print(str(len(good))+' '+str(sum(stocK)))
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = [0] * N
pena = [0] * N
N, M = map(int, input().split())
count1 = 0
count2 = 0
lis = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    count2 += 1
  elif lis[p-1] == 0 and S == "AC":
    count1 += 1
    lis[p-1] = 1
  elif lis[p-1] == 1 and S == "WA":
    continue
  elif lis[p-1] == 1 and S == "AC":
    continue
print(str(count1) + " " + str(count2))
n,m=map(int,input().split())
ac=set()
d={}
for i in range(m):
  i,s=input().split()
  if int(i) not in ac:
    if  s=='AC':
      ac.add(int(i))
    else:
      d[int(i)]=d.get(int(i),0)+1
print(len(ac),sum(d.values()))
n,m = map(int, input().split());

A = [0]*m;
B = [0]*m;

for i in range(m):
  a, b = input().split();
  A[i] = int(a);
  B[i] = b;
  
#ACの数
AC_list = list(set(A));

AC_count = len(AC_list);

#WAの数
WA_count = 0;

for j in AC_list:
  indexes = [i for i, x in enumerate(A) if x == j];
  for k in indexes:
    if B[k] == "WA":
      WA_count += 1;
      continue;
    else:
      break;
      
print(AC_count, WA_count);
n, m = [int(i) for i in input().split()]

to_i = dict(AC=1, WA=0)
cs = list()
cnt_c, cnt_w = 0, 0
for i in range(m):
  p, s = input().split()
  p, s = int(p), to_i[s]
  if p in cs:
    continue
  if s:
    cnt_c += 1
    cs.append(p)
  else:
    cnt_w += 1

print(cnt_c, cnt_w)
n,m = map(int,input().split())
p = [""]*m
for i in range(m):
    p[i] = input().split()
    p[i][0] = int(p[i][0])

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

for i in range(m):
    if p[i][1] == "AC":
        ac[p[i][0]-1] = 1
    if p[i][1] == "WA":
        if ac[p[i][0]-1] != 0:
            continue
        else:
            wa[p[i][0]-1] += 1
print(sum(ac),sum(wa))
n, m = map(int, input().split())

state = {}
wa = 0
ac = 0
for i in range(m):
  no, result = input().split()
  if result == 'AC':
    if not state.get(no):
      ac += 1
    state[no] = True
  elif result == 'WA':
    if not state.get(no):
      wa += 1

print(str(ac) + ' ' + str(wa))
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [j for j in input().split()]
  val = dic.setdefault(tmp[0],'NEW')
  
  if (val == 'NEW') or (val == 'WA'):	#新規追加
    if tmp[1] == 'WA':
      pe += 1
      dic[tmp[0]] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      dic[tmp[0]] = 'AC'

print(co, pe)
n,m = map(int,input().split())
ac = 0
wa = 0
ls = [e for e in range(1,n+1)]
for i in range(m):
    a,b = map(str,input().split())
    if int(a) in ls:
        if b == "AC":
            ac += 1
            ls.remove(int(a))
        else:
            wa += 1
print(ac,wa)
N, M = map(int,input().split())
p = []
S = []
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    tmp_p, tmp_S = input().split()
    tmp_p = int(tmp_p)
    p.append(tmp_p)
    S.append(tmp_S)
p_cnt = [0 for i in range(N)]
for i in range(M):
    if p_cnt[p[i]-1]==1:
        continue
    if S[i]=="AC":
        AC_cnt+=1
        p_cnt[p[i]-1]=1
    elif S[i]=="WA":
        WA_cnt+=1
print(AC_cnt,WA_cnt)
n,m = map(int,input().split(' '))
score = 0
penalty = 0
problems = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in problems:
        continue
    
    if result == "WA":
        penalty +=1
    else:
        score +=1
        problems.add(num)

print(score,penalty)
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]:
    continue
  else:
    if s=="WA":
      wa[p]+=1
    if s=="AC":
      ac[p]=True
account=0
wacount=0
for i in range(len(ac)):
  account+=ac[i]
  wacount+=wa[i]
    
print(account,wacount)
N,M = map(int,input().split())
dp = [0]*(N+1)
li = []
kaku = [0]*(N+1)
count =0
for m in range(M):
    p,s = input().split()
    p = int(p)
    li.append([p,s])
    
for i in li:
    if i[1]=="WA":
        dp[i[0]] += 1
    
    else:
        kaku[i[0]] = dp[i[0]]

for k in kaku:
    if k != 0:
        count += 1

print(count,sum(kaku))
import sys
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,m = IL()
    sub = [0]*n
    t = 0
    for _ in range(m):
        p,s = SL()
        p = int(p)
        if sub[p-1]==0:
            if s=='AC':
                sub[p-1] = 1
            else:
                t += 1
    print(sub.count(1),t)
    return

if __name__=='__main__':
    Main()