Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

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

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

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

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

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

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

Sample Input 1

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

Sample Output 1

2 2

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

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

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

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

Sample Input 3

6 0

Sample Output 3

0 0



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


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]
p = [int(ps[i][0]) for i in range(M)]
s = [ps[i][1] for i in range(M)]


maxac = len(set(p))
ac = s.count('AC')
wa = s.count('WA')

li = []
nocount = 0
for i in range(1, N+1):
    if [str(i), 'AC'] in ps:
        num = ps.index([str(i), 'AC'])
        if [str(i), 'WA'] in ps[num:]:
            nextnum = ps[num:].count([str(i), 'WA'])
            nocount += nextnum

if ac >= maxac:
    print(maxac, wa-nocount)
else:
    print(ac, wa-nocount)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=0
ans=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
    ans+=WA
    WA=0
  elif p not in AC:
    WA+=1
print(len(set(AC)),ans)

Submission status: Wrong Answer

Solution code:
input1 = input().split()
problem = int(input1[0])
num_sub = int(input1[1])
list_sub = set()
for i in range(num_sub):
  input2 = input().split()
  list_sub.add((input2[0], input2[1]))
wrong = 0
for i in list_sub:
  if(i[1] == "WA"):
    wrong = wrong + 1
print(str(len(list_sub) - wrong)+ " " + str(wrong))

Submission status: Wrong Answer

Solution code:
F_str = input().split()
F = [int(f) for f in F_str]
N = F[0]
M = F[1]

WA_dict = {}
AC_list = []

for i in range(M):
    S_str = input().split()
    S = [str(s) for s in S_str]
    if(S[1] == "AC"):
        AC_list.append(S[0])
    else:
        WA_dict.setdefault(S[0], 0)
        WA_dict[S[0]] += 1

AC_set = list(set(AC_list))

WA_count = 0

for item in AC_set:
    if(item in WA_dict):
        WA_count += WA_dict[item]

print(WA_count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
correct = defaultdict(bool)

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

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

for pp, ss in zip(p,s):
    if correct[pp]:
        pass
    else:
        if ss == 'AC':
            correct[pp] = True
            ac += 1
        elif ss == 'WA':
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
nm = input().split()
q = 0
wa = 0
ac = 0
lastac = 0

for i in range(int(nm[1])):
 tmp = input().split()
 if  q != tmp[0] :
  q = tmp[0]
 if tmp[1] == "WA" and lastac !=tmp[0] :
  wa+=1
 elif tmp[1] == "AC" and lastac !=tmp[0] :
  ac+=1
  lastac = tmp[0]
print(wa,ac)

Submission status: Wrong Answer

Solution code:
# AtCoder Beginner Contest 151: C (2020/01/12)
N, M = map(int, input().split())
A = [0 for i in range(N)]
p = [0 for i in range(M)]
S = ['' for i in range(M)]
for i in range(M):
    l = input().split()
    p[i] = int(l[0])
    S[i] = str(l[1])
ans = 0
pnlt = 0
for i in range(M):
    if A[p[i]-1] == 0:
        if S[i] == 'AC':
            ans = ans + 1
            A[p[i]-1] = 1
        else:
            pnlt = pnlt + 1
print(ans, pnlt)

Submission status: Wrong Answer

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

np, cl = "", False
ac, wa = 0, 0
for i in range(M):
  p, s = input().split()
  # 初めての問題
  if np != p:
    if s == "WA":
      wa += 1
      cl = False
    elif s == "AC":
      ac += 1
      cl = True
    np = p
  # 継続問題
  else:
    if cl == True:
      continue
    else:
      if s == "WA":
        wa += 1
      elif s == "AC":
        ac += 1
        cl = True
      np = p
print(ac, wa)

Submission status: Wrong Answer

Solution code:
R = lambda : input().split()

n, m = map(int, R())
a = [False] * n
b = [0] * n
for _ in range(m):
  p, s = R()
  p = int(p) - 1
  if s == 'AC':
    a[p] = True
  elif not a[p]:
    b[p] += 1
print(sum(a), sum(b))

Submission status: Wrong Answer

Solution code:
import sys

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

L = []

d = {}

for _ in range(M):
    P,S = input().split()
    P = int(P)
    L.append([P,S])

for i in range(M):
    p,s = L[i]
    if p in d:
        if s=="AC" and d[p]["AC"]==0:
            d[p]["AC"] = 1
        elif s=="WA" and d[p]["AC"]==0:
            d[p]["WA"] = d[p]["WA"] + 1
    else:
        d[p] = {}
        d[p]["AC"] = 0
        d[p]["WA"] = 0
        if s=="AC":
            d[p]["AC"] = 1
        else:
            d[p]["WA"] = 1

ac_count = 0
wa_count = 0

for i in range(1,N+1,1):
    if not (i in d):
        continue    
    ac_count = ac_count + d[i]["AC"]
    wa_count = wa_count + d[i]["WA"]

print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
a,s=input().split()
a=int(a) 
s=int(s)
A=[]
B=[]
ac=0
wa=0
for i in range(s):
  d,f=input().split()
  if f=="AC" and d not in B:
    ac+=1
    B.append(d)
  else:
    A.append(d)
for i in A:
  if i in B:
    wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
check = [0]*(N+3)
fail = [0]*(N+3)

wa=0
cnt=0
for i in range(M):
    pi,si=input().split()
    pi = int(pi)
    if si=='AC':
        if check[pi]==0:
            check[pi]=1
    else:
        if check[pi]==0:
            fail[pi]+=1
print(sum(check), sum(fail))

Submission status: Wrong Answer

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

nAC = 0
nWA = 0
result_dic = {}

for i in range(M):
    pi, si = input().split()
    
    if pi not in result_dic.keys():
#         result_dic[pi] = si
        if si == "AC":
            result_dic[pi] = [pi,0]
            nAC += 1
        else:
            result_dic[pi] = [pi,1]
    else:
        pi_res = result_dic[pi][0]
        if pi_res == "AC":
            pass
        elif pi_res == "WA":
            if si == "AC":
                nWA += result_dic[pi][1]
                nAC += 1
                result_dic[pi] = si
            elif si == "WA":
                result_dic[pi][1] += 1

print(nAC,nWA)

Submission status: Wrong Answer

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


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

acc = 0
mis = 0

for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == "AC":
            acc += 1
            memo = s[i][0]
        elif s[i][1] == "WA":
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

Solution code:
n=list(map(int,input().split()))
x=[list(input().split())for i in range(n[1])]
wa,ac=0,0
notused=[]
for i in range(n[1]):
  if(x[i][0] not in notused):
    if(x[i][1]=="WA"):
      wa+=1
    else:
      ac+=1
      notused.append(x[i][0])
print('{0} {1}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
ls = []
count_ac = 0
count_wa = 0

for i in range(M):
    P, S = input().split()
    ls.append((P, S))

ls = set(ls)

for i in ls:
    if i[1] == "AC":
        count_ac +=1
    else:
        count_wa +=1
print(count_ac, count_wa)

Submission status: Wrong Answer

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

N = Input[0]
M = Input[1]

Ar = []

for i in range(M):
  Input = list(map(str,input().split()))
  Ar.append([])
  Ar[i].append(int(Input[0]))
  Ar[i].append(Input[1])

ac = 0
pn = 0

ac_ar=[]
pn_ar=[]

chk  = 1

for i in range(M):
  if Ar[i][1]=="AC":
    ac_ar.append(Ar[i][0])
    chk+=1
  elif (chk==Ar[i][0])and(Ar[i][1]=="WA"):
    pn_ar.append(Ar[i][0])

ac = len(set(ac_ar))
pn = len(set(pn_ar))

print(ac,pn)

Submission status: Wrong Answer

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

br = ''
r = ['WA']*(N+1)
o = []
c = 0
ac_c = 0
p_c =0

for ps in li:
    if ps[1] == 'WA':
        c+=1
    else: # AC
        index = int(ps[0])
        if r[index] == 'WA':
            r[index] = 'AC'
            p_c += c
            ac_c+=1
        else:
            pass
        c=0

print(ac_c, p_c)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
AC_list = [0] * N
WA_count = 0
AC_count = 0
for i in range(M):
    A = list(input().split())
    if AC_list[int(A[0])-1] == 1:
        pass
    else:
        if A[1] == "AC":
            AC_count += 1
            AC_list[int(A[0])-1] = 1
        else:
            WA_count += 1
print(AC_count,WA_count)

Submission status: Wrong Answer

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

	num = []
	ans = []
	for i in range(m):
		na,a = input().split()
		num.append(na)
		ans.append(str(a))
	
	ac = 0
	wa = 0
	ac_temp = 0
	wa_temp = 0
	for i in range(m):
		if ans[i] == "WA":
			if i > 0 and num[i] != num[i-1]:
				wa_temp = 1
			else:
				wa_temp += 1
		if ans[i] == "AC" and ac_temp != num[i]:
			ac += 1
			wa += wa_temp
			wa_temp = 0
			ac_temp = num[i]

	print(ac,wa)

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
wacou = [0]*N
acchc = [-1]*N
for i in range(M):
  p, s = input().split()
  p = int(p)
  if s=='WA' and acchc[p-1]<0:
    wacou[p-1] += 1
  elif s=='AC' and acchc[p-1]<0:
    acchc[p-1] = 1
  else:
    continue
print(acchc.count(1), sum(wacou))

Submission status: Wrong Answer

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

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

pS = [list(input().split()) for _ in range(M)]
ACed = [False] * (N+1)
pena_memo = [0] * (N+1)

if N == 1:
    if pS[0][1] == "AC":
        print(1,0)
    else:
        print(0,1)
    exit()

n_ac = 0
n_pena = 0

for i in range(M):
    if not ACed[int(pS[i][0])]:
        if pS[i][1] == "AC":
            ACed[int(pS[i][0])] = True
            n_ac += 1
            n_pena += pena_memo[int(pS[i][0])]
        else:
            pena_memo[int(pS[i][0])] += 1

print(n_ac, n_pena)

Submission status: Wrong Answer

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

list = [input().split() for _ in range(M)]

ac_list = [0] * N
wa_list = [0] * N

for i in range(M):
  if list[i][1] == "AC":
    ac_list[int(list[i][0])-1] = 1
  else:
    if ac_list[N-1] == 0:
      wa_list[int(list[i][0])-1] += 1
      
print(sum(ac_list), sum(wa_list))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input() for _ in range(m)]
p = [0] * m
s = [''] * m
for i in range(m):
  x, y = ps[i].split()
  p[i] = int(x)
  s[i] = y
ac_flag = [0]*n # AC出したかどうかのflag
ac_count = 0
wa_count = 0
for j in range(m):
  if s[j] == 'AC' and ac_flag[p[j]-1] != 1:
    ac_count+=1
    ac_flag[p[j]-1] = 1
  elif s[j] == 'WA' and ac_flag[p[j]-1] != 1:
    wa_count+=1
print(ac_count,wa_count)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
p = []
s = []
ansS = 0
ansP = 0
count = []

if M != 0:
    for x in range(M):
        a,b = list(map(str, input().split()))
        p.append(int(a))
        s.append(b)

for x in range(len(p)):
    if p[x] in count:
        pass

    else:
        if s[x] == 'WA':
            ansP += 1
        elif s[x] == 'AC':
            ansS += 1
            count.append(p[x])

print(ansS,ansP)

Submission status: Wrong Answer

Solution code:
mondai,kaitou = map(int,input().split())
#問題ごとのDict
answerd = {}
cleard = 0
pena = 0
#解答数分繰り返す
for i in range(kaitou):
    qNo,n_k = input().split()
    if qNo in answerd.keys():
        o_k = answerd.get(qNo)
        #今までWA　今回AC
        if o_k == 'WA' and n_k == 'AC':
            cleard += 1
            answerd[qNo]= n_k
            # 今までWA　今回WA
        elif o_k == 'WA' and n_k == 'WA':
            pena +=1
    else:
        if n_k == 'WA':
            pena +=1
        else:
            cleard +=1
        answerd[qNo] = n_k
print(str(cleard) + ' ' + str(pena))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = [list(input().split()) for i in range(M)]
PS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]
WA = 0
prob = [0]*N

for i in range(M):
    if prob[PS[i][0]] == 0:
        if PS[i][1] == "AC":
            prob[PS[i][0]] = 1
        else:
            WA += 1
        # print(prob,WA)

print(sum(prob),WA)

Submission status: Wrong Answer

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

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

print(sum(cor), WA)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]
p = []; S = []
for _ in range(M):
    p_tmp, S_tmp = input().split()
    p.append(int(p_tmp))
    S.append(str(S_tmp))

AC = [0] * N
WA = [0] * N
for i in range(M):
    if AC[p[i] - 1] == 1:
        continue
    if S[i] == 'AC':
        AC[p[i] - 1] = 1
    else:
        WA[p[i] - 1] += 1
AC_count = sum(AC)
WA_count = sum(WA)
print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[]
p=[]
s=[]
cnt=0
cntac=0
flag=[0 for i in range(n)]
for i in range(m):
  a=input()
  ps.append(a)
for i in range(m):
  b=ps[i][0]
  p.append(int(b))
  c=ps[i][2]+ps[i][3]
  s.append(c)
for i in range(m):
  if s[i]=="WA" and flag[p[i]-1]==0:
    cnt+=1
  if s[i]=="AC" and flag[p[i]-1]==0:
    flag[p[i]-1]=1
    cntac+=1
    #print(flag)
print(cntac,cnt)

Submission status: Wrong Answer

Solution code:
d,f = map(int,input().split())
n = []
aw = []
ww = 0
for i in range(f):
  a,b = input().split()
  if not a in n:
    n.append(a)
    aw.append([a,b])
  else:
    h = n.index(a)
    if b == "AC" or (b == "WA" and not "AC" in aw[h]):
      aw[h].append(b)
y = len(aw)
for qu in aw:
  ww += qu.count("WA")
print(y,ww)

Submission status: Wrong Answer

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

if M > 0:
    wa = [0] * N
    ac = set()
    ans = [0, 0]
    for s in S:
        if s[1] == "AC":
            ac.add(int(s[0])-1)
        elif s[1] == "WA" and int(s[0])-1 not in ac:
            wa[int(s[0])-1] += 1
    print(len(ac), sum(wa))
else:
    print(0, 0)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac=0
wa=0
pp=set()
tmp=0
for i in range(0,m):
    p,s = input().split()
    if p in pp:
        continue
    if s == 'AC':
        pp.add(p)
        ac=ac+1
        wa = wa+tmp
        tmp=0
    tmp = tmp+1 if s == 'WA' else tmp
print(ac, wa)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
a = [input().split() for _ in range(M)]
p = [int(x[0]) for x in a]
s = [x[1] for x in a]

sl = []
ans = 0
pen = 0
for i in range(M):
    if p[i] in sl:
        continue

    if s[i] == 'WA':
        pen += 1
    else:
        ans += 1
        sl.append(p[i])

print(ans, pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
dic = {}
for i in range(N):
  dic[i+1] = [0,0]

for _ in range(M):
  round,result = input().split()
  round = int(round)
  if result == 'AC' and dic[round][0] != 1:
    dic[round][0] = 1
  if result == 'WA' and dic[round][0] != 1:
    dic[round][1] += 1

right = 0
wrong = 0

for item in dic.values():
  right += item[0]
  wrong += item[1]

print(right, wrong)

Submission status: Wrong Answer

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_)

uni_p = list(set(p))
AC_numbers = {key:0 for key in uni_p}
WA_numbers = {key:0 for key in uni_p}

for num, res in zip(p, S):
	if res == "WA":
		if AC_numbers[num] != 1:
			WA_numbers[num] += 1

	else:
		AC_numbers[num] = 1

ac = 0
wa = 0
for i in uni_p:
	ac += AC_numbers[i]
	wa += WA_numbers[i]
	
print(ac, wa)

Submission status: Wrong Answer

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

for i in range(M):
	p, S = input().split()
	p = int(p)
	if S == "AC" and ac_chk[p] == 0:
		ac_chk[p] = 1
	if S == "WA" and ac_chk[p] == 0:
		wa_chk[p] += 1
print(sum(ac_chk), sum(wa_chk))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M = map(int,input().split())
pena = np.zeros(N)
clear = np.zeros(N)
for i in range(M):
    p,S = input().split()
    p = int(p)-1
    if S == "WA" and clear[int(p)] == 0:
        pena[int(p)] += 1
    else:
        clear[int(p)] = 1
print(int(np.sum(clear)),int(np.sum(pena)))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, m = map(int, input().split())
    ac_status = defaultdict(int)
    wa_count = defaultdict(int)
    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac_status[p] = 1
        else:
            if ac_status[p] != 1:
                wa_count[p] += 1
    ac = len([v for v in ac_status.values() if v == 1])
    wa = sum([v for v in wa_count.values()])
    #print(ac_status)
    #print(wa_count)
    print(ac, wa)


input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if tb == 'WA' and qp[ta-1] == 0 :dp[ta-1]+=1
    elif tb == 'AC' and qp[ta-1] == 0 :qp[ta-1]+=1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

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

seitou=0
pena=0
cont=0
q=[0]*(n+1)
pena=[0]*(n+1)
for i in range(m):
    
    p,s=input().split()
    p=int(p)
    if q[p]==0:
        if s=="WA":pena[p]+=1
        if s=="AC":
            seitou+=1
            q[p]=1    

print(sum(q),sum(pena))

Submission status: Wrong Answer

Solution code:
import sys

def resolve():
    input = sys.stdin.readline
    N,M=map(int,input().rstrip().split())
    Q=[list(input().rstrip().split()) for _ in range(M)]

    c=[0 for _ in range(N)]
    flag=[0 for _ in range(N)]

    for i in range(M):
        if Q[i][1]=="WA" and flag[int(Q[i][0])-1]==0:
            c[int(Q[i][0])-1]+=1
        else:
            flag[int(Q[i][0])-1]=1
    
    #ans=sum(c)
    #ansAC=sum(flag)
    
    ans=0
    ansAC=0
    for i in range(N):
        ans+=c[i]
        ansAC+=flag[i]
    print(int(ansAC), int(ans))

import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 5
1 WA
1 AC
2 WA
2 AC
2 WA"""
        output = """2 2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """100000 3
7777 AC
7777 AC
7777 AC"""
        output = """1 0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """6 0"""
        output = """0 0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    tmp = str(input()).split(" ")
    n = int(tmp[0])
    m = int(tmp[1])
    p = []
    s = []
    for i in range(m):
        tmp = str(input()).split(" ")
        p.append(int(tmp[0]))
        s.append(str(tmp[1].replace("\n", "")))
    cnt = [[0, 0, False] for i in range(n)]
    for i, j in zip(p, s):
        if j == "WA" and not cnt[i-1][2]:
            cnt[i-1][1] += 1
        elif j == "AC" and not cnt[i-1][2]:
            cnt[i-1][0] = 1
            cnt[i-1][2] = True
    accnt = 0
    wacnt = 0
    for i in range(n):
        accnt += cnt[i][0]
        wacnt += cnt[i][1]
    print(str(accnt) + " " + str(wacnt))


if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Wrong Answer

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

dp = [False for _ in range(n+1)]

def ans(dp, n, m) -> list:
    if m == 0:
        return [0, 0]

    ac = 0
    wa = 0
    i = 0
    while i < m:
        q, r = input().split()
        q = int(q)

        if dp[q] == False and r == 'WA':
            wa += 1

        if dp[q] == False and r == 'AC':
            ac += 1
            dp[q] = True

        i += 1

    return [ac, wa]

a = ans(dp, n, m)

print(*a)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
count_wa = 0
count_ac = 0
if m == 0:
    print('0 0')
    exit()
l = [False] * n
while True:
    try:
        p, s = map(str, input().split())
        if s == 'AC' and not l[int(p) - 1]:
            count_ac += 1
            l[int(p) - 1] = True
        elif s == 'WA' and not l[int(p) - 1]:
            count_wa += 1
    except:
        break
print(str(count_ac) + ' ' + str(count_wa))

Submission status: Wrong Answer

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

flag=0
p=[]
S=[]

for i in range(M):
    pt,st=input().split()
    
    p.append(int(pt))
    S.append(st)

ls=[i for i in range(1,N+1)]

ac_num=0
pn_num=0

for i in range(M):
    if S[i]=='WA':
        if p[i] in ls:
            pn_num+=1
    if S[i]=='AC':
        if p[i] in ls:
            ac_num+=1
            ls.remove(p[i])
print(ac_num,pn_num)

Submission status: Wrong Answer

Solution code:
#N=int(input())
#N,M=map(int, input().split())
#L=list(map(int, input().split()))
N,M=map(int, input().split())
ifACL=[0]*N
psL=[]
AC=0
WA=0
p=0
s=0
for _ in range(M):
  p,s=map(str, input().split())
  p=int(p)
  if ifACL[p-1]==0 and s=="WA":
    WA+=1
  elif ifACL[p-1]==0 and s=="AC":
    AC+=1
    ifACL[p-1]=1

print(AC,WA)

Submission status: Wrong Answer

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

ans_list = []
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if not (p_i in ans_list and p_i<=N):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list.append(p_i)
      
print("{} {}".format(cor_num,pen_num))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac,wa=0,0
t=0
flg=True
for i in range(m):
  p,s=input().split()
  if t!=p:
    flg=True
    t=p
    wa_t=0
    if s=="WA":
      wa_t+=1
    else:
      ac+=1
      wa+=wa_t
      flg=False
  else:
    if s=="WA":
      wa_t+=1
    elif s=="AC" and flg:
      ac+=1
      wa+=wa_t
      flg=False
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = 0
answers = 0
mydict  = {}
for i in range(M):
    tmp1,tmp2 = input().split()
    if tmp1 in mydict.keys():
        if mydict[tmp1] == "WA" and tmp2 == "wA":
            penalty = penalty + 1
        elif mydict[tmp1] == "WA" and tmp2 == "AC":
            mydict[tmp1] = tmp2
            answers = answers + 1
        else:
            continue 
    else:
        mydict[tmp1] = tmp2
        if tmp2 == "WA":
            penalty = penalty + 1
        else:
            answers = answers + 1
    #print(mydict)

ans = str(answers)
pen = str(penalty)
print(ans+" "+pen)

Submission status: Wrong Answer

Solution code:
n,m=[int(x) for x in input().split()]
a=[0 for _ in range(n)]
b=[0 for _ in range(n)]
for _ in range(m):
  p,q=input().split()
  #print(p,q)
  if q=="AC": 
    #print("fir")
    rg=a[int(p)-1]
    if rg==0: a[int(p)-1]=1+b[int(p)-1]
  else : 
    #print("sec")
    b[int(p)-1]+=1
xg=0
for x in a:
  if x>0: xg+=1
print(xg,sum(a))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
total = []


for i in range(M):
    a,b = map(str,input().split())
    P.append(a)
    S.append(b)
ok = 0
pena = 0

for (i,j) in zip(P,S):
    if not i in total:
        if j=='WA':
            pena+=1
        elif j=='AC':
            ok+=1
            total.append(i)
print(str(ok)+' '+str(pena))

Submission status: Wrong Answer

Solution code:
import sys

class problem():
  def __init__(self, n, s):
    self.num = n
    self.result = s


n, m = map(int, input().split())
l = []

for i in sys.stdin:
  pm, c = i.split()
  l.append(problem(int(pm), c))

ck = []
fac = 0
swa = 0
acflag = 0

for i in l:
  if i.result == 'WA':
    if ck.count(i.num) == 0:
      swa += 1
    if acflag == 0:
      fac += 1
  else:
    if ck.count(i.num) == 0:
      ck.append(i.num)
      if acflag == 0:
        acflag += 1
if len(ck) == 0:
  fac = -1
  
print(fac + 1, swa)

Submission status: Wrong Answer

Solution code:
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 1
  else:
    return 0

n,m = map(int, input().split())
p = []
s = []
wacounter = 0
point = 0
point_to_num = [] #acをとった問題
for i in range(0, m):
  list = input().split()
  p.append(int(list[0]))
  s.append(list[1])
 
for i in range(0, m):
  if s[i] == "AC" and find(p[i], point_to_num) == 0: #もし正解で、今までにその問題に正解していなかったら
    point_to_num.append(p[i]) #正解リストにその問題を追加
    point = point + 1 #正解ポイントをあげる
  else: #不正解だったら
    if s[i] == "WA" and find(i, point_to_num) == 0: #今まで正解を出したことがない
      wacounter += 1
print(point, wacounter)

Submission status: Wrong Answer

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

import numpy as np

contest = np.zeros((2, n), dtype=int)

for i in range(m):
  a = list(input().split())
  t_num = int(a[0]) - 1
  if a[1] == "AC":
    if contest[0, t_num] == 0:
      contest[0, t_num] = 1
  else:
    if contest[0, t_num] == 0:
      contest[1, t_num] += 1

ans = np.sum(contest, axis = 1)
print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

LIST = [0 for _ in range(N)]
WA = 0
AC = 0
for i in range(M):
    P, S = input().split()
    if LIST[int(P)-1] == 0:
        if S == "AC":
            LIST[int(P)-1] = 1
            AC += 1
        else:
            WA += 1
print("{} {}".format(AC, WA))

Submission status: Wrong Answer

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

print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC_list = set()
WA = 0
AC = 0
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)

    if S == "AC":
        if p in AC_list:
            continue
        else:
            AC += 1
            AC_list.add(p)
    elif S == "WA":
        if p not in AC_list:
            WA += 1
        else:
            continue
print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = [list(map(str, input().split())) for i in range(m)]
wa_i = ac_i = 0
for i in range(1, n+1):
  for j, k in li:
    if i == int(j):
      if k == 'WA':
        wa_i += 1
      else:
        ac_i += 1
        break
    else:
      continue
      
print(ac_i, wa_i)

Submission status: Wrong Answer

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


correct = 0
penalty = 0

ans = set([])

for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p <= N:
        if p in ans:
            print(0)
            continue
        elif S == 'WA':
            print(1)
            penalty += 1
        else:
            print(2)
            correct += 1
            ans.add(p)

print(correct, penalty)

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 = map(str,input().split())
    if s == "AC":
        ac[int(p)] = 1
    elif ac[int(p)] == 0:
        wa[int(p)] += 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

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


ACd=[0]*N
pena=0
for m in range(M):
    i,x=list(map(str,input().split()))
    if x=='AC':
        ACd[int(i)-1]=1
    elif x=='WA' and ACd[int(i)-1]!=1:
        pena+=1
    
print(sum(ACd),pena)

Submission status: Wrong Answer

Solution code:
def LI():
  return [int(s) for s in input().split()]

correct_answers = []
warning_count = 0

N,M = LI()

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = p_num in correct_answers
  
  if answer == 'AC' and not include_answers:
    correct_answers.append(p_num)
  elif answer == 'WA' and not include_answers:
    warning_count+=1
    
print(len(correct_answers),warning_count)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最大公約数 
def gcd(a, b):
  if a < b:
      a, b = b, a
  while a % b != 0:
      a, b = b, a % b
  return b

# 最小公倍数
def lcm(a, b):
  y = a*b / gcd(a, b)
  return int(y)

n, m = MAP()


L = []
for i in range(m):
  l = S_LIST()
  L.append(l)

num = 1
# wa
wa = 0
ac = 0

wa = [0] * n
ac = [0] * n


for i in range(m):
  p = int(L[i][0])-1
  ans = L[i][1]
  if ans == "WA":
    if ac[p] == 0:
      wa[p] = wa[p] + 1
  if ans == "AC":
    ac[p] = 1
print(sum(ac), sum(wa))


# for p in range(1, n+1):
#   if L[i][0] == str(p):
#     for i in range(m):
#       if L[i][1] == "WA":
#         wa += 1

#     for i in range(m):
#       if L[i][1] == "AC":
#         ac += 1
#   print(wa)
#   print(ac)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC = 0
WA = 0
data = []
for i in range(M):
    x, y = map(str,input().split())

    if x in data:
            continue
    if y == 'WA':
        WA += 1
    else:
        AC += 1
        data.append(x)
print(AC,WA)

Submission status: Wrong Answer

Solution code:
nm = input().split()
q = 0
wa = 0
ac = 0
lastac = 0

for i in range(int(nm[1])):
 tmp = input().split()
 if  q != tmp[0] :
  q = tmp[0]
 if tmp[1] == "WA" and lastac !=tmp[0] :
  wa+=1
 elif tmp[1] == "AC" and lastac !=tmp[0] :
  ac+=1
  lastac = tmp[0]
print(ac,wa)