peterverebics/CodeNet_Python_118 huggingface dataset:
n,m = map(int,input().split())
mem = set()
wrong = set()
ac =0;wa =0
for i in range(m):
    a,b = input().split()
    if a not in mem:
        if b == 'AC':
            mem.add(a)
            ac+=1
        else:
            wrong.add(a)
            c = mem.union(wrong)
            wa = len(c)
print(ac,wa)
from collections import defaultdict

N, M = map(int, input().split())
WA = defaultdict(int)
AC = defaultdict(int)
boollist = [False]*N

for _ in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not boollist[p-1]:
        WA[p] += 1
    elif s == 'AC':
        boollist[p-1] = True
        AC[p] = 1
print(sum(AC.values()), sum(WA.values()))
N,M = map(int, input().split())
AC=WA=0
p=set()
for _ in range(M):
    a,S = input().split()
    if a not in p:
        if S=='AC':
            AC+=1
            p.add(a)
        else:
            WA+=1
print(AC,WA)
N, M = list(map(int, input().split()))
a = []

for i in range(M):
    a.append(map(str, input().split()))

p_sum = 0
s_sum = 0

p_count = 0
s_count = 0
for k in range(M):
    ps = list(a[k])
    if p_count != ps[0]:
        s_count = 0
        p_count = ps[0]
    if s_count == 0:    
        if ps[1] == "WA":  
            s_sum += 1
        else:
            p_sum += 1
            s_count = 1

print(str(p_sum) + " " + str(s_sum))
N,M=map(int,input().split()) 
L=[list(input().split()) for i in range(M)]
W=[0]*N
A=[0]*N
a=0
w=0
for i in range(M):
  if L[i][1]=="AC":
    A[int(L[i][0])-1]=1
  elif L[i][1]=="WA" and A[int(L[i][0])-1]==0:
    W[int(L[i][0])-1]+=1
for i in A:
  a+=i
for i in W:
  w+=i
print(a,w)
N, M = map(int, input().split())

submit_set = {input() for _ in range(M)}

correct_ans_num = 0
penalty = 0
for i in range(1, N + 1):
  results = [result.split()[1] for result in submit_set if int(result.split()[0]) == i]
  
  if not 'AC' in results: continue
  
  correct_ans_num += 1
  penalty += len(results) - 1
  
print('{} {}'.format(correct_ans_num, penalty))
N, M = map(int, input().split())

q = set()
ac = wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in q:
        if S == 'AC':
            q.add(p)
            ac += 1
        else:
            wa += 1
print(ac, wa)
n,m=map(int,input().split())
cnt1=0
cnt2=0
flag=[-1]*(n+1)
for _ in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if s=='AC':
    if flag[p]==1:
      continue
    else:
      cnt1+=1
      flag[p]=1
  if s=='WA':
    if flag[p]==1:
      continue
    else:
      cnt2+=1
print(cnt1,cnt2)
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ok_list = []
for p, s in result_list:
    if p not in ok_list:
        if s == 'WA':
            WA_total += 1
        else:
            AC_total += 1
            ok_list.append(p)
print('{} {}'.format(AC_total, WA_total))
N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

stop_list=[]

WA_count=0
AC_count=0
for i in range(M):
    if not lst[i][0] in stop_list:
        if lst[i][1]=='AC':
            AC_count+=1
            stop_list.append(lst[i][0])
        else:
            WA_count+=1
print( AC_count, WA_count)
n,m=map(int,input().split())

a=[0]*n

ac=0
wa=0

for i in range(m):

  p,s=input().split()
  p=int(p)

  if a[p-1]==0:
    if s=="AC":
      ac+=1
      a[p-1]=1
    else:
      wa+=1
print(ac,wa)
n, m = map(int,input().split())
pS = [input().split() for _ in range(m)]
pena = 0
correct = 0
flag = [False] * n
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        elif s == "AC":
            correct += 1
            flag[p-1] = True
print(correct, pena)
n,m=map(int,input().split())
ps=[list(map(int,input().replace('WA','0').replace('AC','1').split())) for i in range(m)]
tmp_p=0
ac_cnt=0
wa_cnt=0
wa=0
flg=0
for i in range(m):
  p=ps[i][0]
  s=ps[i][1]
  if tmp_p!=p:
    wa=0
    flg=0
  if s==1 and flg==0:
    flg=1
    ac_cnt+=1
    wa_cnt+=wa
  elif s==0 and flg==0:
    wa+=1
  tmp_p=p
print(ac_cnt, wa_cnt)
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict
def main():
    n,m=map(int,input().split())
    ac=defaultdict(int)
    pena=0
    for i in range(m):
        k,s=input().split()
        k=int(k)
        if ac[k-1]!=1:
            if s=="WA":pena+=1
            else:ac[k-1]+=1
    print(sum(ac.values()),pena)


if __name__=='__main__':
    main()
n,m=map(int,input().split())
ansct=0
ansflag=[0]*n
missct=0
for i in range(m):
    p,s=map(str,input().split())
    if (s=='AC')and(ansflag[int(p)-1]==0):
        ansflag[int(p)-1]=1
        ansct+=1
    elif ansflag[int(p)-1]==0:
        missct+=1
print(str(ansct)+' '+str(missct))
F_str = input().split()
F = [int(f) for f in F_str]
N = F[0]
M = F[1]

WA_list = [0 for _ in range(N)]
AC_list = []

for i in range(M):
    S_str = input().split()
    S = [str(s) for s in S_str]
    if(S[1] == "AC"):
        AC_list.append(S[0])
    elif(not(S[0] in AC_list)):
        WA_list[int(S[0])-1] += 1

AC_set = list(set(AC_list))

print(str(len(AC_set)) + " " + str(sum(WA_list)))
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

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

if m == 0:
  print('0 0')
  
s = [input().split() for i in range(m)]

p = get_unique_list(s)

ac = 0
w = []
wa = 0

for i in range(len(p)):
  if p[i][1] == 'AC':
    ac += 1
    w.append(wa)
    wa = 0
  elif p[i][1] == 'WA':
    wa += 1
print(str(ac)+" "+str(sum(w)))
n, m = map(int, input().split())
ac = [False for _ in range(n+1)]
wa = [0 for _ in range(n+1)]

acCount = 0
waCount = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if(ac[p] == False):
        if (s == "AC"):
            ac[p] = True
        else:
            wa[p] += 1

for i in range(n+1):
    if(ac[i] == True):
        acCount += 1
        waCount += wa[p]

print(acCount, waCount)
#ABC151C
n,m=list(map(int,input().split()))
p=[]
s=[]

chk = ''

for i in range(m):
    _p,_s=input().split()
    if chk != _p:
        chk = _p
        c1 = 0
        c2 = 0
        
    if _s == "WA":
        c1+=1
    
    elif _s == "AC":
        c2+=1
        s.append(int(_p))
        if c2 == 1:
          p.append(c1)

ac=len(set(s))
wa=sum(p)
print(ac,wa,sep= ' ')
n,m = map(int,input().split())
d={}
for _ in range(m):
  i,ans = input().split()
  if i in d:
    d[i].append(ans)
  else:
    d.update({i:[ans]})
a=p=0
for i in d:
  if 'AC' in d[i]:
    a+=1
  if 'WA' in d[i]:
    p+=1
print(a,p)
from collections import Counter

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

wa = Counter()

ac = set()

for i in range(M):
    p, s = input().split()
    p = int(p)
    if p in ac: continue
    if s == 'WA':
        wa[p] += 1
    else:
        ac.add(p)
print(len(ac), sum(wa.values()))
n, m = list(map(int,input().split()))

correct = 0
penalty = 0

corrected = []

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and pi not in corrected):
    corrected.append(pi)
    correct += 1
  elif (si == 'WA' and pi not in corrected):
    penalty += 1
      
print("{} {}".format(correct, penalty))
n,m = map(int,input().split())
ac,wa = 0,0
number=[0]*n

for _ 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)
#C - Welcome to AtCoder
N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
    p,s = input().split()
    S.append(s)
    P.append(p)
    
WA = 0
AC = 0
AC_list = []
for i in range(M):
    if (P[i] in AC_list) == False:
        if S[i] == 'AC':
            AC += 1
            AC_list.append(P[i])
        else:
            WA += 1
print(AC,WA)
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    pena = [0] * n

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


if __name__ == '__main__':
    main()
N,M = map(int,input().split())
P = []
s = []
sekai = 0
wrong = 0

for i in range(M):
  p,S = map(str,input().split())
  P.append(int(p))
  s.append(S)
  
problem = list(range(1,N+1))

for j, ans in zip(P,s):
  if (j in problem) and (ans == "AC"):
    problem.remove(j)
    sekai += 1
  elif (j in problem) and (ans == "WA"):
    wrong += 1
print(sekai, wrong)
N,M = map(int, input().split())

AC_num = 0
WA_num = 0
AC_map = []
for i in range(M):
    p,S = map(str, input().split())
    p = int(p)
    if S == 'AC' and (p not in AC_map):
        AC_num += 1
        AC_map.append(p)
    elif S == 'WA':
        if p in AC_map:
            continue
        else:
            WA_num += 1

print(str(AC_num)+' '+str(WA_num))
N,M = map(int, input().split())
table= [0]*N
pen = 0
score = 0
for i in range(M):

  p,S = input().split()
  p = int(p)-1
  if table[p] == 1:
    pass
  elif S == "WA":
    pen += 1
  elif table[p] == 0 and S=="AC":
    score += 1
    table[p] = 1
print(score,pen)
N,M=map(int, input().split())
AC=[]
WA=[]
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  else:
    WA.append(p)
print(len(set(AC)),len(set(WA)))
wa = 0
l = []

n,m = map(int,input().split())
for i in range(m):
    a = list(map(str,input().split()))
    if a[1] == 'AC':
        l.append(a[0])
    else:
        if not a[0] in l:
            wa += 1

ac = len(set(l))

print(ac,wa)
N, M = map(int, input().split())
A_list = [input().split() for _ in range(M)]

wa_count, ac_count = 0, 0
WA = 0  # {prob_id: wa_count}
AC_list = []  # [prob_id]

for i in range(M):
    id = A_list[i][0]
    if A_list[i][1] == 'AC':
        if not id in AC_list:
            wa_count += WA
            ac_count += 1
            AC_list.append(id)
    else:
        WA += 1

print(ac_count, wa_count)
N, M = map(int, input().split())
L = [list(input().split()) for _ in range(M)]
D = {str(c):False for c in range(1, N+1)}
S = 0
for l in L:
  if l[1]=="WA" and D[l[0]]==False:
      S += 1 
  else:
    D[l[0]]=True
print(sum(D.values()), S)
n, m = map(int, input().split())

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

for i in range(m):
    p, s = input().split()
    if ac_list[int(p)-1] == 1:
        pass
    elif ac_list[int(p)-1] == 0 and s == "WA":
        wa +=1
    else:
        ac_list[int(p)-1] = 1
        ac += 1

print(ac, wa)
_,M = map(int,input().split())
result = {}
for i in range(M):
    P, Q = input().split()
    if P not in result:
        result[P] = [Q]
    else:
        if result[P][-1]=='AC':
            pass
        else:
            result[P].append(Q)
AC = 0
WA = 0
numbers = list(result.values())
for i in range(len(numbers)):
    AC += numbers[i].count('AC')
    WA += numbers[i].count('WA')
print(AC,WA)
n,m = map(int,input().split())
score_list = [2]*m
for i in range(m):
    score_list[i] = input().split()

wa_num = 0
ac_q = []
for i in range(m):
    if score_list[i][1] == "AC" and score_list[i][0] not in ac_q:
        ac_q.append(score_list[i][0])
    elif score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
        wa_num = wa_num + 1
    
ac_num = len(ac_q)

print(ac_num,wa_num)
N, M = map(int, input().split())
P, S = list(), list()
for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

AC_flags = [[0, 0] for _ in range(N)]

for p, s in zip(P, S):
    if AC_flags[p - 1][0] == 0 and s == "WA":
        AC_flags[p - 1][1] += 1
    elif AC_flags[p - 1][0] == 0 and s == "AC":
        AC_flags[p - 1][0] += 1

sum_ac, sum_wa = 0, 0
for ac, wa in AC_flags:
    sum_ac += ac
    sum_wa += wa

print(sum_ac, sum_wa)
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
        else:
            was[p-1]+=1
print(sum(acs),sum(was))
N, M = map(int, input().split())
d = {}
for _ in range(M):
    p, s = input().split()
    a = d.get(p, [0, 0])
    if s == "AC" and a[0] == 0:
        a[0] = 1
    elif s == "WA" and a[0] == 0:
        a[1] += 1

    d[p] = a

ac = 0
wa = 0
for x in d.values():
    ac += x[0]
    wa += x[1]

print("{0} {1}".format(ac, wa))
import numpy as np
n,p = map(int,input().split())

ac = np.array([0]*n)
wa = np.array([0]*n)

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

if sum(ac) == 0:
    print(0,0)
else:
    print(sum(ac),sum(wa))
N,M=map(int,input().split())
penalty=[0]*N
result=["WA"]*N

if M==0:
  print(0,0)
else:  
  for i in range(M):
    P,S=input().split()
    if S=="AC" and result[int(P)-1]=="WA":
      result[int(P)-1]="AC"
    elif S=="WA" and result[int(P)-1]=="WA":
      penalty[int(P)-1]+=1
    else:
      continue

  print(result.count("AC"),sum(penalty))
n,m = map(int, input().split())
ac=0
wa=0
pp=set()
tmp=0
for i in range(0,m):
    p,s = input().split()
    if p in pp:
        continue
    if s == 'AC':
        pp.add(p)
        ac=ac+1
        wa = wa+tmp
        tmp=0
    tmp = tmp+1 if s == 'WA' else tmp
print(ac, wa)
n,m = map(int,input().split()) 
x=['0']*m 
y=['0']*m 
for i in range(m): 
    x[i],y[i] = map(str,input().split())

num = 0 
pena = 0

lis2=[0]*n 
sw = [0]*n

for i in range(m): 
    if y[i] == 'WA' and sw[int(x[i])-1]== 0: 
        pena += 1 
    else: 
        lis2[int(x[i])-1] = 1 
        sw[int(x[i])-1] = 1

num = sum(lis2)

print(num,pena)
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(str)
k = 0 #カウント数
for i in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = '1'
    else:
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)
N, M = map(int, input().split())
L = [list(map(str, input().split())) for _ in range(M)]
ac_list = []
wrong = 0
accept = 0
for i in range(M):
    if L[i][0] in ac_list:
        pass
    else:
        if L[i][1] == 'AC':
            ac_list.append(L[i][0])
            accept += 1
        else:
            wrong += 1
            
print(accept, wrong)
n, m = input().split()
a = [False] * int(n)
AC = 0
WA = 0
for i in range(int(m)):
  p, s = input().split()
  if(s == "AC" and a[int(p) - 1] == False):
    a[int(p) - 1] = True
    AC += 1
  if(s == "WA" and a[int(p) - 1] == False):
    WA += 1

print(AC, WA)
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

correct = 0
cnt = 0
for v in d.values():
    if "AC" in v:
        correct += 1
        cnt += len(v[:v.index("AC")])
    else:
        cnt += len(v)

print(correct, cnt)
mondaisu , teisyutukaisu = map(int,input().split())

flag = []
penalog = []

for i in range(mondaisu):
  flag.append(0)
  penalog.append(0)



for i in range(teisyutukaisu):
  bango , kekka = input().split()
  bango = int(bango)
  if flag[bango-1] == 1:
    continue
  if kekka == 'WA':
    penalog[bango-1] = penalog[bango-1] + 1
  elif kekka == 'AC':
    flag[bango-1] = 1
  
print(sum(flag),sum(penalog))
number = list(map(int,input().split()))
prob = ['']*number[0]
ac = 0
wa = 0
for i in range(number[1]):
    word = list(map(str,input().split()))
    if word[1] == 'AC':
        prob[int(word[0])-1] += 'A'
    else:
        prob[int(word[0])-1] += 'W'
for j in range(number[0]):
    for k in range(len(prob[j])):
        if prob[j][k] == 'W':
            wa += 1
        else:
            ac += 1
            break
print(ac,wa)
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
wa = 0
ac = 0
flag = 1
wa_flag = 0
ac_flag = 0
for i in range(m):
  if flag != ps[i][0]:
    flag = ps[i][0]
    wa_flag = 0
    ac_flag = 0
  if ps[i][1] == "AC" and ac_flag == 0:
    ac += 1
    wa += wa_flag
    wa_flag = 0
    ac_flag = 1
  if ps[i][1] == "WA":
    wa_flag += 1
print(ac,wa)
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
    if List[pro]=="AC":
        continue
    if s == "WA":
        penalties+=1
        List[pro]=s
    if s == "AC":
        List[pro]=s
        correct+=1
print("%d %d"%(correct,penalties))
n,m=map(int,input().split())
A=[]
P=[]
wa=0
ac=0
for _ in range(m):
    p,s=input().split()
    P.append(int(p))
    A.append(s)

for j in range(n):
    for i in range(m):
        if P[i]==j and  A[i]=="AC":
            ac+=1
            break
        elif P[i]==j:
            wa+=1
print(ac,wa)
N, M = map(int, input().split())
L = []
ac = []
wa = []

for i in range(M):
    pS = list(map(str, input().split()))
    L.append(pS)

for i in range(M):
    if L[i][1] == 'AC':
        ac.append(int(L[i][0]))
    elif L[i][1] == 'WA' and ((int(L[i][0]) not in ac) == True):
        wa.append(int(L[i][0]))

print(len(set(ac)), len(wa))
n, m = map(int, input().split())
cleared = []
ac_counter = 0
wa_counter = 0
for i in range(m):
    flag = False
    p, s = input().split()
    p = int(p)
    for i in range(len(cleared)):
        if cleared[i] == p:
            flag = True
            break
    if not flag:
        if s == 'AC':
            ac_counter += 1
            cleared.append(p)
        else:
            wa_counter += 1
print(' '.join([str(ac_counter), str(wa_counter)]))
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, m = map(int, input().strip().split())
  counts = numpy.zeros(n).astype(numpy.int)
  flags = numpy.zeros(n).astype(numpy.int)
  for _ in range(m):
    p, s = input().strip().split()
    p = int(p)
    if s == 'WA' and flags[p-1] != 1:
      counts[p-1] += 1
    if s == 'AC':
      flags[p-1] = 1
  print(numpy.sum(flags), numpy.sum(counts))

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

p_list = []
s_list = []
for i in range(M):
    p, s = input().split()
    p_list.append(int(p))
    s_list.append(s)

p_state = [0 for i in range(N)]
pena = 0
ans = 0

for i in range(M):
    if p_state[p_list[i]-1] == 0 and s_list[i] == "WA":
        pena += 1
    elif p_state[p_list[i]-1] == 0 and s_list[i] == "AC":
        p_state[p_list[i]-1] = 1
        ans += 1
    else:
        continue

print(ans, pena)
w,*d=[0]*10**6
a={0}
for t in open(0):
  p,s=t.split()
  p=int(p)
  if'AC'==s*(not p in a):w+=d[p];a|={p}
  d[p]+=1
print(len(a)-1,w)
n,m=list(map(int,input().split()))
question_dict_ac={}
question_dict_wa={}
question_list=[]
question_counter=0
answer_counter=m
while answer_counter > 0:
  question_num,result = input().split()
  if result=='AC':
    question_dict_ac[question_num]=[result]
  if result=='WA':
    question_dict_wa[question_num]=[result]
  answer_counter-=1

print (len(question_dict_ac),len(question_dict_wa))
import sys
N,M = map(int,input().split())

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()



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


for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1

#print(AC_list)
cor_count = len(set(AC_list))

print(cor_count,pen_count)
import sys
input = sys.stdin.readline

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

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


for i in range(m):
    if ac[int(p_s[i][0]) - 1] == 1:
        continue
    else:
        if p_s[i][1] == 'WA':
            wa[int(p_s[i][0]) - 1] += 1
        else:
            ac[int(p_s[i][0]) - 1] = 1
print(sum(ac), sum(wa))
N, M = map(int,input().split())
AC = 0
WA = 0
data = [0]*100001
for i in range(M):
    x, y = map(str,input().split())

    if data[int(x)] == 1:
            continue
    if y == 'WA':
        WA += 1
    else:
        AC += 1
        data[int(x)] = 1
print(AC,WA)
N,M = map(int,raw_input().split())

ans = 0
pen = 0
ans_done = []
for i in range(M):
  p,S = raw_input().split()
  if p in ans_done:
    continue
  if S == "WA":
    pen = pen + 1
  else:
    ans = ans + 1
    ans_done.append(p)
print ans,pen
N,M = map(int,input().split())
pro = [0 for i in range(N+1)]
ac,wa = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        if pro[p] != -1:
            ac += 1
            wa += pro[p]
            pro[p] = -1
    else:
        pro[p] += 1
print(ac,wa)
n, m = map(int, input().split())

solved = [0]* 10**5
penalty_sum = 0
penalty = 0

for _ in range(m):
    q, result = input().split()
    q = int(q)
    
    if result == 'AC':
        if solved[q] == 0:
            penalty_sum += penalty
            penalty = 0
    else:
        if solved[q] == 0:
            penalty += 1

print(str(sum(solved)) + " " + str(penalty_sum))
N, M = list(map(int, input().split()))
P = [0] * M
S = [0] * M

WA = [0] * (N+1)
AC = [0] * (N+1)

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

for i in range(N):
    if AC[i] == 0:
        WA[i] = 0

print(sum(AC),end=' ')
print(sum(WA))
from itertools import groupby


n, m = map(int, input().split())
WA = [0] * (n + 1)
AC = [False] * (n + 1)
wanum = 0
acnum = 0
for i in range(m):
    p, s = input().split()
    if AC[int(p)]:
        continue
    if s == 'AC':
        acnum += 1
        wanum += WA[int(p)]
    elif s == 'WA':
        WA[int(p)] += 1
print(acnum, wanum)
n, m = map(int, input().split())
wa = [0] * (n+1)
ac = [0] * (n+1)

for _ in range(m):
    p, s = input().split()
    if (not ac[int(p)]) and s == 'WA':
        wa[int(p)] += 1
    elif s == 'AC':
        ac[int(p)] = 1
print(sum(ac), sum(wa))
n,m = map(int, input().split()) 

pena=[0]*(n+1)
seitou=[0]*(n+1)

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

pena_kazu=0

for i in range(n):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))
#151c
n,w=map(int,input().split())
ac=0
wa=0
wa_cnt=0
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa+=wa_cnt
		else:
			wa_cnt+=1
print(ac,wa)
question_num, my_submit = list(map(int, input().split(' ')))
sub_list = ['']*my_submit

for i in range(my_submit):
    sub_list[i] = input().split(' ')

question_results = ['hoge'] + [False]*question_num
ac = 0
wa = 0

for j in sub_list:
    if question_results[int(j[0])] == False:
        if j[1] == 'AC':
            question_results[int(j[0])] = True
            ac += 1
        elif j[1] == 'WA':
            wa += 1
    
print(ac, 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(flag.count(1), ans)
N, M = map(int, input().split())
dic = {}
dic2 = {}

for i in range(M):
    p, S = input().split()
    p = int(p)
    if dic.get(p) == None:
        dic[p] = S
        dic2[p] = 1
    elif dic[p] == 'WA':
        dic[p] = S
        dic2[p] += 1
    else:
        pass

# print(dic, dic2)

AC = list(dic.values()).count("AC")
submit_count = sum(list(dic2.values())) - AC
print(AC, submit_count)
n,m=map(int,input().split())
lst=[list(input().split()) for _ in range(m)]
pena_lst=[0]*n
acn_lst=[0]*n

for p,s in lst:
    p=int(p)-1
    if acn_lst[p]==1:
        continue
    if s =="AC":
        acn_lst[p]=1
    else: pena_lst[p]+=1
pena=0
acn=0
for i in range(n):
    acn+=acn_lst[i]
    if acn_lst[i]==1:
        pena+=pena_lst[i]
print(pena,acn)
n,m=map(int,input().split())
a=[0]*n
wa=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA" and a[p-1]==0:
        wa+=1
    elif s=="AC" and a[p-1]==0:
        a[p-1]+=1
print(a.count(1),wa)
n, m = map(int, input().split())
p = [0]*n
ac = [0]*n

for i in range(m):
  a, b = input().split()
  a = int(a)-1
  
  if ac[a]==0:
    if b=="WA":
      p[a]+=1
    else:
      ac[a]=1
print(ac.count(1), sum(p))