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:
import sys
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

for _ in range(M):
    p, s = sys.stdin.readline().split()
    p = int(p) - 1
    if s == "AC":
        ac[p] = 1
    else:
        if not ac[p]:
            wa[p] += 1
acnum = sum(ac)
wanum = sum(wa)
print(acnum, wanum)

Submission status: Wrong Answer

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

C={}
acc=0
wac=0
for i in range(m):
    p0,s = input().split()
    
    p = int(p0)
    if p in C :
        if C[p]!=-1:
            C[p]+=1
    else:
        C[p]=1

    if s=="AC" and C[p]!=-1:
        acc+=1
        C[p]=-1
    elif s=="WA" and C[p]!=-1:
        wac+=1

print( acc, wac )

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ps = [input().split() for _ in range(M)]
cnt_a = 0
cnt_w = 0
ans = []

for i in range(len(ps)):
    if ps[i][1] == 'WA':
        cnt_w += 1
    else:
        cnt_a += 1
        if cnt_a == N:
            break
            
print(str(cnt_a)+' '+str(cnt_w))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1
for i in range(N):
    if acs[i]==0:
        wa[i]=0
ans=[sum(acs),sum(wa)]

Submission status: Wrong Answer

Solution code:

N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1

ans=[sum(acs),sum(wa)]
print(*ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]=1

ans=[sum(acs),sum(wa)]
print(*ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[0]*n
wa=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA" and a[p-1]==0:
        wa+=1
    elif s=="AC" and a[p-1]==0:
        a[p-1]+=1
print(a.count(1),wa)

Submission status: Wrong Answer

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

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

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

  if s == "AC":
    if not ac_list[p]:
      ac_list[p] = True
      ac += 1
  else:
    if not ac_list[p]:
      wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

AC=[0]*(N+1)
WA=[0]*(N+1)
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if AC[p]==0:
       if s=='AC':
            AC[p]=1
       else:
            WA[p]+=1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

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

AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=='AC':
        if AC[p]<=0:
            AC[p]=1
    else:
        if AC[p]<=0:
            WA[p]+=1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

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

ACF=[0]*(N+1)
ac=wa=0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=='AC':
        if ACF[p]==0:
            ACF[p]=1
            ac+=1
    else:
        if ACF[p]==0:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
f=lambda:map(int,input().split())
N,M=f()
P=[0]*M
P=[list(input().split()) for i in range(M)]

P=sorted(P, key=lambda x: x[0])

prv=0
ac=wa=0
acflg=True
for p,s in P:
    if s=='AC':
        if prv!=p:# 新しい番号の開始
            prv=p
            acflg=True
            ac+=1;acflg=False
        else:
            if acflg:ac+=1;acflg=False
            # 同じ番号で、acflg=Falseなら無視
    else:
        if prv!=p: # 新しい番号の開始
            prv=p
            acflg=True
            wa+=1
        else: # WAカウントする。
            if acflg:wa+=1
            # 同じ番号で、acflg=Falseなら無視
print(ac,wa)

Submission status: Wrong Answer

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

prv=0
ac=wa=0
acflg=True
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=='AC':
        if prv!=p:# 新しい番号の開始
            prv=p
            acflg=True
            ac+=1;acflg=False
        else:
            if acflg:ac+=1;acflg=False
            # 同じ番号で、acflg=Falseなら無視
    else:
        if prv!=p: # 新しい番号の開始
            prv=p
            acflg=True
            wa+=1
        else: # WAカウントする。
            if acflg:wa+=1
            # 同じ番号で、acflg=Falseなら無視
print(ac,wa)

Submission status: Wrong Answer

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

prv=0
ac=wa=0
acflg=True
for i in range(M):
    p,s=input().split()
    p=int(p)
    if prv!=p: # 新しい番号の開始
        prv=p
        acflg=True
        if s=='AC': # カウントするのは一回
            ac+=1
            acflg=False
        else: # WAカウントする。
            wa+=1
    else: # おなじP番号の処理
        if acflg: # まだACがでていない
            if s=='AC':
                ac+=1
                acflg=False
            else:
                wa+=1
        # その他は無視
print(ac,wa)

Submission status: Wrong Answer

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

P=[0]*M
prv=0
ac=wa=0
acflg=True
for i in range(M):
    p,s=input().split()
    if prv!=p: # 新しい番号の開始
        prv=p
        acflg=True
        if s=='AC': # カウントするのは一回
            ac+=1
            acflg=False
        else: # WAカウントする。ただしACが出ていたら無視
            wa+=1
    else: # おなじP番号の処理
        if acflg: # まだACがでていない
            if s=='AC':
                ac+=1
                acflg=False
            else:
                wa+=1
        # その他は無視
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [0,0]
AC = N*[0]

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

print(*A)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = (N+1)*[0]
ans = [0,0]

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

print(*ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = (N+1)*[0]
ans = [0,0]

for m in range(M):
  P,S = input().split()
  P = int(P)
  if A[P]==0 and S=="AC":
    ans[0]+=1
    A[P]+=1
  elif A[P]==0 and S=="WA":
    ans[1]+=1

print(*ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
acu = 0
pen = 0
queli = []
sucqueli = []

for i in range(m):
  c_q, result = map(str, input().split())
  if int(c_q) not in queli:
    queli.append(int(c_q))
  if result == "AC" and int(c_q) not in sucqueli:
    sucqueli.append(int(c_q))
    acu += 1
  elif result == "WA" and int(c_q) not in sucqueli:
    pen+=1
print(acu, pen)

Submission status: Wrong Answer

Solution code:
import sys
input()
d={}
nc=np=0
for ln in sys.stdin:
    p,S=ln.split()
    if p not in d:
        d[p]=0
    if not d[p]:
        if S=='AC':
            d[p]=1
            nc+=1
        else:
            np+=1

print(nc,np)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [list(input().split()) for _ in range(M)]

dic = {}

ac = 0
wa = 0

for ps in PS:
    p = int(ps[0])
    s = ps[1]

    if not p in dic:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            dic[p] = True


print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(str, input().split())))
resList= [False]*N
res = 0
waList = [0]*N
for i in range(M):
  if resList[int(List[i][0])-1] == False:
    if List[i][1] == "AC":
      resList[int(List[i][0])-1] = True
    else:
      waList[int(List[i][0])-1] += 1

res = sum(waList)
print(resList.count(True),res)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(str, input().split())))
resList= [False]*N
res = 0
for i in range(M):
  if resList[int(List[i][0])-1] == False:
    if List[i][1] == "AC":
      resList[int(List[i][0])-1] = True
    else:
      res += 1
print(resList.count(True),res)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
pss = [list(input().split()) for _ in range(m)]

dic = {}
for p, s in pss:
    if p not in dic:
        dic[p] = (0, 0)
    ac, wa = dic[p]
    if ac == 0 and s == 'AC':
        dic[p] = (ac + 1, wa)
    elif ac == 0 and s == 'WA':
        dic[p] = (ac, wa + 1)

ac = sum(dic[k][0] for k in dic)
wa = sum(dic[k][1] for k in dic)
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result and result[p] == 'AC':
        continue
    if s == 'WA':
        wa += 1
        result[p] = s
    elif s == 'AC': # AC
        ac += 1
        result[p] = s
    
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
N, M = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result:
        if result[p] == 'AC':
            continue
    if s == 'WA':
        wa += 1
        result[p] = s
    else: # AC
        ac += 1
        result[p] = s
    
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
N, M = [int(s) for s in input().split()]
AC = [0] * 10**5

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

print(sum(AC), wa)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split()]
lst_ac = [False] * n
cnt_pena = 0
cnt_ca = 0
for i in range(m):
	n, m = [j for j in input().split()]
	n = int(n) - 1
	if lst_ac[n] == False and m == 'AC':
		lst_ac[n] = True
		cnt_ca += 1
	elif lst_ac[n] == False and m == 'WA':
		cnt_pena += 1
print(f'{cnt_ca} {cnt_pena}')

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

successes = [0] * N
penalties = [0] * N
for i in range(M):
    (p, s) = [n for n in input().split()]
    if s == 'AC':
        successes[int(p) - 1] = 1
    else:
        if successes[int(p) - 1] == 0:
            penalties[int(p) - 1] += 1

print('%s %s' % (sum(successes), sum(penalties)))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [list(input().split()) for _ in range(M)]
D_1 = {str(c):False for c in range(1, N+1)}
D_2 = {str(c):0 for c in range(1, N+1)}
for l in L:
  if l[1]=="WA" and D_1[l[0]]==False:
      D_2[l[0]] += 1 
  else:
    D_1[l[0]]=True
S_1 = sum(D_2[k] for k, v in D_2.items() if v)  
S_2 = sum(D_1.values())
print(S_2, S_1)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
L = [list(input().split()) for _ in range(M)]
D = {str(c):False for c in range(1, N+1)}
S = 0
for l in L:
  if l[1]=="WA" and D[l[0]]==False:
      S += 1 
  else:
    D[l[0]]=True
print(sum(D.values()), S)

Submission status: Wrong Answer

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

ac = [False] * N
cnt_ac = 0
cnt_wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p) - 1
  if s == "AC" and not ac[p]:
    cnt_ac += 1
    ac[p] = True
  if s == "WA" and not ac[p]:
    cnt_wa += 1

print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0] * 10**6
ac = [0] * 10**6
ans = 0
for i in range(m):
    str_p,str_m = map(str,input().split())
    p = int(str_p)
    if str_m =='WA':
        if ac[p] == 0:
            wa[p] += 1
    else:
        ac[p] = 1
        ans += wa[p]
print(sum(ac),ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0] * 10**6
ac = [0] * 10**6
for i in range(m):
    str_p,str_m = map(str,input().split())
    p = int(str_p)
    if str_m =='WA':
        if ac[p] == 0:
            wa[p] += 1
    else:
        ac[p] = 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0] * 10**6
ac = [0] * 10**6
for i in range(m):
    str_p,str_m = map(str,input().split())
    p = int(str_p)
    if str_m =='WA':
        if ac[p] == 0:
            wa[p] += 1
    if str_m == 'AC':
        ac[p] = 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0] + [0] * 10**5
ac = [0] + [0] * 10**5
for i in range(m):
    str_p,str_m = map(str,input().split())
    p = int(str_p)
    if str_m =='WA':
        if ac[p] == 0:
            wa[p] += 1
    if str_m == 'AC':
        ac[p] = 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
wa = [0] + [0] * 10**5
ac = [0] + [0] * 10**5
for i in range(m):
    str_p,str_m = map(str,input().split())
    p = int(str_p)
    if ac[p] == 0 and str_m =='WA':
        wa[p] += 1
    if str_m == 'AC':
        ac[p] = 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac = [False] * N
wa_cnt = 0
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p_i = int(p) - 1
    if s == 'WA':
        if not ac[p_i]:
            wa_cnt += 1
    else:
        if not ac[p_i]:
            ac[p_i] = True
            ac_cnt += 1

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    n,m = map(int, input().split())
    p_list = []
    ans_ac = 0
    ans_pn = 0
    for i in range (m):
        a,b=input().split()
        p_list.append((int(a), b))
        if i == 0:
            if p_list[i][1] == 'AC':
                ans_ac += 1
            elif p_list[i][1] == 'WA':
                ans_pn += 1
        elif p_list[i-1][0] == p_list[i][0]:
            if p_list[i-1][1] == 'WA' and p_list[i][1] == 'AC':
                ans_ac += 1
            elif p_list[i-1][1] != 'AC' and p_list[i][1] == 'WA':
                ans_pn += 1
        else:
            if p_list[i][1] == 'AC':
                ans_ac += 1
            elif p_list[i][1] == 'WA':
                ans_pn += 1
 
    print(ans_ac,ans_pn)
    
   
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

p = [0]*M
s = [0]*M
b = [0]*N
pena = 0
corr = 0

for i in range(M):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
    if s[i] == "AC":
        if b[p[i]-1] != -1:
            pena += b[p[i]-1]
            corr += 1
            b[p[i]-1] = -1
    else:
        b[p[i]-1] += 1

print(corr, pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ac = [0] * n
wa = [0] * n
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        ac[int(p) - 1] = 1
    elif ac[int(p) - 1] == 0:
        wa[int(p) - 1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac_list = [0 for i in range(n+1)]
p_list = []
ac = 0
pena = 0

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)
    if s == 'AC' and ac_list[p-1] != 1:
        ac += 1
        ac_list[p-1] = 1
    elif s == 'WA' and ac_list[p-1] != 1:
        pena += 1

print(ac, pena)

Submission status: Wrong Answer

Solution code:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
N,M = inputlist()
probs = [False]*(N+1)
count_wa = 0
count_ac = 0
for i in range(M):
    x,ret = input().split()
    x = int(x)
    if ret == "AC":
        if probs[x]:
            continue
        count_ac+=1
        probs[x] = True
    if ret == "WA":
        if probs[x]:
            continue
        count_wa+=1
print(count_ac,count_wa)

Submission status: Wrong Answer

Solution code:
n,m=[int(x) for x in input().split()]
Q=[0]*n
bad=0
for i in range(m):
  P,s=input().split()
  p=int(P)
  if s=="AC" and Q[p-1]==0:
    Q[p-1]=1
  elif s=="WA" and Q[p-1]==0:
    bad+=1
ok=sum(Q)
print(str(ok)+" "+str(bad))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
s = list(tuple(input().split()) for _ in range(k))
ss,cnt_ac,cnt_wa = sorted(list(set(s))), 0, 0
for i in ss:
  if i[1]=='AC':
    cnt_ac+=1
  elif i[1]=='WA':
    cnt_wa+=1
print(cnt_ac,'',cnt_wa)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
s = list(tuple(input().split()) for _ in range(k))
ss,prev,cnt_ac,cnt_wa = sorted(list(set(s))), -1, 0, 0
for i in ss:
  if i[1]=='AC':
    cnt_ac+=1
  else:
    cnt_wa+=1
print(cnt_ac,'',cnt_wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=0
L=[0 for _ in range(n)]
for i in range(m):
  num,s = input().split()
  num=int(num)-1
  if not L[num]:
    if s == "AC":
      L[num]=1
    else:
      p+=1
print(sum(L),p)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=0
p=0
L=[False for _ in range(n)]
for i in range(m):
  num,s = input().split()
  num=int(num)-1
  if not L[num]:
    if s == "AC":
      L[num]=True
      a+=1
    else:
      p+=1
print(a,p)

Submission status: Wrong Answer

Solution code:
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
flg = [True]*(n+1)
for i in range(m):
  p,s=input().split()
  p = int(p)
  s = s.strip()

  if flg[p] == True:
    if s == 'WA' and flg[p] == True:
      wa += 1
    else:
      ac += 1
      flg[p] = False

print(ac,wa)

Submission status: Wrong Answer

Solution code:
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])
  
for i in range(m):
  p,s=input().split()
  p = int(p)
  s = s.strip()

  if s == 'AC':
    results[p][1] = 1
  elif s == 'WA' and results[p][1] < 1:
    results[p][0] += 1

ac = 0
wa = 0
for i in range(1,n+1):
  ac += results[i][1]
  wa += results[i][0]
print(ac,wa)

Submission status: Wrong Answer

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

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

ps=[]
for _ in range(m):
  p,s=input().split()
  ps.append((int(p),s.strip()))

results=[]
for i in range(n+1):
  results.append([0,0])
  
for i in range(m):
  index = ps[i][0]
  result = ps[i][1]
  if result == 'WA' and results[index][1] == 0:
    results[index][0] += 1
  elif result == 'AC':
    results[index][1] = 1

ac = 0
wa = 0
for i in range(1,n+1):
  ac += results[i][1]
  wa += results[i][0]
print(ac,wa)

Submission status: Wrong Answer

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

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

ps=[]
for _ in range(m):
  p,s=input().split()
  ps.append((int(p),s.strip()))

results=[]
for i in range(n+1):
  results.append([0,0])
  
for i in range(m):
  index = ps[i][0]
  result = ps[i][1]
  if result == 'WA' and results[index][1] == 0:
    results[index][0] += 1
  elif result == 'AC':
    results[index][1] = 1

wa = 0
ac = 0
for i in range(1,n+1):
  wa += results[i][0]
  ac += results[i][1]
print(ac,wa)

Submission status: Wrong Answer

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

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

ps=[]
for _ in range(m):
  p,s=input().split()
  ps.append((int(p),s.strip()))

results=[]
for i in range(n+1):
  results.append([0,0])
  
for i in range(m):
  index = ps[i][0]
  result = ps[i][1]
  if result == 'WA' and results[index][1] == 0:
    results[index][0] += 1
  elif result == 'AC':
    results[index][1] = 1

wa = 0
ac = 0
for i in range(1,n+1):
  wa += results[i][0]
  ac += results[i][1]
print(wa,ac)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
listAC = [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
        continue
    listWA[p] += 1

print(sum(listAC), sum(listWA))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cntAC = 0
cntWA = 0
listAW = ['WA'] * n
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    if listAW[p - 1] == 'AC':
        continue
    if s == 'AC':
        cntAC += 1
        listAW[p - 1] = 'AC'
        continue
    cntWA += 1

print(cntAC, cntWA)

Submission status: Wrong Answer

Solution code:
NN, MM = list(map(int,input().split()))
ARR = [list(input().split()) for l in range(MM)]

bin = [0]*NN
done = [0]*NN

for ind in range(MM):
    if done[int(ARR[ind][0])-1] == 0:
        if ARR[ind][1] == 'WA':
            bin[int(ARR[ind][0])-1] += 1
        else:
            done[int(ARR[ind][0])-1] = 1

print(sum(done), sum(bin))

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m = map(int, input().split())
    co = 0
    pe = 0
    bl = False
    P = []
    for _ in range(m):
        p, s = map(str, input().split())
        if s == "AC" and p not in P:
            co += 1
            P.append(p)
        elif s == "WA" and p not in P:
            pe += 1
    print(co, pe)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m = map(int, input().split())
    co = 0
    pe = 0
    bl = False
    ps = "0"
    for _ in range(m):
        p, s = map(str, input().split())
        if ps != p:
            bl = False
        if s == "AC" and p!=ps:
            co += 1
            bl = True
            ps = p
        elif bl is False and s == "WA":
            pe += 1
    print(co, pe)
resolve()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
problems = {x : False for x in range(1, n+1)}
penalty = dict()
wa_count = {x: 0 for x in range(1, n+1)}
for _ in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    problems[p] = True
    penalty[p] = wa_count[p]
  else:
    wa_count[p] += 1

ac_count = 0
pen = 0
for i in range(1, n+1):
  if problems[i]:
    ac_count += 1
  if i in penalty:
    pen += penalty[i]

print(ac_count, pen)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
submissions = [list(input().split()) for _ in range(m)]
count_penalty = [0] * (10 ** 5 + 1)
count_ac = [0] * (10 ** 5 + 1)

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

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

for i in range(m):
    if count_ac[i] != 1:
        count_penalty[i] = 0
        
print("{} {}".format(count_ac.count(1), sum(count_penalty)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
submissions = [list(input().split()) for _ in range(m)]
count_penalty = [0] * (10 ** 5 + 1)
count_ac = [0] * (10 ** 5 + 1)

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

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


print("{} {}".format(count_ac.count(1), sum(count_penalty)))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
for a in range(M):
    P.append(input().split())
error=0
right=0
han=[]
for b in range(N):
    han.append(0)
for a in P:

    """if sum(han)==len(han):
        break"""
    if a[1]=="WA" and han[int(a[0])-1]==0 :
        error+=1
    elif a[1]=="AC" and han[int(a[0])-1]==0:
        han[int(a[0])-1]=1
        right+=1

print(right,error)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
for a in range(M):
    P.append(input().split())
error=0
right=0
han=[]
for b in range(N):
    han.append(0)
for a in P:
    
    if sum(han)==len(han):
        break
    if a[1]=="WA" and han[int(a[0])-1]==0 :
        error+=1
    elif a[1]=="AC" and han[int(a[0])-1]==0:
        han[int(a[0])-1]=1
        right+=1

print(right,error)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
for a in range(M):
    P.append(input().split())
error=0
right=0
han=[]
for b in range(N):
    han.append(0)
for a in P:

    if sum(han)==len(han):
        break
    if a[1]=="WA" and han[int(a[0])-1]==0 :
        error+=1
    elif a[1]=="AC" and han[int(a[0])-1]==0:
        han[int(a[0])-1]=1
        right+=1

print(right,error)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[]
for a in range(M):
    P.append(input().split())
error=0
right=0
han=[]
for b in range(N):
    han.append(0)
for a in P:

    if sum(han)==len(han):
        break
    if a[1]=="WA":
        error+=1
    elif a[1]=="AC" and han[int(a[0])-1]==0:
        han[int(a[0])-1]=1
        right+=1

print(right,error)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
ans=0;wrong=0
d=[0]*n
for i in range(m):
    p,s=input().strip().split()
    p=int(p)-1
    if s=='WA':
        d[p]+=1
    else:
        wrong+=d[p]
        d[p]=-1
        ans+=1
print(ans,wrong)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
M=[list(input().strip().split()) for _ in range(m)]
d={}
for i in M:
    d[i[0]]=0
corr=0
pen=0
for i in M:
    a=i[0]
    b=i[1]
    if b=='WA':
        if d[a]==-1:
            d[a]=0
        d[a]+=1

    else:
        if d[a]!=-1:
            corr+=1
            pen+=d[a]
            d[a]=-1
print(corr,pen)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
M=[list(input().strip().split()) for _ in range(m)]
d={}
for i in M:
    d[i[0]]=''

c1=0
c2=0
for i in M:
    a=i[0]
    b=i[1]
    if d[a]=='WA':
        if b=='AC':
            c1+=1
            d[a]='AC'
        else:
            c2+=1
            d[a]='WA'
    elif d[a]=='':
        if b=='AC':
            c1+=1
            d[a]='AC'
        else:
            c2+=1
            d[a]='WA'
    elif d[a]=='AC':
        if b=='AC':
            c1+=1
print(c1,c2)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n,m=map(int,input().split())
M=[list(input().strip().split()) for _ in range(m)]
d={}
for i in M:
    d[i[0]]=''

c1=0
c2=0
for i in M:
    a=i[0]
    b=i[1]
    if d[a]=='WA':
        if b=='AC':
            c1+=1
            d[a]='AC'
        else:
            c2+=1
            d[a]='WA'
    elif d[a]=='':
        if b=='AC':
            c1+=1
            d[a]='AC'
        else:
            c2+=1
            d[a]='WA'
print(c1,c2)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
submissions = [list(input().split()) for _ in range(m)]
count_p = 0
count_penalty = 0
count_ac = 0
before_problem = -1
ac_p = -1

for i in range(m):
    if submissions[i][0] != before_problem:
        count_p = 0

    if submissions[i][0] != ac_p and submissions[i][1] == "AC":
        ac_p = submissions[i][0]
        count_ac += 1
        count_penalty += count_p
        count_p = 0

    if submissions[i][0] != ac_p and submissions[i][1] == "WA":
        count_p += 1

    before_problem = submissions[i][0]
    
print("{} {}".format(count_ac, count_penalty))

Submission status: Wrong Answer

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

acli = [0]*N
wali = [0]*N

for _ in range(M):
  P,S = map(str,input().split())
  P = int(P)-1
  if acli[P] == 1:
    continue
  if S == "AC":
    acli[P] = 1
  else:
    wali[P] += 1
    
print(sum(acli),sum(wali))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# [ACしたかどうか, 初ACは何回目の提出か]
prob = [[0] * 2 for _ in range(N + 1)]
# print(prob)
ps_list = [[0, 0]]

for i in range(1, M + 1):
    p, s = input().split()
    p = int(p)
    ps_list.append([p, s])
    if s == "AC" and prob[p] != [0, 0]:
        prob[p] = [1, i]


# print(prob)
# この段階でACは数えられる
ac = 0
for item in prob:
    if item[0] == 1:
        ac += 1

penalty = 0
for i in range(1, M + 1):
    p = ps_list[i][0]
    s = ps_list[i][1]
    if s == "WA" and i < prob[p][1]:
        penalty += 1

print(ac, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# [ACしたかどうか, 初ACは何回目の提出か]
prob = [[0] * 2 for _ in range(N + 1)]
# print(prob)
ps_list = [[0, 0]]

for i in range(1, M + 1):
    p, s = input().split()
    p = int(p)
    ps_list.append([p, s])
    if s == "AC":
        prob[p] = [1, i]


# print(prob)
# この段階でACは数えられる
ac = 0
for item in prob:
    if item[0] == 1:
        ac += 1

penalty = 0
for i in range(1, M + 1):
    p = ps_list[i][0]
    s = ps_list[i][1]
    if s == "WA" and i < prob[p][1]:
        penalty += 1

print(ac, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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:
            ans_c += 1
        correct[p-1]+=1
    else:
        if correct[p-1]==0:
            ans_p += 1

print(ans_c,ans_p)

Submission status: Wrong Answer

Solution code:
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:
            ans_c += 1
        correct[p-1]+=1
    if s=="WA":
        if correct[p-1]==0:
            ans_p += 1

print(ans_c,ans_p)