peterverebics/CodeNet_Python_118 huggingface dataset:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  N, M = map(int, input().split())
  acs = [0] * N
  was = [0] * N

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

    if s == 'AC':
      acs[p] = 1
    elif acs[p] == 0:
      was[p] += 1

  s = 0
  p = 0

  for a, w in zip(acs, was):
    if a == 0:
      continue

    s += 1
    p += w

  print(s, p)


if __name__ == '__main__':
  main()
n,m = map(int, input().split())
lst = [[] for i in range(m)]
for i in range(m):
    pi,si = map(str, input().split())
    lst[i] = (int(pi),si)

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

for i in lst:
    if status[i[0]-1]!="AC" and i[1]=="AC":
        ac += 1
        wa += status[i[0]-1]
        status[i[0]-1] = "AC"
    elif status[i[0]-1]!="AC" and i[1]=="WA":
        status[i[0]-1] += 1

print(ac,wa)
N,M=map(int,input().split())
A=0
PE=0
PRO=[[] for i in range(N)]
for i in range(M):
  P,S=input().split()
  P=int(P)-1
  PRO[P].append(S)
#print(PRO)
for i in range(N):
  tmp=0
  for j in range(len(PRO[i])):
    flag=False
    if PRO[i][j]=='AC':
      A+=1
      flag=True
    if PRO[i][j]=='WA':
      tmp+=1
    if flag:
      PE+=tmp
      break
print(A,PE)
n,m=input().split()
n=int(n)
m=int(m)
f=[0]*n
wa=[0]*n
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if f[p]==1:
        continue
    if s=="WA":
        wa[p]+=1
    else:
        ac+=1
        f[p]=1
x=0
for i in range(n):
    if f[i]==1:
        x+=wa[i]
print(ac,x)
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])
c = [0] * (n + 1)
w = [0] * (n + 1)
for i in range(m):
  if c[p[i]] == 0 and s[i] == 'AC':
    c[p[i]] = 1
  elif c[p[i]] == 0 and s[i] == 'WA':
    w[p[i]] = w[p[i]] + 1
    
for i in range(1, n+1):
  if c[i] == 0:
    w[i] = 0
print(sum(c), sum(w))
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n
for i in range(m):
  p,s=map(str,input().split())
  if ac[int(p)-1]==0:
    if s=="AC":
      ac[int(p)-1]=ac[int(p)-1]+1
    else:
      wa[int(p)-1]=wa[int(p)-1]+1
for i in range(n):
  if ac[i]==0:
    wa[i]=0
print(sum(ac),sum(wa))
n,m = map(int, input().split())
p = [0] * m
s = [0] * m
for i in range(m):
     p[i],s[i] = map(str,input().split())

lisa = [0] * n
lisw = [0] * n
for i in range(m):
     if lisa[int(p[i])-1] == 0:
          if s[i] == 'WA':
               lisw[int(p[i]) - 1] += 1
          else:
               lisa[int(p[i])-1] = 1
num = 0
for i in range(n):
     if lisa[i] == 1:
          num += lisw[i]



print(sum(lisa),num)
N,M=map(int,input().split())

ps_dic={}
for i in range(M):
  pi,si=input().split()
  if pi not in ps_dic:
    ps_dic[pi]=[si]
  else:
    ps_dic[pi].append(si)
  
#print(ps_dic)
total_ac=0
total_wa=0
for p in ps_dic:
  num_wa=0
  for s in ps_dic[p]:
    if s == "WA":
      num_wa+=1
    elif s == "AC":
      total_ac+=1
      total_wa+=num_wa
      break

print(str(total_ac) + " " + str(total_wa))
n, m = map(int, input().split())
ACc = [0 for i in range(n)]
WAc = [0 for i in range(n)]

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if ACc[p - 1] == 0:
            ACc[p - 1] += 1
    else:
        if ACc[p - 1] != 1:
            WAc[p - 1] += 1
for j in range(n):
    if ACc[j] == 0:
        WAc[j] = 0

print(sum(ACc), sum(WAc))
n,m = map(int,input().split())
L = [0]*n
penalty = [0]*n
ans = 0
out = 0
for i in range(m):
  p,q = input().split()
  if q == 'AC':
    if L[int(p)-1] == 0:
      L[int(p)-1] = 1
      ans += 1
  else:
    if L[int(p)-1] == 0:
      penalty[int(p)-1] += 1
for i in range(n):
  if L[i] == 1:
    out += penalty[i]
print(ans,out)
#python3
from collections import defaultdict
n,m = map(int, input().split())
a = []
dic = defaultdict(list)
for _ in range(m):
  x,y = map(str, input().split())
  dic[int(x)].append(y)

acc=0
for j in dic.values():
  if 'AC' in j:
    acc+=1;


cnt=0
for li in dic.values():
  if 'AC' in li:
    for j in li:
      if j == 'AC':
        break
      cnt+=1

ans = str(acc) + ' ' + str(cnt)
print(ans)
N,M = map(int,input().split())
ac,wa = 0,0
was = [0]*(N+1)
acs = [0]*(N+1)
for i in range(M):
    p,S = input().split()
    p = int(p)
    if S=="AC":
        if acs[p]==0:
            ac+=1
            wa+=was[p]
            acs[p]=1
    else:
        was[p] += 1
print(ac,wa)
N,M = (int(x) for x in input().split())
cor = 0
mis = 0
numList = [0] * N
misList = [0] * N

for _ in range(M):
    num,ans = input().split()

    if ans == 'WA':
        misList[int(num)-1] += 1
    else:
        if numList[int(num)-1] == 0:
            mis += misList[int(num)-1]
            cor += 1
            numList[int(num)-1] = 1

print(cor,mis)
N,M = map(int,input().split())
wa_list= [0]*(N+2)
ac_list=[-1]*(N+2)
for i in range(M):
  p,a = map(str,input().split())
  p = int(p)
  if a =='WA':
    wa_list[p]+=1
  if a =='AC' and ac_list[p] == -1:
    ac_list[p]+=(wa_list[p]+1)
count = 0;count2 = 0
for i in ac_list:
  if i>=0:
    count+=1
    count2+=i
print(count,count2)
n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
i = 0
sumac = 0
sumwa = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and ac[p - 1] == 0:
        wa[p - 1] += 1
    elif s == "AC" and ac[p - 1] == 0:
        ac[p - 1] += 1
        sumac += 1
        sumwa += wa[p - 1]

print(str(sumac) + " " + str(sumwa))
n,m = map(int,input().split())
a = [0]*n
AC,WA=0,0
for i in range(m):
    x,y = input().split()
    x = int(x)
    if a[x-1]!=-1 and y=="WA":
        a[x-1]+=1
    if a[x-1]!=-1 and y=="AC":
        WA+=a[x-1]
        AC+=1
        a[x-1]=-1
print(AC,WA)
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):
        ans[P]=[S]
    else:
        ans[P].append(S)

for i in ans.values():
    tmp=0
    for value in i:
        if(value=='AC'):
            AC+=1
            WA+=tmp
            break
        else:
            tmp+=1
print(AC,WA)
def main():
    k, n = map(int, input().split())
    dp = [0] * (k+1)
    dq = [0] * (k+1)
    pen = 0
    for i in range(n):
        p,q = input().split()
        p = int(p)
        if dp[p] == 0:
            if q == 'WA':
                dq[p] += 1
            elif q == 'AC':
                dp[p] = 1
                pen += dq[p]
    print(sum(dp), pen)

if __name__ == '__main__':
    main()
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]

ac = 0
wa = [0 for i in range(N)]
ansed = set()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed.add(psn[0])
    else:
        if psn[0] not in ansed:
            wa[int(psn[0])-1] += 1
for i in range(N):
    if str(i+1) not in ansed:
        wa[i] = 0

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

for _ in range(M):
    p,S = input().split()
    p = int(p)-1
    if not AC[p]:
        if S == 'AC':
            AC[p] = 1
        else:
            WA[p] += 1
    else:
        continue
WAcount = 0
for i in range(N):
    if AC[i]:
        WAcount += WA[i]
print(sum(AC),WAcount)
n,m = list(map(int, input().split()))

problems = [0]*n
accurate = 0
penalty = 0

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

    if s == "AC" and problems[p-1] != -1:
         #初めて正解
         penalty += problems[p-1]
         accurate += 1
         problems[p-1] = -1
    elif s == "WA" and problems[p-1] != -1:
        #正解してない問題を不正解
        problems[p-1] += 1

print(accurate,penalty)
import numpy as np
N, M = map(int,input().split())
ansAC = 0
ansWA = 0
zeros = np.zeros(N)
is_solved = set()
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if S == "WA":
        if p-1 not in is_solved:
            zeros[p-1] += 1
    else:
        is_solved.add(p-1)
ansAC = len(is_solved)
ansWA = int(sum(zeros[list(is_solved)]))
print(ansAC, ansWA)
n, m = map(int, input().split())
p, s = [], []
pslist = []
for i in range(m):
  row = list(input().split( ))
  pslist.append(row)
aclist = [0] * n
walist = [0] * n
for j, k in pslist:
  j = int(j)
  if k == 'AC':
    if aclist[j - 1] == 0:
      aclist[j - 1] = 1
  if k == 'WA':
    if aclist[j - 1] == 0:
      walist[j - 1] += 1
wacountlist = [x * y for (x, y) in zip(aclist, walist)]
print(sum(aclist), sum(wacountlist))
n, m = map(int, input().split())
AC = [0] * n
WA = [0] * n
w = 0

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

print(sum(AC), w)
N,M=map(int,input().split())
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
    p,S=input().split()
    p=int(p)
    if S=='WA' and AC[p]==0:
        WA[p]+=1
    if S=='AC' and AC[p]==0:
        AC[p]+=1
        
#結局正解できなかった場合はWA=0になる
for j in range(N+1):
    WA[j] = WA[j]*AC[j]
    
print(sum(AC),sum(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' and ac[p] == 0:
        wa[p] += 1
 
accept = 0
penalty = 0
for i in range(n):
    if ac[i]:
        penalty += wa[i]
        accept += 1
 
print(accept, penalty)
N,M = map(int,input().split())
correct = [0]*N
penalty = [0]*N
ans_c,ans_p = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s=="AC":
        if correct[p-1]==0:
            correct[p-1]+=1
    if s=="WA":
        if correct[p-1]==0:
            penalty[p-1]+=1

ans_penalty = 0
for i in range(N):
    if correct[i]>=1:
        ans_penalty+=penalty[i]
print(sum(correct),ans_penalty)
N,M = map(int, input().split())

ans = {}
if M > 0:
  for _ in range(M):
    key, value = input().split()
    if key not in ans:
      ans[key] = []
    ans[key].append(value)
else:
  print(0," ",0)
  exit()

ac = 0
wa = 0

for v in ans.values():
  if 'AC' in v: # ACを出している場合
    for a in v:
      if a == 'WA':
        wa += 1
      else:
        ac += 1
        break
  else: # ACを出していない場合
    continue

print(ac, " ", wa)
N,M=map(int,input().split())
wa=[0]*N
pen=[0]*N
ac=[0]*N
for x in range(M):
  P,S=input().split()
  if S=="WA" and ac[int(P)-1]==0:
    wa[int(P)-1] += 1
  elif S=="AC" and ac[int(P)-1]==0:
    ac[int(P)-1] += 1
    pen[int(P)-1] = wa[int(P)-1]
print(f"{sum(ac)} {sum(pen)}")
n,m = map(int, input().split())

num = [0]*n
flag = [False]*n

for _ in range(m):
  p,s = input().split()
  p = int(p)-1
  if flag[p]:
    continue
  else:
    if s == "AC":
      flag[p] = True
    else:
      num[p] += 1

for i in range(n):
  if flag[i] == False:
    num[i] = 0
    
print(flag.count(True),sum(num))
n,m=map(int,input().split())
cnt1=[0]*(n+1)
cnt2=[0]*(n+1)
for _ in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if cnt1[p]==1:
    continue
  else:
    if s=='AC':
      cnt1[p]=1
    else:
      cnt2[p]+=1
ans1=0
ans2=0
for i in range(1,n+1):
  if cnt1[i]==1:
    ans1+=1
    ans2+=cnt2[i]
print(ans1,ans2)
n, m = map(int, input().split())
l = [0] * n
f = [True] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'WA':
        if f[p]:
            l[p] += 1
    else:
        f[p] = False
ans = 0
for i in range(n):
    if not f[i]:
        ans += l[i]
print(f.count(False), ans)
n, m = map(int, input().split())
 
sac = set()
lwa = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if p in sac:
        continue
    elif s == 'AC':
        sac.add(p)
    else:
        lwa[p] += 1

print(len(sac), sum(lwa[p] for p in sac))
n,m=map(int, input().split())
al=[]
for i in range(m):
    a=list(map(str, input().split()))
    al.append(a)
l_all=[[] for i in range(n)]
for i in range(m):
    l_all[int(al[i][0])-1].append(al[i][1])
ac=0
pn=0
for j in range(n):
    if l_all[j].count('AC')!=0:
        pn+=l_all[j].index('AC')
        ac+=1
print('{} {}'.format(ac,pn))
N, M = [int(_) for _ in input().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
    else:
        ans += 1
        pen += P[p]
        P[p] = -1
print(ans,pen)
n,m = map(int,input().split())

max_val = 10**5+1
# dictの初期化
ac_L = []
wa_L = []
for val in range(1,max_val):
    wa_L.append(0)
    ac_L.append(0)

ac_ans,wa_ans = 0,0


for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    # acの処理
    if ac_L[p] ==0 and s == "AC":
        ac_L[p] = 1
        wa_ans += wa_L[p]
    # waの処理
    wa_L[p] += 1


#print(ac_dic,wa_dic)
print(sum(ac_L),wa_ans)
n, m = map(int, input().split())
listAC = [0] * n
listWAAC = [0] * n
listWA = [0] * n
for i in range(m):
    p, s = map(str, input().split())
    p = int(p) - 1
    if listAC[p] == 1:
        continue
    if s == 'AC':
        listAC[p] += 1
        listWAAC[p] += listWA[p]
        continue
    listWA[p] += 1

print(sum(listAC), sum(listWAAC))
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=0
for i in range(m):
  p,c=input().split()
  if c=='WA' and ac[int(p)]!=1:
    ac[int(p)]-=1
  elif c=='AC' and ac[int(p)]!=1:
    wa+=abs(ac[int(p)])
    ac[int(p)]=1
print(ac.count(1),wa)
d=dict()
wa=ans=0
N,M=map(int,input().split())
for i in range(M):
  p,s=input().split()
  if p not in d:
    d[p]=0
  if d[p]>=0 and s=="AC":
    ans+=1
    wa+=d[p]
    d[p]=-float("inf")
  else:
    d[p]+=1
print(ans,wa)
N, M = list(map(int, input().split()))
PS = [input().split() for _ in range(M)]

ps = [(int(p)-1, s) for p, s in PS]

ac = [0]*N
wa = [0]*N
for p, s in ps:
    if s == "AC":
        ac[p] = 1
    else:
        if ac[p] == 0:
            wa[p] += 1

print(sum(ac), sum([a*w for a, w in zip(ac, wa)]))
n,m = map(int,input().split())
p = [0]*m
s = [""]*m
for i in range(m):
  p[i],s[i] = input().split()
  
p = [int(j) for j in p]

u = [[0 for i in range(2)]for j in range(n)]

for k in range(0,m):
  if(s[k] == "WA" and u[p[k]-1][1] == 0):
    u[p[k]-1][0] += 1
  elif(s[k] == "AC"):
    u[p[k]-1][1] = 1

ans = 0
ac = 0
for i in range(n):
  if(u[i][1] == 1):
    ac += 1
    ans += u[i][0]
print(ac,ans)
n, m = map(int, input().split())
submit = {}

for _ in range(m):
  p, s = input().split()
  if submit.get(p, -1) == -1:
    submit[p] = [0, 0]
  if (submit[p])[0] == 0:
    if s == 'AC':
      (submit[p])[0] += 1
    else:
      (submit[p])[1] += 1
      
ac = 0
wa = 0
for i in submit.values():
  if i[0] > 0:
    ac += i[0]
    wa += i[1]

print(ac, wa)
n,m = map(int,input().split())
a = [0]*n
b = [0]*n
for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s=='AC' and a[p-1]==0:
        a[p-1]+=1
    elif s=='WA' and a[p-1]==0:
        b[p-1] +=1
for j in range(n):
    if a[j]==0:
        b[j]=0
        
print(sum(a),sum(b))
n,m = map(int,input().split())
ans = [0]*2
tmp = [0]*n
false = [0]*n
for _ in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if tmp[p-1] == 0:
        if s == 'AC':
            ans[0] += 1
            tmp[p-1] += 1
            ans[1] += false[p-1]
        elif s == 'WA':
            false[p-1] += 1
print(*ans)
N,M=map(int, input().split())
C = [ [0,0] for _ in range(N) ]
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        C[p][1] = 1
    else:
        if C[p][1] == 0:
            C[p][0] += 1
ans = 0
pena = 0
for i in range(N):
    if C[i][1] == 1:
        ans += 1
        pena += C[i][0]
print(ans,pena)
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
_set = set()
ac = 0
wa = 0
ls = []
for i in range(m):
    p, s = [i for i in sys.stdin.readline().split()]
    if s == "AC":
        _set.add(p)
    ls.append([p, s])

new_set = set()
for p, s in ls:
    if s == "AC":
        new_set.add(p)
    if s == "WA" and p in _set and p not in new_set:
        wa += 1
print(len(_set), wa)
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]
ans = 0

for _ in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

for num, i in enumerate(d_ac):
    if i:
       ans += d_wa[num]

print(sum(d_ac),ans)
N, M = map(int, input().split())
solve_problem = set()
WA = [0 for _ in range(N)]

ans = 0
penalty = 0

for i in range(M):
    p, S = input().split()
    if p in solve_problem:
        continue

    if S == 'AC':
        solve_problem.add(p)
        ans += 1
        penalty += WA[int(p)-1]
    if S == 'WA':
        WA[int(p)-1] += 1

print('{} {}'.format(ans, penalty))
from collections import defaultdict
N, M = map(int, input().split())
D = defaultdict(int)
acd = set()
ac = 0
pen = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == "WA":
        D[p] += 1
    else:
        if p not in acd:
            acd.add(p)
            ac += 1
            pen += D[p]
print(ac, pen)
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

num_WA = 0
for i, WA in enumerate(WAs):
    if ACs[i] == True:
        num_WA += WA

print(sum(ACs), num_WA)
n, m = map(int, input().split())
ps = [list(map(str, input().split())) for i in range(m)]

AC =[0]*n
WA = [0]*n
WA_ans = [0]*n

for i in range(m):
    if AC[int(ps[i][0])-1] == 0:
        if ps[i][1] == 'AC':
            AC[int(ps[i][0])-1] = 1
            WA_ans[int(ps[i][0])-1] = WA[int(ps[i][0])-1]

        elif ps[i][1] == 'WA':
            WA[int(ps[i][0])-1] += 1

print(sum(AC), sum(WA_ans))
n,m = [int(x) for x in input().split()]
ans = [0]*(n+1)
w = [0]*(n+1)
for _ in range(m):
    a,b = input().split()
    a = int(a)
    if ans[a] == 1:
        continue
    if b == "AC":
        ans[a] = 1
    else:
        w[a] += 1

aa = 0
ww = 0
for i in range(1,n+1):
    if ans[i]==1:
        aa += 1
        ww += w[i]
print(aa,ww)
n,m=map(int,input().split())
acount=0
wcount=0
a=[False]*n
w=[0]*n
for i in range(m):
  p,m=input().split()
  p=int(p)
  if m=="AC":
    if a[p-1]==False:
      acount+=1
      a[p-1]=True
  else:
    if a[p-1]==False:
      w[p-1]+=1
      
for i in range(n):
  if a[i-1]==1:
    wcount+=w[i-1]
    
print(acount,wcount)
from collections import defaultdict
n, m = map(int, input().split())
ac_set = set()
wa_dic = defaultdict(int)
wa_cnt = 0
for i in range(m):
    p, s = input().split()
    if s == 'AC':
        ac_set.add(p)
    else:
        if p not in ac_set:
            wa_dic[p] += 1
print(len(ac_set), sum(value for key, value in wa_dic.items() if key in ac_set))
import sys
N, M, *PS = sys.stdin.read().strip().split()
N = int(N)
ac = [0] * N
wa = [0] * N
for p, s in zip(*[iter(PS)] * 2):
  p = int(p) -1
  if s == "AC":
    ac[p] = 1
  elif ac[p] == 0:
    wa[p] += 1
penalties = sum([w * a for a, w in zip(ac, wa)])
print("{} {}".format(sum(ac), penalties))
N, M = map(int,input().split()) 
p = [0]*M
S = [0]*M
T = [0]*(N+1) 
U = [0,0]
for i in range(M):
  p[i],S[i] = input().split()
  P = int(p[i])
  if T[P] != -1:
    if S[i] == 'WA':
      T[P] += 1
    elif S[i] == 'AC':
      U[0] += 1
      U[1] += T[P]
      T[P] = -1


print(U[0],U[1])
N, M = map(int, input().split())
Counted = [0 for _ in range(N)]
num1 = 0
num2 = 0
subnum2 = [0 for l in range(N)]
for j in range(M):
  p, S = input().split()
  p_ = int(p)
  if S == "AC" and Counted[p_ -1] == 0:
    num1 += 1
    num2 += subnum2[p_ - 1]
    Counted[p_ -1] = 1
  elif S == "WA" and Counted[p_-1] == 0:
    subnum2[p_ - 1] += 1
print("{} {}".format(num1, num2))
import numpy as np

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

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

for i in range(M):
    p,S = input().split()
    p = int(p)-1
    if S == "AC":
        A[p] = 1
        C[p] = B[p]
    elif A[p]==0:
        B[p] += 1
    
A = np.array(A)
C = np.array(C)
print(np.sum(A), np.sum(C))
## C - Welcome to AtCoder
N ,M = map(int, input().split())
AC = [0] + [0] * N
WA = [0] + [0] * N
for m in range(M):
    p, S = map(str, input().split())
    if S == 'WA' and AC[int(p)] != 1:
        WA[int(p)] += 1
    else:
        AC[int(p)] = 1
print(' '.join([str(x) for x in [sum(AC), sum([WA[i] for i in range(N+1) if AC[i] == 1 ])] ]) )
n, m = map(int, input().split())
ans = [list(input().split()) for i in range(m)]
ac = [0 for i in range(n)]
penali = [0 for i in range(n)]

a = 0

for s,t in ans:
    if t== 'WA' and ac[int(s)-1] == 0:
        penali[int(s)-1] += 1
    if t == 'AC':
        if ac[int(s)-1] == 0:
            a +=1
        ac[int(s)-1] = 1

for i in range(n):
    if ac[i] == 0:
        penali[i] = 0

pena = 0
for i in penali:
    pena += i

print(a, pena)
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans,pena=0,0
N,M=MI()
P=[0]*N
PENA=[0]*N
for i in range(M):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=='AC':
    if P[p]==0:
      ans+=1
      P[p]=1
      if PENA[p]!=0:
        pena+=PENA[p]
  if s=='WA':
    if P[p]==0:
      PENA[p]+=1
print(ans,pena)
n,m=map(int,input().split())
p=[]
s=[]
for i in range(m):
	P,S=input().split()
	P=int(P)-1
	p.append(P)
	s.append(S)

wa=[0 for i in range(n)]
ac=[0 for i in range(n)]
for i in range(m):
	if s[i]=="AC":
		ac[p[i]]+=1
	else:
		if ac[p[i]]==0:
			wa[p[i]]+=1

sum_ac=0
pena=0
for i in range(n):
	if ac[i]!=0:
		sum_ac+=1
		pena+=wa[i]
print(sum_ac,end=' ')
print(pena)
# coding: utf-8
import re
import math
#import numpy as np


#main
n,m=map(int,input().split())
MAP={}
PS=[]
for a in range(m):
    s,t=input().split()
    if(not s in MAP):MAP[s]=[]
    MAP[s].append(t)
ac=0
wa=0
for a,b in MAP.items():
    if(not "AC" in MAP[a]):continue
    for c in b:
        if(c=="WA"):
            wa+=1
        else:
            ac+=1
            break
print(ac,wa)
n, m = map(int, input().split())
ac = {}
wa = {}
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        ac[p] = 1
    else:
        if not ac.get(p, 0):
            wa[p] = wa.get(p, 0) + 1
pen = 0
for p in ac:
    pen += wa.get(p, 0)
print(len(ac), pen)
n, m = map(int, input().split())

mapAC = [False]*(n+1)
countWA = [0]*(n+1)

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        mapAC[p] = True
    else:
        countWA[p] += 1*(not mapAC[p])
countWA = map(lambda x, y: x*y, countWA, mapAC)
print(mapAC.count(True), sum(countWA))
n, m = map(int, input().split())
ps = []
memo = [0 for i in range(n)]
pena = [0 for i in range(n)]
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        memo[p-1] = 1
    else:
        if memo[p-1] == 0:
            pena[p-1] += 1
ans = 0
for i, p in enumerate(pena):
    if memo[i]:
        ans += p
print(sum(memo), ans)
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(1,n+1):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))
n, m = map(int, input().split())

lac = [0] * n
lwa = [0] * n

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

print(sum(lac), sum(x * y for x, y in zip(lac, lwa)))
n, m = list(map(int, input().split()))

wa_count = [0] * n
is_accepted = [False] * n
ans_ac = 0
ans_wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == 'AC':
        if not is_accepted[p]:
            is_accepted[p] = True
            ans_ac += 1
            ans_wa += wa_count[p]
    else:
        wa_count[p] += 1

print(ans_ac, ans_wa)