peterverebics/CodeNet_Python_118 huggingface dataset:
n,m=[int(_) for _ in input().split()]
p=[0 for i in range(m)]
s=[0 for i in range(m)]
for i in range(m):
    _p,_s=input().split()
    p[i]=int(_p)-1
    s[i]=_s

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

for  i in range(m):
    if s[i]=="WA" and not(ac[p[i]]):
        wa[p[i]]+=1
    else:
        ac[p[i]]=True

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

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

WA = [0] * (10 ** 5 + 1)
AC = [False] * (10 ** 5 + 1)
for i in range(M):
    _no , re = input().split()
    no = int(_no)
    if re == 'AC':
        AC[no] = True
    if not AC[no]:
        if re == 'WA':
            WA[no] += 1
pena = 0
for i in range(10 ** 5 + 1):
    if AC[i]:
        pena += WA[i]

print(AC.count(True), pena)
n,m=map(int,input().split())
cnt = [0]*n
total = [0]*n
for i in range(m):
    P=list(input().split())
    p = int(P[0]) - 1
    if P[1] == 'WA' and cnt[p] == 0:
        total[p] += 1
    if P[1] == 'AC' and cnt[p] == 0:
        cnt[p] = True
ans = 0
for i in range(n):
    if cnt[i] == True:
        ans += total[i]
print(sum(cnt),ans)
n, m = map(int, input().split())
res1, res2 = 0, 0
l = [0] * (n + 1)

for _ in range(m):
    p, s = input().split()
    p = int(p)
    
    if l[p] == -1:
        continue

    if s == "AC":
        res1 += 1
        res2 += l[p]
        l[p] = -1
    else:
        l[p] += 1

print(res1, res2)
N,M = [int(x) for x in input().split()]
ac = [0]*(N+1)
wa = [0]*(N+1)
for i in range(M):
  p,s = input().split()
  if s =="AC" and ac[int(p)]==0:
    ac[int(p)]=1
  if s=="WA" and ac[int(p)]==0:
    wa[int(p)]+=1
ans = 0
answa = 0
for i in range(N+1):
  if ac[i]==1:
    ans+=1
    answa+=wa[i] 
print(ans,answa)
def main():
    import sys
    input = sys.stdin.readline

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

    ac = [False] * N
    wa = [0] * N
    for _ in range(M):
        it = iter(input().split())
        p = int(next(it)) - 1
        s = next(it)
        if s == 'AC':
            ac[p] = True
        else:
            if not ac[p]:
                wa[p] += 1
    print(ac.count(True), sum(w for p, w in enumerate(wa) if ac[p]))


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
WA = [0] * N
AC = [0] * N

for i in range(M):
  p,s = input().split()
  p = int(p)
  if AC[p-1] == 0:
    if s == "AC":
      AC[p-1] = 1
    else:
        WA[p-1] += 1
        
wa = 0
for j in range(N):
  if AC[j] == 1:
    wa += WA[j]
print(sum(AC),wa)
n,m = map(int,input().split())
ac, wa=[False]*n,[0]*n
for i in range(m):
  p,s = input().split()
  p=int(p)
  if s=='AC': ac[p-1]=True
  elif (s=='WA') and (ac[p-1]==False): wa[p-1]+=1

penalty, clear=0,0
for i,tf in enumerate(ac):
  if tf:
    penalty += wa[i]
    clear += 1
print('%d %d'%(clear,penalty))
import sys
input = sys.stdin.readline

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

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

for i in range(m):
    x, s = map(str, input().split())
    x = int(x) - 1
    if s == "AC":
        if marked[x] == False:
            wa += cnt[x]
            marked[x] = True
    else:
        cnt[x] += 1

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

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

ans_ac = ac.count(True)
print("{} {}".format(ans_ac, ans_wa))
N, M = map(int,input().split())

myAC = [0 for n in range(N+1)]
myWA = [0 for n in range(N+1)]

ansAC = 0
ansWA = 0


for m in range(M):
    a,  b = map(str, input().split())
    a = int(a)
    if b == 'WA' and myAC[a] != 1:
        myWA[a] += 1
        
    if b == 'AC' and myAC[a] != 1:
        myAC[a] = 1
        ansWA += myWA[a]
        ansAC += 1

#print(myAC)
#print(myWA)
print(ansAC,ansWA)
N, M = map(int, input().split())
cleared = [0 for i in range(N)]
wrong = [0 for i in range(N)]
penalty = 0
for i in range(M):
  p, s = map(str, input().split())
  p = int(p) - 1
  if cleared[p] == 1:
    continue
  if s == "AC":
    cleared[p] = 1
    penalty += wrong[p]
  else:
    wrong[p] += 1
print(sum(cleared), penalty)
N, M = map(int, raw_input().split())
#print N, M

state = [-1 for i in range(N)]
pena = [0 for i in range(N)]
WA = [0 for i in range(N)]

for i in range(M):
    s = raw_input().split()
    p = int(s[0])
    sc = s[1]
    #print p, sc
    p -= 1
    if (state[p] == 0):
        continue
    if sc == 'WA':
        pena[p] += 1
    else:
        state[p] = 0

ok = 0
pn = 0
for i in range(N):
    if state[i] == 0:
        ok += 1
        pn += pena[i]

print ok, pn
N, M = map(int, input().split())

no = [0] * (N + 1)
ok = 0
x = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and no[p] != -1:
        ok += 1
        x += no[p]
        no[p] = -1
    elif s == 'WA' and no[p] != -1:
        no[p] += 1

print(ok, x)
n,m=map(int,input().split())
wa_check=[0 for _ in range(n+1)]
ac_check=[0 for _ in range(n+1)]
for i in range(m):
    p,s=input().split()
    p=int(p)
    if(ac_check[p]==0):
        if(s=='AC'):
            ac_check[p]=1
        else:
            wa_check[p]+=1
wa_ans=[wa_check[i] for i in range(n+1) if ac_check[i]!=0]
print(sum(ac_check),sum(wa_ans))
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])
n,m = map(int, input().split())
l = [[] for _ in range(n)]
ac,wa = (0,0)
for i in range(m):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if s not in l[p-1]:
      l[p-1].append(s)
      ac += 1
      wa += l[p-1].count("WA")
  else:
    l[p-1].append(s)
print(ac,wa)
N, M = map(int,input().split())
ac = [0] * N
wa = [0] * N
for i in range(M):
    p, s = map(str,input().split())
    num = int(p)-1
    if s == 'WA' and ac[num] == 0: 
        wa[num] += 1
    elif s == 'AC' and ac[num] == 0:
        ac[num] += 1

for i in range(N):
    if ac[i] == 0:
        wa[i] = 0

print('{} {}'.format(sum(ac), sum(wa)))
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
num=[0]*(n+1)
numcnt=[0]*(n+1)
ans=0
cnt=0
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if s=="WA":
        num[p]+=1
    if s=="AC" and numcnt[p]!=1:
        ans+=num[p]
        cnt+=1
        numcnt[p]=1
print(cnt,ans)
import sys
lines = sys.stdin.read().split("\n")
n, m = map(int, lines[0].split())

ac_flags = [0] * (n + 1)
wa_counter = [0] * (n + 1)

ac_count = 0
wa_count = 0
for line in lines[1:-1]:
    p, s = line.split()
    p = int(p)
    if ac_flags[p] == 0:
        if s == "AC":
            ac_flags[p] = 1
            ac_count += 1
            wa_count += wa_counter[p]
        else:
            wa_counter[p] += 1

print ac_count, wa_count
N, M = [int(x) for x in input().split()]
ans = [0] * N
pen = [0] * N
for _ in range(M):
    ps, S = [x for x in input().split()]
    p = int(ps)-1
    if S == 'WA':
        if ans[p] == 0:
            pen[p] += 1
    else:
        ans[p] = 1
ans1 = 0
ans2 = 0
for a, p in zip(ans, pen):
    ans1 += a
    ans2 += (a*p)
print(ans1, ans2)
n, m = [int(i) for i in input().split()]
ans = [input().split() for _ in range(m)]

is_ac = [0 for i in range(n)]
cnt_wa = [0 for i in range(n)]
for p, s in ans:
  p = int(p) - 1
  if is_ac[p]:
    continue
  if s == 'AC':
    is_ac[p] = 1
  else:
    cnt_wa[p] += 1

cor = sum(is_ac)
pena = 0
for p, c in enumerate(is_ac):
  if c:
    pena += cnt_wa[p]

print(cor, pena)
N, M=(int(i) for i in input().split())
P=[[int(j)-1  if i==0 else j for i, j in enumerate(input().split())] for  _ in range(M)]
ac="AC"
wa="WA"
flag=[0]*N
ans=0
pe=0

for i in range(M):
    if flag[P[i][0]]!=-1 and P[i][1]==ac:
        ans+=1
        pe+=flag[P[i][0]]
        flag[P[i][0]]=-1
    elif flag[P[i][0]]!=-1 and P[i][1]==wa:
        flag[P[i][0]]+=1
        
print(ans,pe)
n,m=map(int,input().split())

data=[0]*n
s=set()
sum_wa=0

for i in range(m):
    p,a=input().split()
    p=int(p)-1
    if p in s:
        continue
    else:
        if a=='WA':
            data[p]+=1
        else:
            sum_wa+=data[p]
            s.add(p)

print(len(s),sum_wa)
# coding=utf-8

import collections
get = lambda: int(raw_input().strip())
gets = lambda: map(int, raw_input().strip().split())
getss = lambda x: [gets() for _ in xrange(x)]


N, M = gets()
count = collections.Counter()
penalty = 0
ac = set()
for i in xrange(M):
    p, s = raw_input().split()
    p = int(p)
    if p in ac: continue
    if s == 'AC':
        ac.add(p)
        penalty += count[p]
    else:
        count[p] += 1
print len(ac), penalty
N, M = map(int, input().split())

accepted = [False for _ in range(N)]
wa = [0 for _ in range(N)]

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not accepted[p - 1]:
        if s == 'AC':
            accepted[p - 1] = True
        else:
            wa[p - 1] += 1

correct = sum(accepted)
penalty = sum([a * w for a, w in zip(accepted, wa)])

print(correct, penalty)
N, M = map(int, input().split())
ps = [[i for i in input().split()] for i in range(M)]

ac = 0
penalty = 0
check = [0 for i in range(N)]
for i in range(M):
    p, S = ps[i]
    if check[int(p)-1] != -1:
        if S == "AC":
            ac += 1
            penalty += check[int(p)-1]
            check[int(p)-1] = -1
        if S == "WA":
            check[int(p)-1] += 1

print("{} {}".format(ac, penalty))
N, M = map(int,input().split(" "))

ans = [0]*N
wc_c = [0]*N
pena = 0

for i in range(M):
    p, s = input().split(" ")
    p = int(p) - 1
    s = str(s)
    
    if s == "AC" and ans[p] == 0:
        ans[p] = 1
        pena += wc_c[p]
        
    elif s == "WA" and ans[p] == 0:
        wc_c[p] += 1
        
print(sum(ans), pena)
N, M = map(int, input().split())
WAC = [0 for i in range(N)]
TF = [0 for i in range(N)]
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'AC':
        TF[p] = 1
    if TF[p] == 0 and S == 'WA':
        WAC[p] += 1
count = 0
for i in range(N):
    count += TF[i] * WAC[i]
print(sum(TF), count)
n, m = [int(i) for i in input().split()]
wa = [0]*n
ac = [0]*n

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

print(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))
n,m=map(int,input().split())
w,l=0,[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC':
        w+=l[p]*(l[p]>=0)
        l[p]=-1
    else:
        l[p]+=(l[p]>=0)
print(l.count(-1),w)
n, m = map(int, input().split(' '))
problem = [0] * n
ok=0
pen=0
i=0

while i < m:
    p, result = input().split(' ')
    p = int(p) - 1
    if problem[p] < 0:
        pass
    else:
        if result == 'WA':
            problem[p] += 1
        else:
            ok += 1
            pen += problem[p]
            problem[p] = -1
    i+=1
print('{} {}'.format(ok, pen))
import numpy as np

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

P = []
S = []

for _ in range(M):
    p, s = input().split()
    P.append(int(p))
    S.append(s)

AC = np.zeros(N)
WA = np.zeros(N)

for i in range(M):
    if AC[P[i]-1] == 0:
        if S[i] == 'WA':
            WA[P[i]-1] += 1
        else:
            AC[P[i]-1] += 1

WA[AC == 0] = 0

print(int(sum(AC)), int(sum(WA)))
N,M= map(int,input().split())

tempP = ""
ac = []
wa = []

for count in range(N):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1



a = 0
b = 0
 
for i in range(N):
    if ac[i] == 1:
        a += 1
        b += wa[i]
 
print(*[a, b])
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int, readline().split())
PS = [line.split() for line in readlines()]

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

penal = 0
for p,s in PS:
  p = int(p)
  if AC[p]:
    continue
  if s== b'WA':
    WA_cnt[p] += 1
  else:
    AC[p] = True
    penal += WA_cnt[p]
    
ac = sum(AC)
print(ac, penal)
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 ac[p-1]:
        continue
    if s == 'AC':
        ac[p-1] = 1
    else:
        wa[p-1] += 1
count_ac = 0
count_wa = 0
for i in range(n):
    count_ac += ac[i]
    if ac[i]:
        count_wa += wa[i]
print(str(count_ac) + " " + str(count_wa))
#!/usr/bin/env python3

N, M = map(int, input().split())
ps = [list(input().split()) for _ in range(M)]
pen = [0]*N
rig = [0]*N

for i in range(M):
    if ps[i][1] == "AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1] == 0:
            pen[int(ps[i][0])-1] += 1

cnt1, cnt2 = 0, 0
for i in range(N):
    if rig[i] == 1:
        cnt1 += rig[i]
        cnt2 += pen[i]

print(cnt1, cnt2)
import numpy as np
n,m = map(int, input().split())
a = [False]*n
b = [0]*n
for i in range(m):
  p,s = map(str,input().split())
  p = int(p)-1
  if s == "AC":
    a[p] = True
  else:
    if a[p] == False:
      b[p]=b[p]+1
print(np.array(a).sum(),np.array(b)[np.array(a)].sum())
N,M=map(int,input().split())
ST=['WA'] * N
WA=[0]*N
OK=0
NG=0
for i in range(M):
  c,s = map(str,input().split())
  c = int(c)
  if s == 'WA':
    if ST[c-1] != 'AC':
      WA[c-1] += 1
  else:
    if ST[c-1] != 'AC':
      ST[c-1] = 'AC'
      OK += 1

for i,s in enumerate(ST):
  if s != 'AC':
    WA[i] = 0

print("{} {}".format(OK, sum(WA)))
n,m = map(int,input().split())
f = [False for i in range(n)]
ac = 0
wa = [0 for i in range(n)]
for i in range(m):
  p,s = input().split()
  p = int(p) - 1
  if not f[p]:
    if s == "WA":
      wa[p] += 1
    else:
      f[p] = True
      ac += 1
w = 0
for e,c in zip(f,wa):
  if e:
    w += c
print(ac,w)
n,m = map(int,input().split())

flag = dict()
for i in range(m):
  q, s = input().split()
  if q not in flag:
    flag[q] = [0,0]
    if s == "AC":
      flag[q][0] += 1
    else:
      flag[q][1] += 1
  else:
    if flag[q][0] != 1:
      if s == "AC":
        flag[q][0] += 1
      else:
        flag[q][1] += 1
      
ans = [0,0]
for v in flag.values():
  if v[0]:
    ans[0] += 1
    ans[1] += v[1]

print(ans[0],ans[1])
n, m = map(int, input().split())
ps = [list(map(str, input().split())) for _ in range(m)]

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

for i, j in ps:
    if j == "AC":
        ac.add(i)
    else:
        if i not in ac:
            wa[int(i) - 1] += 1

for k in range(n):
    if str(k + 1) not in ac:
        wa[k] = 0

print(len(ac), sum(wa))
from collections import defaultdict

N, M = map(int, input().split())
WA = {i : 0 for i in range(1,N+1)}
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([a for a,b in zip(WA.values(), boollist) if b==True]))
import sys
input = sys.stdin.readline
from collections import defaultdict

(n, m), d, a, b = map(int, input().split()), defaultdict(int), 0, 0
for i in range(m):
	p, s = input()[:-1].split(); p = int(p)
	if d[p] == sys.maxsize: continue
	if s == 'WA': d[p] += 1
	if s == 'AC': b += abs(d[p]); a += 1; d[p] = sys.maxsize
print(a, b)
n,m = map(int,input().split())
l = [1]*n
a = 0
w = 0
for i in range(m):
  p,s = map(str,input().split())
  p = int(p)
  if l[p-1]>0:
    if s == "AC":
      w+=l[p-1]-1
      l[p-1] = 0
      a+=1
    else:
      l[p-1]+=1
print(a,w)
n,m = map(int,input().split())
ac = 0
wa = 0
wa_d = {}
ac_d = {}
for i in range(1,n+1):
    ac_d[str(i)] = False
    wa_d[str(i)] = 0

for _ in range(m):
    p,s = input().split()
    if s == "AC":
        if ac_d[p]:
            pass
        else:
            wa += wa_d[p]
            ac += 1
            ac_d[p] = True 
    else:
        wa_d[p] += 1

print (ac,wa)
n,m=map(int,input().split())
p=[0]*m
s=[""]*m
flag=[0]*n
pen=[0]*n
penalty=0
for i in range(m):
  p[i],s[i]=input().split()
  if (flag[int(p[i])-1]==0):
    if (s[i]=="WA"):
      pen[int(p[i])-1]+=1
    elif (s[i]=="AC"):
      flag[int(p[i])-1]=1
      penalty+=pen[int(p[i])-1]
print(sum(flag),penalty)
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

N, M = map(int, input().split())
AC = [False]*(N+1)
WA = [0]*(N+1)
WAsum = 0

for _ in range(M):
  p, s = input().split()
  p = int(p)  
  if AC[p]:
    continue
  if s == b"AC":
    AC[p] = True
    WAsum += WA[p]
  else:
    WA[p] += 1
print(sum(AC), WAsum)
n, m = map(int, input().split())
tmp  = [0]*n
wtmp = [0]*n
for _ in range(m):
    P, s = map(str, input().split())
    p = int(P)
    p -= 1
    if not tmp[p] == 0:
        continue
    if s == 'AC':
        tmp[p] = 1
    else:
        wtmp[p] += 1
ans1 = sum(tmp)
ans2 = 0
for i in range(n):
    if tmp[i] == 1:
        ans2 += wtmp[i]
print(ans1, ans2)
#151c
n,w=map(int,input().split())
ac=0
wa=[0]*n
wa_cnt=[0]*n
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[p] =wa_cnt[p]
			#wa_cnt=0
		else:
			wa_cnt[p]+=1

wa_ans=0
for i in range(n):
	wa_ans+=wa[i]

print(ac,wa_ans)
N,M=map(int,input().split())
p=[]
S=[]
for i in range(M):
    x,y=input().split()
    p.append(int(x)-1)
    S.append(y)
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
ans1=sum(AC)
ans2=0
for i in range(N):
    if AC[i]==1:
        ans2+=WA[i]
print(ans1,ans2)
n,m=map(int,input().split())
A=[[0,0] for i in range(n)] #ACしたか、WA数
AC=0
pen=0
for i in range(m):
    a,b=map(str,input().split())
    a=int(a)
    if b=="AC":
        A[a-1][0]=1
    elif b=="WA" and A[a-1][0]==0:
        A[a-1][1]+=1
for i in range(n):
    if A[i][0]==1:
        AC+=1
        pen+=A[i][1]
print(AC,pen)
n, m = map(int, input().split())

result = {}
fin = {}
success = 0
wa_sum = 0
for i in range(m):
    p, s = map(str, input().split())
    if not (p in result):
        result[p] = 0
        fin[p] = False
    if s == 'AC' and not fin[p]:
        fin[p] = True
        success += 1
        wa_sum += result[p]
    elif not fin[p]:
        result[p] += 1

print(success, wa_sum)
n, m = map(int, input().split())
submissions = [list(input().split()) for _ in range(m)]
count_penalty = [0] * (n + 1)
count_ac = [0] * (n + 1)

for i in range(m):
    ploblem = int(submissions[i][0])
    if submissions[i][1] == "AC":
        count_ac[ploblem] = 1

    elif count_ac[ploblem] != 1 and submissions[i][1] == "WA":
        count_penalty[ploblem] += 1

for i in range(n + 1):
    if count_ac[i] != 1:
        count_penalty[i] = 0

print("{} {}".format(count_ac.count(1), sum(count_penalty)))
n,m=map(int,input().split())
acl=["WA"]*n
wal=[0]*n
ans=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if(acl[p]=="WA"):
        if s=="WA":
            wal[p]+=1
        else:
            ans+=wal[p]
            acl[p]="AC"
print(acl.count("AC"),ans)
n,m=map(int,input().split())
l1=[list(input().split()) for i in range(m)]
l2=["WA"]*n
l3=[0]*n
account=0
wacount=0
for i in range(m):
  if l1[i][1]=="WA" and l2[int(l1[i][0])-1]=="WA":
    wacount+=1
    l3[int(l1[i][0])-1]+=1
  if l1[i][1]=="AC":
    l2[int(l1[i][0])-1]="AC"

for i in range(n):
  if l2[i]=="AC":
    account+=1
  else:
    wacount-=l3[i]
print(account,wacount)
N,M = map(int,input().split())

List = []
ans = [0  for i in range(N+1)]
WA = [0  for i in range(N+1)]

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ans[p] == 0:
    if S == "AC":
      ans[p] = 1
    else:
      WA[p] += 1
      
A = sum(ans)

W= 0

for i in range(N+1):
  W += ans[i] * WA[i]

print(A,W)
from sys import stdin 
n,m = [int(x) for x in stdin.readline().rstrip().split()]
a = []
for i in range(m):
    a.append([x for x in stdin.readline().rstrip().split()])
ac = [0] * n
wa = [0] * n
WA = 0
for i in range(m):
    if a[i][1] == 'WA':
        wa[int(a[i][0])-1] += 1
    if a[i][1] == 'AC':
        if ac[int(a[i][0])-1] == 0:
            WA += wa[int(a[i][0])-1]
        ac[int(a[i][0])-1] = 1
print(sum(ac),WA)
ac={}
wa={}
ans1=0
ans2=0
N,M=input().split(" ")
for i in range(int(M)):
    num,sa=input().split(" ")
    if sa=='AC':
        if num in ac:
            continue
        else:
            ans1+=1
            ac[num]=1
            if num in wa:
                ans2+=wa[num]
    else:
        if num in wa:
            wa[num]+=1
        else:
            wa[num]=1
print(ans1,ans2)
n, m = map(int, input().split())

ac = 0
wa = 0
dwa = {}
d = {}

for i in range(m):
  p, s = input().split()
  if d.get(p) == "AC":
    continue
  if p not in dwa:
    dwa[p] = 0
  if s == "WA":
    dwa[p] += 1
  else:
    ac += 1
    wa += dwa[p]
  d[p] = s
  
print(ac, wa)
n, m = map(int, input().split())
ac = [False] * n
wa = [0] * n
for _ in range(m):
  prob, s = input().split()
  p = int(prob) - 1
  if not ac[p]:
    if s == 'AC':
      ac[p] = True
    else:
      wa[p] += 1
penalty = 0
for i in range(n):
  if ac[i]:
    penalty += wa[i]
print(sum(ac), penalty)
import numpy as np

n,m = map(int,input().split())
base = np.zeros(n)
pena = np.zeros(n)

for i in range(m):
  s = list(input().split())
  if (s[1] == "WA") and (base[int(s[0])-1] == 0):
    pena[int(s[0])-1] += 1
  elif (s[1] == "AC"):
    base[int(s[0])-1] = 1
    
ans_1 = np.multiply(base,pena)
print(int(np.sum(base)),int(np.sum(ans_1)))
n,m = map(int,input().split())
a = [0]*n
ac,wa = 0,0
for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s == "AC" and a[p-1] != -1:
        ac +=1
        wa += a[p-1]
        a[p-1] = -1
    elif s == "WA" and a[p-1] != -1:
        a[p-1] += 1
print(ac,wa)
n,m=map(int,input().split())

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

        
print(ans,pen)
n,m = map(int, input().split(" "))
a=[list(map(str, input().split(" "))) for i in range(m)]
check = [False for i in range(n + 1)]
times = [False for i in range(n + 1)]

for i in range(m):
  #print(check)
  #print(a[i])
  if check[(int)(a[i][0])] == False and a[i][1] == "AC":
    #print("OK")
    check[(int)(a[i][0])] = True
  elif check[(int)(a[i][0])] == False and a[i][1] == "WA":
    times[(int)(a[i][0])] += 1
    #print("MISS")

for i in range(n + 1):
  if check[i] == False:
    times[i] = 0
print(check.count(True), sum(times))
n, m = map(int, input().split())

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

for i 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

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i, j in enumerate(ac) if j != 0]])))
n,m=map(int,input().split())
num = [1]*(n + 1)
pena = [0]*(n + 1)
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p,s=input().split()
    if s == 'AC':
        if num[int(p)]:
            num[int(p)] = 0
            AC_cnt += 1
            WA_cnt += pena[int(p)]
    else:
        pena[int(p)] += 1
print(AC_cnt,WA_cnt)
n,m = map(int,input().split(' '))
score = 0
penalty = 0
penalties = {}
acs = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in acs:
        continue
    
    if result == "WA":
        if num in penalties:
            penalties[num] +=1
        else:
            penalties[num] =1
    else:
        score +=1
        if num in penalties:
            penalty += penalties[num]
        acs.add(num)

print(score,penalty)
n,m=map(int,input().split())
l=[[0,0] for i in range(n)]
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        if l[p-1][0]!=1:
            l[p-1][0]=1
    else:
        if l[p-1][0]!=1:
            l[p-1][1]+=1
ac=0
wa=0
for i in range(len(l)):
    ac+=l[i][0]
    if l[i][0]!=0:
        wa+=l[i][1]
print(ac,wa)