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:

a,b = map(int,input().split())
if b == 0:
    print(0,0)
    exit()
L1,L2=[],[]
for i in range(b):
    c,d = map(str,input().split())
    L1.append(c)
    L2.append(d)

no = L1[0]
wac = 0
pre_wac = 0
acc = 0
flag = False
for i in range(b):
    if L1[i] == no:
        if L2[i] == "WA" and flag == False:
            pre_wac +=1
        elif L2[i] == "AC" and flag == False:
            acc +=1
            wac += pre_wac
            pre_wac = 0
            flag = True
    if L1[i] != no:
        no = L1[i]
        flag = False
        if L2[i] == "WA":
            pre_wac +=1
        elif L2[i] == "AC":
            acc +=1
            wac += pre_wac
            pre_wac = 0
            flag = True

print(acc,wac)

Submission status: Wrong Answer

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
    
N,M=map(int,input().split())
a=0
b=0
AC=[0]*(N+1)
pen=0
l=[]
for i in range(M):
	j,r=input().split()
	if AC[int(j)]==0:
		if r=="WA":
			pen+=1
		else:
			AC[int(j)]+=1
print(sum(AC),pen)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=set()
from collections import Counter
w=Counter()
wa=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.add(p)
        wa+=w[p]
    else:
        if p not in ac:
            w[p]+=1
print(len(ac),wa)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c

N,M = map(int, input().split()) # 複数数値入力
p = []
S = []
for i in range(M):
    a,b = input().split() # 複数数値入力
    p.append(int(a)-1)
    S.append(b)

# 正答数
flag = [False for e in range(N)]
corr = 0
# 各問題iについて
for i in range(M):
    # これまで一度でもACを出していればskip
    if flag[p[i]]:
        continue
    else:
        # ACなら1足してflagを立てる
        if S[i] == "AC":
            corr += 1
            flag[p[i]] = True

# 誤答数
flag = [False for e in range(N)]
error = 0
# 各問題iについて
for i in range(M):
    # これまで一度でもACを出していればskip
    if flag[p[i]]:
        continue
    else:
        # WAなら1足す
        if S[i] == "WA":
            error += 1
        # ACならflagを立てる
        else:
            flag[p[i]] = True

print(corr,error)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c

N,M = map(int, input().split()) # 複数数値入力
p = []
S = []
for i in range(M):
    a,b = input().split() # 複数数値入力
    p.append(int(a)-1)
    S.append(b)

# 正答数
flag = [False for e in range(N)]
corr = 0
# 各問題iについて
for i in range(M):
    # これまで一度でもACを出していればskip
    if flag[p[i]]:
        continue
    else:
        # ACなら1足してflagを立てる
        if S[i] == "AC":
            corr += 1
            flag[p[i]] = True

# 誤答数
flag = [False for e in range(N)]
error = 0
# 各問題iについて
for i in range(M):
    # これまで一度でもACを出していればskip
    if flag[p[i]]:
        continue
    else:
        # WAなら1足す
        if S[i] == "WA":
            error += 1
        # ACならflagを立てる
        else:
            flag[p[i]] = True

print(corr,error)

Submission status: Wrong Answer

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

answer = [0] * N
penalty = [0] * N
P = 0

for i in range(M):
    p_tmp, s_tmp = input().split()   
    p_tmp = int(p_tmp) - 1

    if(answer[p_tmp] == 0):
        # 正解
        if s_tmp == 'AC':
            answer[p_tmp] = 1
            P += penalty[p_tmp]
        else:
            penalty[p_tmp] += 1

print(sum(answer), sum(penalty))

Submission status: Wrong Answer

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

answer = 0
penalty = 0
P = 0

flag = True
answered = False
for i in range(M):
    p_tmp, s_tmp = input().split()   
    if int(p_tmp) != P:
        P = int(p_tmp)
        answered = False
        flag = True
    if s_tmp == 'AC':
        if flag and not answered:
            answer += 1
            answered = True
        flag = False 
    if flag and s_tmp == 'WA':
        penalty += 1

print(answer, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if M == 0:
  print(0, 0)
else:
  pS = [list(input().split()) for i in range(M)]

  for i in range(M):
    pS[i][0] = int(pS[i][0])

  listWA = [0 for i in range(N)]
  listAC = [0 for i in range(N)]
  
  for j in range(M):
    if listAC[pS[j][0] - 1] < 1:
      if pS[j][1] == "AC":
        listAC[pS[j][0] - 1] = 1
      else:
        listWA[pS[j][0] - 1] += 1
  
  print(sum(listAC), sum(listWA))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)
res_ans = 0
res_pena = 0

for _ in range(m):
    p, s = input().split()
    if s == "AC":
        if d[p] == -1:
            continue
        else:
            res_ans += 1
            res_pena += d[p]
            d[p] = -1
    else:
        d[p] += 1

print(res_ans, res_pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
d = {}
for _ in range(M):
    p, s = input().split()
    a = d.get(p, [0, 0])
    if s == "AC" and a[0] == 0:
        a[0] = 1
    elif s == "WA" and a[0] == 0:
        a[1] += 1

    d[p] = a

ac = 0
wa = 0
for x in d.values():
    ac += x[0]
    wa += x[1]

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

Submission status: Wrong Answer

Solution code:
mondai, teisyutu = map(int, input().split())

list = [0]*mondai

seikai = 0
pena = 0

for i in range(teisyutu):
    kaitou, kekka = map(str, input().split())
    if list[int(kaitou)-1] == 0 and kekka == "WA":
        pena = pena + 1
    if list[int(kaitou)-1] == 0 and kekka == "AC":
        seikai = seikai + 1
        list[int(kaitou)-1] = 1

print("{} {}".format(seikai, pena))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
PM = [stdin.readline().rstrip().split() for _ in range(M)]
AC = set()
WA = {}
wa = 0
for pm in PM:
    if pm[0] in AC:
        continue
    if pm[1] == "AC":
        AC.add(pm[0])
        if pm[0] in WA:
            wa += WA[pm[0]]
    elif pm[1] == "WA":
        if pm[0] not in WA:
            WA[pm[0]] = 0
        WA[pm[0]] += 1  
print(len(AC), sum(WA.values()))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
PM = [stdin.readline().rstrip().split() for _ in range(M)]
AC = set()
WA = {}
for pm in PM:
    if pm[1] == "AC":
        AC.add(pm[0])
    elif pm[1] == "WA":
        if pm[0] in AC:
            continue
        if pm[0] not in WA:
            WA[pm[0]] = 0
        WA[pm[0]] += 1  
print(len(AC), sum(WA.values()))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
kekka = []
wa = 0
ac = 0
for i in range(m):
    ans,result = input().split()
    ans = int(ans)
    if ans not in kekka and result =='WA':
        wa += 1
    elif result == 'AC' and ans not in kekka:
        ac += 1
        kekka.append(ans)

print('{} {}'.format(ac,wa))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m == 0:
    number.append(1)
    judgment.append(1)
else:
    pass

if len(judgment) > 0:
    for i in range(0,m):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m == 0:
    number.append(1)
    judgment.append(1)
if not judgment:
    for i in range(0,m):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
cor = 0
penalty = 0
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
  if (S == "AC") & (dic[p] != "AC"):
    dic[p] = "AC"
    cor = cor+1
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    penalty = penalty + 1
    
print("{} {}".format(cor, penalty))

Submission status: Wrong Answer

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

penalty = 0
dic = {}
for i in range(M):
  p, S = input().split()
  p = int(p)
  if p not in dic:
    dic[p] = "_"
  if S == "AC":
    dic[p] = "AC"
    continue
  elif (S == "WA") & (dic[p] != "AC"):
    penalty = penalty + 1
    
print(penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
WA = 0
ACflg = [0 for i in range(N)]
Wnum =[0 for i in range(N)]
for i in range(M):
	P, S = input().split()
	if S == "AC" and ACflg[int(P)-1] == 0:
		AC += 1
		ACflg[int(P)-1] = 1
		#WA += Wnum[int(P)-1]
	elif S == "WA" and ACflg[int(P)-1] == 0:
		Wnum[int(P)-1] += 1
print(AC,sum(Wnum))

Submission status: Wrong Answer

Solution code:
[N, M] = list(map(int, input().split()))
if M == 0:
  ans = [0, 0]
else:
  pS = [list(map(str, input().split())) for i in range(M)]
  P = [sol[0] for sol in pS]
  P = list(set(P))
  P.sort()
  p_count = len(P)
  A = []
  for i in range(p_count):
    p_num = P[i]
    for PS in pS:
      if PS[0] == p_num:
        A.append(PS)
        if PS[-1] == 'AC':
          break
  WA = [a for a in A if a[-1] == 'WA']
  AC = [a for a in A if a[-1] == 'AC']
  ans = [len(AC), len(WA)]
print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
l = [0 for i in range(n)]
pena = 0
for i in range(m):
    q,res = input().split()
    if res == "AC":
        l[int(q)-1] = 1
    elif l[int(q)-1] == 0:
        pena+=1
print(sum(l),pena)

Submission status: Wrong Answer

Solution code:
total = {}
penalty = 0
n,m = map(int, input().split())
for _ in range(m):
    num,answer = input().split()
    #キーに値を持つか
    if num in total:
        total[num].append(answer)
    else:
    #辞書の作成
        total[num] = [answer]
        
for answer_value in total.values():
    if "AC" in answer_value:
        penalty += answer_value.index("AC")
            
            
print(len(total),penalty)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]*m
s=[""]*m
for i in range(m):
  p[i],s[i]=input().split()
mn=max(m,n)
p=[int(x) for x in p]
ans=[0]*(mn+1)
aced=[0]*(mn+1)
ac=0
for i in range(m):
  if s[i]=="AC" and aced[p[i]]==0:
    ac+=1
    aced[p[i]]=1
  elif s[i]=='WA' and aced[p[i]]==0:
    ans[p[i]]+=1

su=0
for i in range(m+1):
  if ans[i] and aced[i]:
    su+=ans[i]
print(ac,su)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def t(ps):
    ac = 0
    wa = 0
    a = []
    for p, s in ps:
        if p in a:
            continue
        if s == 'AC':
            ac += 1
            a.append(p)
        else:
            wa += 1
    return (ac, wa)


if __name__ == '__main__':
    n, m = map(int, input().split())
    ps = []
    for i in range(m):
        a = input().split()
        ps.append((int(a[0]), a[1]))
    print(' '.join(map(str, t(ps))))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as DD
N, M = map(int, input().split())


D = DD(bool)
ansAC =0 
ansWA = 0
for i in range(M):
  p, S = input().split()
  if S=="WA":
    if not D[p]:
      ansWA += 1
  else:
    if not D[p]:
      ansAC += 1
      D[p]= True
print (ansAC,ansWA)

Submission status: Wrong Answer

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

if M == 0:
  print(0,0)
  exit();

AL = []  
for i in range(M):
  a,w = map(str,input().split())
  AL.append((a,w))

AC = []
cnt = 0
for i in AL[::-1]:
  if i[1] == 'AC' and i not in AC:
    AC.append(i)
  elif i[1] == 'WA' and len(AC) > 0 and i[0] == AC[-1][0]:
    cnt += 1
  else:
    continue

print(len(AC),cnt)

Submission status: Wrong Answer

Solution code:
def solve(n, m, p, s):
    accept = {i+1: False for i in range(n)}
    penalty = {i+1: 0 for i in range(n)}
    for i in range(m):
        if s[i] == "WA":
            if not accept[p[i]]:
                penalty[p[i]] += 1
        else:
            accept[p[i]] = True
    a = sum(accept.values())
    b = sum(penalty.values())
    return "%d %d" % (a, b)

n, m = map(int, input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = input().split()
    p[i] = int(p[i])
print(solve(n, m, p, s))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
correct = 0
penal = 0
d = {i: set() for i in range(1,n+1)}
for _ in range(m):
    p, s = input().split()
    if s == 'AC':
        if not s in d[int(p)]:
            correct += 1
    else:
        if not 'AC' in d[int(p)]:
            penal += 1
    d[int(p)].add(s)
print(correct, penal)

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
dic = {}
L,LL=[],[]
for i in range(b):
    c,d = map(str,input().split())
    L.append((c,d))

from itertools import groupby
for k, v in groupby(L,key = lambda x:x[0]):
    LL.append(list(v))

wac = 0
acc = 0
for i in range(len(LL)):
    flag = False
    for j in range(len(LL[i])):
        if LL[i][j][1] == "WA" and flag != True:
            wac +=1
            flag = False
        elif LL[i][j][1] == "AC" and flag == False:
            acc +=1
            flag = True

print(acc,wac)

Submission status: Wrong Answer

Solution code:
def main(n, m, p_s: list):
    AC = 0
    WA = 0

    tmp_WA = 0
    tmp_AC = 0

    for p, s in p_s:
        if s == 'WA':
            tmp_WA += 1
        elif s == 'AC' and tmp_AC != p:
            AC += 1
            WA = tmp_WA
            tmp_AC = p
        else:
            continue

    print(AC, WA)


if __name__ == "__main__":
    n, m = map(int, input().split())
    p_s = [input().split() for _ in range(m)]

    main(n, m, p_s)

Submission status: Wrong Answer

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  q = int(q) - 1
  # まだ正解が出ていない場合
  if(points[q] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[q] = 1
    # 不正解の場合
    else:
      penalties[q] += 1

print('{} {}'.format(sum(points), sum(penalties)))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
p = []
S = []
cnt = 0
arr = [False]*M
for i in range(M):
    tmp_p,tmp_S = input().split()
    p.append(int(tmp_p))
    S.append(tmp_S)

    #if tmp_S=='AC':
    #    arr[i]=True

question = -1
flg = True
wa_cnt = 0
ac_cnt = 0
for i in range(M):
    if question!=p[i]:
        flg = True
        cnt = 0

    if flg == True:
        if S[i]=='AC':
            ac_cnt += 1
            wa_cnt += cnt
            flg = False
        #else:
        #    wa_cnt += 1
    question = p[i]
    cnt += 1

print(str(ac_cnt),str(wa_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if M == 0:
  print(0, 0)
else:
  pS = [list(input().split()) for i in range(M)]

  for i in range(M):
    pS[i][0] = int(pS[i][0])

  list1 = [[0 for i in range(2)] for j in range(N)]
  
  for i in range(M):
    if list1[pS[i][0] - 1][1] == 0:
      if pS[i][1] == "AC":
        list1[pS[i][0] - 1][1] = 1
      else:
        list1[pS[i][0] - 1][0] += 1
  
  
  seito = 0
  penalty = 0


  for i in range(N):
    seito = seito + list1[i][1]
    penalty = penalty + list1[i][0]
  
  print(seito, penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac = [False for i in range(n)]
pen = [0 for i in range(n)]
s = list()
p = list()
for i in range(m):
    a,b = input().split()
    a = int(a)
    s.append(a)
    p.append(b)
for i in range(m):
    if ac[s[i]-1] == True:
        pass
    else:
        if p[i] == "AC":
            ac[s[i]-1] = True
        else:
            pen[s[i]-1] += 1
wa = 0
for i in range(n):
    if ac[i] == "AC":
        wa += pen[i]
print(sum(ac), wa)

Submission status: Wrong Answer

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

max_val = 10**5+1
# dictの初期化
ac_dic = {}
wa_dic = {}
for val in range(1,max_val):
    ac_dic[str(val)] = None
    wa_dic[str(val)] = 0

ac_ans,wa_ans = 0,0


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

    # acの処理
    if s == "AC":
        ac_dic[p] = "AC"
        wa_ans += wa_dic[p]
    # waの処理
    wa_dic[p] += 1


for i in range(1,max_val):
    if ac_dic[str(i)] == "AC":
        #wa_ans += wa_dic[p]
        ac_ans += 1

#print(ac_dic,wa_dic)
print(ac_ans,wa_ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac = [False for i in range(n)]
pen = int()
s = list()
p = list()
for i in range(m):
    a,b = input().split()
    a = int(a)
    s.append(a)
    p.append(b)
for i in range(m):
    if ac[s[i]-1] == True:
        pass
    else:
        if p[i] == "AC":
            ac[s[i]-1] = True
        else:
            pen += 1
print(sum(ac), pen)

Submission status: Wrong Answer

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

#p_L,s_L = [],[]
ac_dic = {}
wa_dic = {}
for val in range(10**5+1):
    ac_dic[str(val)] = None
    wa_dic[str(val)] = 0

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

    # acの処理
    if s == "AC":
        ac_dic[p] = "AC"
    
    # waの処理
    if s == "WA" and ac_dic[p] != "AC":
        wa_dic[p] += 1

ac_ans,wa_ans = 0,0
for i in range(10**5+1):
    if ac_dic[str(i)] == "AC":
        wa_ans += wa_dic[p]
        ac_ans += 1

print(ac_ans,wa_ans)

Submission status: Wrong Answer

Solution code:
class A:
    def __init__(self):
        self.ac = 0
        self.wa = 0
        data = input().split(" ")
        self.data = [int(s) for s in data]
        #data[0] 問題 [1] 回答数
        self.name = list()
        self.score = list()
    
    def do(self):
        for i in range(self.data[1]):
            my_data =input().split(" ")
            result = my_data[1]
            if not my_data[0] in self.name:
                self.name.append(my_data[0])
                success = 0
                miss = 0
                index = self.name.index(my_data[0])
                if result == "WA":
                    miss += 1
                else:
                    success += 1
                    self.score.insert(index, 0)
                    self.ac += 1
                    
            else:
                if success == 1:
                    pass
                else:
                    if result == "WA":
                        miss  += 1
                        
                    else:
                        self.score.insert(index, miss)
                        self.wa += miss
                        self.ac += 1
        print(self.ac, end=" ")
        print(self.wa)
a = A()
a.do()

Submission status: Wrong Answer

Solution code:
data = input().split()
problems = int(data[0])
count = int(data[1])
number = list()
score = list()

for i in range(count):
    my_data = input().split(" ")
    if not my_data[0] in number:
        number.append(my_data[0])
        score.append(-1)
    else:
        pass
    result = my_data[1]
    my_index = number.index(my_data[0])
    if score[my_index] == -1:
        score[my_index] = 0
        miss = 0
        success = 0
        index = score.index(0)
        if result == "AC":
            success += 1
            score.append(0)
            print(1)
        else:
            miss += 1
            print(2)
            
    else:
        if success == 1:
            print(3)
            pass
        else:
            if result == "AC":
                success += 1
                score[index] = miss
                print(4)
            else:
                miss += 1
                print(5)

print(len(number), end=" ")
print(sum(score))

Submission status: Wrong Answer

Solution code:
n,m= map(int,input().split())
cnt=0
acc=0
ac=[0]*n
for i in range(m):
	p,s= map(str,input().split())
	if ac[int(p)-1]==0:
		if s=='AC':
			acc+=1
			ac[int(p)-1]=1
		else:
			cnt+=1
print(acc,cnt)

Submission status: Wrong Answer

Solution code:

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


list_AC = []
count_WA = {}

for i in range(M):
    p , S = input().split(' ')
    
    if (p in list_AC):
        # 既にAC済みの場合は何もしない
        continue 
    else:
        if S == 'AC':
            list_AC.append(p)
        else:
            if p in count_WA:
                count_WA[p] += 1
            else:
                count_WA[p] = 1
        
for i in list_AC:
    if i in count_WA:
        print(count_WA[i])
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n,m= map(int,input().split())
bp,bs='',''
nn=0
cnt=0
ac=0
for i in range(m):
	p,s= map(str,input().split())
	if p!=bp:
		nn=1
	if nn==1 and s=='WA':
		cnt+=1
	if nn==1 and s=='AC':
		ac+=1
	if s=='AC':
		nn=0
	bp=p
	bs=s
print(ac,cnt)

Submission status: Wrong Answer

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

cnt_ac = 0
cnt_wa = 0
for j in range(m):
  if ac_flags[ps[j][0]-1]==1:
    continue
  if ps[j][1]=='WA':
    if ac_flags[ps[j][0]-1]==0:
      cnt_wa += 1
  else:
    #ps[j][1]=='AC':
    cnt_ac += 1
    ac_flags[ps[j][0]-1] = 1
ac = 0
pena = 0

print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

Solution code:
import sys
N, M = [int(v) for v in sys.stdin.readline().split()]
PS = []
AC = {}
WA = {}
for i in range(M):
    p, s = sys.stdin.readline().split()
    p = int(p)

    if s == 'AC':
        if p not in AC:
            AC[p] = 1
    else:
        if p not in AC:
            if p not in WA:
                WA[p] = 1
            else:
                WA[p] += 1
print(len(AC), sum(WA.values()))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
for i in range(m):
  ps[i][0] = int(ps[i][0])
  
ac_flags=[0]*n
cnt_ac = 0
cnt_wa = 0
for j in range(m):
  #print('{}'.format(ps[j]))
  # まだACしていない問題でWAだった場合
  if ac_flags[ps[j][0]-1]==1:
    continue
  if ac_flags[ps[j][0]-1]==0 and \
  ps[j][1]=='WA':
    cnt_wa += 1
    #print('cnt_wa={}'.format(cnt_wa))
  # まだACしていない問題でACだった場合
  elif ac_flags[ps[j][0]-1]==0 and \
  ps[j][1]=='AC':
    cnt_ac += 1
    ac_flags[ps[j][0]-1] = 1
    #print('cnt_ac={}'.format(cnt_ac))
    #print('ac_flags={}'.format(ac_flags))
  # ACした問題だった場合
    
print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

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

for i in range(m):
		a, b = input().split()
		a_list.append([int(a), b])
		
ac = 0
wa = 0

if m == 0:
	print(ac, wa)
elif (m == 1) and (a_list[0][1] == 'AC'):
	print(1, 0)
elif (m == 1) and (a_list[0][1] == 'WA'):
	print(0, 1)
else:
	for i in range(m-1):
		if (a_list[i][1] == 'WA'):
			if (a_list[i][1] == 'WA') and (a_list[i+1][1] == 'WA'):
				wa += 1				
			elif(a_list[i][1] == 'WA') and (a_list[i+1][1] == 'AC'):
				wa += 1
			else:
				pass
		elif(a_list[i][1] == 'AC'):
			ac += 1
			for ii in range(i,m-1):
				if a_list[ii+1][0] == a_list[i][0] :
					a_list[ii+1][1] = 'NO'
				else:
					pass
		else:
			pass
	print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
for i in range(m):
  ps[i][0] = int(ps[i][0])
  
ac_flags=[0]*n
cnt_ac = 0
cnt_wa = 0
for j in range(m):
  #print('{}'.format(ps[j]))
  # まだACしていない問題でWAだった場合
  if ac_flags[ps[j][0]-1]==0 and \
  ps[j][1]=='WA':
    cnt_wa += 1
    #print('cnt_wa={}'.format(cnt_wa))
  # まだACしていない問題でACだった場合
  elif ac_flags[ps[j][0]-1]==0 and \
  ps[j][1]=='AC':
    cnt_ac += 1
    ac_flags[ps[j][0]-1] = 1
    #print('cnt_ac={}'.format(cnt_ac))
    #print('ac_flags={}'.format(ac_flags))
  # ACした問題だった場合
  else:
    pass
    
print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

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

ans = [0,0]
flag = False
for i in range(m):
    if flag and i >= 1:
        if lst[i][0] == lst[i-1][0]:
            break
        else:
            flag = False
    if lst[i][1] == "AC":
        ans[0] += 1
        flag = True
    else:
        ans[1] += 1
        
print(str(ans[0])+" "+str(ans[1]))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

lst = [[] for i in range(N)]
for i in range(M):
  p, S = input().split()
  p = int(p) - 1
  lst[p].append(S == 'AC')

ac = 0
wa = 0
for Q in lst:
  for q in Q:
    if q == True:
      ac += 1
      break
    else:
      wa += 1

print('{:d} {:d}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

lst = [[] for i in range(N)]
for i in range(M):
  p, S = input().split()
  p = int(p) - 1
  lst[p].append(S == 'AC')

ac = 0
wa = 0
for Q in lst:
  if len(Q) == 0:
    continue
    
  Q = np.array(Q)
  idx = np.where(Q == True)[0]
  
  if idx.size > 0:
    ac += 1
    wa += idx[0]
  else:
    wa += Q.size

print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input().split() for i in range(m)]
for i in range(m):
  ps[i][0] = int(ps[i][0])
  
ac_flags=[0]*n
cnt_ac = 0
cnt_wa = 0
  
for i in range(1, n+1):
  #print('i={}'.format(i))
  for j in range(m):
    #print('{}'.format(ps[j]))
    # まだACしていない問題でWAだった場合
    if ac_flags[i-1]==0 and \
    ps[j][0]==i and \
    ps[j][1]=='WA':
      cnt_wa += 1
    # まだACしていない問題でACだった場合
    elif ac_flags[i-1]==0 and \
    ps[j][0]==i and \
    ps[j][1]=='AC':
      cnt_ac += 1
      ac_flags[i-1] = 1
    else: pass
    # 調べた問題は削除
    
print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    # 不正解の場合
    elif(ans == 'WA'):
      penalties[int(q) - 1] += 1

print(sum(points), sum(penalties))

Submission status: Wrong Answer

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    # 不正解の場合
    else:
      penalties[int(q) - 1] += 1

print(sum(points), sum(penalties))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt[x] += 1
for i in range(b):
  if list[x] ==0:
    f_cnt[x] = 0
print("{} {}".format(t_cnt, sum(f_cnt)))

Submission status: Wrong Answer

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    # 不正解の場合
    else:
      penalties[int(q) - 1] = penalties[int(q) - 1] + 1

print(sum(points), sum(penalties))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cor, wro = 0,0
solved = [False]*(n+1)
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC' and not solved[p]:
        cor+=1
        solved[p]=True
    elif s == 'WA' and not solved[p]:
        wro+=1
print(cor,wro)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = [0]*a
f_cnt = [0]*a
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt[x] = 1
    else:
        f_cnt[x] += 1
print("{} {}".format(sum(t_cnt), sum(f_cnt)))

Submission status: Wrong Answer

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

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  # まだ正解が出ていない場合
  if(points[int(q) - 1] == 0):
    # 正解の場合
    if(ans == 'AC'):
      points[int(q) - 1] += 1
    # 不正解の場合
    else:
      penalties[int(q) - 1] += 1

print(sum(points), sum(penalties))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
pre = None
ac, wa = 0, 0
wc = 0
flag = False
for _ in range(m):
    p, s = input().split()
    if p != pre: wc = 0; flag = False; pre = p
    if flag == True: continue
    if s == "WA": wc += 1
    else: ac += 1; wa += wc; flag = True

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
Ps = [ input().split() for _ in range(m)]
Prb = [[-1, -1] for _ in range(n)]
wa, ac = 0, 0
for ps in Ps:
    p, s = int(ps[0])-1, ps[1]
    if Prb[p][0] == -1:
        Prb[p][0] = 1
    if Prb[p][1] == -1:
        if s == 'WA':
            wa += 1
        else:
            Prb[p][1] = 1
            ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
Ps = [ input().split() for _ in range(m)]
Prb = [[-1, -1] for _ in range(n)]
wa, ac = 0, 0
for ps in Ps:
    print(ps)
    p, s = int(ps[0])-1, ps[1]
    if Prb[p][0] == -1:
        Prb[p][0] = 1
    if Prb[p][1] == -1:
        if s == 'WA':
            wa += 1
        else:
            Prb[p][1] = 1
            ac += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac, wa = [0] * n, 0
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa += 1
    return "{} {}".format(sum(ac), wa)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))