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:
from operator import itemgetter

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

p = [0] * M
s = [0] * M

# 行数の入力
for i in range(M):
    p[i], s[i] = map(str, input().split())

wa = 0
ac = 0
acNo = []

for i in range(M):
    # 回答があったらスキップ
    if p[i] in acNo:
       continue
    # WAをカウント
    if s[i] == "WA":
        wa = wa + 1
    # ACをカウント
    if s[i] == "AC":
        ac = ac + 1
        # ACを保存
        acNo.append(p[i])

print('%s %s' % (ac, wa))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

p = [0] * M
s = [0] * M
row = [0] * M

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


wa = 0
ac = 0
acNo = ""

for i in range(M):
    if acNo == p[i]:
        continue
    if s[i] == "WA":
        wa = wa + 1
    if s[i] == "AC":
        ac = ac + 1
        acNo = p[i]

print('%s %s' % (ac, wa))

Submission status: Wrong Answer

Solution code:
_, m = map(int, input().split())
l = []
w = a = 0
for _ in range(m):
    n, j = input().split()
    if n not in l:
        if j == "WA":
            w += 1
        else:
            a += 1
            l += [n]
print(a, w)

Submission status: Wrong Answer

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

cnt = [-1] * (10**5 + 1)
ans = 0
pnt = 0
for i in range(M):
    if P[i][1] == 'AC' and cnt[int(P[i][0])] == -1:
        ans += 1
        cnt[int(P[i][0])] = 0
    if P[i][1] == 'WA' and cnt[int(P[i][0])] == -1:
        pnt += 1
print(ans, end=" ")
print(pnt)

Submission status: Wrong Answer

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

cnt = [-1] * (10**5 + 1)
ans = 0
pnt = 0
for i in range(M):
    if P[i][1] == 'AC' and cnt[int(P[i][0])] == -1:
        ans += 1
        cnt[int(P[i][0])] = 0
    elif P[i][1] == 'WA' and cnt[int(P[i][0])] == -1:
        pnt += 1
print(ans, end=" ")
print(pnt)

Submission status: Wrong Answer

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

cnt = [-1] * (N + 1)
ans = 0
pnt = 0
for i in range(M):
    if P[i][1] == 'AC' and cnt[int(P[i][0])] == -1:
        ans += 1
        cnt[int(P[i][0])] = 0
    elif P[i][1] == 'WA' and cnt[int(P[i][0])] == -1:
        pnt += 1
print(ans, end=" ")
print(pnt)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    c = np.array([0] * N)

    penalty = 0

    for i in range(M):
        if S[i]=='AC':
            c[p[i]-1] = 1
        else:
            if c[p[i]-1]:
                pass
            else:
                penalty+=1
    
    print(c.sum(), penalty)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = set()
penalty = 0
for i in range(M):
    p, S = input().split()
    if p in AC:
        continue
    if S == 'AC':
        AC.add(p)
    else:
        penalty += 1

print(len(AC),penalty)

Submission status: Wrong Answer

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

x=[0]*n
y=[0]*n
if m!=0:
  for i in range(m):
    P,s=input().split()
    p=int(P) 
    if x[p-1]==0:
      if s=="WA":
        y[p-1]+=1
      if s=="AC":
        x[p-1]+=1
    else:
      print(str(x[p-1]))
sx=0
sy=0
for i in range(n):
  sx+=x[i]
  sy+=y[i]
  
print(str(sx),str(sy))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
x=[0]*n
y=[0]*n
for i in range(m):
  P,s=input().split()
  p=int(P) 
  if x[p-1]==0:
    if s=="WA":
      y[p-1]+=1
    if s=="AC":
      x[p-1]+=1
sx=0
sy=0
for i in range(n):
  sx+=x[i]
  sy+=y[i]
  
print(str(sx),str(sy))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
x=[0]*n
y=[0]*n
for i in range(m):
  P,s=input().split()
  p=int(P) 
  if x[p-1]==0:
    if s=="WA":
      y[p-1]+=1
    if s=="AC":
      x[p-1]+=1

print(str(sum(x)),str(sum(y)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = [[0]*2 for _ in range(n + 1)]
ac = 0
wa = 0

for i in range(m):
    p, s = input().split()
    p = int(p)
    if l[p][0] == 0: #ACが0の場合
        if s == "AC":
            l[p][0] = 1
        else:
            l[p][1] += 1

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
x=[0]*n
y=[0]*n
for i in range(m):
  P,s=input().split()
  p=int(P) 
  if s=="WA":
    if x[p-1]==0:
      y[p-1]+=1
  elif x[p-1]==0:
    x[p-1]+=1


print(str(sum(x)),str(sum(y)))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
p = []
for i in range(M):
    x,y = list(map(str, input().split()))
    p.append([int(x),y])
count = [[0,0]for i in range(N)]
ansac = 0
answa = 0
for i in range(M):
    if count[p[i][0]-1][1] != 0:
        pass
    else:
        if p[i][1] == 'AC':
            count[p[i][0]-1][1] += 1
        else:
            count[p[i][0]-1][0] += 1
for i in range(N):
    answa += count[i][0]
    ansac += count[i][1]
print(str(ansac) + ' ' + str(answa))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
p = []
for i in range(M):
    p.append(list(map(str,input().split())))
fr = []
ansac = 0
answa = 0
for i in range(M-1,-1,-1):
    if p[i][0] in fr:
        if p[i][1] == 'WA':
            answa += 1
    else:
        if p[i][1] == 'AC':
            ansac += 1
            fr.append(p[i][0])
print(str(ansac) + ' ' + str(answa))

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict
def main():
    n,m=map(int,input().split())
    ac=defaultdict(int)
    pena=0
    for i in range(m):
        k,s=input().split()
        k=int(k)
        if ac[k-1]!=1:
            if s=="WA":pena+=1
            else:ac[k-1]+=1
    print(sum(ac.values()),pena)


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,m=map(int,input().split())
    ac=[0]*n
    pena=0
    for i in range(m):
        k,s=input().split()
        k=int(k)
        if ac[k-1]!=1:
            if s=="WA":pena+=1
            else:ac[k-1]=1
    print(sum(ac),pena)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(int)
c = 0
p = 0
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if dd[a] != 1:
            p += 1
            dd[a] = 1
    else:
        if dd[a] != 1:
            c += 1
print(p, c)

Submission status: Wrong Answer

Solution code:
import math
import sys
AClist=set()
pena=0
N,M=map(int,input().split())

for i in range(M):
    pm,sm=input().split()
    if sm=="AC":
        AClist.add(pm)
    else:
        if not pm in AClist:
            pena+=1

print(len(AClist),pena)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
from collections import defaultdict
wa_d = defaultdict(int)
wa = [0 for _ in range(n)]
ac = [0 for _ in range(n)]
for x in [list(input().split()) for _ in range(m)]:
    if x[1]=="AC":
        if x[0] not in ac:
            ac[int(x[0])-1] = 1
            wa[int(x[0])-1] = wa_d[int(x[0])-1]
    else:
        wa_d[int(x[0])-1] += 1
        
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
from itertools import groupby


n, m = map(int, input().split())
WA = [0] * (n + 1)
AC = [False] * (n + 1)
wanum = 0
acnum = 0
for i in range(m):
    p, s = input().split()
    if AC[int(p)]:
        continue
    if s == 'AC':
        acnum += 1
        wanum += WA[int(p)]
    elif s == 'WA':
        WA[int(p)] += 1
print(acnum, wanum)

Submission status: Wrong Answer

Solution code:
from itertools import groupby


n, m = map(int, input().split())
p_s = []
for i in range(m):
    p_s.append(list(input().split()))
ac_num = 0
wa_num = 0
for key, group in groupby(p_s, lambda x: x[0]):
    group_lst = list(group)
    wa_num_sub = 0
    for i in range(len(group_lst)):
        if group_lst[i][1] == 'WA':
            wa_num_sub += 1
        if group_lst[i][1] == 'AC':
            ac_num += 1
            wa_num += wa_num_sub
            break
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
from itertools import groupby


n, m = map(int, input().split())
p_s = []
for i in range(m):
    p_s.append(list(input().split()))
ac_num = 0
wa_num = 0
for key, group in groupby(p_s, lambda x: x[0]):
    group_lst = list(group)
    for i in range(len(group_lst)):
        if group_lst[i][1] == 'WA':
            wa_num += 1
        if group_lst[i][1] == 'AC':
            ac_num += 1
            break
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
q=[""]*m
r=[""]*m
for i in range(m):
  q[i],r[i]=input().split()
  q[i]=int(q[i])
  
answa=0
ansac=0

Q=sorted(set(q))
for i in Q:
  for j in range(m):
    if q[j]==i and r[j]=="WA":
      answa+=1
    if q[j]==i and r[j]=="AC":  
      ansac+=1
      break
      
print(ansac,answa)

Submission status: Wrong Answer

Solution code:
import os

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


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import os

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


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AClist = []
penalty = 0
for i in range(M):
    p, s = map(str,input().split())
    p = int(p)
    if not p in AClist:
        if s == "AC":
            AClist.append(p)
        else:
            penalty += 1
print(len(AClist), penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
la = []
lw = []
lwa = []
for i in range(n):
  la.append(0)
  lw.append(0)
  lwa.append(0)
for _ in range(m):
  q,a = input().split()
  if a == "WC" and la[int(q)-1] != 1:
    lw[int(q)-1] += 1
  elif a == "AC" and la[int(q)-1] != 1:
    la[int(q)-1] = 1
    lwa[int(q)-1] = lw[int(q)-1]
    
print(sum(la), sum(lwa))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
la = []
lw = []
for i in range(n):
  la.append(0)
  lw.append(0)
for _ in range(m):
  q,a = input().split()
  if a == "WA" and la[int(q)-1] != 1:
    lw[int(q)-1] += 1
  else:
    la[int(q)-1] = 1
print(sum(la), sum(lw))

Submission status: Wrong Answer

Solution code:
#C - Welcome to AtCoder

N, M = map(int, input().split())
Score = [[]*i for i in range(N)]
Count_AC = 0
Count_WA = 0

#小問毎の正誤リスト作成
for i in range(M):
  p, S = input().split()
  Score[int(p)-1].append(S)

for i in range(N):
  for j in range(len(Score[i])):
    if Score[i][j] == "WA":
      continue
    else:
      Count_AC += 1
      Count_WA += j

print(Count_AC, Count_WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [[] for i in range(N)]
old_p = 0
for i in range(M):
    tmp = list(input().split())
    # if tmp[0] != str(old_p + 1):
    #     old_p += 1
    # l[old_p].append(tmp[1])
    l[int(tmp[0]) - 1].append(tmp[1])
ac = 0
wa = 0
print(l)
for i in range(N):
    wa_tmp = 0
    for j in range(len(l[i])):
        if l[i][j] == 'WA':
            wa_tmp += 1
        else:
            ac += 1
            wa += wa_tmp
            break
print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = [[] for i in range(N)]
old_p = 0
for i in range(M):
    tmp = list(input().split())
    # if tmp[0] != str(old_p + 1):
    #     old_p += 1
    # l[old_p].append(tmp[1])
    l[int(tmp[0]) - 1].append(tmp[1])
ac = 0
wa = 0
#print(l)
for i in range(N):
    for j in range(len(l[i])):
        if l[i][j] == 'WA':
            wa += 1
        else:
            ac += 1
            break
print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

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

AC = 0
WA = 0
WA_dict = {i: 0 for i in range(1, N+1)}
AC_dict = {i: 0 for i in range(1, N+1)}

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

Submission status: Wrong Answer

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

AC = 0
WA = 0
exc = []

for p, s in P_S:
    if p in exc:
        continue
    elif s=='WA':
        WA += 1
    else:
        AC += 1
        exc.append(p)
print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
exc = []

for p, s in P_S:
    if p in exc:
        continue
    elif s=='WA':
        WA += 1
    elif s=='AC':
        AC += 1
        exc.append(p)
print(AC, WA)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
ps = [list(input().split()) for i in range(m)]
check = [False] * n
ac = 0
wa = 0
for p, s in ps:
    p = int(p)
    if s == 'AC':
        if not check[p - 1]:
            check[p - 1] = True
            ac += 1
    else:
        if not check[p - 1]:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(int)
k = 0 #カウント数
for i in range(x):
    dd[i+1] = 0
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if dd[int(a)] == 1:
            continue
        else:
            dd[int(a)] = 1
    elif b == 'WA':
        if dd[int(a)] == 1:
            continue
        else:
            k += 1
s = 0
for l in dd:
    if dd[l] == 1:
        s += 1
print(s, k)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(str)
k = 0 #カウント数
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = a
    elif b == 'WA':
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
li = []
k = 0 #カウント数
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in li:
            continue
        else:
            li.append(a)
    elif b == 'WA':
        if a in li:
            continue
        else:
            k += 1
s = 0
for _ in li:
    s += 1
            
print(s, k)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(int)
k = 0 #カウント数
for _ in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = 1
    elif b == 'WA':
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(str)
k = 0 #カウント数
for i in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = '1'
    else:
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)

Submission status: Wrong Answer

Solution code:
x, y = map(int, input().split())
from collections import defaultdict
dd = defaultdict(int)
k = 0#カウント数
for i in range(y):
    a, b = map(str, input().split())
    if b == 'AC':
        if a in dd:
            continue
        else:
            dd[a] = 1
    else:
        if a in dd:
            continue
        else:
            k += 1
s = 0
for _ in dd:
    s += 1
            
print(s, k)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [input().split() for i in range(m)]
a_cnt = 0
a_num = 0
w_num = 0
for i in range(m):
    if a[i][1] == "AC":
        if not(a[i][0] == a_num):
            a_num = a[i][0]
            a_cnt += 1
    else:
        if not(a[i][0] == a_num):
            w_num += 1
print("{} {}".format(a_cnt, w_num))

Submission status: Wrong Answer

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

a_num = []
w_num = 0
for i in range(m):
    if a[i][1] == "AC":
        if not(a[i][0] in a_num):
            a_num.append(a[i][0])
    else:
        if not(a[i][0] in a_num):
            w_num += 1
print("{} {}".format(len(a_num), w_num))

Submission status: Wrong Answer

Solution code:
from collections import deque

N, M = map(int,input().split())
P = deque()
S = deque()

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

switch = 1
ans1 = 0
ans2 = 0
cor = 0
pena = 0
bnum = 0
res = 0

for a in range(M):
    bnum = res
    res = P.popleft()
    judge = S.popleft()

    if switch == -1:
        if bnum != res:
            switch = 1
        else:
            continue

    if switch == 1:
        if judge == 'WA':
            pena += 1
        if judge == 'AC':
            cor += 1
            switch = -1

print(cor,pena)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = [0]*(n+1)
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1

    elif mp[quiz] == 0 and ans == 'WA':
        cnt[quiz] += 1

for i in range(1, n+1):
    if i == 0 and cnt[i] > 0:
        cnt[i] = 0

print(mp.count(1), sum(cnt))

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = [0]*(n+1)
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1

    elif mp[quiz] == 0 and ans == 'WA':
        cnt[quiz] += 1

for i in range(1, m):
    if i == 0 and cnt[i] > 0:
        cnt[i] = 0

print(mp.count(1), sum(cnt))

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = [0]*(n+1)
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1

    elif mp[quiz] == 0 and ans == 'WA':
        cnt[quiz] += 1

for i in range(n+1):
    if i == 0 and cnt[i] > 0:
        cnt[i] = 0

print(mp.count(1), sum(cnt))

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = [0]*(n+1)
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1
        continue

    if mp[quiz] == 0 and ans == 'WA':
        cnt[quiz] += 1

ans = 0
for i in mp:
    if i == 1:
        ans += cnt[i]

print(mp.count(1), ans)

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = [0]*(n+1)
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1
        continue

    if mp[quiz] == 0 and ans == 'WA':
        cnt[quiz] += 1

for i in mp:
    if i == 0 and cnt[i] > 0:
        cnt[i] = 0

print(mp.count(1), sum(cnt))

Submission status: Wrong Answer

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

mp = [0]*(n+1)
cnt = 0
for i in lst:
    quiz = int(i[0])
    ans = i[1]
    if ans == 'AC':
        mp[quiz] = 1
        continue

    if mp[quiz] == 0 and ans == 'WA':
        cnt += 1

print(mp.count(1), cnt)

Submission status: Wrong Answer

Solution code:

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
w = 0
for i in range(n):
    if ac[i] ==1:
        w+=wa[i]
print(sum(ac),w)

Submission status: Wrong Answer

Solution code:

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
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
counter = [0, 0]
p = [0]
for i in range(m):
    a = input().split()
    if a[1] == 'AC':
        decesion = True
        for j in p:
            if j == int(a[0]):
                decesion = False
                break
        if decesion:
            counter[0] += 1
            p.append(int(a[0]))
    else:
        decesion = True
        for j in p:
            if j == int(a[0]):
                decesion = False
                break
        if decesion:
            counter[1] += 1
print(counter[0], counter[1])

Submission status: Wrong Answer

Solution code:
from collections import Counter
N, M = list(map(int, input().split()))
results = []
for _ in range(M):
    p, s = input().split()
    results.append((int(p), s))

wa_counter = Counter()
is_active = [True for _ in range(N)]
for p, s in results:
    p -= 1
    if s == 'WA':
        if is_active[p]:
            wa_counter[p] += 1
        else:
            pass
    elif s == 'AC':
        if is_active[p]:
            is_active[p] = False
        else:
            pass

correct = 0
incorrect = 0
for i in range(N):
    if is_active[i] is False:
        correct += 1
        incorrect += wa_counter[p]
print(correct, incorrect)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N, M = list(map(int, input().split()))
results = []
for _ in range(M):
    p, s = input().split()
    results.append((int(p), s))

wa_counter = Counter()
is_active = [True for _ in range(N)]
correct = 0
for p, s in results:
    p -= 1
    if s == 'WA':
        if is_active[p]:
            wa_counter[p] += 1
        else:
            pass
    elif s == 'AC':
        if is_active[p]:
            correct += 1
            is_active[p] = False
        else:
            pass

incorrect = sum(wa_counter.values())
print(correct, incorrect)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N, M = list(map(int, input().split()))
results = []
for _ in range(M):
    p, s = input().split()
    results.append((int(p), s))

wa_counter = Counter()
is_active = [True for _ in range(N)]
for p, s in results:
    p -= 1
    if s == 'WA':
        if is_active[p]:
            wa_counter[p] += 1
        else:
            pass
    elif s == 'AC':
        is_active[p] = False

correct = N - sum(is_active)
incorrect = sum(wa_counter.values())
print(correct, incorrect)

Submission status: Wrong Answer

Solution code:
n, m = input().split()
n = int(n)
m = int(m)
correct = 0
penalty = 0
numbers = set()
for i in range(m):
    number, answer = input().split()
    number = int(number)
    if not number in numbers:
        if answer == "AC":
            correct += 1
            numbers.add(number)
        else:
            penalty += 1
    else:
        if not answer == "AC":
            if not number in numbers:
                penalty += 1
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p_dict = {}
# value = [ac, wa]
for i in range(m):
    p, s = input().split()
    if p not in p_dict:
        if s == 'AC':
            p_dict[p] = [1, 0]
        elif s == 'WA':
            p_dict[p] = [0, 1]
    else:
        if s == 'WA' and p_dict[p][0] == 0:
            p_dict[p][1] = p_dict[p][1] + 1
        if s == 'AC' and p_dict[p][0] == 0:
            p_dict[p][0] = 1

ac = 0
wa = 0
for key, value in p_dict.items():
    ac = ac + value[0]
    wa = wa + value[1]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
l = [list(map(str,input().split())) for _ in range(m)]
case  = ["WA"]*n
good = 0
bad = 0
for (a,b) in l:
  a = int(a)
  if b=="AC" and case[a-1]=="WA":
    case[a-1]="AC"
    good += 1
  elif b=="WA" and case[a-1]=="WA":
    bad += 1
print(good,bad)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
WA = [0] * N
AC = [0] * N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == "AC":
        AC[p-1] = 1
    else:
        if AC[p-1] == 1:
            pass
        else:
            WA[p-1] += 1
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
f=[0]*(N+1)
ans_a=[0]*(N+1)
ans_w=0
for i in range(M):
    p,s = map(str, input().split())
    if s=='WA' and ans_a[int(p)]==0:
        f[int(p)]+=1
    else:
        if ans_a[int(p)]==0:
            ans_a[int(p)]+=1
            ans_w+=f[int(p)]
print(sum(ans_a),sum(f))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
f=[0]*(N+1)
ans=[0]*(N+1)
for i in range(M):
    p,s = map(str, input().split())
    if f[int(p)]>=0:
        if s=='WA' and ans[int(p)]==0:
            f[int(p)]+=1
        else:
            if ans[int(p)]==0:
                ans[int(p)]+=1                
print(sum(ans),sum(f))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
f=[0]*(N+1)
ans=[0]*(N+1)
for i in range(M):
    p,s = map(str, input().split())
    if f[int(p)]>=0:
        if s=='WA':
            f[int(p)]+=1
        else:
            f[int(p)]=-f[int(p)]
            if ans[int(p)]==0:
                ans[int(p)]+=1                

print(sum(ans),-sum(f))

Submission status: Wrong Answer

Solution code:
n, m = (int(x) for x in input().split())
dic={}
for i in range(m):
    p, s = input().split()
    if p in dic:
        if dic[p][1]>0:
            pass
        elif s=="WA":
            dic[p][0]+=1
        elif s=="AC":
            dic[p][1]+=1
    else:
        if s=="WA":
            dic[p]=[1,0]
        else:
            dic[p]=[0,1]
su_ac = 0
su_wa = 0
for value in dic.values():
    su_ac+=value[1]
    su_wa+=value[0]
print(su_ac, su_wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M = map(int,input().split())
AC = np.zeros(N,np.int32)
WA = np.zeros(N,np.int32)
for j in range(M):
    p,S = input().split()
    i = int(p) - 1
    if AC[i] == 1:
        continue
    if S =='AC':
        AC[i] = 1
    else:
        WA[i] += 1
        
print(len(AC[AC == 1]),np.sum(WA))

Submission status: Wrong Answer

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

seito = 0
pena  = 0

for i in range(1, n+1):
    flg = False
    for j in range(m):
        if ps[j][0] == i and ps[j][1] == "AC":
            if flg == False:
                seito += 1
                flg = True
        elif ps[j][0] == i and ps[j][1] == "WA":
            if flg == False:
                pena += 1
        else:
            pass

print(seito, pena)

Submission status: Wrong Answer

Solution code:
import numpy as np

N,M=map(int,input().split())
ac=np.array([0]*N)
wa=np.array([0]*N)

for i in range(M):
    a,b=input().split()
    A=int(a)
    if ac[A-1]==0 and b=="WA":
        wa[A-1]+=1
    else :
        ac[A-1]=1

cal=sum(ac)
ans=sum(ac*wa)