peterverebics/CodeNet_Python_118 huggingface dataset:
n, m = map(int, input().split())
sub = [list(input().split()) for j in range(m)]
li = [[0 for i in range(n)]for j in range(2)]
for i in range(m):
    x = int(sub[i][0])-1
    if sub[i][1] == 'AC':
        if li[0][x] == 0:
            li[0][x] += 1
    elif li[0][x] == 0:
        li[1][x] += 1
    else:
        next

ac = sum(li[0])
wa = 0
for i in range(n):
    if li[0][i] == 1:
        wa += li[1][i]

print('{} {}'.format(ac,wa))
N, M = map(int, input().split())
data = [0]*N
solved = [False]*N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if solved[p] == False and S == "WA":
        data[p] += 1
    if solved[p] == False and S == "AC":
        solved[p] = True

print(sum(solved),sum( x*y for x, y in zip(data, solved)) )
n,m= map(int, input().split())

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

for i in range(m):
  p_number, p_status = input().split()
  p_number =int(p_number)
  if (p_status =='WA') & (AC[p_number]==0):
    WA[p_number]+=1
  if (p_status =='AC') & (AC[p_number]==0):
    AC[p_number] +=1

for i in range(n+1):
  if AC[i] ==0:
    WA[i]=0

print(sum(AC), sum(WA))
#print(AC,WA)
#C
n,m=map(int,input().split())
f=False
ps=[]
AC=[0]*n
WA=[0]*n
for i in range(m):
    ps.append(list(input().split()))
for i in range(m):
    if ps[i][1]=='AC'and AC[int(ps[i][0])-1]==0:
        AC[int(ps[i][0])-1]=1
    if ps[i][1]=='WA'and AC[int(ps[i][0])-1]==0:
        WA[int(ps[i][0])-1]+=1
wasum=0
for i in range(n):
    if AC[i]==1:
        wasum+=WA[i]
print(sum(AC),wasum)
n, m = input().split()
a = [False] * int(n)
b = [0] * 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
        WA += b[int(p) - 1]

    if(s == "WA" and a[int(p) - 1] == False):
        b[int(p)-1] += 1

print(AC, WA)
N, M = map(int, input().split())
submit = [list(input().split()) for _ in range(M)]
acflag = [False]*N
AC = 0
waflag = [0]*N
WA = 0

for i in range(M):
    if (not acflag[int(submit[i][0])-1]) and submit[i][1] == "AC":
        acflag[int(submit[i][0])-1] = True
        AC += 1
    elif (not acflag[int(submit[i][0])-1]) and submit[i][1] == "WA":
        waflag[int(submit[i][0])-1] += 1

for i in range(N):
    if acflag[i]:
        WA += waflag[i]
print(AC, WA)
N, M = map(int, input().split())
Pn = []
for i in range(M):
    Pn.append(list(input().split()))

check = [0 for i in range(N + 1)]
pAC = 0
pWA = 0
for p in Pn:
    x = int(p[0])
    if check[x] != -1:
        if p[1] == 'WA':
            check[x] += 1
        elif p[1] == 'AC':
            pWA += check[x]
            pAC += 1
            check[x] = -1

print(pAC, pWA)
n, m = map(int, input().split())

a = [0] * (n+1)
b = [0] * (n+1)

c = 0

for i in [0]*(m):

    s = input().split()

    if a[int(s[0])] == 0:
        if s[1] == "AC":
            a[int(s[0])] = 1
            c += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(a), c)
N,M = map(int,input().split())

wa = [0]*N
ac = [0]*N

wac = 0
acc = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if ac[p-1] != 1:
      ac[p-1] = 1
      acc += 1
      wac += wa[p-1]
  else:
    if ac[p-1] == 0:
      wa[p-1] += 1
print(str(acc) +" "+ str(wac))
n,m = map(int,input().split())
x = [0]*(n+1)
t = [0]*(n+1)
p=q=0
for i in range(m):
  k,l = input().split()
  y=int(k)-1
  if x[y]==0:
    if l=='WA':
      t[y]+=1
    else:
      q+=t[y]
      p+=1
      x[y]=1
print(p,q)
n,m = map(int,input().split())
na = [0]*n
nw = [0]*n

for i in range(m):
    a,b = input().split()

    if b == "AC":
        na[int(a)-1] = 1
    elif b == "WA":
        if na[int(a)-1] == 0:
            nw[int(a)-1] += 1
count = 0
print(sum(na),end="")
for i in range(n):
    if na[i] == 1:
        count += nw[i]
print(" {}".format(count))
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

P = [0] * (n+1)
pena = [0] * (n+1)
for p,s in ps:
    p = int(p)
    if s == "WA":
        if P[p] == 0: pena[p] += 1
    else:
        P[p] = 1
ans = [0,0]
for p,pe in zip(P,pena):
    p = int(p)
    if p == 0: continue
    ans[0] += 1
    ans[1] += pe
print(" ".join(map(str, ans)))
import numpy as np

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

aced = np.zeros(N, dtype="bool")
waed = np.zeros(N, dtype="int")

AC = "AC"
WA = "WA"

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

    if s == AC:
        aced[p] = True
    else:
        if not aced[p]:
            waed[p] += 1

ac_count = 0
wa_count = 0

for i in range(N):
    if aced[i]:
        ac_count += 1
        wa_count += waed[i]

print("{} {}".format(ac_count, wa_count))
N, M = map(int, input().split())
X = [list(input().split()) for _ in range(M)]

acs = [False] * (N + 1)
was = [0] * (N + 1)

for p, s in X:
    if s == "AC":
        acs[int(p)] = True
    elif not acs[int(p)]:
        was[int(p)] += 1

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

print(sum(acs), was_cnt)
N,M = map(int,input().split())
PS =[""]*N
PS2 =[0]*N

PENALTY = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)-1
    if PS[p]!="AC" and s=="WA":
        PS2[p]+=1
    elif PS[p]!="AC" and s=="AC":
        AC+=1
        PENALTY+=PS2[p]
        PS[p]="AC"
        
print(AC,PENALTY)
n, m = map(int, input().split())
account, wacount = 0, 0
acdic = [0] * (n + 10)
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC" and acdic[p] <= 0:
        account += 1
        wacount += abs(acdic[p])
        acdic[p] = 1
    elif s == "WA" and acdic[p] <= 0:
        acdic[p] -= 1
print(account, wacount)
N,M = map(int,input().split())
a=[]
ac_list = [0]*N
wa_list= [0]*N
count_wa = 0
for i in range(M):
    p,s=input().split()
    p = int(p) - 1
    if ac_list[p] == 0:
        if s == 'WA':
            wa_list[p] += 1
        else:
            ac_list[p] = 1
for i in range(N):
    if ac_list[i] == 1:
        count_wa += wa_list[i]

print(sum(ac_list),count_wa)
n,m=map(int,input().split())
dp=[0]*(n+1)
charge=[0]*(n+1)
cnt=0
ans=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    charge[int(q[:-3])]+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
    ans+=1
    cnt+=charge[int(q[:-3])]
    charge[int(q[:-3])]=0
print(ans,cnt)
N,M = map(int,input().split())
WA = [0] * (N + 1)
AC = [0] * (N + 1)
sum_WA = 0
for _ in range(M):
  i,s = input().split()
  i = int(i)
  if AC[i] == 0:
    if s == 'WA':
      WA[i] += 1
    elif s == 'AC':
      AC[i] = 1
      sum_WA += WA[i]

print(sum(AC),sum_WA)
import sys
N, M = [int(v) for v in sys.stdin.readline().split()]
AC = set()
WA = {}
for i in range(M):
    p, s = sys.stdin.readline().split()
    p = int(p)

    if s == 'AC':
        AC.add(p)
    else:
        if p not in AC:
            if p not in WA:
                WA[p] = 1
            else:
                WA[p] += 1
wa = 0
for a, c in WA.items():
    if a in AC:
        wa += c

print(len(AC), wa)
import sys
readline = sys.stdin.buffer.readline

n, m = map(int, readline().split())
ac_lst = [False] * (n + 1)
wa_lst = [0] * (n + 1)
w = 0
for _ in range(m):
    a, b = readline().split()
    a = int(a)
    if ac_lst[a]:
        continue
    if b == b'WA':
        wa_lst[a] += 1
    else:
        w += wa_lst[a]
        ac_lst[a] = True
print(sum(ac_lst), w)
N,M=map(int,input().split())
c=[0]*(N+1)
w=[0]*(N+1)
AC=0
WA=0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if(c[p]==0 and s=="AC"):
        c[p]+=1
        AC+=1
        WA+=w[p]
    elif(c[p]==0 and s=="WA"):
        w[p]+=1
print(AC,WA)
n, m = map(int, input().split())

dwa = {}
dac = {}
ansac = 0
answa = 0

for m in range(m):
  p, s = map(str, input().split())
  p = int(p)
  if s == 'WA':
    if p in dwa:
      dwa[p] += 1
    else:
      dwa[p] = 1
  if s == 'AC' and p not in dac:
    ansac += 1
    dac[p] = 1
    if p in dwa:
      answa += dwa[p]
    
print(ansac, answa)
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 not ac[p]:
        if s == "AC":
            ac[p] = True
        else:
            wa[p] += 1
accnt = len([1 for x in ac if x])
wacnt = sum([wa[i] for i in range(N) if ac[i]])
print(accnt, wacnt)
n,m = map(int,input().split())
prb = [[0] for _ in range(n+1)]

for _ in range(m):
    sub = input().split()
    p, s = int(sub[0]), sub[1]
    lst = prb[p]
    if lst[-1] == 1:
        pass
    elif s == "WA":
        lst.append(0)
    elif s == "AC":
        lst.append(1)
    prb[p] = lst

ac_prb = [lst for lst in prb if lst[-1] == 1]
ac_num = len(ac_prb)
pe_num = -2*ac_num

for prb in ac_prb:
    pe_num += len(prb)

print(ac_num, pe_num)
N, M = map(int,input().split())
li = []
for _ in range(M):
  p, S = input().split()
  li.append([int(p), S])

ac = [0] * N
wa = [0] * N
c1 = 0
c2 = 0

for i in range(M):
  j = li[i][0] - 1
  if li[i][1] == "WA":
    wa[j] += 1
  if ac[j] == 0 and li[i][1] == "AC":
    ac[j] = 1
    c1 += 1
    c2 += wa[j]

print(c1, c2)
n,m=map(int,input().split())
mon = [0]* n
ac =0
wa = 0
for i in range(m):
    p,s = list(input().split())
    p = int(p)-1
    if mon[p] <0:
        continue
    if s == 'AC':
        ac += 1
        wa += mon[p]
        mon[p] = -1
    else:
        mon[p] += 1

print(ac,wa)
N, M = map(int, input().split())
ACed = [0] * (N + 1)
WAed = [0] * (N + 1)
WA_count = 0
AC_count = 0
WA_sum = 0

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

    if s == 'WA':
        WAed[p] += 1

    if s == 'AC' and ACed[p] == 0:
        ACed[p] = 1
        AC_count += 1
        WA_sum += WAed[p]

print(AC_count, WA_sum)
N,M = list(map(int,input().split()))
colect_quest = [0]*N
WA_quest = [0]*N
for i in range(M):
    pi,si = list(map(str,input().split()))
    pi = int(pi)
    if si == "AC":
        colect_quest[pi-1] = 1
    if si == "WA" and colect_quest[pi-1] != 1:
        WA_quest[pi-1] += 1
WA_count = 0
for i in range(len(WA_quest)):
    if colect_quest[i] == 1 :
        WA_count += WA_quest[i] 
print(sum(colect_quest),WA_count)
N,M = map(int, input().split())

isAC = [0] * (N+1)
isWA = [0] * (N+1)

ACnum = 0
WAnum = 0

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

    if isAC[p] == 1: continue
    if s == 'AC':
        isAC[p] = 1
        ACnum += 1
        WAnum += isWA[p]
    elif s == 'WA':
        isWA[p] += 1

print("%d %d"%(ACnum, WAnum))
n,m= map(int,input().split())
r = 0
p = 0
li = [0]*n
for i in range(m):
    a,b = input().split()
    if li[int(a)-1]==-1:
        pass
    elif b=='WA':
        li[int(a)-1]+=1
    elif b=='AC':
        r += 1
        p += li[int(a)-1]
        li[int(a)-1]=-1
print(r,p)
N, M = [int(i) for i in input().split()]
dic = {}

for _ in range(M):
    p, s = input().split()
    if p not in dic:
        dic[p] = [False, 0]
    isAC, WC = dic[p]
    if isAC:
        continue
    if s == "AC":
        dic[p][0] = True
    elif s == "WA":
        dic[p][1] += 1

correct = 0
penalty = 0

for v in dic.values():
    if v[0]:
        correct += 1
        penalty += v[1]

print(correct, penalty)
n, m = map(int, input().split())
d = [[] for i in range(n)]    


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

ac_cnt, w_cnt = 0, 0
for l in d:
    if len(l) != 0 and "AC" in l:
        w_cnt += l.index("AC")

    if "AC" in l:
        ac_cnt += 1

print(ac_cnt, w_cnt)
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
	p, s = input().split()
	P.append(int(p))
	S.append(s)

collect=[0]*N
miss = [0]*N

for a in range(M):
	if S[a] == "AC":
		if collect[P[a]-1] != 1:
			collect[P[a]-1] += 1
	else:
		if collect[P[a]-1] != 1:
			miss[P[a]-1] += 1

AC = sum(collect)
WA = 0
for a in range(N):
	if collect[a] == 1:
		WA += miss[a]


print(AC, WA)
def main():
    n, m = map(int, input().split())
    ab = [input().split() for _ in [0]*m]
    cnt = 0
    ac_list = [False]*n
    cnt_list = [0]*n
    for a, b in ab:
        if b == "WA":
            cnt_list[int(a)-1] += 1
        else:
            if ac_list[int(a)-1] == False:
                cnt += cnt_list[int(a)-1]
                ac_list[int(a)-1] = True
    print(sum(ac_list), cnt)


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

acline = [0]*n
wanum = [0]*n

for i in range(m):
    num, acwa = map(str, input().split())
    
    num = int(num) -1
    
    if acwa == "AC":
        acline[num] = 1
    else:
        if acline[num] == 1:
            continue
        else:
            wanum[num] += 1
            
for j in range(n):
    if acline[j] == 0:
        wanum[j] = 0
            
print(sum(acline), sum(wanum))
n,m = map(int,input().split())
A = []
for _ in range(m):
    a,b = input().split()
    tmp = [int(a),b]
    A.append(tmp)
dict = {}
for a in A:
    dict.update({a[0]:[False,0]})
for a in A:
    if dict[a[0]][0] == False:
        if a[1] == "WA":
            dict[a[0]][1] += 1
        else:
            dict[a[0]][0] = True
wa = 0
ac = 0
for i in dict:
    if dict[i][0]:
        ac += 1
        wa += dict[i][1]
print("{} {}".format(ac,wa))
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== "AC":
		ac[p] = 1
	else:
		if ac[p]==0:
			wa[p]+=1

for i in range(n+1):
	if ac[i]==0:
		wa[i]=0
        
print(sum(ac),sum(wa))
N, M = [int(_) for _ in input().split()]

A = [0 for _ in range(N+1)]
ac, wa = 0, 0

for _ in range(M):
    p, S = input().split()
    p = int(p)
    if A[p] != None:
        if S == "AC":
            ac += 1
            wa += A[p]
            A[p] = None
        else:
            A[p] += 1
print(ac, wa)
n,m=map(int,input().split())
use=[0]*n
pen=[0]*n
ans=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=="AC":
        if use[p]==0:
            use[p]=1
            ans+=1
    else:
        if use[p]==0:
            pen[p]+=1
pe=0
for i in range(n):
    pe+=use[i]*pen[i]
print(ans,pe)
N,M = map(int,input().split())
ac = (N+1)*[0]
wa = (N+1)*[0]
pt = 0
for i in range(M):
  p,s = input().split()
  p = int(p)
  if ac[p] == 0 and s == "AC":
    ac[p] = 1
    pt += wa[p]
  wa[p] += 1
print(sum(ac),pt)
n,m = map(int,input().split())
pen_list = [0 for i in range(n)]
pen_num = 0
ans_num = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if pen_list[p-1] != -1:
            pen_list[p-1] += 1
    else:
        if pen_list[p - 1] != -1:
            pen_num = pen_num + pen_list[p-1]
            pen_list[p-1] = -1
            ans_num = ans_num + 1
print(ans_num, pen_num)
import sys
from collections import defaultdict

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

wa=defaultdict(lambda: 0)
already=set()
ac = 0
for line in sys.stdin:
  p, s = line.split()
  p = int(p)
  if p in already:
    continue

  if s == "AC":
    ac+=1
    already.add(p)
  else:
    wa[p] += 1

print(ac, sum(wa[i] for i in already))
N,M=map(int,input().split())
PS=[list(input().split()) for _ in range(M)]
wa=[0]*(N+1)
ac=[0]*(N+1)
ac_cnt=set()
for ps in PS:
    if ps[1]=='AC':
        ac_cnt.add(ps[0])
        ac[int(ps[0])]=1
    if ps[1]=='WA' and ac[int(ps[0])]==0:
        wa[int(ps[0])]+=1
for i in range(1,N+1):
    if str(i) not in ac_cnt:
        wa[i]=0
print(sum(ac),sum(wa))
N, M = map(int, input().split())

baselis = []

for _ in range(M):
    temp = [x for x in input().split()]
    baselis.append(temp)

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

for i in range(M):
    result = baselis[i][1]
    question = int(baselis[i][0])

    if result == 'AC' and ac[question] == 0:
        ac[question] = 1
    elif result == 'WA' and ac[question] == 0:
        wa[question] += 1

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

print(sum(ac), sum(wa))
N, M = map(int, input().split())
AC_or_not = [False] * N
n_penalty = [0] * N
cnt_ac = 0
cnt_pen = 0

for _ in range(M):
    prob, wa_ac = input().split()
    prob = int(prob) - 1
    if wa_ac == 'AC':
        if not AC_or_not[prob]:
            cnt_pen += n_penalty[prob]
            cnt_ac += 1
            AC_or_not[prob] = True
    else:
            n_penalty[prob] += 1

print(cnt_ac ,cnt_pen)
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
tmp = 0
flag = False
for j in range(N):
    tmp = 0
    for k in ans[j]:
        if k == "WA":
            tmp += 1
        else:
            ac += 1
            pe += tmp
            tmp = 0
            break
print(ac,pe)
N,M=map(int,input().split())
Accepted=[0]*N
Penalty=[0]*N
for i in range(M):
    p,S=input().split()
    p=int(p)
    if Accepted[p-1]==0 and S=="WA":
        Penalty[p-1]+=1
    elif Accepted[p-1]==0 and S=="AC":
        Accepted[p-1]=1
total_Accepted=sum(Accepted)
total_Penalty=0
for i in range(N):
  if Accepted[i-1]==1:
    total_Penalty+=Penalty[i-1]
print(total_Accepted,total_Penalty)
params = input().split(' ')
m = eval(params[0])
n = eval(params[1])

penaltyCount = []

for i in range(m):
    penaltyCount.append(0)

penalties = 0
points = 0

for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])-1
    status = submission[1]
    
    if penaltyCount[p] == -1:
        continue

    if status == 'AC':
        penalties += penaltyCount[p]
        penaltyCount[p] = -1
        points += 1
    else:
        penaltyCount[p] += 1


print(points, penalties)
n,m = map(int,input().split())
d = {}
for i in range(m):
  p,s = input().split()
  if p not in d:
    d[p] = [s]
  else:
    d[p].append(s)

wa_c = 0
ac_c = 0
for k in d.keys():
  target = d[k]
  if target.count("AC") != 0:
    ind = d[k].index("AC")
    ac_c += 1
    wa_c += target[:ind].count("WA")
print(ac_c,wa_c)
n,m=map(int,input().split())

if m == 0:
  print(0,0)
  exit(0)

results=[]
for i in range(n+1):
  results.append([0,0])
  
ac = 0
wa = 0
memo = [0]*(n+1)
for i in range(m):
  p,s=input().split()
  p = int(p)
  s = s.strip()

  if memo[p] != -1:
    if s == 'WA':
      memo[p] += 1
    else:
      ac += 1
      wa += memo[p]
      memo[p] = -1

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

P = []
S = []

clear = 0

q = {}
c = set()

for i in range(M):
    sss = input().split(" ")
    p = int(sss[0])
    s = sss[1]
    P.append(p)
    S.append(s)

    if p not in c:
        if s == "AC":
            clear += 1
            c.add(p)

        if s == "WA":
            q[p] = q.get(p, 0) + 1

warng = sum([
    q[k]
    for k in c
    if k in q
])

print("{} {}".format(clear, warng))
import numpy as np
 
N, M = map(int, input().split())
 
suc = [0 for i in range(N+1)]
pen = [0 for i in range(N+1)]
 
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == "WA" and suc[p] == 0:
        pen[p] += 1
    elif s == "AC":
        suc[p] = 1

for i in range(N+1):
    if suc[i] == 0:
        pen[i] = 0

print( sum(suc), sum(pen) )
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, M = inpl()
AC = [False]*N
WA = [0]*N
for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        AC[p-1] = True
    else:
        if not AC[p-1]:
            WA[p-1] += 1
ans = 0
acs = 0
pens = 0
for i in range(N):
    if AC[i]:
        acs += 1
        pens += WA[i]
print(acs, pens)
from collections import OrderedDict
N, M = map(int, input().split())

correct = set()
wrong = OrderedDict()

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

print(len(correct), sum([wrong[pn] for pn in correct]))
n,m =list(map(int,input().split()))
ac = [0]*n
wa = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if ac[p]: continue
    if s == "AC":
        ac[p] = 1

    elif s == "WA":
        wa[p]+=1
AC = 0
pena = 0

for i in range (n):
    AC += ac[i]
    if ac[i]: pena += wa[i]
print(str(AC)+" "+str(pena))
N, M = map(int, input().split())

ok, ng = (0, 0)
oks = set()
ngdict = dict()
for _ in range(M):
    pp, S = input().split()
    p = int(pp)
    if p in oks:
        continue
    if S == 'AC':
        ok += 1
        ng += ngdict.get(pp, 0)
        oks.add(p)
    else:
        ngdict[pp] = ngdict.get(pp, 0) + 1

print('{} {}'.format(ok, ng))
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]+=s>'V'
print(len(a)-1,w)
N,M=map(int,input().split())
T=[]
frag=[0 for y in range(N)]
p=[0 for y in range(N)]
a=0
for i in range(M):
  s=list(map(str,input().split()))
  T.append(s)
for i in range(M):
  if T[i][1]=='WA' and frag[int(T[i][0])-1]==0:
    p[int(T[i][0])-1]=p[int(T[i][0])-1]+1
  elif T[i][1]=='AC' and frag[int(T[i][0])-1]==0:
    a=a+1
    frag[int(T[i][0])-1]=1
for i in range(N):
  if frag[i]==0:
    p[i]=0
print(a,sum(p))
N, M = map(int, input().split())

ac = [0] * N
wa = [0] * N

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

count_ac = count_wa = 0
check_ac = [0] * n
wa_p_i = [0] * n

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

    if s == "AC":
        if check_ac[now] == 0:
            count_ac += 1
            check_ac[now] = 1
            count_wa += wa_p_i[now]
    elif s == "WA":
        wa_p_i[now] += 1

print(count_ac, count_wa)
from collections import OrderedDict
n, m = map(int,input().split())

aclist = [0]*n
walist = [0]*n
ac = 0
wa = 0
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC' and not aclist[p]:
    aclist[p] = 1
    ac += 1
    wa += walist[p]
  else:
    walist[p] += 1
  

print(ac, wa)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np


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

    AC = np.array([0] * N)
    WA = np.array([0] * N)

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

        if AC[int(p) - 1] == 0 and S == 'WA':
            WA[int(p) - 1] += 1
        else:
            AC[int(p) - 1] = 1
    print(sum(AC), sum(AC * WA))


if __name__ == "__main__":
    main()
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(m):
  p,s=input().split()
  p=int(p)-1
  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())
P = []
S = []
T = [0 for i in range(N)]
U = [0 for i in range(N)]
ACs = 0
WAs = 0
for i in range(M):
  p, s = input().split()
  p = int(p)
  P.append(p)
  S.append(s)
for i in range(M):
  if S[i] == "AC":
    if U[P[i]-1] != 1:
      U[P[i]-1] += 1
      ACs += 1
      WAs += T[P[i]-1]
  else:
    T[P[i]-1] += 1
print(ACs, WAs)
n,m=map(int,input().split())
l=[]
for i in range(m):
    a=list(input().split())
    a.append(i)
    l.append(a)

l.sort(key=lambda x:(x[0],x[2]))

f=""
q=""
a=0
w=0

for i in range(m):
    if l[i][0] != f:
        ww=0
    if l[i][1] == "AC":
        if l[i][0] != q:
            a+=1
            w+=ww
            q=l[i][0]
    else:
        ww+=1
    
    f=l[i][0]

print(a,w)
n, m = map(int, input().split())
scores = []
for _ in range(m):
    num, r = input().split()
    scores.append([num, r])

answers = [0] * (n + 1)
penalties = [0] * (n + 1)
ac = set()
for num, r in scores:
    n = int(num)
    if r == 'AC':
        answers[n] = 1
        ac.add(n)
    elif r == 'WA' and answers[n] == 0:
        penalties[n] += 1

ans = sum(answers)
p = 0
for a in ac:
    p += penalties[a]

print(ans, p)
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
acs = [0]*n
was = [0]*n
for X in inputs[1:]:
    p, s = X.split()
    p = (int(p)-1)
    if acs[p] == 0:
        if s == 'AC':
            acs[p] = 1
        else:
            was[p] += 1

print(*[sum(acs), sum(w for a, w in zip(acs, was) if a)])