Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
a=0
w=0
for i in range(m):
    l=input().split()
    if ac.count(l[0])==0:
        if l[1]=='AC':
            ac.append(l[0])
            a+=1
        else:
            w+=1
    if a==n:
        break
print(a,w)

Submission status: Wrong Answer

Solution code:

N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: int(x[0]))

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while M > scan:
        #print(N,M,scan)
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
cor, pen = 0, 0
for _ in range(m):
    li = input().split()
    p.append(int(li[0]))
    s.append(li[1])
for j in range(n):
    corFlag = False
    for i in range(m):
        if (p[i] == j + 1):
            if (s[i] == 'WA' and (not corFlag)):
                pen += 1
            else:
                cor += 1
                corFlag = True
print(cor, pen)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=["0"]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]=="0":
        if SI=="WA" :
            Wsum=Wsum+1
        elif SI=="AC" :
            ACCNT[iii]=1
            Asum=Asum+1

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
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 list_Flag[a-1] == 1:
      pass
  else:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
    else:
      pass
WA=sum(list_WA)
AC=sum(list_Flag)
ans=[AC,WA]
print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())


correct = [0] * (n+1)
wrong = [0] * (n+1)



for _ in range(m):
    problem,result_text = input().split()
    problem = int(problem)
    
    if result_text == "AC":
        correct[problem]=1
        
    
    if result_text == "WA":
        if correct[problem] == 0:
            wrong[problem] += 1
    

for _ in range(m):
    if correct[problem] == 0:
        wrong[problem] = 0



print ( sum(correct), sum(wrong) )

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
a=0
w=0
for i in range(m):
    l=input().split()
    if l[1]=='AC' and ac.count(l[0])==0:
        ac.append(l[0])
        a+=1
    elif l[1]=='WA' and ac.count(l[0])==0:
        w+=1
print(a,w)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=[0]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]==0:
        if SI=="WA" :
            Wsum=Wsum+1
        elif SI=="AC" :
            ACCNT[iii]=1
            Asum=Asum+1

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n,m = map(int,input().split())
ac = wa = wa_another = 0
p_list = []

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

    if s == "WA":
        if not p in p_list:
            wa_another += 1
        else:
            wa += 1

    
    if (s == "AC") and (not p in p_list):
        ac += 1
        wa += wa_another
        wa_another = 0
        p_list.append(p)

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**5+100)
acl=[0]*(10**5+100)
wacnt=0
for i in range(m):
	p[i],s[i]=map(str, input().split())

for i in range(m):
	if s[i]=="WA" and acl[int(p[i])]==0:
		wacnt+=1
	if s[i]=="AC" and acl[int(p[i])]==0:
		acl[int(p[i])]=1
		wal[int(p[i])]=wacnt
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
wa={}
ac=[]
key=[]
for i in range(M):
    p,s=input().split()
    if p not in ac:
        
        if s=="WA":
            if s not in key:
                wa[p]=1
                key.append(p)
            else:
                wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in ac:
    if i in key:
        ans+=wa[i]
print(len(ac),ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())

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

for _ in range(M):
    p, s = input().split()
    p = int(p)
    
    if isAC[p] == 1: continue
    if s == 'AC':
        isAC[p] += 1
    elif s == 'WA':
        isWA[p] += 1

print("%d %d"%(sum(isAC[1:]), sum(isWA[1:])))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())


correct = [0] * (n+1)
wrong = [0] * (n+1)



for _ in range(m):
    problem,result_text = input().split()
    problem = int(problem)
    
    if result_text == "AC":
        correct[problem]=1
        
    
    if result_text == "WA":
        if correct[problem] == 0:
            wrong[problem] += 1
    


print ( sum(correct), sum(wrong) )

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())

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

for _ in range(M):
    p, s = input().split()
    p = int(p)
    
    if isAC[p] == 1: continue
    if s == 'AC':
        isAC[p] += 1
    elif s == 'WA':
        isWA[p] += 1

print("%d %d"%(sum(isAC), sum(isWA)))

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
wa={}
ac=[]
key=[]
for i in range(M):
    p,s=input().split()
    if p not in ac:
        if s=="WA":
            if s not in key:
                wa[p]=0
                key.append(p)
            else:
                wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in ac:
    if i in key:
        ans+=wa[i]
print(len(ac),ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
L = []
for i in range(M):
    L.append(list(map(str,input().split())))
count_AC = 0
count_WA = 0
temp = 0
flag = 'WA'
p = 0

for i in range(M):
    #print(L[i])
    if L[i][0] != p:
        p = L[i][0]
        temp = 0
        flag = 'WA'
        if L[i][1] == 'WA':
            temp += 1
        else:
            count_AC += 1
            flag = 'AC'
    else:
        if L[i][1] == 'WA':
            temp += 1
        else:
            if flag == 'WA':
                count_AC += 1
                count_WA += temp
                flag = 'AC'
            else:
                pass
            
    #print(temp, count_AC, count_WA)

print('{} {}'.format(count_AC, count_WA))

Submission status: Wrong Answer

Solution code:


N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while M > scan:
        #print(N,M,scan)
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac_l=[]
l=[]
cnt1=0
cnt2=0
for i in range(m):
	s,p=input().split()
	if p=="AC" and s not in ac_l:
			ac_l.append(s)
			cnt1+=1
	elif p=="WA" and s not in ac_l:
			cnt2+=1
print("{} {}".format(cnt1,cnt2))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
s = [0] * M
wcount = 0
acount = 0
k=0
for i in range(M):
    p[i], s[i] = map(str, input().split())
while k <M:
    if s[k]=="WA":
        wcount+=1
    elif s[k]=="AC":
        acount+=1
        while True:
            if k+1==M:
                break
            elif p[k]==p[k+1]:
                k+=1
            else:
                break
    k+=1
print(acount,wcount)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [0] * N  # 正解済みは1
ac, penalty = 0, 0

for _ in range(M):
    # 読み込み
    p, S = input().split()
    p = int(p)
    if P[p-1] == 1:
        # すでに正解済みの場合は何もしない
        continue
    elif S == "WA":
        # 未正解で WA
        penalty += 1
    else:
        # 未正解で AC
        ac += 1
        P[p-1] = 1
print(ac, penalty)

Submission status: Wrong Answer

Solution code:
import numpy as np
DEB = True
N,M = map(int, input().split())
res = np.zeros((105000,2), dtype=np.int16)

for i in range(M):
    p, s = input().split()
    p = int(p)
    if res[p][0] == 0:
        if s == 'AC':
            res[p][0] += 1
        elif s == 'WA':
            res[p][1] += 1
    
#if DEB:
#    for r in res:
#        print(r)

print("%d %d"%(res[1:,0].sum(), res[1:,1].sum()))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[input().split() for i in range(m)]
a=[0 for i in range(n)]
p=[0 for i in range(n)]
for i in range(m):
  if l[i][1]=='AC':
    a[int(l[i][0])-1]=1
  else:
    if a[int(l[i][0])-1]!=1:
      p[int(l[i][0])-1]+=1
print(sum(a),sum(p))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# INPUT
n,m = list(map(int, input().split()))

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

for i in range(m):
    
    if len(finished) == n:
        break

    s = input().split()

    if finished[int(s[0])] == 0:
        if s[1] != "AC":
                wa = wa + 1
        else:
                finished[int(s[0])] = 1
                ac = ac + 1

print("{0} {1}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = []
wrong = 0
for j in range(N):
    right.append(0)
for k in range(M):
    if right[p[k] - 1] == 0:
        if S[k] == 'WA':
            wrong += 1
        elif S[k] == 'AC':
            right[p[k] - 1] += 1
print(str(sum(right)) + ' ' + str(wrong))

Submission status: Wrong Answer

Solution code:
# ABC151 C

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

AC = [0] * N
WA = 0

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

print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:


N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    for i in range(scan,M):
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

cw = 0
ca = 0
d = {}
for i in range(m):
    p, s = input().split()
    if d.get(p) == "AC":
        continue
    if s == "WA":
        cw += 1
    else:
        ca += 1
    d[p] = s

print(ca, cw)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=[0]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if SI=="WA" and ACCNT[iii]==0:
        Wsum=Wsum+1
    elif SI=="AC" and ACCNT[iii]==0:
        ACCNT[iii]=1
        Asum=Asum+1

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())

pn_num=0
AC_list=[0]*N

for _ in range(M):
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        AC_list[pi-1]=1
    
    else:
        if AC_list[pi-1]==0:
            pn_num+=1
    
print(sum(AC_list),pn_num)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))

a = [0]*(n+10)
w = [0]*(n+10)

for i in range(0, m):
    p, s = input().split()
    p = int(p)
    if ((s == "AC")&(a[p] == 0)):
        a[p] += 1
    if ((s == "WA")&(a[p] == 0)):
        w[p] += 1
ac = 0
wa = 0
for i in range(0, n+10):
    ac += a[i]
    if a[i]==1:
        wa += w[i]
print(n)
print(a)
print(w)
print(str(ac)+" "+str(wa))

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N = a[0]
M = a[1]

list = []
for i in range(M):
  a,b=input().split()
  list.append((int(a), b))

bool_ac = []
ac_sum = 0
wa = []
wa_sum = 0
for i in range(N):
  bool_ac.append(0)
  wa.append(0)


for i in range(M):
  j = list[i][0] - 1
  if list[i][1] == "AC":
    bool_ac[j] = 1
    ac_sum += 1
    wa_sum += wa[j]
  elif list[i][1] == "WA":
    if bool_ac[j] == 0:
      wa[j] += 1

print(ac_sum, end=" "), print(wa_sum)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
 
aclist = [0]*n
walist = [0]*n
 
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC':
    if not aclist[p]:
      aclist[p] = 1
  else:
    if not aclist[p]:
      walist[p] += 1
  
 
print(sum(aclist), sum(walist))

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

n, m = input().split()
i = [input() for i in range(int(m))]

n_l = [0] * int(n)
w_l = [0] * int(n)
p_l = []

for i_s in i:
    p, c = i_s.split()
    p = int(p) - 1
    if n_l[p] == 1:
        continue

    if p not in p_l:
        p_l.append(p)

    if c == "AC":
        n_l[p] = 1
    else:
        w_l[p] += 1

n_l = np.array(n_l)
w_l = np.array(w_l)
w_l = w_l[w_l == n_l]

print("{} {}".format((n_l==1).sum(), w_l.sum()))

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
ac,wa=0,0
if m==0:
    print(ac,wa)
else: #一度飛ばして新たな問題を解いたうえで戻ってくる場合があるのか？
    l=[0]*n
    for i in range(m):
        pa,s=map(str, input().split())
        p=int(pa)
        if l[p-1]==0 and s=='AC': #初正解時の処理
            l[p-1]=1
            ac+=1
        elif l[p-1]==0 and s=='WA': #未正解で誤答時の処理
            wa+=1
        else:
            continue
    print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = []
S = []
for i in range(M):
    p1,S1=[i for i in input().split()]
    p.append(p1)
    S.append(S1)
a = 0
b = 0
c = 0

for j in range(N):
    for k in range(M):
        if int(p[k]) == j+1:
            if S[k] == 'WA':
                b += 1
            elif S[k] == 'AC':
                a += 1
                c = c + b
                break
print(a,c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans1 = 0
ans2 = 0
preans2 = 0
check = 0
t = []
pret = []

for i in range(m):
  pret = list(map(str, input().split()))
  t.append(pret)
  
for i in range(m):
  if i > 0:
    if t[i][0] != t[i-1][0]:
      check = 0
  if t[i][1] == "WA":
    if check == 0:
      preans2 += 1
  else:
    if check == 0:
      ans1 += 1
      ans2 += preans2
      preans2 = 0
      check += 1
      
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
WA = 0
AC = [0 for i in range(n)] 

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

print(AC.count(1), WA)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
 
aclist = [0]*(n + 1)
walist = [0]*(n + 1)
acflag = [False]*(n + 1)
 
for i in range(m):
  pp, s = input().split()
  p = int(pp)
  if s == 'AC':
    if not acflag[p]:
      aclist[p] += 1
      acflag[p] = True
  else:
    if not acflag[p]:
      walist[p] += 1
  
 
print(sum(aclist), sum(walist))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())

pn_num=0
WA_list=[0]*N
AC_list=[0]*N

for _ in range(M):
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        pn_num+=WA_list[pi-1]
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

cmp = 0
pnt = 0
tmp = 0

for _ in range(M):
    p, s = map(str, input().split())
    if not(tmp == int(p)) and s == 'AC':
      tmp = int(p)
      cmp+=1
    elif s == 'WA' and N > cmp:
      pnt+=1

print(cmp,pnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = {}
WA = []
wa = 0
ac = 0
for i in range(m):
    p, s = input().split()
    if p not in l:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            WA.append(wa)
            wa = 0
            l[p] = "AC"
#print(l)
print(ac, sum(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    for i in range(scan,M):
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

Solution code:
N,M= map(int,input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]
for i in range(M):
    p, s = input().split()
    if s == "WA" and S[int(p)] != 1:P[int(p)] += 1
    if s == "AC":S[int(p)] = 1
for i in range(N):
    if S[i] == 0:P[i] = 0
print(sum(S),sum(P))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
WA = [0 for i in range(n)] 
AC = [0 for i in range(n)] 

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

print(AC.count(1), sum(WA))

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
 
aclist = [0]*n
walist = [0]*n
acflag = [False]*n
 
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC':
    if acflag[p]:
      pass
    else:
      aclist[p] += 1
      acflag[p] = True
  else:
    if acflag[p]:
      pass
    else:
      walist[p] += 1
  
 
print(sum(aclist), sum(walist))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))

p = [0] * M
S = [''] * M


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

dp = [[0] * 2 for i in range(N)]  # x問目の、score, 正答までのwrong_ans

for i in range(M):
    num = p[i] - 1
    # 未得点のときだけ影響
    if(dp[num][0] >= 1):
        continue

    if(S[i] == 'WA'):
        dp[num][1] += 1

    elif(S[i] == 'AC'):
        dp[num][0] += 1

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
total = []
pena = 0
ok = 0
for i in range(M):
    a,b = map(str,input().split())
    if b=='AC' and not a in total:
        ok+=1
        total.append(a)
    elif b=='WA' and not a in total:
        pena+=1
print(str(ok)+' '+str(pena))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())

AC=[]
WA=[]
for i in range(M):
  p,s=input().split()
  if s=='AC':
    if not p in AC:
      AC.append(p)
  else:
    if not (p in WA and p in AC):
      WA.append(p)

print(len(AC),len(WA))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))

p = [0] * M
S = [''] * M


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

dp = [[0] * 2 for i in range(N)]  # x問目の、score, 正答までのwrong_ans
#dp = [[0] * 2 for i in range(100005)]  # x問目の、score, penalty

for i in range(M):
    num = p[i] - 1
    # 未得点のときだけ影響
    if(dp[num][0] >= 1):
        continue

    if(S[i] == 'WA'):
        dp[num][1] += 1

    elif(S[i] == 'AC'):
             dp[num][0] += 1

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)

Submission status: Wrong Answer

Solution code:
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
        else:
            b[int(s[0])] += 1

print(sum(a), sum(b))

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
ac,wa=0,0
if m==0:
    print(ac,wa)
else: #一度飛ばして新たな問題を解いたうえで戻ってくる場合があるのか？
    l=[0]*n
    for i in range(m): #入力処理、各提出の問題番号と結果を拾った
        pa,s=map(str, input().split())
        p=int(pa)
        if l[p-1]!=1 and s=='AC': #初正解時の処理
            l[p-1]=1
            ac+=1
        elif l[p-1]!=1 and s=='WA': #誤答時の処理
            wa+=1
        else:
            continue
    print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
wa={i:0 for i in range(1,a+1)}
ac={i:0 for i in range(1,a+1)}
g=0
pe=0
if b==0:
    print("0 0")
    g=1
for i in range(b):
    c,d=input().split()
    
    if d=="WA" and ac[int(c)]==0:
        wa[int(c)]+=1
        
    if d=="AC" and ac[int(c)]==1:
        pe+=wa[int(c)]
    if d=="AC" and ac[int(c)]==0:
        ac[int(c)]=1
        
f=0
h=0
if g==0:
    
    print(str(sum(ac.values()))+" "+str(pe))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p, s = [], []
cor, pen = 0, 0
for _ in range(m):
    li = input().split()
    p.append(int(li[0]))
    s.append(li[1])
for j in range(n):
    for i in range(m):
        if (p[i] == j + 1):
            if (s[i] == 'WA'):
                pen += 1
            else:
                cor += 1
                break
print(cor, pen)

Submission status: Wrong Answer

Solution code:
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
    else:
        break

lwa = [x * y for x, y in zip(lac, lwa)]
print(sum(lac), sum(lwa))

Submission status: Wrong Answer

Solution code:
# ABC151 C

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

AC = [0] * N
WA = [0] * N

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

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
sum_ok,sum_miss=0,0
former_ok=[0]*n
for i in range(m):
    p, s=input().split()
    p=int(p)
    if p not in former_ok:
        if s == 'AC':
            former_ok[sum_ok] = p
            sum_ok += 1
            if sum_ok == n:
                break
        else:
            sum_miss += 1

print(sum_ok, sum_miss)

Submission status: Wrong Answer

Solution code:
from itertools import groupby
N, M  =map(int, input().split())
ps = [[] for i in range(M)]
for i in range(M):
    ps[i] = list(input().split())
if M == 0:
    print(0,0)
    exit()
newps = sorted(ps,key=lambda i:i[0]) 
newpslist = list([list(g) for k, g in groupby(newps, key = lambda i:i[0])])
countAC = 0
counterror = 0
for group in newpslist:
    for subgroup in group:
        if subgroup[1] == 'WA':
            counterror += 1
        else:
            countAC += 1
            break    
print(countAC, counterror)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
WA = [0 for i in range(n)] 
AC = [0 for i in range(n)] 

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

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=[0]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    for ii in range(N):
        if int(PI)==ii+1:
            if SI=="WA" and ACCNT[ii]!=1:
                Wsum=Wsum+1
            elif SI=="AC":
                ACCNT[ii]=1
                Asum=Asum+1

print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())

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

for _ in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if AC[p]:
        continue
    if s == "WA":
        WA_cnt[p] += 1
    else:
        AC[p] = True

penal = sum(WA_cnt)
ac = sum(AC)
print(ac, penal)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[]
s=[]
for i in range(M):
    n,a=input().split()
    p.append(int(n))
    s.append(a)

k=[]
l=[]

for i in range(M):
  if s[i]=="AC":
     k.append(p[i])
  else:
     l.append(p[i])

print(len((list(set(k)))))
print(len(l))

Submission status: Wrong Answer

Solution code:
def solve():
    N,M=map(int,input().split())
    A=[]
    ansAC=0
    ansWA=0
    for i in range(M):
        x,y=input().split()
        if y=="AC":
            if x in A:
                continue
            else:
                ansAC+=1
                A.append(x)
        elif y=="WA":
            if x in A:
                continue
            else:
                ansWA+=1
    print(ansAC,ansWA)
solve()

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())

aclist = [0]*(n + 1)
walist = [0]*(n + 1)
acflag = [False]*(n + 1)

for i in range(m):
  pp, s = input().split()
  p = int(pp)
  if s == 'AC':
    if acflag[p]:
      pass
    else:
      aclist[p] += 1
      acflag[p] = True
  else:
    if acflag[p]:
      pass
    else:
      walist[p] += 1
  

print(sum(aclist), sum(walist))

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
string_list = [input() for i in range(s[1])]
AC_count = 0
WA_count = 0
AC_list = []

for ele in string_list:
    l = ele.split()
    if l[1] == "AC":
        if l[0] in AC_list:
            pass
        else:
            AC_list.append(l[0])
            AC_count = AC_count+1
    elif l[1] == "WA":
        # if not l[0] in AC_list:
        WA_count = WA_count+1

print(str(AC_count)+" "+str(WA_count))

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
string_list = [input() for i in range(s[1])]
AC_count = 0
WA_count = 0
AC_list = []

for ele in string_list:
    l = ele.split()
    if l[1] == "AC":
        if l[0] in AC_list:
            pass
        AC_list.append(l[0])
        AC_count = AC_count+1
    elif l[1] == "WA":
        # if not l[0] in AC_list:
        WA_count = WA_count+1

print(str(AC_count)+" "+str(WA_count))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

p = []
S = []
for i in range(M):
    a, b = input().split()
    p.append(int(a))
    S.append(b)

#print(N, M, p, S)
ac = 0
wa = 0
wa_a = 0

if M != 0:
    p_AC = []
    for i in range(M):#回答数
        if p[i] in p_AC:
            continue
        else:
            if S[i] == "WA":
                wa_a += 1
            if S[i] == "AC":
                ac += 1
                wa += wa_a
                wa_a = 0
                p_AC.append(p[i])

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
answerd = [0] * 100100
WA_count = 0
AC_count = 0
tmp_count = 0

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

    if s == 'WA' and answerd[p] == 0:
        WA_count += 1
        tmp_count += 1

    if s == 'AC' and answerd[p] == 0:
        AC_count += 1
        WA_count += tmp_count
        tmp_count = 0
        answerd[p] = 1

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n,m = map(int,input().split())
ac = wa = wa_another = 0
p_list = []

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

    if s == "WA":
        wa_another += 1
    elif (s == "AC") and (not p in p_list):
        ac += 1
        wa += wa_another
        wa_another = 0
        p_list.append(p)

print(ac,wa)

Submission status: Wrong Answer

Solution code:
P=[]
S=[]

N,M = map(int, input().split(' '))
for i in range(M):
    p,s=map(str,input().split(' '))
    P+=p
    S+=[s]    
P=[int(p) for p in P]

Q=[]
for i in range(N):
    Q+=[[]]

for i in range(M):
    for j in  range(N):
        if P[i] == j+1 :
            Q[j]+=[S[i]]
            
        
A=0
B=0
b=0

for  i in range(len(Q)):
    for j in range(len(Q[i])):
        b=0
        if Q[i][j]==[]:
            break
        elif Q[i][j]=='WA':
            b +=1
        elif Q[i][j]=='AC':
            A +=1
            B+=b
            break
            
print(A,B)