peterverebics/CodeNet_Python_118 huggingface dataset:
N,M=map(int,input().split())
number=[0]*N
ac,wa,=0,0
for m 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 = list(map(int,input().split()))

lac = [0]*(N+1)
lpcnt = [0]*(N+1)

for i in range(M):
  s = input().split()
  n = int(s[0])
  if s[1] == "AC":
    lac[n] =1
    continue
  if s[1] == "WA" and lac[n] == 0:
    lpcnt[n] += 1

cnt = 0
for i in range(N+1):
  if lac[i] == 1:
    cnt += lpcnt[i]
  
print(sum(lac), end=" ")
print(cnt)
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
t = [0] * (N + 1)
vis = set()
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if p in vis: continue
  if s == "AC":
    vis.add(p)
  else:
    t[p] += 1
res = 0
for i in range(N + 1):
  if i in vis:
    res += t[i]
print(len(vis), res)
N, M = map(int, input().split())
PS = [input().split() for i in range(M)]

AC_and_penalty = {i:[False, 0] for i in range(1, N+1)}

for p, s in PS:
  _AC_and_penalty = AC_and_penalty[int(p)]
  if _AC_and_penalty[0]:
    continue
  else:
    if s == "AC":
      _AC_and_penalty[0] = True
    else:
      _AC_and_penalty[1] += 1
    
num_AC = 0
penalty = 0
for cond, p in AC_and_penalty.values():
  if cond:
    num_AC += 1
    penalty += p
    
print("{} {}".format(num_AC, penalty))
n,m = map(int,input().split())
j = [0]*n
w = [0]*n
wa = 0
ac = 0

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

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

wa_cnt = [0]*N
ac_flag = [False]*N

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

    if not ac_flag[p]:
        if S == 'WA':
            wa_cnt[p] += 1
        else:
            ac_flag[p] = True


print(sum(ac_flag), sum(c for c,f in zip(wa_cnt,ac_flag) if f))
n,m=map(int,input().split())

l=[0]*n
ll=[0]*n
no_ac=0
no_pen=0

for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if b=='AC':
    if l[a-1]==0:      
      no_ac+=1
      l[a-1]=1
  else:
    if l[a-1]==0:
      ll[a-1]+=1

for i in range(n):
  if l[i]==1:
    no_pen+=ll[i]
print(no_ac,no_pen)
N, M = map(int, input().split())
S=[[0, ""] for j in range(M)]
ACcheck=[False for j in range(N)]
AC=0
WA=[0 for j in range(N)]
WA2 = 0
for i in range(M):
  ps = input().split()
  S[i][0]=int(ps[0])
  S[i][1]=ps[1]
for i in range(M):
  if S[i][1]=="AC":
    if ACcheck[S[i][0]-1]==False:
      AC+=1
      ACcheck[S[i][0]-1]=True
      WA2+=WA[S[i][0]-1]
  else:
    if ACcheck[S[i][0]-1]==False:
      WA[S[i][0]-1]+=1

print(AC, WA2)
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]

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

for p, s in ps:
    p = int(p) - 1
    if ac[p] == 0:
        if s == "AC":
            ac[p] = 1
        else:
            wa[p] += 1

wa = [ac[i] * wa[i] for i in range(n)]
print(sum(ac),sum(wa))
N,M=map(int,input().split())
L=[0]*N
A=0
W=0
tmp=[0]*N
for i in range(M):
	x,y=input().split()
	t=int(x)
	if L[t-1]==0:
		if y=="WA":
			tmp[t-1]+=1
		else:
			A+=1
			W+=tmp[t-1]
			L[t-1]=1
print(A,W)
n,m=map(int,input().split())
acf,waf=[0]*n,[0]*n
ac,wa=0,0
for i in range(m):
    x,y=input().split()
    x=int(x)
    if y=='AC':
        if acf[x-1]==0:
            ac+=1
            wa+=waf[x-1]
            acf[x-1]+=1
    else:
        waf[x-1]+=1
print(ac,wa)
n, m = map(int, input().split())

ac = [False] * n
wa = [0] * n
res_ac = 0
res_wa = 0
for _ in range(m):
    p, s = input().split()
    p = int(p)

    if s == "AC":
        if not ac[p-1]:
            ac[p-1] = True
            res_ac += 1
            res_wa += wa[p-1]
    else:
        wa[p-1] += 1

print(res_ac, res_wa)
n, m = map(int, input().split())
q_re = set()
ac = 0
wa = 0
dic_wa = {}
for i in range(m):
    q, re = input().split()
    if(re == "WA" and q not in q_re): 
        if(q not in dic_wa): dic_wa[q] = 1
        else: dic_wa[q] += 1
    if(re == "AC" and q not in q_re): 
        ac += 1
        q_re.add(q)
        if(q in dic_wa): wa += dic_wa[q]
print(ac, wa)
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
all_ac = set(int(p) for p,s in ps if s=='AC')
ac = set()
pena_cnt = 0
ac_cnt = 0
for p,s in ps:
  p = int(p)
  if p in all_ac:
    if p not in ac:
      if s == 'WA':
        pena_cnt += 1
      else:
        ac_cnt += 1
        ac.add(p)
print(ac_cnt, pena_cnt)
N, M = map(int, input().split())
sub = [[0, 0] for _ in range(N)]  # 0: WC_num, 1: AC
ac, penalty = 0, 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        sub[p-1][0] += 1
    elif s == 'AC' and sub[p-1][1] == 0:
        sub[p-1][1] = 1
        ac += 1
        penalty += sub[p-1][0]
print(ac, penalty)
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)
from collections import defaultdict

n,m = list(map(int, input().split(" ")))
dic = defaultdict(lambda : [0,0])

for i in range(m):
    task,status = input().split(" ")
    if status == "AC":
        dic[task][0] += 1
    if dic[task][0] == 0 and status == "WA":
        dic[task][1] += 1

acCnt = 0
waCnt = 0

for _, v in dic.items():
    a,b = v
    if a > 0:
        acCnt += 1
        waCnt += b
print(str(acCnt) + " " + str(waCnt))
n,m = map(int, input().split())

x = [False]*n
y = [0]*n

for i in range(m):
  a,b = input().split()
  a = int(a) - 1
  if b =='AC' and x[a] == False:
    x[a] = True
  elif b == 'WA' and x[a] == False:
    y[a] += 1

ac = 0
wa = 0
for i in range(n):
  if x[i]:
    ac += 1
    wa += y[i]
print(ac,wa)
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
ps = [input().split() for _ in range(m)]

wa = [0]*(n+1)
solve = [False for _ in range(n+1)]
for p,s in ps:
    p = int(p)
    if s=="AC":
        solve[p] = True
    else:
        if not solve[p]:
            wa[p] += 1

ra = 0
rw = 0
for i in range(1,n+1):
    if solve[i]:
        ra += 1
        rw += wa[i]
print(ra,rw)
n, m = map(int, input().split())
s = [[] for i in range(n)]
for i in range(m):
    p, S = input().split()
    s[int(p) - 1] += [S]
print(sum('AC' in si for si in s), sum(si[:si.index('AC')].count('WA') if 'AC' in si else 0 for si in s))
n,m = map(int,input().split())

ps = []
for _ in range(m):
	p,s = map(str,input().split())
	p = int(p)-1
	ps.append([p,s])

ac = [-1 for _ in range(n)]
wa = [0 for _ in range(n)]
ans_ac = 0
ans_wa = 0
for i in range(m):
	if ps[i][1] == 'WA':
		if ac[ps[i][0]] == -1:
			wa[ps[i][0]] += 1
	else:
		if ac[ps[i][0]] == -1:
			ac[ps[i][0]] = 1
			ans_ac += 1

for i in range(n):
	if ac[i] != -1:
		ans_wa += wa[i]
print(ans_ac,ans_wa)
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,sep=" ")
n, m = map(int, input().split())

submission = []
for i in range(n):
    submission.append([])

for i in range(m):
    pi, si = input().split()
    submission[int(pi) - 1].append(si)
    
n_ac = 0
n_penalty = 0
for i in range(n):
    if "AC" in submission[i]:
        n_ac += 1
        ac_index = submission[i].index('AC')
        n_penalty += ac_index
print(n_ac, n_penalty)
N, M = map(int, input().split())
P = []
S = []
flag = [False for i in range(0, N)]
for i in range(0, M):
    x, y = map(str, input().split())
    P.append(int(x)-1)
    S.append(y)
ans = [0, 0]
wa = [0 for i in range(0, N)]
for i in range(0, M):
    if not flag[P[i]]:
        if S[i] == 'AC':
            flag[P[i]] = True
            ans[0] += 1
            ans[1] += wa[P[i]]
        else:
            wa[P[i]] += 1
print(*ans)
from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 6)
input = stdin.readline
N, M = map(int, input().split())
ac = [False] * N # index means p
wa = [0] * N # index means p
wa_cnt = 0
for i in range(M):
  p, s = input().split()
  p = int(p) - 1 # index starts from 0
  if ac[p] is False and s == "AC":
    wa_cnt += wa[p]
    ac[p] = True
  elif s == "WA":
    wa[p] += 1
print(ac.count(True), wa_cnt)
N,M=map(int,input().split())

WA=[0 for _ in range(N+1)]
solved=[False for _ in range(N+1)]
AC=0

for _ in range(M):
    P,S=input().split()
    P=int(P)
    
    if S=="AC" and solved[P]==False:
        AC+=1
        solved[P]=True
    elif S=="WA" and solved[P]==False:
        WA[P]+=1

U=0
for i in range(1,N+1):
    if solved[i]:
        U+=WA[i]

print(AC,U)
import math
N, M = map(int, input().split())
judge = [0]*N
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    wa += judge[int(p)-1]
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    judge[int(p)-1] += 1
print(ac,wa)
N, M = map(int, input().split())

err_list = [0] * N
score_list = ['WA'] * N
sum_error = 0
sum_ac = 0

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

  # 既にACとなった問題については評価対象から外す
  if score_list[idx - 1] == 'WA':
    # scoreによって分岐する
    if s == 'WA':
      err_list[idx - 1] += 1
    else:
      score_list[idx - 1] = 'AC'
      sum_ac += 1
      sum_error += err_list[idx - 1]

print(sum_ac, sum_error)
n, m = map(int, input().split())

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

a = 0
b = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and dic[p] != 'AC':
        b += dic[p]
        dic[p] = 'AC'
    elif dic[p] != 'AC':
        dic[p] += 1
    
for i in range(1, n+1):
    if dic[i] == 'AC':
        a += 1
    
print(a, b)
N, M = map(int, input().split())
question = {}
wa = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q, s = input().split()
    question.setdefault(q, '')
    wa.setdefault(q, 0)
    if s == 'AC':
        if question[q] == 'AC':
            continue
        else:
            question[q] = 'AC'
            ac_count += 1
            wa_count += wa[q]
    else:
        wa[q] += 1
print(ac_count, wa_count)
N,M = map(int,input().split())
W = dict()
A = dict()
ac = 0
pt = 0
Q = []
for i in range(M):
    p, S = input().split()
    p = int(p)
    if not p in W.keys():
        W[p] = 0
        A[p] = 0
    if S == 'WA':
        W[p] += 1
    if S == 'AC':
        if A[p] != 'AC':
            A[p] = 'AC'
            pt += W[p]
            ac += 1
print(ac,pt)
def solve():
    N, M = map(int, input().split())
    ac, wa= 0, 0

    mp = [0] * N
    for _ in range(M):
        p, s = input().split()
        p = int(p) - 1
        if s == "AC":
            if mp[p] != -1:
                ac += 1
                wa += mp[p]
                mp[p] = -1
        else:
            if mp[p] != -1:
                mp[p] += 1
    return ac, wa

print(*solve())
n, m = input().split()
n = int(n)
m = int(m)

# 正解した問題を入れるlist

correct = 0
pn = 0
done_list = [0] * n
pn_list = [0] * n

for i in range(m):
    a,b=input().split()
    
    if done_list[int(a)-1] == 0 and b == "AC":
        done_list[int(a)-1] += 1
        correct += 1
        pn += pn_list[int(a) - 1]
    elif b == "WA":
        pn_list[int(a) - 1] += 1

print(correct, pn)
from collections import Counter
N, M = map(int, input().split())

point = 0
answer_problems = set()
wrong_count = Counter()
for _ in range(M):
    p, s = input().split()
    
    if p in answer_problems:
        continue
    
    if s == 'AC':
        point += wrong_count[p]
        answer_problems.add(p)
    else:
        wrong_count[p] += 1

print(len(answer_problems), point)
n, m = map(int, input().split())
ans = 0
lstn = [False for i in range(n)]
lstc = [0 for i in range(n)]
for i in range(m):
  p, s = input().split()
  pp = int(p)
  status = lstn[pp-1]
  if not status:
    if s == "WA":
      lstc[pp-1] += 1
    else:
      lstn[pp-1] = True
seikai = lstn.count(True)
for i in range(len(lstn)):
  tf = lstn[i]
  if tf:
    ans += lstc[i]
print(seikai, ans)
N, M = [int(s) for s in input().split()]
AC = [0] * 10 ** 5
WA = [0] * 10 ** 5

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

print(sum(AC), sum(map(lambda x: x[0] * x[1], zip(AC, WA))))
N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N

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

for i in range(N):
    if AC[i]==0:
        WA[i]=0
    
print(sum(AC),sum(WA))
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa[p] += 1
    return "{} {}".format(sum(ac), sum([w * a for a, w in zip(ac, wa)]))
 
 
if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
n, m = list(map(int, input().split()))
S = [input().split() for _ in range(m)]
S = [[int(s[0]), s[1]] for s in S]
ac = [0] * n
wa = [0] * n
for s in S:
    if s[1] == 'AC':
        ac[s[0] - 1] = 1
        continue
    elif ac[s[0] - 1] == 0:
        wa[s[0] - 1] += 1
        continue
wa = [0 if ac[i] == 0 else wa[i] for i in range(n)]
ans = ' '.join(list(map(str, [sum(ac), sum(wa)])))
print(ans)
N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)
N, M = map(int, input().split())

answer = [0] * N
penalty = [0] * N
P = 0

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

    if(answer[p_tmp] == 0):
        # 正解
        if s_tmp == 'AC':
            answer[p_tmp] = 1
            P += penalty[p_tmp]
        else:
            penalty[p_tmp] += 1

print(sum(answer), P)
n,m = map(int, input().split())

ac_count = 0
wa_count = 0
p_dict = {str(i):[0,0] for i in range(1, n+1)}

for m_i in range(m):
  p,s = input().split()
  if p_dict[p][1] == 0:
    if s=='WA':
      p_dict[p][0] += 1
    elif s=='AC':
      p_dict[p][1] += 1
  
for val in p_dict.values():
  if val[1] == 1:
    ac_count += 1
    wa_count += val[0]
    
print(ac_count, wa_count)
N, M = map(int, input().split())
ps = [[] for _ in range(N)]
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    ps[p].append(s)
wa = 0
ac = 0
for ss in ps:
    tmp_wa = 0
    for s in ss:
        if s == "WA":
            tmp_wa += 1
        else:
            ac += 1
            wa += tmp_wa
            break
print("{} {}".format(ac, wa))
n,m = map(int,input().split())
cor = set()
pens = {}
for i in range(m):
  p,s = input().split()
  if s=="AC":
    cor.add(p)
  else:
    if not p in cor:
      if p in pens:
        pens[p] += 1
      else:
        pens[p] = 1
pen = 0
for x in cor:
  if x in pens:  
    pen += pens[x]
print(str(len(cor))+" "+str(pen))
n,m=map(int,input().split())
ps=list(list(input().split()) for _ in range(m))

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

for p,s in ps:
    p=int(p)-1
    if s=='AC' and acl[p] ==0:
        acl[p]+=1
    elif s=='WA' and acl[p] ==0:
        wal[p]+=1

wa=0
for i,ac in enumerate(acl):
    if ac == 1:
        wa+=wal[i]    
    
print(sum(acl),wa)
n,m=map(int,input().split())
AC=[0]*n
cnt=[0]*n
ans=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    s=str(s)
    if s=='WA' and AC[p-1]==0:
        cnt[p-1]+=1
    if s=='AC' and AC[p-1]==0:
        AC[p-1]=1
        ans+=cnt[p-1]
print(sum(AC),ans)
from collections import defaultdict
import sys
input = sys.stdin.readline

m = defaultdict(int)
ac = {}

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

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


print("{} {}".format(len(ac.keys()), pena))
N, M = map(int, input().split())

ac = 0
wa = 0

hist_ac = [0] * N
hist_wa = [0] * N
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if hist_ac[p] == 0:
        if s == 'AC':
            hist_ac[p] = 1
            ac += 1
            wa += hist_wa[p]
        else:
            hist_wa[p] += 1

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

pn_num=0
WA_list=[0]*N
AC_list=[0]*N

for _ in range(M):
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        if AC_list[pi-1]==0:
            pn_num+=WA_list[pi-1]
            AC_list[pi-1]=1
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)
n, m = map(int, input().split())
c = [input().split() for i in range(m)]
for i in range(m):
    c[i][0] = int(c[i][0])
AC, WA = 0, 0
acwa = [[0, 0] for i in range(n)]
for i in range(m):
    if acwa[c[i][0] - 1][0] == 0:
        if c[i][1] == 'AC':
            acwa[c[i][0] - 1][0] += 1
            AC += 1
            WA += acwa[c[i][0] - 1][1]
        else:
            acwa[c[i][0] - 1][1] += 1

print(AC, WA)
n,m=map(int,input().split())
a=[list(input().split()) for _ in range(m)]

ac=[True]*n
d=[0]*n
tw=0
ta=0
for i in a:
  j=int(i[0])-1
  if (ac[j]):
    if (i[1]=="WA"):
      d[j]+=1
    else :
      tw+=d[j]
      ta+=1
      ac[j]=False
print(ta,tw)
from collections import defaultdict

a,b = map(int,input().split())

k=defaultdict(lambda:defaultdict(int))

for _ in range(b):
    p,s = input().split()

    if k[p].get('AC'):
        continue

    k[p][s] += 1

x = y = 0

for i,j in k.items():
    if j.get('AC'):
        x+=1
        if j.get('WA'):
            y+=j['WA']

    # print(i,j)


print(x,y)
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for i in range(m):
  a,b=map(str,input().split())
  a=int(a)
  if ac[a]==0:
    if b=='WA':
      wa[a]+=1
    else:
      ac[a]=1
print(sum(ac))
ans=0
for i in range(n+1):
  if ac[i]==1:
    ans+=wa[i]
print(ans)
n, m = map(int, input().split())
ac = [False] * n
wa = [0] * n
u, v = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if ac[p - 1]:
        continue
    if s == 'AC':
        ac[p - 1] = True
        u += 1
        v += wa[p - 1]
    elif s == 'WA':
        wa[p - 1] += 1
print(u, v)
n, m = map(int, input().split())

ac = set()
wa = {}

for i in range(m):
    p, s = input().split()
    if s == 'AC':
        ac.add(p)
        wa[p] = wa.get(p, 0)
    else:
        if not p in ac:
            wa[p] = wa.get(p, 0)+1

ans = sum([wa[i] for i in ac])

print(len(ac), ans)
N, M = map(int, input().split())
a, w = 0, 0
P = set()
W = {}
for _ in range(M):
    p, S = map(str, input().split())
    if p in P:
        continue
    if S == 'WA':
        W.setdefault(p, 0)
        W[p] += 1
    if S == 'AC':
        a += 1
        P.add(p)
        if p in W:
            w += W[p]
print(a, w)
n, m = map(int, input().split())
tocni = [0 for i in range(n + 1)]
correct = wrong = 0
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if s == "AC" and tocni[p] != 1:
        correct += 1
        wrong -= tocni[p]
        tocni[p] = 1
    if s == "WA" and tocni[p] != 1:
        tocni[p] -= 1
print(correct, wrong)
N,M=map(int,input().split())
L=[0]*N
R=[0]*N
right=0
pena=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    p-=1
    if R[p]==0:
        if s=='AC':
          right+=1
          R[p]=1
          pena+=L[p]
        else:
            L[p]+=1

print(right,pena)
n,m=list(map(int,input().split()))
ac,wa=0,0
aclis=[0]*n
walis=[0]*n

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

ac = [False] * n
pena = [0] * n

acCnt = 0
waCnt = 0
for i in range(m):
  p, s = input().split()
  p = int(p) - 1
  if ac[p]:
    continue
  if s == 'AC':
    ac[p] = True
    acCnt += 1
    waCnt += pena[p]
  else:
    pena[p] += 1

print(acCnt, waCnt)
N,M = map(int, input().split())
p = []
S = []
acnum = [-1]*N
for i in range(M):
    tmp1,tmp2 = input().split()
    p.append(int(tmp1))
    S.append(tmp2)
account = 0
wacount = [0]*N
waans = 0
for i in range(M):
    if acnum[p[i] - 1] == -1:
        if S[i] == "AC":
            acnum[p[i] - 1] = 1
            account += 1
            waans += wacount[p[i] - 1]
        else:
            wacount[p[i] - 1] += 1
print(account,waans)
n, m = map(int, input().split())

p = [0] * m
s = [0] * m
ac = [0] * n
wa = [0] * n

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

p = [int(i) for i in p]
 
for i in range(m):
    if ac[p[i] - 1] == 0:
        if s[i] == 'AC':
            ac[p[i] - 1] = 1
        else:
            wa[p[i] - 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())
is_ac = [False]*n
ac = 0
was = [0]*n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s=='AC' and (not is_ac[p]):
        ac += 1
        is_ac[p] = True
    if s=='WA' and (not is_ac[p]):
        was[p] += 1
wa = 0
for i in range(n):
    if is_ac[i]:
        wa += was[i]
print(ac, wa)
N, M = map(int, input().split())
PS = []
for i in range(M):
    p, s = input().split()
    PS.append([int(p), s])

ac = [False] * N
pena = [0] * N

for p, s in PS:
    p -= 1
    if ac[p]:
        continue

    if s == 'AC':
        ac[p] = True
    else:
        pena[p] += 1

a_cnt = 0
w_cnt = 0
for i in range(N):
    if ac[i]:
        a_cnt += 1
        w_cnt += pena[i]

print(a_cnt, w_cnt)
N,M = map(int,input().split())
d = {}
P = {}
for i in range(1,N+1):
    d[i] = 0
    P[i] = 0
for i in range(M):
    p,s = map(str,input().split())
    q = int(p)
    if d[q] == 1:
        continue
    else:
        if s == 'AC':
            d[q] = 1
        else:
            P[q] += 1
ans1 = 0
ans2 = 0
for i in range(1,N+1):
    if d[i] == 1:
        ans1 += 1
        ans2 += P[i]
print(ans1,ans2)
n,m = map(int,input().split())
if m != 0:
    l = [list(input().split()) for i in range(m)]
    p,s = [list(i) for i in zip(*l)]
t = [0] * n
ac = 0
wa = 0
for i in range(m):
    if s[i] == 'WA' and t[int(p[i])-1] != 'AC':
        t[int(p[i])-1] += 1
    elif s[i] == 'AC' and t[int(p[i])-1] != 'AC':
        ac += 1
        wa += t[int(p[i])-1]
        t[int(p[i])-1] = 'AC'
    else:
        pass
print(ac,wa)
a = input().split(" ")
n = int(a[0])
m = int(a[1])
ac = dict()
wa = dict()
for i in range(m):
    v = input().split(" ")
    q = int(v[0])
    res = v[1]
    if q in ac:
        continue
    if res == "AC":
        ac[q] = wa.get(q, 0) + 1
    elif res == "WA":
        wa[q] = wa.get(q, 0) + 1

acs = len(ac)
was = 0
for k in ac.keys():
    was = was + wa.get(k, 0)
print(str(acs) + " " + str(was))
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
ans=0;wrong=0
d=[0]*n
for i in range(m):
    p,s=input().strip().split()
    p=int(p)-1
    if d[p]!=-1:
        if s=='WA':
            d[p]+=1
        else:
            wrong+=d[p]
            d[p]=-1
            ans+=1
print(ans,wrong)
n,m=map(int,input().split())
ac=[[0,False] for i in range(n)]
for i in range(m):
    p=list(input().split(" "))
    x=p[0]
    y=p[1]
    if ac[int(x)-1][1]==True:
        pass
    else:
        if y=="WA":
            ac[int(x)-1][0]+=1
        elif y=="AC":
            ac[int(x)-1][1]=True
counter=0
acc=0
for i in range(n):
    if ac[i][1]:
        acc+=1
        counter+=ac[i][0]
print(acc,counter)
n, m = map(int, input().split())
c = {}
for i in range(n):
    c[i] = 0
ac = [False] * n
acn = 0
for _ in range(m):
    p,s = tuple(input().split())
    p = int(p)
    if s == 'AC' and ac[p-1]==False:
        ac[p-1] = True
        acn+=1
    elif s== 'WA' and ac[p-1]==False:
        c[p-1]+=1
pen = 0
for i,p in c.items():
    if ac[i]: pen+=p
print(acn, pen, sep=' ')