peterverebics/CodeNet_Python_118 huggingface dataset:
N,M = map(int,input().split())

AC = [False] * (N+1)
WA_cnt = [0] * (N+1)

for _ in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if AC[p]:
        continue
    if s == "WA":
        WA_cnt[p] += 1
    else:
        AC[p] = True

penal = sum(WA_cnt)
ac = sum(AC)
print(ac, penal)
n,m = map(int, input().split())
ac = [0]*n
wa = [0]*n

num_ac = 0
num_wa = 0
solved = []

for i in range(m):
  p,s = input().split()
  p = int(p)-1
  if s == 'AC':
     ac[p] = 1
  elif s == 'WA':
    if ac[p] == 1:
      continue
    else:
      wa[p] += 1
    
print(sum(ac), sum(wa))
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
ans=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
    ans+=1
print(ans,cnt)
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=[]
i=0
WA_count=0
for i in range(M):
    if PS[i][0] in ACzumi:
        i+=0
    else:
        if PS[i][1]=="AC":
            ACzumi.append(PS[i][0])
        else:
            WA_count+=1
#print(ACzumi)
print(len(ACzumi),WA_count)
n, m = map(int, input().split())
ac = [0] * n
pen = [0] * n
pen_count = 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[p] += 1

for i in range(n):
    if ac[i] == "AC":
        pen_count = pen[i]

print(ac.count("AC"), pen_count)
n,m = map(int,input().split())
ac = [0 for i in range(n)]
a = 0
b = 0
for i in range(m):
  s,t = map(str,input().split())
  if ac[int(s)-1] == 0:
    if t == "WA":
      b += 1
    else:
      a += 1
      ac[int(s)-1] = 1
print(a,b)
N,M=map(int,input().split())
d={}
e={}
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(s,0)
    if s=="WA" and d[p]!=1:
        e[s]+=1
    elif s=="AC":
        d[p]=1

print(sum(d.values()),sum(e.values()))
N, M = map(int,input().split())
AC_Set = set()
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        continue
    else:
        if result == "AC":
            AC_Set.add(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_Set),WA_Count))
n,m=map(int,input().split())
ss=set()
penality=0
for _ in range(m):
  p,s=input().split()
  p=int(p)
  if (p not in ss) and s=="WA":
    penality+=1
  if s=="AC":
    ss.add(p)
print(len(ss),penality)
from collections import Counter

N, M = map(int, input().split())
ans = []
chk = 0
for _ in range(M):
    p, s = input().split()
    if _ == 0:
        ind = int(p)
    intp = int(p)

    # reset chk when next index
    if intp != ind:
        chk = 0
    
    # Add data only when chk = 0
    if chk == 0:
        ans.append(s)

    # chk = 1 when first 'AC' 
    if intp == ind and s == 'AC':
        chk = 1


    
    ind = intp
        

cnt = Counter(ans)

print(cnt['AC'], cnt['WA'])
n, m = map(int, input().split())
p = []
s = []
for i in range(m):
    p_i, s_i = input().split()
    p.append(int(p_i))
    s.append(s_i)


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

print(correct, penalty)
n, m = map(int, input().split())
l = {}
WA = []
wa = 0
ac = 0
for i in range(m):
    p, s = input().split()
    if p not in l:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            WA.append(wa)
            wa = 0
            l[p] = "AC"
#print(l)
print(ac, sum(WA))
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] == 0:
        wa += 1
    elif s[i] == 'AC' and t[int(p[i])-1] == 0:
        ac += 1
        t[int(p[i])-1] = 1

print(ac,wa)
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'

for i in range(m):
    p, s = map(str, input().split())
    if quest == p and result == s and result == 'AC':
        break
    elif quest == p and s == 'WA':
        wa += 1
    elif quest == p and s == 'AC':
        ac += 1
    elif quest != p and s == 'WA':
        wa += 1
    elif quest != p and s == 'AC':
        ac += 1

    quest = p
    result = s

print(ac, wa)
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()
    print(p, s)
    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]))
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nas = lambda: list(map(str, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
aced = [0] * n
pen = 0
for i in range(m):
    p, s = nas()
    p = int(p)
    if s == "AC":
        aced[p-1] = 1
    else:
        if not aced[p-1]:
            pen += 1
print(sum(aced), pen)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
acCount = 0
waCount = 0
check = [0] * n

for i in range(m):
    p, s = map(str, input().split())
    #print(p,s)
    p = int(p)
    if (check[p - 1] == 0):
        if (s == 'WA'):
            waCount += 1
        else:
            acCount += 1
            check[p - 1] = 1

    else:
        continue

print(acCount, waCount)
N, M = map(int, input().split())
wrongnumber = [0] * N
ACset = set()
for i in range(M):
    p, S = input().split()
    if S == "AC":
        ACset.add(int(p)-1)
    else:
        if (int(p) - 1) not in ACset:
            wrongnumber[int(p) - 1] += 1
WAnumber = 0
ACnumber = len(ACset)
for j in ACset:
    WAnumber += wrongnumber[j-1]

print(ACnumber, WAnumber)
N,M = map(int,input().split())
List = [0]*N
correct , penalties = 0,0
for i in range(M):
    p,s = input().split()
    pro = int(p)-1
    if pro > len(List):
        penalties+=1
        continue
    #elif List[pro]=="AC":
        #continue
    elif s == "WA":
        penalties+=1
        List[pro]=s
    elif s == "AC":
        List[pro]=s
        correct+=1
print("%d %d"%((List.count("AC")+1),penalties))
N,M = map(int,input().split())
 
p = [0]*(M+1)
s = [0]*(M+1)
 
for i in range(1,M+1):
  p[i],s[i] = input().split()
p = list(map(lambda pi:int(pi),p))
 
wa=0
ac = 0
m=0
for i in range(1,N+1):
	if not i in p:
		continue
	m += 1
	if p[m]==i:
		if s[m]=='AC':
			ac += 1
			break
		elif s[m] == 'WA':
			wa += 1
	if m == N:
		break    
if N==wa:
  wa = 0
print(str(ac)+' '+str(wa))
N,M = list(map(int, input().split()))

wa = 0
ac = 0
remind = []

# 行数の入力
for i in range(M):
    # for文で回しつつ処理する
    p,s = input().split()
    p = int(p)

    # すでにあるACスキップ
    if p in remind:
        continue
    # ACをカウント
    if s == 'AC':
        ac += 1
        remind.append(p)
    # WAをカウント
    if s == 'WA':
        wa += 1

print('%s %s' % (ac, wa))
N, M = list(map(int, input().split()))
p, S = [], []
solved = {}
failed = {}
for _ in range(M):
    x = input().split()
    if x[1] == 'AC':
        if x[0] in solved:
            pass
        else:
            solved[x[0]] = 1
    else:
        if not x[0] in solved:
            if x[0] in failed:
                failed[x[0]] += 1
            else:
                failed[x[0]] = 1

print(sum(solved.values()), sum(failed.values()))
nm = [int(i) for i in input().split()]
ac = 0
wa = 0
sub = []
for i in range(0, nm[1]):
    seen = set()
    seen_add = seen.add
    sub.append([i for i in input().split() if i not in sub])
for i in range(0, len(sub)):
    if sub[i][1] == "AC":
        ac += 1
    elif sub[i][1] == "WA":
        wa += 1
    else:
        continue

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

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])
n,m = list(map(int, input().split()))

x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
x_arr = list(map(list, set(map(tuple, x))))

AC = [i for i in x_arr if i[1] == "AC"]
WA = [i for i in x_arr if i[1] == "WA"]

print(len(AC), len(WA))
def main():
    N, M = map(int, input().split())
    a = [0] * N
    w = [0] * N

    for _ in range(M):
        p, s = map(str, input().split())
        if a[int(p) - 1] == 1:
            continue
        if s == "AC":
            a[int(p) - 1] = 1
        elif s == "WA":
            w[int(p) - 1] += 1

    print(sum(a), sum(w))


if __name__ == "__main__":
    main()
N, M = map(int, input().split())

list = [input().split() for _ in range(M)]

ac_list = [0] * N
wa_list = [0] * N

for i in range(M):
  if list[i][1] == "AC":
    ac_list[int(list[i][0])-1] = 1
  else:
    if ac_list[N-1] == 0:
      wa_list[int(list[i][0])-1] += 1
      
print(sum(ac_list), sum(wa_list))
N, M = (int(x) for x in input().split())
ac_dir = {n:False for n in range(1, N+1)}
ac_count = 0
wa_count = 0
for _ in range(M):
    data = input().split()
    p = int(data[0])
    S = data[1]
    if ac_dir[p]:
        continue
    else:
        if S == "AC":
            ac_dir[p] = True
            ac_count += 1
        elif S == "WA":
            wa_count += 1
print(ac_count, wa_count)
n, m = list(map(int, input().split()))
P = []
S = []
ac_list = []
pn = 0
for _ in range(m):
  P_, S_ = input().split()
  P.append(P_)
  S.append(S_)
for p, s in zip(P,S):
  if not p in ac_list:
    if s == 'WA':
      pn += 1
    elif s == 'AC':
      ac_list.append(p)
print(len(ac_list), pn)
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
AC = [False for i in range(n)]
WA = 0
for i in ps:
    if AC[int(i[0]) - 1]:
        pass
    else:
        if i[1] == "AC":
            AC[int(i[0]) - 1] = True
        else:
            WA += 1
print(AC.count(True), WA)
import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

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

print('%s %s' % (sum(successes), sum(penalties)))
def main():
    n, m = [int(i) for i in input().strip().split()]
    accepted = set()
    ac = 0
    wa = 0
    for _ in range(m):
        p, s = input().strip().split()
        if int(p) in accepted:
            continue
        else:
            if s == "AC":
                accepted.add(int(p))
                ac += 1
            elif s == "WA":
                wa += 1
    print(ac, wa)

    return


if __name__ == "__main__":
    main()
N, M = list(map(int, input().split()))

check = [0]*N
count_W = 0
count_A = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if check[p-1] == 0:
        if S == "WA":
            count_W = count_W + 1
        else:
            count_A = count_A + 1
            check[p-1] = 1
print(count_A, count_W)
n,m=map(int,input().split())
AC=[0]*n
WA=[0]*n
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        AC[p-1]=1
    else:
        if AC[p-1]==0:
            WA[p-1]+=1
print(sum(AC),sum(WA))
N, M = map(int, input().split())
A=[]
p = [0] * M
S = [0] * M
for i in range(M):
  p[i], S[i]= map(str, input().split())
  T=[int(p[i]),S[i]]
  A.append(T)
A.sort(key=lambda x: x[0])
wa=0
wa2=0
ac=0
tmp=0
for j in range(M):
  if A[j][0]>tmp:
    if A[j][1]=='WA':
      wa+=1
    else:
      ac+=1
      wa2+=wa
      wa=0
      tmp=A[j][0]
print(ac,wa2)
import sys
input = sys.stdin.readline


m = {}

N, M = list(map(int, input().split()))
penalty = 0
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if p not in m:
            m[p] = 1
    else:
        if p not in m:
            penalty += 1


print(str(len(m.keys())) + " " + str(penalty))
n,m = map(int,input().split())
ps = [input().split() for i in range(m)]

ans =[]
for i in range(m):
  if not(ps[i][0] in ans) :
    ans += ps[i][0]
    


wa = 0
ac = 0
for i in ans:
  for j in range(m):
    
    #問題番号の確認
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        wa += 1
      elif ps[j][1] == "AC":
        ac += 1
        break

    else:
      continue
      
      
print(ac,wa)
Input = list(map(int,input().split()))

N = Input[0]
M = Input[1]

Ar = []

for i in range(M):
  Input = list(map(str,input().split()))
  Ar.append([])
  Ar[i].append(int(Input[0]))
  Ar[i].append(Input[1])

ac = 0
pn = 0

ac_ar=[]
pn_ar=[]

chk  = 1

for i in range(M):
  if Ar[i][1]=="AC":
    ac_ar.append(Ar[i][0])
    chk+=1
  elif (chk<=Ar[i][0])and(Ar[i][1]=="WA"):
    pn_ar.append(Ar[i][0])

ac = len(set(ac_ar))
pn = len(pn_ar)

print(ac,pn)
from collections import defaultdict

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

cnt = defaultdict(int)
d = defaultdict()
for p, s in ps:
    if s == "AC":
        if not d.get(p):
            d[p] = cnt[p]
    else:
        cnt[p] += 1

correct = 0
pena = 0
for k, v in d.items():
    correct += 1
    pena += v

print(correct, pena)
n,m = map(int, input().split())
wrong = [0] * n
wrongAns = [0] * n
goodAns = [0] * n
badAnsF = 0
greatAnsF = 0
#print(wrong)
for i in range(m):
  p,s = input().split()
  if(s == "WA"):
    wrong[int(p)-1] += 1
  elif(s == "AC"):
    wrongAns[int(p)-1] = wrong[int(p)-1]
    goodAns[int(p)-1] = 1
    
for i in wrongAns:
  badAnsF += i
for i in goodAns:
  greatAnsF += i
print(greatAnsF,badAnsF)
n, m=map(int, input().split())
AC, WA=[0]*n, [0]*n
for _ in range(m):
  p, s=list(map(str, input().split()))
  p=int(p)-1
  if AC[p]==0:
    if s=='WA':
      WA[p]+=1
    else:
      AC[p]+=1
  
print(sum(AC), sum(WA))
N,M=map(int,input().split())
p_s=[list(map(str,input().split())) for _ in range(M)]
ac_wa = [0,0]
ac_list = []
wa_list = []

for p,s in p_s:
    if s == "AC" and p not in ac_list:
        ac_wa[0] += 1
        ac_list.append(p)
    elif s == "WA" and p not in wa_list:
        ac_wa[1] += 1
        wa_list.append(p)
print(*ac_wa)
n,m=map(int,input().split())
row=m
number=[0]
judgment=[0]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m > 0:
    for i in range(0,m+1):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)
N , M = map(lambda x: int(x),input().split())
isAC = ["WA"] * N
score=0
penalty = 0
for i in range(M):
    p,r = input().split()
    #print(p,r)
    p = int(p)
    p -= 1
    if isAC[p] =="AC":
        continue
    if r == "WA":
        penalty += 1
        #print(penalty)
    elif r == "AC":
        isAC[p] = "AC"
        score+=1
        #print(score)
    #print(isAC)
print(score,penalty)
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=[]
W=0
for i in range(0, M):
    if S[i]=='AC':
        if p[i] not in A:
            A.append(p[i])
    elif S[i]=='WA':
        if p[i] not in A:
            W+=1
print(len(A), W)
n, m = map(int, input().split())

from collections import defaultdict
d = defaultdict(list)
ab = [tuple(input().split()) for i in range(m)]

nAC = 0
nWA = 0


for a,b in ab:
    a = int(a)

    if len(d[a]) == 0:
        flag = 0

    if flag == 1:
        continue

    if flag == 0 and b == 'AC':
        flag = 1
        nAC += 1

    if flag == 0 and b == 'WA':
        nWA += 1

    d[a].append(b)

print(nAC, nWA)
n,m=map(int,input().split())
sum_ok,sum_miss=0,0
former_ok=[0]*n
for i in range(m):
    p, s=input().split()
    p=int(p)
    if p not in former_ok:
        if s == 'AC':
            former_ok[sum_ok] = p
            sum_ok += 1
            if sum_ok == n:
                break
        else:
            sum_miss += 1

print(sum_ok, sum_miss)
N, M = map(int,input().split())
tasks = []
for i in range(M):
  a, b = map(str,input().split())
  tasks.append([int(a),b])
AC = 0
WA = 0

try:
  for i in range(len(tasks)):
    num = tasks[i][0]
    if tasks[i][1]=="AC":
      AC += 1
      for j in range(i+1,len(tasks)):
        if tasks[j][0]==tasks[i][0]: del tasks[j]
    else: 
      for j in range(i+1,len(tasks)):
        if tasks[j]==[i,"AC"]: WA += 1
except IndexError: pass
print(AC, WA)
N,M = map(int,input().split())
A = (N+1)*[0]
ans = [0,0]

for m in range(M):
  P,S = input().split()
  P = int(P)
  if A[P]==0 and S=="AC":
    ans[0]+=1
    A[P]+=1
  elif A[P]==0 and S=="WA":
    ans[1]+=1

print(*ans)
N, M = map(int, input().split())
acCheck = [False] * (N + 1)
waCnt = 0
acCnt = 0
for i in range(M):
    query = list(input().split())
    ok = acCheck[int(query[0])]
    if ok:
        continue
    if query[1] == "AC":
        acCheck[int(query[0])] = True
        acCnt += 1
    else:
        waCnt += 1
print(str(acCnt), str(waCnt))
N,M = [int(i) for i in input().rstrip().split(' ')]
P = [0 for _ in range(N)]
ans,pen = 0,0
for _ in range(M):
    p,s = input().rstrip().split(' ')
    p = int(p) - 1
    if P[p] == -1:
        continue
    if s == "WA":
        P[p] += 1
        pen += 1
    else:
        ans += 1
        P[p] = -1
print(ans,pen)
n, m = (int(x) for x in input().split())
ps = []
for _ in range(m):
    p, s = (x for x in input().split())
    ps.append([int(p), s])
ans = [0] * n
pen = 0
tmp = 0
for p, s in ps:
    if s == 'WA':
        tmp += 1
        continue
    else:
        ans[p - 1] = 1
        pen += tmp
        tmp = 0 
print(sum(ans), pen)
n ,m = map(int,input().split())
ok = [False] * n
wa_cnt = 0
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        ok[int(p)-1] = True
    elif not(ok[int(p)-1]):
        wa_cnt += 1
print(sum(ok),wa_cnt)
N, M = map(int, input().split())
AC_or_not = [False] * N
n_penalty = [0] * N

for _ in range(M):
    prob, wa_ac = input().split()
    prob = int(prob) - 1
    if wa_ac == 'AC':
        AC_or_not[prob] = True
    else:
        if not AC_or_not[prob]:
            n_penalty[prob] += 1

print(sum(AC_or_not), sum(n_penalty))
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
print(acl)
print(wal)
wa=0
for i,ac in enumerate(acl):
    if ac == 1:
        wa+=wal[i]    
    
print(sum(acl),wa)
import numpy as np

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

Q = np.zeros((N,2),dtype=int)
for i in range(M):
  p,S = input().split()
  p = int(p)-1
  if Q[p,0] == 0 and S == "AC":
    Q[p,0] = 1
  elif Q[p,0] == 0 and S == "WA":
    Q[p,1] += 1
  else:
    pass

ret = Q.sum(axis=0)
print(ret[0],ret[1])
total = {}
penalty = 0
n,m = map(int, input().split())
for _ in range(m):
    num,answer = input().split()
    #キーに値を持つか
    if num in total:
        total[num].append(answer)
    else:
    #辞書の作成
        total[num] = [answer]
        
for answer_value in total.values():
    if "AC" in answer_value:
        penalty += answer_value.index("AC")
            
            
print(len(total),penalty)
n,m = map(int,input().split())

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

print(a,w)
N,M = map(int,input().split())
ps = [list(map(str,input().split())) for _ in range(M)]

wacnt = [0]*(N+1)
is_ac = [False]*(N+1)
for pp,s in ps:
    p = int(pp)
    if s=='AC':
        is_ac[p] = True
    else:
        if not is_ac[p]:
            wacnt[p] += 1

ans = 0
for l in range(N+1):
    if is_ac[l]:
       ans += wacnt[l]
       
print(ans)
N, M = map(int, input().split())
l = [[] for i in range(N)]
old_p = 0
for i in range(M):
    tmp = list(input().split())
    # if tmp[0] != str(old_p + 1):
    #     old_p += 1
    # l[old_p].append(tmp[1])
    l[int(tmp[0]) - 1].append(tmp[1])
ac = 0
wa = 0
#print(l)
for i in range(N):
    for j in range(len(l[i])):
        if l[i][j] == 'WA':
            wa += 1
        else:
            ac += 1
            break
print('{} {}'.format(ac, wa))
N, M = map(int, input().split())
P = [True] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  elif P[p-1]:
      wa += 1
  
print(P.count(False), wa)
N, M = map(int, input().split())
ac = [0]*N
wa = [0]*N

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

print(ac.count(1), wa.count(1))
n,m = list(map(int, input().split()))
P,S = [],[]
for i in range(m):
  p,s = input().split()
  P.append(p)
  S.append(s)

WA_count, AC_count = 0, 0
P_set = list(set(P))
for i in range(len(P_set)):
  Pi_index = [j for j, x in enumerate(P) if x == P_set[i]]
  for k in Pi_index :
    if S[k] == 'WA' :
      WA_count += 1
    else :
      AC_count += 1
      break
      
print(AC_count, WA_count)
N, M = list(map(int, input().split()))
WA = [0]*N
AC = [False]*N
for _ in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'WA':
        if AC[p] == False:
            WA[p] += 1
    else:
        AC[p] = True

print(AC.count(True), sum(WA))
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=[]
i=0
WA_count=0
while i<M:
    if PS[i][0] in ACzumi:
        i+=0
    else:
        if PS[i][1]=="AC":
            ACzumi.append(PS[i][0])
        else:
            WA_count+=1
    i+=1
print(len(ACzumi),WA_count)
import sys

read = sys.stdin.read
readline = sys.stdin.readline

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

WA = [0] * (N + 1)
AC = [False] * (N + 1)
for _ in range(M):
    p, S = readline().split()
    p = int(p)
    if S == 'AC':
        AC[p] = True
    else:
        if not AC[p]:
            WA[p] += 1

print(sum(AC), sum(WA))
n,m=map(int,input().split())
p=[0 for i in range(n)]
penalty=0
acc=0
for i in range(m):
  a,b=input().split()
  a=int(a)
  a-=1

  if (p[a]==0 or p[a]=='WA') and b=='AC':
    acc+=1
    p[a]='AC'
  elif (p[a]==0 or p[a]=='WA') and b=='WA':
    penalty+=1
    p[a]='WA'

print(acc,penalty)
n, m = map(int, input().split())
wrong_list = [0] * (n + 1)
correct_list = [0] * (n + 1)
correct_answers = 0
wrong_answers = 0

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

print(str(sum(correct_list[1:])) + " " + str(sum(wrong_list[1:])))
n,m = map(int,input().split())
question = 0
ans = 0

co = 0
pe = 0

ans_check = [0]*n

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

print(co,pe)
N, M = map(int, input().split())
penalty = 0
ac_list = [False]*N
for i in range(M):
    p, S = input().split()
    if S == 'WA' and ac_list[int(p)-1]==False:
        penalty += 1
    else:
        ac_list[int(p)-1]=True
print(sum(ac_list), penalty)
N, M = map(int, input().split())

AC, WA, C = 0, 0, [False] * N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if not C[p]:
        if S == 'AC':
            AC += 1
            C[p] = True
        else:
            WA += 1

print(AC, WA)
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

if sum(q) == 0:
    print(0,0)
    exit()


print(sum(q),sum(t))