peterverebics/CodeNet_Python_118 huggingface dataset:
n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]==0:
    l[int(a)]=1
  elif str(b)=="WA" and l[int(a)]==0:
    p+=1
print(l.count(1),p)
N, M = map(int, input().split())
p = [0] * M
S = ['a'] * M
for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

ansac = answa = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 0:
        if S[i] == 'WA':
            answa += 1
        elif S[i] == 'AC':
            ansac += 1
            flg[p[i]-1] = 1

print(ansac, answa)
N,M=map(int,input().split())
P=[]
for a in range(M):
    P.append(input().split())
error=0
right=0
han=[]
for b in range(N):
    han.append(0)
for a in P:

    """if sum(han)==len(han):
        break"""
    if a[1]=="WA" and han[int(a[0])-1]==0 :
        error+=1
    elif a[1]=="AC" and han[int(a[0])-1]==0:
        han[int(a[0])-1]=1
        right+=1

print(right,error)
import sys

n, m = map(int, input().split())
ckn = set()
swa = 0
ac = 0

for i in sys.stdin:
  pm, c = i.split()
  
  if not(pm in ckn):
    if c == 'WA':
      swa += 1

    else:
      ckn.add(pm)
      ac += 1

print(ac, swa)
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m-1):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n+1)
AC_count = [0]*(n+1)
for i in range(m):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]] == 0):
            PN_count[p[i]-1] += 1
#print(AC_count,PN_count)
print(sum(AC_count),sum(PN_count))
N, M= map(int, input().split())

WAlist = [0]*N
ACflag = [0]*N

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

print(sum(ACflag), sum(WAlist))
n, m = input().split()
n = int(n)
m = int(m)
correct = 0
penalty = 0
numbers = set()
for i in range(m):
    number, answer = input().split()
    number = int(number)
    if not number in numbers:
        if answer == "AC":
            correct += 1
            numbers.add(number)
        else:
            penalty += 1
    else:
        if not answer == "AC":
            if not number in numbers:
                penalty += 1
print(correct, penalty)
print('reference')

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

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

a = 0
b = 0
for i in range(N):
    if ac[i]:
        a += 1
        b += wa[i]
print(*[a, b])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    ac = []
    wa = []
    for i in range(m):
        p, s = input().split()
        if [p, 'AC'] in ac:
            continue
        if s == 'AC':
            ac.append([p, s])
        else:
            wa.append([p, s])
    print(len(ac), len(wa))


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

acs = set()
wa = was = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in acs:
        if S == 'AC':
            acs.add(p)
            wa += was
            was = 0
        else:
            was += 1
print(len(acs), wa)
N,M = map(int,input().split())
P = []
S = []
total = []
pena = 0
ok = 0
for i in range(M):
    a,b = map(str,input().split())
    if b=='AC' and not a in total:
        ok+=1
        total.append(a)
    elif b=='WA' and not a in total:
        pena+=1
print(str(ok)+' '+str(pena))
n,m = map(int,input().split())

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

for _ in range(m):
  p,s = map(str,input().split())
  if s == "AC" and ac[int(p)] == 0:
    ac[int(p)] += 1
  if s == "WA" and ac[int(p)] == 0:
    wa[int(p)] += 1
print(sum(ac),sum(wa))
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
wa = 0
ac = 0
flag = -1
for i in range(m):
  if flag == ps[i][0]:
    continue
  else:
    if ps[i][1] == "AC":
      ac += 1
      flag = ps[i][0]
    else:
      wa += 1
print(ac,wa)
N,M = map(int,input().split())

grid = []

for i in range(M):
    array = list(map(str, input().strip().split()))
    grid.append(array)

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

for a in grid:
    if a[1] == 'AC':
        ac_list[int(a[0]) - 1] = 1
    elif a[1] == 'WA' and ac_list[int(a[0]) - 1] != 1:
        wa_list[int(a[0]) - 1] += 1

print(str(sum(ac_list)) + ' ' + str(sum(wa_list)))
n , m = (int(a) for a in input().split())
check = []
for i in range(m) :
    p,s = input().split()
    check.append([int(p),s])

ans = []
ng = 0
for i in range(m) :
    if check[i][0] not in ans :
        if check[i][1] == "AC" :
            ans.append(check[i][0])
        else : ng += 1

print(len(ans) , ng)
# 問題数 = n と 回答数 = m を取得
n, m = map(int, input().split())

# 必要な変数を定義
ac = [0] * n
wa = [0] * n

for i in range(m):
    # i+1 回目の結果を取得
    p, s = list(input().split())
    p = int(p) - 1

    # ACではない場合
    if ac[p] != 1:
        wa[p] = 1

    # ACである場合
    if s == "AC":
        ac[p] = 1

print(sum(ac), sum(wa))
N, M=list(map(int, input().split()))
problem = []
result  = []
for _ in range(M):
    str_list = input().split(' ')
    problem.append(int(str_list[0]))
    result.append(str_list[1])

first_AC = [False]*N
pena     = [0]*N
for (p, r) in zip(problem, result):
    if first_AC[p-1]==False:
        if r=='WA':
            pena[p-1] += 1
        elif r=='AC':
            first_AC[p-1]=True
collect    = sum(first_AC)
total_pena = sum(pena)
print('%d %d' % (collect, total_pena))
n, m = map(int, input().split())
p = []
s = []
ans = [0, 0]
for i in range(m):
    input_p, input_s = input().split()
    p.append(int(input_p))
    s.append(input_s)

ac_list = []
for i in range(m):
    if p[i] not in ac_list and s[i] == 'AC':
        ans[0] += 1
        ac_list.append(p[i])
    elif p[i] not in ac_list and s[i] == 'WA':
        ans[1] += 1
print(ans[0], ans[1])
n, m = map(int, input().split())
A = [list(map(str, input().split())) for _ in range(m)]

ans = 0
pen = 0

A = list(map(list, set(map(tuple, A))))

for i in range(len(A)):
    if A[i][1]=='AC':
        ans += 1
        if i+1<=len(A)-1 and A[i+1] == (''.format(i), 'WA'):
          A.remove(A[i+1])
    if A[i][1] == 'WA':
        pen += 1

print(ans, pen)
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
    else:
        if solve_problem[ int(ps[0])-1] == 0:
            ans[1] += 1

print(ans[0],ans[1])
N, M = map(int, input().split())
P = []
S = []
P_count = 0
S_count = 0

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

  if s == 'WA' and p not in P:
    S_count += 1
  if s == 'AC' and p not in P:
    P.append(p)
    P_count += 1

print(P_count, S_count)
import sys
s = sys.stdin.readlines()

c = []
a = 0
b = 0
N, M = map(int, s[0].split())
for e in s[1:M + 1]:
  p, S = e.split()
  if p not in c:
    if S == 'AC':
        c.append(p)
        a += 1
    else:
        b += 1

print('{} {}'.format(a, b))
n, m = map(int, input().split())
ac = set()
pn = 0
for i in range(m):
  p, s = map(str, input().split())
  if s == 'AC':
    ac.add(p)
  if p not in ac and s == 'WA':
    pn += 1

print(len(list(ac)), pn)
N, M = map(int, input().split())
AC_list = set()
WA = 0
AC = 0
for i in range(M):
    p, S = map(str, input().split())
    if S == "AC":
        if p in AC_list:
            continue
        else:
            AC += 1
            AC_list.add(p)
    elif S == "WA":
        if p not in AC_list:
            WA += 1
        else:
            continue
print(AC, WA)
N,M = map(int,input().split())
p = ['0']*M
S = ['0']*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
i = 0
for i in range(M):
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
  else:
    AC[int(p[i])]=1
print(sum(AC),sum(WA))
N,M = map(int,input().split())
D = [[]for i in range(N)]
AC = 0
WA = 0
for i in range(M):
  plobNum,res = input().split()
  D[int(plobNum)-1].append(res)

for prob in D:
  for submit in prob:
    if submit == "WA" :
      WA+=1
    else:
      AC+=1
      break
print("{} {}".format(AC,WA))
N, M = map(int, input().split())
PS = [input().split() for _ in range(M)]

AC = [False] * (N+1)
ans = 0
tmp_pena = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        tmp_pena += 1
        # pena = 1 これだと、AC確定時にpenalty加算されるというルールが守られない
    elif s == "AC":
        ans += 1
        pena += tmp_pena
        AC[p] = True

print(ans, pena, sep=' ')
N, M = map(int, input().split())

correct = 0
penalty = 0
answered = set()

for _ in range(M):
  p, s = input().split()
  pn = int(p)
  if s == 'AC':
    if pn not in answered:
      correct += 1
      answered.add(pn)
  elif s == 'WA':
    if pn not in answered:
      penalty += 1

print(correct, penalty)
n,m=map(int,input().split())
wa=[0]*(n+1)
ac=[0]*(n+1)
for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=='AC':
    ac[p]=1
  if s=='WA' and ac[p]==0:
    wa[p]+=1
print(sum(ac),sum(wa))
n,m=list(map(int, input().split()))
cor,wro=0,0
dic={}
for i in range(m):
  x,y=list(map(str, input().split()))
  if y=="AC" and x not in dic:
    cor+=1
    dic[x]="ok"
  elif y=="WA":
    if x not in dic:
      wro+=1
  
print(cor,wro)
number,submit=input().rstrip().split()
result=[input().rstrip().split() for i in range(int(submit))]
#print(result)
good=[]
bad=[]
for i in range(int(submit)):
    if result[i][1]=='AC':
        if result[i][0] not in good:
            good.append(result[i][0])
    else:       
        if result[i][0] not in good:
            bad.append(result[i][0])
print(str(len(good))+' '+str(len(bad)))
a,b=map(int,input().split())
List=[list(input().split()) for i in range(b)]
account=0
wacount=0
acbox=[0]*(a+1)
for i in List:
  if i[1]=="WA":
    if acbox[int(i[0])]==0:
      wacount+=1
  else:
    if acbox[int(i[0])]==0:
      acbox[int(i[0])]=1
      account+=1
print(account,wacount)
N,M=map(int,input().split())

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        if(S=='AC'):
            AC+=1
        ans[P]=S
    if(ans[P]=='WA'):
        if(S=='AC'):
            AC+=1
            ans[P]=S
        elif(S=='WA'):
            WA+=1
print(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 s == 'AC':
        ac[p] = 1
    if not ac[p] and s == 'WA':
        wa[p] += 1

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

L = []
search_n_list = [i for i in range(N)]
p_list = [0 for i in range(N)]
ac_list = [0 for i in range(N)]

for i in range(M):
    L_ = list(input().split())
    p = int(L_[0]) - 1
    w = L_[1]
    
    if p in search_n_list:
        if w == 'AC':
            ac_list[p] = 1
            search_n_list.remove(p)
        else:
            p_list[p] += 1

print("{} {}".format(sum(ac_list), sum(p_list)))
n,m=map(int,input().split())
ps=[list(input().split()) for _ in range(m)]
wa=0
ac=0
d=[0]*n
for p,s in ps:
  if s=='WA':
    if d[int(p)-1]==0:
      wa+=1
  else:
    if d[int(p)-1]==0:
      ac+=1
      d[int(p)-1]=1
print(ac,wa)
n,m = map(int,input().split())
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0

for i in range(1,m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if flag == 1:
        continue
    if s[i] == 'AC':
        flag = 1
        a_count += 1
    else:
        w_count += 1
    
print(a_count,w_count)
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        for j in range(M):
            if S[j] == 'AC':
                count_wa += 1

print(count_ac, count_wa)
N, M = map(int, input().split())
p = [list(map(str, input().split())) for _ in range(M)]
aclst = [0] * (N + 1)
cntw = 0
cnta = 0

for i in range(M):
    if aclst[int(p[i][0])] == 0:
        if p[i][1] == 'AC':
            cnta += 1
            aclst[int(p[i][0])] = 1
            print(aclst)
        else:
            cntw += 1

print(cnta, cntw)
def main():
    N, M = map(int, input().split())
    ans = [False for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
        else:
            if ans[i - 1] == False:
                wa += 1

    print(ac, wa)
    return 0
if __name__ == '__main__':
    main()
N, M = map(int, input().split())

p = []
s = []
for i in range(M):
    a, b = input().split()
    p.append(int(a))
    s.append(b)
    
from collections import defaultdict
correct = defaultdict(bool)

ac = 0
wa = 0

for pp in p:
    correct[pp] = False
for pp, ss in zip(p,s):
    if correct[pp]:
        pass
    else:
        if ss == 'AC':
            correct[pp] = True
            ac += 1
        elif ss == 'WA':
            wa += 1
print(ac, wa)
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [['WA'] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    a = int(a)
    a -= 1
    if li[a][-1] == 'WA':
        li[a].append(b)
print(li)
ac = 0
wa = 0
for i in li:
    for v in i:
        if v == 'AC':
            ac += 1
        elif v == 'WA':
            wa += 1
print(ac, wa-len(li))
N,M=map(int,input().split())
ans=['WA' for i in range(N)]
crt=0
mis=0
for i in range(M):
    p,S=map(str,input().split())
    if ans[int(p)-1]=='WA':
        if S=='WA':
            mis+=1
        else:
            crt+=1
            ans[int(p)-1]='AC'
    else:
        continue
print(crt,mis)
def main():
    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
    ans = [sum(ac), sum(wa)]
    print(*ans)

main()
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" and isAC[p] == "WA":
        penalty += 1
        #print(penalty)
    elif r == "AC" and isAC[p] == "WA":
        isAC[p] = "AC"
        score+=1
        #print(score)
    #print(isAC)
print(score,penalty)
n,m = list(map(int , input().split()))
wa = 0
ac = 0
ch = []
for i in range(m):
	f = list(map(str,input().split()))
	p = int(f[0])
	s = str(f[1])
	if p not in ch:
		if s == 'WA':
			wa+=1
		elif s == 'AC':
			ch.append(p)
			ac+=1
print(ac,wa)
n, m = map(int, input().split())
query = [tuple(input().split()) for _ in range(m)]

wa = [0] * n
ac = [0] * n
for p, result in query:
    p = int(p) - 1
    if result == 'AC':
        ac[p] = 1
    if result == 'WA':
        if ac[p] == 0:
            wa[p] += 1

accept = 0
penalty = 0
for i in range(n):
    if ac[i]:
        penalty += wa[p]
        accept += 1

print(accept, penalty)
N,M=map(int,input().split())
fin=set()
AC=0
WA=0
for i in range(M):
  p,s=input().split()
  p=int(p)
  if not p in fin:
    if s=="AC":
      AC+=1
      fin.add(p)
    else:
      WA+=1
print(AC,WA)
n,m = map(int,input().split())
p = []
q = []
for i in range(m):
  s = list(map(str,input().split()))
  p.append(s[0])
  q.append(s[1])
kotae = {}
panel = 0
ac = 0
acichi = [[],[]] # 問題、位置の順
for i in range(m):
  if p[i] not in kotae:
    kotae[p[i]] = []
  if p[i] not in  acichi[0]:
    if q[i] == "AC":
      acichi[0].append(p[i])
      acichi[1].append(q[i])
      ac += 1
    else:
      panel += 1
print(ac,panel)
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]
ac = 0
wa = 0
ansed = []
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed.append(psn[0])
    else:
        if psn[0] not in ansed:
            wa += 1

print(ac, wa)
import sys

def main():
    N, M = map(int, input().split())

    arr = [input().split() for i in range(M)]
    for j in arr:
        j[0] = int(j[0])

    ac, wa = 0, 0

    AC_lis = []
    for k in arr:
        if k[1] == 'WA' and k[0] not in AC_lis:
            wa += 1
        if k[1] == 'AC' and k[0] not in AC_lis:
            ac += 1
            AC_lis.append(k[0])

    print(ac, wa)

main()
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

l=[0]*N

ans=[0,0]
for _ in range(M):
    num,judge=input().split()
    num=int(num)
    num-=1
    if l[num]==1:
        continue
    else:
        if judge=="AC":
            ans[0]+=1
            l[num]=1
        else:
            ans[1]+=1
    

print(*ans)
n, m = map(int, input().split())
info = [[] for _ in range(n)]
for _ in range(m):
    p, s = input().split()
    info[int(p) - 1].append(s)

AC = 0
WA = 0

for meta in info:
    for s in meta:
        # print(s)
        if s == 'AC':
            AC += 1
            break
        else:
            WA += 1

print(AC, WA) 
# print(info)
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=0
for i in range(m):
  p,c=input().split()
  if c=='AC' and ac[int(p)]==0:
    ac[int(p)]=1
  elif c=='WA' and ac[int(p)]==0:
    wa+=1
print(ac.count(1),wa)
N, M = map(int, input().split())
ACflags = [False] * N
WAcounts = [0] * N
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if ACflags[p]:
        continue
    if s == 'AC':
        ACflags[p] = True
    else:
        WAcounts[p] += 1

print(sum(ACflags), sum(WAcounts))
import numpy as np
n,m = map(int,input().split())

p = []
s = []
ans_a = np.zeros(n+1)
ans_p = np.zeros(n+1)

for i in range(m):
    pi ,si = map(str,input().split())
    p.append(int(pi))
    s.append(si)

for i in range(m):
    if s[i] == "AC":
        ans_a[p[i]] = 1
    if s[i] == "WA" and ans_a[p[i]] == 0:
        ans_p[p[i]] += 1

print(int(np.sum(ans_a)), int(np.sum(ans_p)))
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(int)
k = 0 #カウント数
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = 1
    elif b == 'WA':
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#n, m = map(int, readline().split())
n, m = map(int, input().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())
k = []
t,f = 0,0
for _ in range(m):
  a,b = map(str,input().split())
  if a in k:
    pass
  elif b == "AC":
    k.append(a)
    t = t + 1
  else:
    f = f + 1
print(t,f)
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]
for i in range(0, M):
    if flag[P[i]]:
        continue
    else:
        if S[i] == 'AC':
            flag[P[i]] = True
            ans[0] += 1
        else:
            ans[1] += 1
print(*ans)
n,m = map(int, input().split())
ps = [list(map(str, input().split())) for _ in range(m)]

sum_wa = 0
sum_ac = 0
flag_ac = 0

for i in range(m):
    if flag_ac == 1:
        if ps[i][0] != ps[i-1][0]:
            flag_ac = 0
        else:
            break

    if flag_ac == 0:
        if ps[i][1] == 'WA':
            sum_wa += 1
        elif ps[i][1] == 'AC':
            flag_ac = 1
            sum_ac += 1

print(sum_ac, sum_wa)
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
for i in range(N):
    if S[i] == 0:P[i] = 0
print(sum(S),sum(P))
n, m = [int(i) for i in input().split()]

cs = list()
cnt_c, cnt_w = 0, 0
for i in range(m):
  p, s = input().split()
  if p in cs:
    continue
  if s == 'AC':
    cnt_c += 1
    cs.append(p)
  else:
    cnt_w += 1

print(cnt_c, cnt_w)
n,m=map(int,input().split())
if m==0:
    print(0,0)
    exit()
l=[]
for i in range(m):
    x,y=input().split()
    l.append([int(x),y])
l=sorted(l,key=lambda x:x[0])
ac=0
wa=0
tmp=0
t=[0]*(n+1)

for i in range(m):
    if tmp==l[i][0]:
        continue
    elif l[i][1]=="WA":
        wa+=1
    elif l[i][1]=="AC":
        ac+=1
        tmp=l[i][0]
print(ac,wa)
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if a in A:
        continue
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

    
    
print(ac,wa)
n, m = map(int, input().split( ))
wa = [0] * (n + 1)
ac = [0] * (n + 1)
for i in range(m):
    no_s, res = map(str, input().split( ))
    no = int(no_s)
    if ac[no] == 0 and res == "AC":
        ac[no] = 1
    elif ac[no] == 0 and res == "WA":
        wa[no] += 1
for i in range(1, n):
    if ac[i] == 0:
        wa[i] = 0
acsum = 0
wasum = 0
for i in ac:
    acsum += i
for i in wa:
    wasum += i
print(str(acsum) + " " + str(wasum))
N,M = map(int,input().split())
dic = {}
for i in range(N):
  dic[i+1] = [0,0]

for _ in range(M):
  round,result = input().split()
  round = int(round)
  if result == 'AC' and dic[round][0] == 0:
    dic[round][0] = 1
  elif result == 'WA' and dic[round][0] == 0:
    dic[round][1] += 1

right = 0
wrong = 0

for item in dic.values():
  right += item[0]
  wrong += item[1]

print(right, wrong)
n,m=[int(i) for i in input().split()]
l=[]
w=0
c=0
for i in range(m):
    a,b=[str(i) for i in input().split()]
    a=int(a)
    if(a not in l):
        if(b=='WA'):
            w=w+1
        else:
            c=c+1
            l.append(a)
print(c,w)
n, m = map(int, input().split())
a = [0]*n
answ = [0, 0] 
for i in range(m):
    ind, ans = input().split()
    ind = int(ind)
    if a[ind-1] in [0, -1] and ans == 'WA':
        a[ind-1] = -1
        answ[1]+=1;
    elif a[ind-1] in [0, -1] and ans == 'AC':
        a[ind-1] = 1
        answ[0]+=1
    a[ind-1] = 1 if ans == 'AC' else -1
print(answ[0], answ[1])
import math

N,M = map(int, input().split())
#A = list(map(int, input().split()))
p=[]
S=[]

A=[0 for _ in range(N)]
B=[0 for _ in range(N)]

for i in range(M):
    p,S = input().split()
    p = int(p)-1
    #p.append(a)
    #S.append(b)
    if S == "AC":
        A[p] = 1
    elif A[p]==0:
        B[p] += 1
    
#s = input()
#N = int(input())
#X = list(map(int, input().split()))
MOD = 10 ** 9 + 7

print(sum(A), sum(B))
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
from bisect import *
from collections import *
# from heapq import *
# import functools
# import itertools
# import math
INF = 500000
mod = 10**9+7

N, M = map(int, input().split())
flg = [0] * N
cnt = [0] * N
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'WA':
        if flg[p] == 0:
            cnt[p] += 1
    else:
        if flg[p] == 0:
            flg[p] = 1
print(sum(flg), sum(cnt))
def LI():
  return [int(s) for s in input().split()]

correct_answers = []
warning_count = 0

N,M = LI()

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = p_num in correct_answers
  
  if answer == 'AC' and not include_answers:
    correct_answers.append(p_num)
  elif answer == 'WA' and not include_answers:
    warning_count+=1
    
print(len(correct_answers),warning_count)