peterverebics/CodeNet_Python_118 huggingface dataset:
N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N

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

    if S == "AC":
        AC[p-1] = 1
    elif S == "WA":
        if not AC[p-1]:
            WA[p-1] = 1

for j in range(N):
    if AC[j]==0:
        WA[j]==0
            
print(sum(AC), sum(WA))
n,m = map(int, input().split())
b = [0]*(n+1)
AC,WA = 0,0
for _ in range(m):
    p,s = map(str, input().split())
    if b[int(p)] == 0:
        if s == "AC":
            AC += 1
            b[int(p)] = 1
        else:
            WA += 1
print(AC,WA)
n,m = map(int,input().split())
ac, wa=[], {}
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac):
    if p not in wa.keys(): wa[p]=1
    else: wa[p]+=1
penalty = sum(wa.values())
clear = len(ac)
print('%d %d'%(clear,penalty))
n, m = map(int, input().split())
correct = 0
penal = 0
d = {i: set() for i in range(1,n+1)}
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        if not s in d[int(p)]:
            correct += 1
    else:
        if not 'AC' in d[int(p)]:
            penal += 1
    d[int(p)].add(s)
print(correct, penal)
n,m=map(int,input().split())
list=[]
seikai=0
sum=0
for i in range(m):
  p,s=input().split()
  if p not in list:
    if s=='AC':
      list.append(p)
      seikai=seikai+1
    elif s=='WA':
      sum=sum+1
print(seikai,sum)
N,M=map(int,input().split())
AC=WA=[0] * (N + 1)
cnt_AC=cnt_WA=0

for i in range(M):
  p,s=input().split()
  p=int(p)
  if AC[p]==0:
    if s=='WA':
      cnt_WA+=1
    if s=='AC':
      AC[p]=1
cnt_AC=sum(AC)
print(cnt_AC,cnt_WA)
import numpy as np

N,M = map(int,input().split())
P = np.zeros(M, dtype=int)
S = np.zeros(M, dtype=int)
for i in range(M):
    p,s = map(str,input().split())
    P[i] = int(p)
    if s == 'AC':
        S[i] = 1
    
cOK = 0
cNG = 0
aP = np.argsort(P)
P = P[aP]
S = S[aP]
i = 0
while i<M:
    Q = list(S[P==P[i]])
    if 1 in Q:
        cOK += 1
        cNG += Q.index(1)
    i += len(Q)

print(cOK, cNG)
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x] and not wa[x]:
    wa[x]=1
    pen+=1
print(sum(l),pen)
N,M = map(int,input().split())
P = []
S = []
total = []


for i in range(M):
    a,b = map(str,input().split())
    P.append(a)
    S.append(b)
ok = 0
pena = 0

for (i,j) in zip(P,S):
    if not i in total:
        if j=='WA':
            pena+=1
        elif j=='AC':
            ok+=1
            total.append(i)
print(str(ok)+' '+str(pena))
N, M = map(int, input().split())
PS = [input().split() for _ in range(M)]

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

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        pena += 1
    elif s == "AC":
        ans += 1
        AC[p] = True


print(ans, pena, sep=' ')
import numpy as np
def LI():
  return [int(s) for s in input().split()]

correct_answers = []
warning_count = 0
import numpy
N,M = LI()

correct_answers = np.zeros(N,dtype = 'int')

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = True if correct_answers[p_num-1] == 1 else False
  
  if answer == 'AC' and not include_answers:
    correct_answers[p_num-1] = 1
  elif answer == 'WA' and not include_answers:
    warning_count+=1
    
print(sum(correct_answers),warning_count)
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':
        ac+=1
        wa+=waf[x-1]
        acf[x-1]+=1
    else:
        waf[x-1]+=1
print(ac,wa)
n, m = map(int, input().strip().split())

num = [0]*n
nn = []
WA = 0
AC = 0

for i in range(m):
  text = input().strip().split()
  p = int(text[0])
  s = text[1]
  
  if p not in nn:
    if s == 'AC':
      AC += 1
      nn.append(p)
    elif s == 'WA':
      num[p-1] += 1
      
for i in range(len(nn)):
    WA += num[i-1]
    
print(AC, WA)
N, M = map(int, input().split())
pS = []
for _ in range(M):
    pS.append(input().split())

current = 0
penalty = 0
state = [False] * (N+1)
for i in pS:
    if i[1] == "WA" and (not state[int(i[0])]):
        penalty += 1
    elif i[1] == "AC" and (not state[int(i[0])]):
        current += 1
        state[int(i[0])] = True
print(current, penalty)
n, m = [int(x) for x in input().split()]
lst = [None]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and lst[p] is None:
    a += 1
    lst[p] = True
  elif s == 'WA' and lst[p] is None:
    b += 1
print(a,b)
N, M = map(int, input().split())
pSs = [list(map(str, input().split())) for _ in range(M)]

#%%

ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

print(sum(ACs), sum(WAs))
n,m = map(int,input().split())
li = []
for _ in range(m):
    li.append(list(input().split()))
li.sort(key=lambda x:x[0])
already = False
cnt_ans = 0
cnt_penalty = 0
prev = 0
checked = []
for p,s in li:
    if p in checked:
        continue
    else:
        prev = p
        if s == "WA":
            cnt_penalty += 1
        else:
            cnt_ans += 1
            checked.append(p)
print(cnt_ans,cnt_penalty)
n,m = map(int, input().split())

arS = [0] * 100000
#arP = [0] * 100000

score = 0
penalty = 0
for i in range(m):
	id, res = input().split()
	id = int(id)
	if res == "AT" and arS[id]==0:
		arS[id] = 1
		score = score+1
	if res =="WA": 
#		arP[id] = arP[id] + 1
		penalty = penalty + 1
print(score, penalty)
def main():
    N, M = map(int, input().split(" "))
    ac = 0
    wa = 0
    accpted = []
    for _ in range(M):
        ps = input().split(" ")
        if ps[0] not in accpted:
            if ps[1] == "AC":
                ac += 1
                accpted.append(ps[0])
            else:
                wa += 1
    print(ac, wa)


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
    tmp = input().split()
    P.append(int(tmp[0]))
    S.append(tmp[1])

point = 0
pena = 0
ind = 0

for p in set(P):
    isAC = False
    for i in range(P.count(p)):
        if S[ind] == "AC" and isAC == False:
            isAC = True
            point += 1
        if S[ind] == "WA" and isAC == False:
            pena += 1
        ind += 1

print(point, pena)
N, M = map(int, input().split())
AC = set()
WA = set()
for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    S = S == 'AC'
    if S:
        AC.add(p)
    else:
        WA.add(p)
print(len(AC), len(AC & WA))
N, M = map(int, input().split())
p = []
S = []
for _ in range(M):
    n, s = input().split()
    p.append(int(n))
    S.append(s)

wa = 0
ac = 0
ac_list = []
for i, s in enumerate(S):
    if p[i] not in ac_list:
        if s == "WA":
                wa += 1
        else:
                ac += 1
                ac_list.append(p[i])

print(ac, wa)
N, M = [int(item) for item in input().split()]
ans_list = [input().split() for _ in range(M)]
# print(ans_list)

res_ac = 0
ans_stack = []
wa_stack = []

for q, ans in ans_list:
    print(q, ans)
    if ans == 'AC':
        if q not in ans_stack:
            res_ac += 1
        ans_stack.append(q)
    else:
        if q not in ans_stack:
            wa_stack.append(q)

res_list = []
for i in wa_stack:
    if i in ans_stack:
        res_list.append(i)


print(res_ac, len(res_list))
N, M = map(int, input().split())

AC = [False for _ in range(N)]

n_AC = 0
n_WA = 0

for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if not AC[p]:
        if S == "AC":
            AC[p] = True
            n_AC += 1
        elif S == "WA":
            n_WA += 1
        else:
            raise ValueError

print(n_AC, n_WA)
hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = [0] * nm[0]
wa = [0] * nm[0]

for i in range(nm[1]):
    if hist[i][1] == "AC":
        if ac[hist[i][0]-1] != 1:
            ac[hist[i][0]-1] = 1
    else:
        if ac[hist[i][0]-1] != 1:
            wa[hist[i][0]-1] = wa[hist[i][0]-1] + 1

print(sum(ac), sum(wa))
n, m = map(int, input().split())
N = [0]*n
ac = 0
wa = 0
wa_ = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p)
  if N[p-1]==0:
    if s=='WA':
      wa_+=1
    elif s=='AC':
      ac+=1
      N[p-1]=1
      wa+=wa_
      wa_=0
print(ac, wa)
n,m = map(int,input().split())
pn = [0] * n
aw = [0] * n

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

print ("%d %d" % (sum(aw),sum(pn)))
N,M=map(int,input().split())
p=[list(input().split()) for _ in range(M)]
AC_count=0
WA_count=0
AC_flag=0
if M==0:
  print(0,0)
  exit()
if p[0][1]=="WA" and AC_flag==0:
  WA_count+=1
else:
  AC_count+=1
  AC_flag=1

for i in range(1,M):
  if p[i-1][0]!=p[i][0]:
    AC_flag=0
  if p[i][1]=="WA" and AC_flag==0:
    WA_count+=1
  elif p[i][1]=="AC" and AC_flag==0:
    AC_count+=1
    AC_flag=1
print(AC_count,WA_count)
n,m=map(int,input().split())

dict = {}
for i in range(m):
    p,s=input().split()
    dict.setdefault(p,[]).append(s)

ac_count=0
wa_count=0
for p,s in dict.items():
    for ans in s:
        if ans=='AC':
            ac_count+=1
            is_ac=True
            break
        else:
            wa_count+=1
print(ac_count, wa_count)
import collections
import sys
N,M = map(int,input().split())
P = []
S = []
for i in range(M):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)
if M == 0:
    print(0,0)
    sys.exit()
c = collections.Counter(P)
values, counts = zip(*c.most_common())
result = [0]*len(values)
penalty = 0
d  = dict(zip(values,result))
for i in range(M):
    if S[i] == 'WA' and d[P[i]] == 0:
        penalty += 1
    elif S[i] == 'AC':
        d[P[i]] = 1
sum = 0
for i in values:
    sum += d[i]

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

result = {}
c_cnt = 0
w_cnt = 0
for i in range(m):
    p, s = input().split()
    if (p in result):
        continue
        
    if (s == 'AC'):
        result[p] = 1
        c_cnt = c_cnt + 1
    else:
        w_cnt = w_cnt + 1

print('{} {}'.format(c_cnt, w_cnt))
N, M = map(int, input().split())
AC = []
ans = []
for i in range(M):
    p, S = list(input().split())
    if S == "AC" and p not in AC:
        AC.append(p)
    elif p not in AC:
        ans.append(p)
print(len(AC), len(ans))
n,m=map(int,input().split())
TF=[0]*n
p=[0]*n
for _ in range(m):
    i,s =map(str,input().split())
    i=int(i)-1
    if (s=="WA") and TF[i]==0:
        p[i]+=1
    elif (s=="WA")and TF[i]==1:
        pass
    elif s=="AC" and TF[i]==0:
        TF[i]=1
    else:
        pass
ac=sum(TF)
pe=sum(p)
print(ac,pe)
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=input().split()
    if S=="WA" and already.count(P)==0:
        wa=wa+1
    if S=="AC" and already.count(P)==0:
        ac=ac+1
        already.append(P)
    else:
        pass
if ac==0:
    print(0,0)
else:
    print(ac,wa)
N,M = map(int,input().split())

Check_AC = [0]*N
WA_Counter = 0

for i in range(M):
    pi,Si = input().split()
    pi = int(pi)
    # まだ正解していない問題
    if Check_AC[pi-1] == 0:
        if Si == "AC":
            Check_AC[pi-1] = 1
        else:
            WA_Counter += 1
    
print(str(sum(Check_AC)) + " " + str(WA_Counter))
N, M = map(int, input().split())
S = [[i for i in input().split()] for _ in range(M)]

if M > 0:
    wa = [0] * N
    ac = set()
    ans = [0, 0]
    for s in S:
        if s[1] == "AC":
            ac.add(int(s[0])-1)
        elif s[1] == "WA" and int(s[0])-1 not in ac:
            wa[int(s[0])-1] += 1
    print(len(ac), sum(wa))
else:
    print(0, 0)
N, M = map(int, input().split())

isACs = [0] * N
numPenalty = 0
for _ in range(M):
    p, res = input().split()
    p = int(p) - 1
    if res == 'AC':
        isACs[p] = 1
    else:
        if not isACs[p]:
            numPenalty += 1

numAC = sum(isACs)
print(numAC, numPenalty)
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
ac=0
tmp=0
for j in range(M):
  if A[j][0]>tmp:
    if A[j][1]=='WA':
      wa+=1
    else:
      ac+=1
      tmp=A[j][0]
print(ac,wa)
n,m = list(map(int, input().split()))
wa_cnt = 0
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa_cnt += 1
print(len(ac), wa_cnt)
n,m = map(int,input().split())
ac_dir = {}
wa_dir = {}

for _ in range(m):
    p, s = input().split()
    if s == 'AC' and p not in ac_dir:
        ac_dir[p] = 1
    
    elif s == 'WA' and p not in wa_dir and p not in ac_dir:
        wa_dir[p] = 1
    
    elif s == 'WA' and p in wa_dir and p not in ac_dir:
        wa_dir[p] += 1

print(sum(ac_dir.values()), sum(wa_dir.values()))
n,m=map(int,input().split())

l=[]
t=""
w=0
ww=0
a=0
for i in range(m):
    p,s=input().split()
    if(p in l):continue
    if(s=="WA"):
        w+=1
        ww+=1
    if(s=="AC"):
        ww=0
        a+=1
        l.append(p)
print(a,w-ww)
n, m = map(int, input().split())
ans_ac = 0
ans_wa = 0
lst = []
for i in range(m):
  p, s = input().split()
  if p in lst:
    continue
  if s == 'WA':
    ans_wa += 1
  else:
    ans_ac += 1
    lst.append(p)
print(ans_ac, ans_wa)
# -*- coding: utf-8 -*-
import sys

N,M = map( int, input().split() )
list_str_P_S = [input().split() for i in range(M)]
#-----

count_AC=0
count_WA=0
check_question_no=[]

for L in list_str_P_S:
  str_number = L[0]
  result = L[1]
  
  if ( str_number in check_question_no ):
    continue
  else:
    if result == "WA":
      count_WA += 1
    elif result == "AC":
      count_AC += 1
      check_question_no.append(str_number)
      
print(count_AC,count_WA)
n,m = map(int,input().split())

l=list(input().split() for _ in range(m))

q=[0]*n

w=0
a=0

for i in l:
    if q[int(i[0])-1]==0:
        if i[1]=="WA":
            w+=1
        elif i[1]=="AC":
            a+=1
            q[int(i[0])-1]+=1

print(a,w)
n,m = map(int,input().split())
action = [list(input().split()) for _ in range(m)]
answer_dict = {}
score = 0
penalty = 0

for a in action:
    if a[1] == 'WA' and a[0] not in answer_dict:
        penalty += 1
    elif a[1] == 'AC' and a[0] not in  answer_dict:
        score += 1
        answer_dict[a[0]] = True


print(score,penalty)
#N=int(input())
#N,M=map(int, input().split())
#L=list(map(int, input().split()))
N,M=map(int, input().split())
ifacL=[0]*N
psL=[]
AC=0
WA=0
for _ in range(M):
  psL.append(list(map(str, input().split())))

for i in range(M):
  if ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="WA":
    WA+=1
  elif ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="AC":
    AC+=1
    ifacL[int(psL[i][0])-1]=1

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

solved = [False] * n
ac_cnt = 0
wa_cnt = 0

for i in range(m):
    cn, cj = int(a[i][0]) - 1, a[i][1]
    if not solved[cn]:
        if cj == 'WA':
            wa_cnt += 1
        else:
            ac_cnt += 1
            solved[cn] = True
print(ac_cnt, wa_cnt)
N,M = map(int,input().split())
arr = []
pre_idx = '-1'
pre_s = 'start'
cnt = 0
errors = 0
ans = 0
for i in range(M):
  idx,s = input().split()
  arr.append([int(idx),s])
  
arr = sorted(arr)

flag = False
for idx,s in arr:
  if pre_idx != idx:
    cnt = 0
    flag = False
  if flag:
    continue
  else:
    if s=='WA':
      cnt += 1
    else:
      errors += cnt
      ans += 1
      flag = True
  pre_idx = idx
  pre_s = s
    
print(ans,errors)
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
P, S = [], []
for s in inputs[1:]:
    x, y = s.split()
    P.append(int(x)-1)
    S.append(y)

num_ac = num_wa = 0
acs = [0]*n
for p, s in zip(P, S):
    if acs[p]:
        continue
    if s == 'WA':
        num_wa += 1
    else:
        acs[p] = 1
        num_ac += 1
        
print(*[num_ac, num_wa])
n,m=map(int,input().split())
a=[0]*(n+1)
b=[0]*(n+1)
for i in range(m):
  p,s=input().split()
  p=int(p)
  if a[p]==0:
      if s=="AC":
        a[p]=1
      else:
        b[p]+=1
for i in range(n):
    if a[i]==0:
        b[i]==0
print(sum(a),sum(b))
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 == 'WA' and wa[p] == 0:
        wa[p] += 1
print(ac.count(1), wa.count(1))
import numpy as np

N,M=map(int,input().split())
ac=np.array([0]*N)
wa=np.array([0]*N)

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

cal=sum(ac)
ans=sum(ac*wa)
N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
WA=sum(list_WA)
AC=sum(list_Flag)
print(AC,WA)
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
a = []
for i in range(m):
    a.append([str(i) for i in input().split()])

ac = []
ans2 = 0
for i in range(m):
    if a[i][1] == "AC":
        ac.append(a[i][0])
    if a[i][1] == "WA" and not(a[i][0] in ac):
        ans2 += 1
ans1 = len(set(ac))

print(ans1,end = " ")
print(ans2)
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac_cnt, wa_cnt = 0, 0
n_and_ac = {}
for n in range(N):
  n_and_ac[str(n + 1)] = 0
for ps in PS:
  if ps[1] == "AC" and n_and_ac[ps[0]] == 0:  
    n_and_ac[ps[0]] += 1
    ac_cnt += 1
  if ps[1] == "WA" and n_and_ac[ps[0]] == 0:
    wa_cnt += 1
print(str(ac_cnt) + " " + str(wa_cnt))
N, M = map(int, input().split())
AC = [0]*N
WA = [0]*N

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

    if S == "AC":
        AC[p-1] = 1
    elif S == "WA":
        if not AC[p-1]:
            WA[p-1] = 1

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

print(sum(AC), sum(WA))
n, m = map(int, input().split())
P, S = [], []
for _ in range(m):
    p, s = input().split()
    P.append(int(p))
    S.append(s)
ac = {}
wa = {}

for p, s in zip(P, S):
    if s == 'AC':
        ac.setdefault(p, 1)
    else:
        wa.setdefault(p, 0)
        if wa[p] == 0:
            wa[p] += 1
        
n_ac = 0
n_wa = 0

for i in ac.values():
    n_ac += i

for i in wa.values():
    n_wa += i

print(n_ac,n_wa)
N, M = map(int, input().split())
 
if M == 0:
    print(0,0)
    exit()
 
false_count = 0
ans = 0
 
p, s = input().split()
now = int(p)
if s == "WA":
    false_count += 1
elif s == "AC":
    ans += 1
    now += 1
 
for i in range(M-1):
    p, s = input().split()
    if int(p) > now:
        now = int(p)
    if int(p) == now:
        if s == "WA":
            false_count += 1
        elif s == "AC":
            ans += 1
            now += 1
 
print(ans, false_count)
from operator import itemgetter

n, m = map(int, input().split())
X = []

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


for _ in range(m):
    x, y = input().split()
    X += [(int(x), y)]

# X = sorted(X, key=itemgetter(0))

for (x, y) in X:
    if ac[x] == 0:
        if y == 'AC':
            ac[x] = 1
        if y == 'WA':
            wa[x] += 1
    print(x, y, sum(ac), sum(wa))


print(sum(ac), sum(wa))
N, M = [int(x) for x in input().split(" ")]

subms = [input().split(" ") for i in range(M)]

setto = set()
penalties = 0 
correct = 0 
for sub in subms:
    sub[0] = int(sub[0])
    if sub[0] not in setto and sub[0] <= N:
        if sub[1] == "WA":
            penalties += 1
        if sub[1] == "AC":
            correct += 1
            setto.add(sub[0])

print(correct, penalties)
N,M = map(int,input().split())
X = [[str(i) for i in input().split()] for i in range(M)]
a=[]
count_ac = 0
count_wa = 0
for i in range(M):
    if X[i][0] in a:
        continue
    if X[i][1] == 'AC':
        a.append(X[i][0])
        count_ac += 1
    else:
        count_wa += 1
print(count_ac,count_wa)
n,m = map(int,input().split())
prbs = [ [0] for _ in range(1,n+1)]
#print(prbs)
for _ in range(m):
    i,j = map(str,input().split())
    i = int(i)
    i -= 1
    if prbs[i][-1] != "AC":
        prbs[i].append(j)
pen = 0
for i in range(n):
    pen += prbs[i].count("WA")
ans = 0
for i in range(n):
    ans += prbs[i].count("AC")
#print(prbs)
print(ans,pen)
#!/usr/bin/env python3
def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [0] * (N + 1)
    for p, S in pS:
        p = int(p)
        if S == 'AC':
            ac[p] = 1
        if ac[p]:
            continue
        score[p] += 1
    print(sum(ac), sum(score))
    # print(score)


if __name__ == '__main__':
    main()
from collections import defaultdict
N,M = map(int,input().split())
AC_List = defaultdict(int)
WA_List = defaultdict(int)

for i in range(M):
    Num,Sta = map(str,input().split())
    if Num in AC_List:
        continue
    else:
        if Sta == "WA":
            WA_List[Num] += 1
        else:
            AC_List[Num] += 1

print(str(len(AC_List))+" " +str(sum(WA_List.values())))
N, M = map(int, input().split())
PS = [list(input().split()) for _ in range(M)]

C = [0 for _ in range(N + 1)]

cnt = 0
ans = 0
for p, s in PS:
    if C[int(p)] == 0:
        if s == "WA":
            cnt += 1
        else:
            C[int(p)] += 1
            ans += 1


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

ac = 0
wa = 0

temp = -1
is_ac = False
temp_wa = 0
for i in range(M):
  s = input().split()
  no = int(s[0])
  result = s[1]

  if temp != no:
    temp = no
    temp_wa = 0
    is_ac = False
  
  if (not is_ac) and result == 'AC':
    is_ac = True
    ac += 1
    wa += temp_wa
  elif (not is_ac) and result == 'WA':
    temp_wa += 1

print(str(ac) + " " +  str(wa))
n, m = map(int, input().split())
wa = [0]*(n+1)
ac = [False]*(n+1)
for i in range(m):
    p, s = input().split()
    p = int(p)
    if ac[p]:
        continue
    if s == 'WA':
        wa[p] += 1
    elif s == 'AC':
        ac[p] = 1
print(sum(ac[1:]), sum(wa[1:]))
n, m = [int(s) for s in input().split()]
a = [0 for _ in range(n)]
for i in range(m):
  p, res = input().split()
  p = int(p) - 1
  if a[p]%2==0:
  	a[p] += 2 if res=='WA' else 1
  
print(sum([tmp%2 for tmp in a]), sum([tmp//2 for tmp in a]))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)

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

ac_set = set()
wa_count = 0

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

    #  ACだった時の処理
    if s == 'AC':
        ac_set.add(p)
    elif s == 'WA':
        if s not in ac_set:
            wa_count += 1
    else:
        pass

ac_count = len(ac_set)

print('{} {}'.format(ac_count, wa_count))
n,m = map(int,input().split())
p,s = ["0"]*m,["WJ"]*m
for i in range(0,m):
    p[i],s[i] = input().split()
p = [int(s) for s in p]
PN_count = [0]*(n)
AC_count = [0]*(n)
for i in range(len(s)):
    if(s[i] == "AC"):
        AC_count[p[i]-1] = 1
    else:
        if(AC_count[p[i]-1] != 1):
            PN_count[p[i]-1] += 1
print(sum(AC_count),sum(PN_count))
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=[]

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

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

print(ac,pn)
n,m = map(int,input().split())

x = [0]*n #correct = 1
y = [0]*n #penalty

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if x[p-1] == 0:
        if s == "WA":
            y[p-1] += 1
        else:
            x[p-1] = 1
    elif x[p-1] == 1:
        if s == "AC":
            pass
        elif s == "WA":
            pass

ans1 = sum(x)
ans2 = sum(y)

print(ans1,ans2)