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 = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(N):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a-1] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a-1]
      plbnum = a
print(cr, pn)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
aclist = []

for i in range(m):
    a,b = input().split()
    a = int(a)
    if a in aclist:
        continue
    elif b == 'WA':
        wa += 1
    elif b == 'AC':
        aclist.append(a)
        ac += 1
        
print(ac, wa)

Submission status: Wrong Answer

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

quiz_dict = {}
wa_dict = {}
 
for i in range(M):
  tmp = input().split()
  
  quiz = tmp[0]
  res = tmp[1]
  
  if quiz not in quiz_dict:
    quiz_dict[quiz] = 0
  
  if quiz not in wa_dict: 
    wa_dict[quiz] = 0
  
  if res == "AC":
    quiz_dict[quiz] = 1
  if res == "WA":
    if quiz_dict[quiz] == 0:
      wa_dict[quiz] += 1


tmp_list = [k for k, v in quiz_dict.items() if v > 0] 

print(tmp_list)

def filter_dict(f, d):
  return {k:v for k,v in d.items() if f(k,v)}

a = len(filter_dict(lambda k,v: v==1, quiz_dict))
tmp = filter_dict(lambda k,v: k in tmp_list, wa_dict)
wa_n = sum(tmp.values())

print(a, wa_n)

Submission status: Wrong Answer

Solution code:
import sys

n, m = input().split()
i = [input() for i in range(int(m))]

n_l = [0] * int(n)

a = 0
w = 0
for i_s in i:
    p, c = i_s.split()
    p = int(p) - 1
    if n_l[p] == 1:
        continue

    if c == "AC":
        n_l[p] = 1
        a += 1
    elif n_l[p] == 0:
        w += 1

print("{} {}".format(a, w))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
li=[]
sei=0
go=0
for k in range(M):
    li.append(input().split())
li = sorted(li, key=lambda x: x[0])
kotae=[]
mondai=0
for i in range(M):

    if li[i][0]!=str(mondai):

        if li[i][1]=="WA":
            kotae.append("WA")
        elif li[i][1]=="AC":
            mondai=int(li[i][0])
            kotae.append("AC")

    else:
        kotae.append("dame")

AC=kotae.count("AC")
WA=kotae.count("WA")

print(AC,WA)

Submission status: Wrong Answer

Solution code:
def main():
    N, M= map(int, input().split())
    ps = [(input().split()) for _ in range(M)]
    wa_count = [0]*N
    ac_count = [0]*N
    for p, s in ps:
        if s == "WA":
            wa_count[int(p)-1] += 1
        elif s == "AC":
            ac_count[int(p)-1] += 1
    ac_c = 0
    wa_c = 0
    for ac, wa in zip(ac_count, wa_count):
        if ac >= 1:
            ac_c += 1
        if wa >= 1:
            wa_c += 1
    print(ac_c, wa_c)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
a = [[] for i in range(n)]
for i in range(m):
    q, r = input().split(' ')
    Q = int(q) - 1
    a[Q].append(r)
c, p, pc = 0, 0, 0
for i in range(n):
    f = False
    for j in a[i]:
        pc = pc + 1 if j == 'WA' else pc
        if j ==  'AC' and not f:
            c += 1
            p += pc
            pc = 0
            f = True
print('{} {}'.format(c, p))

Submission status: Wrong Answer

Solution code:
def main():
    n,m=map(int,input().split())
    f =[0]*n
    p=[]
    s=[]
    for i in range(m):
        pp,ss=input().split()
        ppp=int(pp)-1
        p.append(ppp)
        s.append(ss)


    cntA = 0
    cntW = 0

    for i in range(m):
        ptmp=p[i]
        stmp=s[i]
        cnt=0
        if f[ptmp] == 0:
            if stmp == 'WA':
                cnt += 1
            elif stmp == 'AC':
                cntA +=1
                cntW += cnt
                f[ptmp] =1

    print(str(cntA) + ' ' + str(cntW))
    # print(cntA)
    # print(cntW)
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

ac = 0
wa = 0


hist_ac = set()
for _ in range(M):
    p, s = input().split()
    if p not in hist_ac:
        if s == 'AC':
            ac += 1
            hist_ac.add(p)
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

for x in range(M):
    pS[x][0] = int(pS[x][0])
    
Ans, Pen = 0, 0
for x in range(M):
    if (x == 0) or (pS[x][0] != pS[x-1][0]):
        pS_temp = 0
        Ans_temp = 0
    if (pS[x][1] == 'AC') and (pS_temp == 0):
        Ans += 1
        Ans_temp += 1
        pS_temp += 1
    elif (pS[x][1] == 'WA') and (pS_temp == 0) and (Ans_temp == 0):
        Pen += 1
print(Ans, Pen)

Submission status: Wrong Answer

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

AC = 0
WA = 0
x = 0
ACs = []
y = 0
for i in range(0, M):
    if P[i][1] == 'WA':
        x += 1
    elif P[i][1] == 'AC':
        for s in ACs:
            if s == P[i][0]:
                y = 1
        if y == 0:
            AC += 1
            WA += x
            x = 0
            ACs.append(P[i][0])
        y = 0
        
print(AC, WA)

Submission status: Wrong Answer

Solution code:
P=[]
S=[]

N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
WACNT=[0]*N
ACCNT=[0]*N

for i in range(M):
    PI,SI=input().split()
    for ii in range(N):
        if int(PI)==ii+1:
            if SI=="WA" and ACCNT[ii]!=1:
                WACNT[ii]=WACNT[ii]+1
            elif SI=="AC":
                ACCNT[ii]=1

Asum=0
Wsum=0
for i in range(N):
    Asum=Asum+ACCNT[i]
    Wsum=Wsum+WACNT[i]
print(Asum,Wsum)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
sum_a = 0
tmp = []
test_cnt = []
false_cnt = 0
for index in range(M):
    A = input().split()
    chk = 0
    if int(A[0]) not in test_cnt:
        if len(test_cnt) <= int(N - 1):
            test_cnt.append(int(A[0]))
        else:
            chk = 1
    if A[0] not in tmp and chk == 0:
        if A[1] == 'WA':
            false_cnt += 1
        elif A[1] == 'AC':
            tmp.append(A[0])

print(len(test_cnt))
print(false_cnt)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
c=[]
d=[]
co=0
wr=0
for i in range(k):
    a,b=map(str,input().split())
    c.append(int(a))
    if b=='AC':
        if a not in d:
            co+=1
        d.append(a)
       
    if b=='WA' and a not in d:
        wr+=1
print(co,wr)

Submission status: Wrong Answer

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

cor = pen = temp_pen = 0
temp_p = "0"
pen_dic={}
ac=set()

for _ in range(m):
  temp=input().split()
  if set(temp[0]) & set(ac):
    continue
  else:
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      t = 0

    if temp[1] == "AC":
      ac.add((temp[0]))
      pen += t
    else:
      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pis=[]
wa,ac={},{}
for i in range(M):
    p  = input().split()
    pis += [(int(p[0]),p[1])]
for p in pis:
    wa[p[0]]=0
    ac[p[0]]=0
if __name__ == '__main__':
   for p in pis:
      if ac[p[0]]<1:
         if p[1]=='WA':
              wa[p[0]]+=1
         elif p[1]=='AC':
              ac[p[0]]=1
   a=sum(ac.values())
   w=sum(wa.values())
   print('{} {}'.format(a,min(a,w)))

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
ps = []
for i in range(M):
    ps.append(list(map(str,input().split())))
    
import sys

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

ps_new = sorted(ps , key=lambda x: x[0])
toi = []

for i in range(M):
    toi.append(ps[i][0])
    
toi2 = toi[0]
toi3 = [toi2]

for i in range(M):
    if toi2 != toi[i]:
        toi3.append(toi[i])
        toi2 = toi[i]
toi3.append("0")
toi = ps_new[0][0]
j = 0
count1 = 0
count2 = 0
count3 = 0

for i in range(M):
    if toi == ps[i][0]:
        count2 += 1
        if count2 == 1:
            shokai = i
        if ps_new[i][1] == "AC":
            count1 += 1
            j += 1
            toi = toi3[j]
            count2 = 0
            count3 = count3 + (i-shokai)
    elif toi != ps[i][0] and ps_new[i][1] == "AC":
        count1+=1
print(count1,count3)

Submission status: Wrong Answer

Solution code:
import sys
N,M = map(int,input().split())
if M == 0:
    print('%d %d' % (0,0))
    sys.exit(0)
Liste = dict()
Question = [0] * M
ACorWE = [0] * M
Z = 0
correct = 0
pena = 0
for i in range(M):
    Question[i], ACorWE[i]= map(str, input().split())
Question = [int(element) for element in Question]
for _ in range(max((max(Question)+1),len(ACorWE))): #range(max(Question)+1) before
    Liste[_] = [0] 
#Liste[4].append(0) 
#print(Liste)
#print(Question) #[1, 1, 2, 2, 2]
#print(ACorWE) #['WA', 'AC', 'WA', 'AC', 'WA']
for i in range(M): ###for i in range(M) before 
    Liste[Question[i]].append(ACorWE[i])
    #print(Liste)
    Liste[i].remove(0)
#print(Liste)
#{0: [], 1: ['WA', 'AC'], 2: ['WA', 'AC', 'WA'], 3: [], 4: []}

for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    if 'AC' in Liste[i] and Z == 0:
        correct += 1
        Z = 1
    Z = 0
for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    for j in range(len(Liste[i])):
        if j <= len(Liste[i]) -2:
            if Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC' and (i == max(Question)):
                pena += 1
                print('%d %d' % (correct,pena))
                sys.exit(0)
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC':
                pena += 1
                break
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'WA':
              if 'AC' in Liste[i]:
                pena += 1
#高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
print('%d %d' % (correct,pena))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if a in A:
        continue
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

    
    
print(ac,wa)

Submission status: Wrong Answer

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

cnt_WA = 0
cnt_AC = 0
j0 = 0
for j, k in L:
  if (cnt_AC == N) or (j0 == j):
    break
  if k == 'WA':
    cnt_WA += 1
  if k == 'AC':
    cnt_AC += 1
  j0 = j
print(cnt_AC, cnt_WA)

Submission status: Wrong Answer

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

ans_n = 0
penalty_n = 0

if m == 0:
  print(ans_n, penalty_n)
else:
  i = 0
  ans_f = 0
  for row in src:
    if i != row[0]:
      ans_f = 0
      i = row[0]
      if row[1] == "AC":
        ans_n += 1
        ans_f = 1
      else:
        penalty_n += 1
    else:
      if ans_f == 0:
        if row[1] == "AC":
          ans_n += 1
          ans_f = 1
        else:
          penalty_n += 1
      else:
        continue

print(ans_n, penalty_n)

Submission status: Wrong Answer

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

ac = 0
wa = 0
ans = {}

for i in range(m):
  a, b = input().split()
  
  if a in ans.keys():
    if ans[a] == 'AC':
      pass
    elif b == 'AC':
      ac += 1
      ans[a] = b

    elif b == 'WA':
      wa += 1
  

  else:
    if b == 'AC':
      ac += 1
    elif b == 'WA':
      wa += 1
  
    ans[a] = b
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
s,p = [False]*N, [0]*N
for i in range(M):
  tmp = input().split()
  pi,Si = int(tmp[0])-1, tmp[1]
  s[pi] |= Si == "AC"
  p[pi] += 1 if not s[pi] else 0
print(sum(s), sum([pi for si,pi in zip(s,p) if s]))

Submission status: Wrong Answer

Solution code:
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	A=[]
	for i in range(M):
		a=list(map(str,input().split()))
		A.append(a)
	ch=[]
	pe=0
	for i in range(M):
		if A[i][0] in ch:
			continue
		elif A[i][1]=="AC":
			ch.append(A[i][0])
		else:
			pe+=1
	print(len(ch),pe)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
Ap = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    for i in range(scan,M):
        if int(Ap[scan][0]) == j+1 and Ap[scan][1] == "WA":
            all_failure += 1
            scan+=1

        elif int(Ap[scan][0]) == j+1 and Ap[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

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

count_penalty = 0
HMpass = 0
avoid_dup = {}

for i in range(0, M):
    if result_set[2*i+1] == "WA" and avoid_dup.get(result_set[2*i]) != "AC" or avoid_dup.get(result_set[2*i], 0) == 0:
        count_penalty += 1
        avoid_dup[result_set[2*i]] = "WA"
    elif result_set[2*i+1] == "AC" and avoid_dup.get(result_set[2*i]) != "AC":
        HMpass += 1
        avoid_dup[result_set[2*i]] = "AC"
        
print(HMpass, count_penalty)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
sum_a = 0
tmp = []
test_cnt = []
false_cnt = 0
for index in range(M):
    A = input().split()
    chk = 0
    if int(A[0]) not in test_cnt:
        if len(test_cnt) <= int(N - 1):
            print(len(test_cnt))
            print(int(N))
            test_cnt.append(int(A[0]))
        else:
            chk = 1
    if A[0] not in tmp and chk == 0:
        if A[1] == 'WA':
            false_cnt += 1
        elif A[1] == 'AC':
            tmp.append(A[0])

print(len(test_cnt))
print(false_cnt)

Submission status: Wrong Answer

Solution code:

n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = 0
wa = 0
i = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and flag[p - 1] == False:
        wa += 1
    elif s == "AC" and flag[p - 1] == False:
        ac += 1
        flag[p - 1] = True

print(str(int(ac)) + " " + str(int(wa)))

Submission status: Wrong Answer

Solution code:
#C - Welcome to AtCoder
N,M = list(map(int, input().split()))
p = []
S = []
for k in range(M):
    p_input,S_input = input().split()
    p.append(p_input)
    S.append(S_input)
p = list(map(int, p))

j = 0
sum_ac,sum_wa,sum_wa_with_ac = 0,0,0
for i in range(N):
    try:
        flg = 0
        sum_wa = 0
        while p[j] == i + 1:
            if S[j] == 'WA':
                j = j + 1
                sum_wa = sum_wa + 1
            elif S[j] == 'AC' and flg == 0:
                flg = flg + 1
                j = j + 1
                sum_ac = sum_ac + 1
                sum_wa_with_ac = sum_wa_with_ac + sum_wa
            elif S[j] == 'AC' and flg != 0:
                j = j + 1
            else:
                pass
    except IndexError:
        pass

print(sum_ac,sum_wa_with_ac)

Submission status: Wrong Answer

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

    Q = [False] * (N+1)
    F = [0] * (N+1)
    ok = 0
    for _ in range(M):
        p,S = map(str,input().split())
        p = int(p)
        if not Q[p]:
            if S == "AC":
                Q[p] = True
                ok += 1
            elif S == "WA":
                F[p] += 1
                
    print(ok,sum(F))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections


NM = str(raw_input()).split()
N = int(NM[0])
M = int(NM[1])
A = []
B = []
C = [0]*100001
#D = [0]*100100
d = 0
poi1 = 100001
# poi2 = 100100
owa = [0]* 100001


for i in xrange(M):
  temp = str(raw_input()).split()
  A.append(int(temp[0]))
  B.append(temp[1])

#print(A)
#print(B)

for i in xrange(M):
  if(B[i] == "AC" and A[i] != 0):
    C[A[i]] = 1
    # owa[A[i]] = 1
  elif(C[A[i]]==0 and A[i] != 0):
    d += 1

c = collections.Counter(C)
#d = collections.Counter(D)

poi1 -= c[0]
poi2 = d


print(str(poi1)+ " " + str(poi2));

Submission status: Wrong Answer

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

for k in range(m):
  key_and_value = input()
  key, value = key_and_value.split()
  key = int(key)
  for i in range(1, n+1):
      if key == i and value == "AC":
        count_tru +=1
        break
      else:
          if key == i and value == "WA":
            count_fal +=1
      break


print(count_tru)
print(count_fal)

Submission status: Wrong Answer

Solution code:
s=[]
lis=[]
N,M=map(int, input().split())
wacount=0
account=0
count=0
zero=0
flag=0
cur=0
changeflag=1
#s=[list(input()) for i in range(2)] 
#for range(M):
#print(N,M)

for i in range(M):
     lis=input().split()
     #print(lis)
     lis[0]=int(lis[0])
     lis.append(i)
     #print(lis)
     s.append(lis)

s2=sorted(s,key=lambda x:x[0])
sorted(s2,key=lambda x:x[2])
j=1
cur=j
for i in range(len(s2)):
    if s2[i][0]>cur:
        j=s2[i][0]
        count=0
    if s2[i][0]==j:
        if s2[i][1]=="WA":
            count=count+1
        elif s2[i][1]=="AC":
            account=account+1
            wacount=wacount+count
            j=j+1
            cur=j
            count=0
                
print(wacount,account)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=0
W=0
li=[0]*n
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if s=="AC" and li[p-1]==0:
        li[p-1]+=1
        A+=1
    else:
        if li[p-1]==0:
            W+=1
print(A,W,end="")

Submission status: Wrong Answer

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

  p,S = input().split()
  p = int(p)-1
  if table[p] == 1:
    pass
  elif S == "WA":
    pen += 1
  elif table[p] == 0 and S=="AC":
    score += 1
    table[p] = 1
print(score,pen)

Submission status: Wrong Answer

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


a=[]
count_AC=0
count_WA=0
for i in range(M):
    a.append(input().split())
now=[]
owa=[]
see=[]
for i in a:
    if (i[0] in see):
        if not(i[0] in owa):
            if i[1]=="AC":
                count_AC+=1
                owa.append(i[0])

            else:
                count_WA+=1

    #初見
    else:
        if i[1]=="AC":
            count_AC+=1
            see.append(i[0])
            owa.append(i[0])
        else:
            count_WA+=1
            now.append(i[0])
        see.append(i[0])


print(count_AC,count_WA,sep=" ")

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = map(int, input().split())
    errcnt = [0] * N
    isSolved = [False] * N
    
    for i in range(M):
        p, S = input().split()
        p = int(p) - 1

        if not isSolved[p]:
            if S == 'WA':
                errcnt[p] += 1
            else:
                isSolved[p] = True

    print(str(sum(isSolved)) + ' ' + str(sum(errcnt)))

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

done = [False for i in range(N)]

suc = 0
pen = 0

for j in range(M):
	# p is 0 indexed
	p, S = [num for num in input().split(' ')]
	p = int(p)
    
	if done[p-1] == False:
		if S == 'AC':
			done[p-1]=True
			suc+=1
		else:
			pen+=1
	else: # done[p-1] == True
		if S == 'AC':
			pass
		else:
			pass

print('{} {}'.format(suc, pen))

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
ans=[list(map(str,input().split())) for i in range(s[1])]
que=[[0,0] for i in range(s[0])]
a=0
b=0
for i in range(s[1]):
  if que[int(ans[i][0])-1][0]==0:
    if ans[i][1]=='WA':
      que[int(ans[i][0])-1][1]+=1
      a+=1
    else:
      b+=1
      que[int(ans[i][0])-1][0]=1
for j in range(s[0]):
  if que[j]==0:
    a-=que[j][1]
print(*[b,a])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
c=[]
d=[]
co=0
wr=0
for i in range(k):
    a,b=map(str,input().split())
    c.append(int(a))
    if b=='AC':
        d.append(a)
        co+=1
    if b=='WA' and a not in d:
        wr+=1
print(co,wr)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cleared = []
ac_counter = 0
wa_counter = 0
for i in range(m):
    flag = False
    p, s = input().split()
    p = int(p)
    for i in range(len(cleared)):
        if cleared[i] == p:
            flag = True
            break
    if not flag:
        if s == 'AC':
            ac_counter += 1
            cleared.append(p)
        else:
            wa_counter += 1
print(' '.join([str(ac_counter), str(wa_counter)]))

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
N,M = map(int, input().split())
s = list(input().split() for i in range(M))

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

AC = 0
WA = 0
Num = s[0][0]
AC_count = 0
WA_count = 0


for i in range(M):
    tmp_N = Num
    if tmp_N == s[i][0]:
        pass
    else:
        tmp_N = s[i][0]
        Num = tmp_N
        AC_count = 0
        WA_count = 0

    if s[i][1] == 'AC':
        AC_count += 1
        if AC_count == 1:
            AC += 1
            WA += WA_count
            WA_count = 0
        else:
            WA_count = 0
    else:
        if AC_count == 0:
            WA_count += 1
        else:
            pass

print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

    
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    if(l[i][0] in ac) == False:
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
    
 
    
print(len(ac),wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
L = []
for i in range(M):
    L.append(list(map(str,input().split())))
L.sort()
count_AC = 0
count_WA = 0
temp = 0
flag = 'WA'
p = 0

for i in range(M):
    if L[i][0] != p:
        p = L[i][0]
        temp = 0
        flag = 'WA'
        if L[i][1] == 'WA':
            temp += 1
        if L[i][1] == 'AC':
            count_AC += 1
    elif L[i][0] == p:
        if L[i][1] == 'WA':
            temp += 1
        if L[i][1] == 'AC':
            if flag == 'WA':
                count_AC += 1
                count_WA += temp
                flag = 'AC'
            if flag == 'AC':
                pass

print('{} {}'.format(count_AC, count_WA))

Submission status: Wrong Answer

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

grid = []

for i in range(M):
    array = list(map(str, input().strip().split()))
    grid.append(array)

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

for a in grid:
    if a[1] == 'AC':
        ac_list[int(a[0]) - 1] = 1
    elif a[1] == 'WA' and ac_list[int(a[0]) - 1] == 0:
        wa_list[int(a[0]) - 1] += 1

print(str(sum(ac_list)) + ' ' + str(sum(wa_list)))

Submission status: Wrong Answer

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

ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

print(str(sum(ac)) + " " + str(sum(wa)))

Submission status: Wrong Answer

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

idxw = {}
ac = 0
wa = 0

for i in range(int(M)):
  p, s = input().split(" ")
  if not (p in idxw):
    idxw[p] = []
  idxw[p].append(s)

  
#print(idxw)
for i in idxw:
  a = 'AC' in idxw[i]
  if a == True:
    ac += 1
    tmpwa = 0
    #print("-----")
    for j in idxw[i]:
      #print(j)
      if j == 'AC':
        wa += tmpwa
      else:
        tmpwa += 1

#print(ac)
#print(wa)


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

Submission status: Wrong Answer

Solution code:
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])
sum_ok,sum_miss=0,0
former_ok=[0]*n
for p_,s_ in zip(p,s):
    if p_ in former_ok or p_>n:continue
    elif s_=='AC':
        former_ok[sum_ok]=p_
        sum_ok+=1
        if sum_ok==n:break
    else:sum_miss+=1
print(sum_ok, sum_miss)

Submission status: Wrong Answer

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

for i in range(m):
    res = list(input().split())
    if res not in PS:
        PS.append(res)
    elif res[1] == "WA" and res[0] + " AC" in PS:
        pass
    elif res[1] == "AC" and res[0] + " AC" in PS:
        pass

ans = 0
pn = 0
for i in range(len(PS)):
    if PS[i][1] == "AC":
        ans += 1
    elif PS[i][1] == "WA":
        pn += 1

print(ans, pn)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans1 = 0
ans2 = 0
t = []
pret = []
for i in range(m):
  pret = list(map(str, input().split()))
  t.append(pret)
  if i > 0:
    if t[i-1][0] == t[i][0]:
      if t[i-1][1] == "WA":
        ans2 += 1
      if t[i][1] == "AC":
        if i > 1:
          if t[i-1][1] == "WA":
            ans1 += 1
        else:
          ans1 += 1
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
A=[""]
for i in range(M):
  A.append(tuple(map(str,input().split())))
check=np.zeros((N+1,2))
for i in range(1,M+1):
  if check[int(A[i][0]),0]==0:
    if A[i][1]=='WA':
      check[int(A[i][0]),1]+=1
    elif A[i][1]=='AC':
      check[int(A[i][0]),0]+=1
  else:
    continue
sum=check.sum(axis=0)
print(int(sum[0]),int(sum[1]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m==0:
    print(0,0)
    exit()
l=[]
for i in range(m):
    x,y=input().split()
    l.append([int(x),y])
l=sorted(l,key=lambda x:x[0])
ac=0
wa=0
tmp=0
t=[0]*(n+1)

for i in range(m):
    if tmp==l[i][0]:
        continue
    elif l[i][1]=="WA":
        wa+=1
    elif l[i][1]=="AC":
        ac+=1
        tmp=l[i][0]
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac_cnt, wa_cnt = 0, 0
n_and_ac = {}
for n in range(N):
  n_and_ac[str(n + 1)] = 0
for ps in PS:
  if ps[1] == "AC" and n_and_ac[ps[0]] == 0:  
    n_and_ac[ps[0]] += 1
    ac_cnt += 1
    continue
  elif ps[1] == "WA" and n_and_ac[ps[0]] == 0:
    wa_cnt += 1
print(str(ac_cnt) + " " + str(wa_cnt))

Submission status: Wrong Answer

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

idxw = {}
ac = 0
wa = 0

for i in range(int(M)):
  p, s = input().split(" ")
  if not (p in idxw):
    idxw[p] = []
  idxw[p].append(s)

  
print(idxw)
for i in idxw:
  a = 'AC' in idxw[i]
  if a == True:
    ac += 1
    tmpwa = 0
    #print("-----")
    for j in idxw[i]:
      #print(j)
      if j == 'AC':
        wa += tmpwa
      else:
        tmpwa += 1

#print(ac)
#print(wa)


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

Submission status: Wrong Answer

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

seikai = 0
miss = 0

seikai_list = []  ##既に正解した問題番号のリスト
input_list = [[0 for i in range(2)] for j in range(M)]  ##入力のリスト 問題番号と正誤

for i in range(M):
  tmp = input().split()
  input_list[i][0] = tmp[0]
  input_list[i][1] = tmp[1]

for i in range(M):
  if input_list[i][1] == 'WA':
    miss += 1  
  else:
    if (input_list[i][0] in seikai_list) == False:   ##正解リストの中に無ければ
      seikai += 1
      seikai_list.append(input_list[i][0])
            
print("{} {}".format(seikai, miss))

Submission status: Wrong Answer

Solution code:
ac_q = []
wa_num = 0
n,m = map(int,input().split())
#score_list = [2]*m
for i in range(m):
    q_no,anser = input().split()
    if q_no not in ac_q:
        if anser == "AC":
            ac_q.append(q_no)
        elif anser == "WA":
            wa_num = wa_num + 1 
    #score_list[i] = input().split()
    #if score_list[i][1] == "AC" and score_list[i][0] not in ac_q:
    #    ac_q.append(score_list[i][0])
    #elif score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
    #    wa_num = wa_num + 1
    
ac_num = len(ac_q)

print(ac_num,wa_num)

Submission status: Wrong Answer

Solution code:
s=[]
lis=[]
N,M=map(int, input().split())
wacount=0
account=0
count=0
zero=0
flag=0
cur=0
changeflag=1
#s=[list(input()) for i in range(2)] 
#for range(M):
#print(N,M)

for i in range(M):
     lis=input().split()
     #print(lis)
     lis[0]=int(lis[0])
     lis.append(i)
     #print(lis)
     s.append(lis)

s2=sorted(s,key=lambda x:x[0])
sorted(s2,key=lambda x:x[2])
j=1
cur=j
for i in range(len(s2)):
    if s2[i][0]>cur:
        j=s2[i][0]
    if s2[i][0]==j:
        if s2[i][1]=="WA":
            count=count+1
        elif s2[i][1]=="AC":
            account=account+1
            wacount=wacount+count
            j=j+1
            cur=j
            count=0
                
print(wacount,account)