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: Runtime Error

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

ans_wa = 0
ans_ac = 0

p0, s0 = input().split()
if s0 == 'WA':
    ans_wa = 1
    ans_ac = 0
    ac_flag = False
elif s0 == 'AC':
    ans_wa = 0
    ans_ac = 1
    ac_flag = True

for i in range(M-1):
    p, s = input().split()
    if p == p0:
        if s == 'WA' and ac_flag is False: # これまでWAで今回もWAの時
            ans_wa += 1
        elif s == 'AC' and ac_flag is False: # 初ACの時
            ans_ac += 1
            ac_flag = True
    elif p != p0: #新しい問題
        if s == 'WA':
            ans_wa += 1
            ac_flag = False
        elif s == 'AC':
            ans_ac += 1
            ac_flag = True
    p0 = p
    s0 = s

print(ans_ac, ans_wa)

Submission status: Runtime Error

Solution code:
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ac_list = []
wa_dict = {}
for p, s in result_list:
    if p not in ac_list:
        if s == 'WA':
            if p in wa_dict:
                wa_dict[p] += 1
            else:
                wa_dict[p] = 1
        else:
            AC_total += 1
            ac_list.append(p)
for p in wa_dict:
    if p in ac_list:
        WA_total += wa
print('{} {}'.format(AC_total, WA_total))

Submission status: Runtime Error

Solution code:
n, m = map(int,input().split())
list_ac = []
count_wa = 0

for i in range(m):
    p, s = map(str,input().split())
    if s =='AC':
        list_ac.append(int(p))
        list_ac = set(list_ac)
    else:
        tmp = list_ac.find(int(p))
        if tmp >=0:
            count_wa +=1
print(len(set(list_ac)), count_wa)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
p = [0] * M
S = [0] * M
count_AC = [0] * M
count_WA = [0] * M
for i in range(M):
    p[i],S[i] =  input().split()
    p[i] = int(p[i])

    if S[i] == 'AC':
        if count_AC[p[i]] == 0:
            count_AC[p[i]] = 1
            
    if S[i] == 'WA':
        if count_AC[p[i]] == 0:
            count_WA[p[i]] += 1
            
print(sum(count_AC) , sum(count_WA))

Submission status: Runtime Error

Solution code:
# import itertools
# import math

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

ans_p = [0] * N
ans_s = [0] * N

for i in range(M):
    input_sp = input().split()
    P = int(input_sp[0]) - 1
    S = input_sp[1]

    if S == 'AC':
        ans_s[P] = 1
    elif S == 'WA' and ans_p[P] == 0:
        ans_p[P] += 1

for i in ans_p:
    if ans_s[i] == 0 and ans_p[i] != 0:
        ans_p[i] = 0


print(str(sum(ans_s)) + " " + str(sum(ans_p)))

Submission status: Runtime Error

Solution code:
import numpy as np
n,m = map(int,input().split())
penalty = np.zeros(n)
did = np.zeros(n)
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if did[p-1]==0:
            penalty[p-1] +=1
    else:
        did[p-1]=1
penalty = penalty*did
print(int(sum(did)),int(sum(penalty)))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
p = list()
s = list()
for i in range(m):
    a,b = input().split()
    p.append(int(a))
    s.append(b)
toi = set(p)
x = -1
ac = 0
pen = 0
check = False
for i in toi:
    for j in range(p.count(i)):
        x += 12
        if s[x] == "AC":
            if not check:
                check = True
                ac += 1
        else:
            if not check:
                pen += 1
    check = False
print(ac,pen)

Submission status: Runtime Error

Solution code:
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[i]=p[i]+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))

Submission status: Runtime Error

Solution code:
# import itertools
# import math

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

ans_p = [0] * N
ans_s = [0] * N

for i in range(M):
    input_sp = input().split()
    P = int(input_sp[0]) - 1
    S = input_sp[1]

    if S == 'AC':
        ans_s[P] = 1
    elif S == 'WA' and ans_p[P] == 0:
        ans_p[P] += 1

for i in range(ans_p):
    if ans_s[i] == 0 and ans_p[i] != 0:
        ans_p[i] = 0


print(str(sum(ans_s)) + " " + str(sum(ans_p)))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ans = {i:0 for i in range(N)}
pn = {i:0 for i in range(N)}
ans_num = 0
pn_num = 0

for i in range(M):
    p_tmp, S_tmp = input().split()
    p_tmp = int(p_tmp)
    
    if ans[p_tmp] == 0 and S_tmp == "AC":
        ans[p_tmp] = 1
        ans_num += 1
        pn_num += pn[p_tmp]
        
    elif ans[p_tmp] != 1 and S_tmp == "WA":
        pn[p_tmp] = pn[p_tmp] + 1
        
print(ans_num, pn_num)

Submission status: Runtime Error

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+1)
ACed = [0]*(N+1)

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

Submission status: Runtime Error

Solution code:
cin=input().split()
N=int(cin[0])
M=int(cin[1])


result={}
ac=0
wa=0
for i in range(M):
    cin=input().split()
    p=int(cin[0])
    S=str(cin[1])

    log=result.get(p,None)
    if S == "AC" and log != "AC":
        ac+=1
        result[p]="AC"

    if S == "WA" and log != "AC":
        wa+=1

print(f"{ac} {wa}")

Submission status: Runtime Error

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

acList = [False] * n
waCount = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p) - 1 # インデックスの調整
  print(acList)
  if acList[p]:
    continue
  if s == 'WA':
    waCount += 1
    continue
  acList[p] = True

print(sum(acList), waCount)

Submission status: Runtime Error

Solution code:
import numpy as np
n,m = map(int,input().split())
penalty = np.zeros(n)
done = np.zeros(n)
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA':
        if done[p-1]==0:
            penalty[p-1] +=1
    else:
        done[p-1]=1
penalty = penalty*done
print(int(sum(done)),int(sum(penalty)))

Submission status: Runtime Error

Solution code:

check = {}
error = {}

ans_ac = 0
ans_wa = 0

for i in range(m):
    p,s = map(str, input().split())
    p = int(p)
    if p in check:
        pass
    else:
        if s == "WA":
            if p in error:
                error[p] += 1
            else:
                error[p] = 1
        else:
            if p in check:
                check[p] += 1
            else:
                check[p] = 1
            if p in error:
                ans_wa += error[p]
            ans_ac += 1
print(str(ans_ac) + " " + str(ans_wa) )

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
p = []
s = []
wacounter = 0
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  p[i], m[i] = map(input().split())

for i in range(0, m):
  if s[i] == "AC" and find(i, point_to_num) == false: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(i) #正解リストにその問題を追加
    point += 1 #正解ポイントをあげる
  else: #不正解だったら
    if find(i, point_to_num) == false:
      wacounter += 1
print(point, wacounter)
    
def find(n, list): #n番目の問題がlistにあるかどうか
  counter = 0
  for i in range(0, len(list)):
    if list[i] == n:
      counter += 1
  if counter >= 1:
    return true
  else:
    return false

Submission status: Runtime Error

Solution code:
import collections


def solve(n, m, hist):
    cor = 0
    pen = 0
    for p, tries in hist.items():
        for i, t in enumerate(tries):
            if t == 'AC':
                cor += 1
                pen += i
                break
    return f'{cor} {pen}'


def input_to_int():
    return [int(r) for r in input().split(' ')]


if __name__ == "__main__":
    n, m = input_to_int()
    hist = collections.defaultdict(list)
    for _ in range(m):
        p, s = input().split(' ')
        hist[p].append(s)
    print(solve(n, m, hist))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
sub_ls = []
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)
    sub_ls.append([p,s])
ac_cnt = []
wa_cnt = []
for i in range(n):
    ac_cnt.append(0)
    wa_cnt.append(0)
#print(ac_cnt, wa_cnt)
for i in range(m):
    if ac_cnt[sub_ls[i][0]-1] == 0:
        #print(sub_ls[i][1], ac_cnt[i])
        if sub_ls[i][1] == "AC":
            ac_cnt[sub_ls[i][0]-1] = 1
        else:
            wa_cnt[i-1]+=1
ac_sum = 0
wa_sum = 0
for i in range(n):
    if ac_cnt[i] == 1:
        ac_sum+=1
    wa_sum+=wa_cnt[i]
print(ac_sum, wa_sum)

Submission status: Runtime Error

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

pena = [0 for i in range(n)]
acc = [0 for i in range(n)]

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

    if acc[p] == 0:
        if ss == 'WA':
            pena[p] += 1
        else:
            acc[p] = 1

for i in range(m):
    pena[i] = pena[i] * acc[i]

print(sum(acc), sum(pena))

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
wa = 0
ac = 0
ac_list = []
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        if s=='WA' & ac_list.count(p) ==0:
            wa += 1
        elif ac_list.count(p) ==0:
            ac_list.append(p)
            ac += 1
        else:
            pass
    print(ac, wa)

Submission status: Runtime Error

Solution code:
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    # dic = {}
    has_been_solved = set()
    pen = 0
    cor = 0
    for i in inputs:
        if i[0] in has_been_solved:
            continue

        if i[1] == 'AC':
            cor += 1
            has_been_solved.add(i[0])
        else:
            pen += 1

    print(f'{cor} {pen}')
    



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
# M submissions
# i-th problem, pi-th problem recieved Si verdict ("AC" or "WA")
# Penalty: recieve WA before AC

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

problem_ac = set()
problem_penalty = dict()

for _ in range(M):
    problem, verdict = input().split()

    if problem in problem_ac:
        continue
    elif verdict == "WA":
        problem_penalty[problem] = problem_penalty.get(problem, 0) + 1
    elif verdict == "AC":
        problem_ac.add(problem)

print(f"{len(problem_ac)} {sum(problem_penalty.values())}")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(m) if ac[i]==1))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
p = []
s = []
pen= [0] * (n+1)
result=[False] * (n+1)
cnt = 0
for i in range(m):
    p1, s1 = input().split()
    p1 = int(p1)
    p.append(p1)
    s.append(s1)

    if s1 == "AC" and not result[p1]:
        result[p1] = True
        cnt += 1
    if s1 == "WA" and not result[p1]:
        pen[p1] += 1
print(f"{cnt} {sum(pen)}")

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
AC = {}
WA = {}
for i in range(M):
    prb ,ans = input().split()
    if ans == "AC":
        AC[prb] = 1
    else:
        if (prb in WA) == False:
            WA[prb] = 1
        else:
            if AC[prb] == None:
                WA[prb] +=1
wa = 0
for i,v in WA.items():
    wa += v
print("{} {}".format(len(AC),wa))

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
p=[]
S=[]
for i in range(M):
  p0,S0=map(int,input().split())
  p+=[p0]
  S+=[S0]
awlist=[0 for i in range(N)]
walist=[0 for i in range(N)]
wacount=0
account=0
for i in range(M):
  if s[i]=='WA' and awlist[s[i]]==0:
    walist[s[i]]+=1
  elif s[i]=='AC' and awlist[s[i]]==0:
    account+=1
    awlist[s[i]]=1
    wacount+=walist[s[i]]
Answer=[account,wacount]
print(*Answer)

Submission status: Runtime Error

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


import numpy as np
P=np.array(P)
S=np.array(S)

ans=np.unique(P[S=="AC"])

wa=0
for j in ans:
    for i in S[P==j]:
        if i=="WA":
            wa+=1
        else:
            break

print(len(ans),wa)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# abc151/abc151_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    wa_list = [0] * N
    penalty = 0
    ac = 0
    for _ in range(M):
        p, S = i2s().split(' ')
        p = int(p)
        if wa_list[p] >= 0:
            if S == 'WA':
                wa_list[p] += 1
            else:
                penalty += wa_list[p]
                wa_list[p] = -1
                ac += 1
    print(ac, penalty)
    return

main()

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append(ans[i][0])

    else:
        cnt += 1
kotae = set(hantei)
kari=[ans[i][1] for i in range(len(ans))]
kari.reverse()

print(count-(count-len(kotae)),cnt-kari.index("AC"))

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    ac = set()
    wa = [0] * (m+1)

    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if p in ac:
            continue
        if s == 'AC':
            ac.add(p)
        elif s == 'WA':
            wa[p] += 1
    print(len(ac), sum(wa))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
p = []
q = []
for i in range(m):
  s = list(map(inpt,input().split()))
  p.append(s[0])
  q.append(s[1])
kotae = {}
penal = 0
ac = 0
acichi = [[],[]] # 問題、位置の順
for i in range(m):
  if p[i] not in kotae:
    kotae[p[i]] = []
  if p[i] not in  acici[0]:
    if q[i] == "AC":
      acichi[0].append(p[i])
      acichi[1].append(q[i])
      ac += 1
    else:
      panel += 1
print(ac,panel)

Submission status: Runtime Error

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

p = [0]*M
k = [""] * M

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

ans = [0]*N
pen = [0]*N
accept = 0
pena = 0
for i in range(M):
    if k[i] == "WA" and ans[p[i]] == 0:
        pen[p[i]] += 1
    elif k[i] == "AC" and ans[p[i]] == 0:
        pena += pen[p[i]]
        ans[p[i]] = 1
        accept += 1
        
print(str(accept) + " " + str(pena))

Submission status: Runtime Error

Solution code:
wa = 0
ac = 0
ac_list = []
if m==0:
    print(0,0)
else:
    for i in range(m-1:
        p,s = input().split()
        if s=='WA':
            wa += 1
        elif ac_list.count(p) ==0:
            ac_list.append(p)
            ac += 1
        else:
            pass

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
table = {}
ac = 0
pena_arr = [0 for _ in range(m + 1)]
for _ in range(n):
    a, b = input().split()
    a = int(a)
    if a not in table and b == "AC":
        ac += 1
        table[a] = True
    elif a not in table and b == "WA":
        pena_arr[a] += 1
pena = 0
for i in range(1, m + 1):
    if pena_arr[i] > 0 and i in table:
        pena += pena_arr[i]
print(ac, pena)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if m == 0:
    print(0, 0)
else:
    check_list = [0]*20000
    wa = 0
    ac = 0
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if check_list[p] == 1:
            continue
        elif check_list[p] == 0 and s == 'AC':
            check_list[p] = 1
            ac += 1
        elif check_list[p] ==0 and s == 'WA':
            wa += 1
    print(ac, wa)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
s=[0]*n
t=[0]*n
for i in range(m):
    a,b=map(str,input().split())
    a,
    a=int(a)-1
    if not s[a]:
        if b=="WA":
            t[a]+=1
        else:
            s[a]=1
print(sum(s),sum(t[i] for i in range(n)if s[a]))

Submission status: Runtime Error

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

for i in range(M):
	S = list(input().split())
	# print(S)
	num = int(S[0])
	res = S[1]
	if res == "AC":
		seitou[num - 1] = 1
	else:
		if seitou[num - 1] == 0:
			penalty[num - 1] += 1
			
# print(*seitou)
# print(*penalty)
print(sum(seitou), end=" ")
print(sum(penalty))

Submission status: Runtime Error

Solution code:
from collections import defaultdict

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

submit = defaultdict(list)
for i in range(M):
    p,s = map(str, input().split())
    submit[p].append(s)


wa = 0
ac = 0
for k in submit.keys():
    for i in range(N):
        if submit[k][i] == "AC":
            wa += i
            ac += 1
            break

print(ac, wa)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
table = {}
ac = 0
pena_arr = [0 for _ in range(m + 1)]
for _ in range(m):
    a, b = input().split()
    a = int(a)
    if a not in table and b == "AC":
        ac += 1
        table[a] = True
    elif a not in table and b == "WA":
        pena_arr[a] += 1
pena = 0
for i in range(1, m + 1):
    if pena_arr[i] > 0 and i in table:
        pena += pena_arr[i]
print(ac, pena)

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, m = map(int, input().split())
    ps = [input() for _ in range(m)]

    ac = set()
    wa = [0] * m

    for i in ps:
        p, s = i.split()
        p = int(p)
        if s == 'AC':
            ac.add(p)
        elif p not in ac and s == 'WA':
            wa[p] += 1
    print(len(ac), sum(wa))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy as np

n, m = map(int, input().split())
is_ac = np.zeros(n, dtype=int)
wc_count = np.zeros(n, dtype=int)

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

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
	N, M = map(int, input().split())
	prob_list = [0] * (N+1)
	wa = 0
	for i in range(M):
		p, s = input().split()
		p = int(p)
		if s == "AC":
			prob_list[p] = 1
		else:
			if prob_list[p] == 0:
				wa += 1
		# print(prob_list)
	ac = 0
	for i in range(N+1):
		ac += prob_list[i]
	print(f"{ac} {wa}")

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
is_ac = [False] * 10050
numok = 0
numwa = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if is_ac[p]: # すでに正解
        continue
    else: # 未正解
        if s == "AC":
            numok += 1
            is_ac[p] = True
        else:
            numwa += 1
print("{0} {1}".format(numok, numwa))

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
S = []
P = 0
for i in range(M):
    p,s = map(str,input().split())
    q = int(p)
    if q in S:
        continue
    if s == 'AC':
        S.append(q)
    else:
        P += 1
ans = len(s)
print(ans,P)

Submission status: Runtime Error

Solution code:
n, m = [int(v) for v in input().split()]

count_map = [0] * m

count = 0
miss = 0
for i in range(m):
	p, s = input().split()
    
    if count_map[p] == True:
      continue
    
    if s == 'AC':
	    count_map[p] = True
        count += 1
    else:
      	miss += 1
      
print(count, miss)

Submission status: Runtime Error

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

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

for p in range(m):
  if ac[p] == 0:
    pen[p] = 0
print(str(sum(ac)) + ' ' + str(sum(pen)))

Submission status: Runtime Error

Solution code:
nm=list(map(int,input().split()))
ps=[]
for i in range(nm[1]):
    ps.append(list(input().split()))
    ps[-1][0]=int(ps[-1][0])
ac=[0]*nm[0]
wa=0
for i in range(nm[1]):
    if ps[i][1]=="AC":
        if ac[ps[i][0]]==0:
            ac[ps[i][0]]=1
        else:
            pass
    else:
        if ac[ps[i][0]]==0:
            wa+=1
        else:
            pass
print(sum(ac),wa)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
A = [list(input().split()) for i in range(m)]

for i in range(m):
    A[i][0] = int(A[i][0])

P = [0] * n
AC = [0] * n

for i in range(m):
    if A[i][1] == "WA":
        if AC[A[i][0]] == 0:
            P[A[i][0]] += 1
    else:
        AC[A[i][0]] = 1
    
p=0
ac=sum(AC)
for i in range(len(P)):
    if AC[i] == 1:
        p += P[i]
print(ac,p)