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

a={}
for i in range(1,n+1):
    a[str(i)]='WA'
    
ans=0
pen=0
d=0
for i in range(m):
    p,s=input().split()
    if s == 'WA' and a[p] == s :
       d+=1 
    if s == 'AC' and a[p] != s:
        ans+=1
        pen+=d
        a[p]=s
        d=0
        
print(ans,pen)

Submission status: Wrong Answer

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


zisyo = {}
zisyoAC = {}

#回答していないものはとりあえず0にしておく。0スタートなので1ずれる事に注意する。
for i in range(N):
    zisyo[i] = 0
for i in range(N):
    zisyoAC[i] = 0


for i in range(M):
    P,S = list(map(str,input().split()))
    P = int(P)
    S = str(S)
    
    
    
    
    if S =="WA":
        kari2 = P -1
        if zisyoAC[kari2] ==0:
            kari = zisyo[kari2]
            kari = kari + 1
            zisyo[P-1] = kari
        
    else:
       zisyoAC[P-1] = 1
       
     
    
#辞書2の1の数が正解数、辞書の値の合計がNG数
ans1 = 0
ans2 = 0
for i in range(N):
    ans1 = ans1 + int(zisyo[i])
    ans2 = ans2 + int(zisyoAC[i]) 
       

kari1 = str(ans2)
kari2 = str(ans1)

print(kari1 +" "+ kari2 )

Submission status: Wrong Answer

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

s = []

for i in range(m):
    s.append(list(map(str, input().split())))

a = []
t = 0
b = 0

for i in range(m):
    v = s[i]
    p, q = v[0],v[1]

    if ((p in a) == False) and q == 'AC':
        a.append(p)
        b += 1

c = []


print(s)

for i in range(m):
    v = s[i]
    p, q = v[0],v[1]
    
    if (p in c) == True:
        continue
    else:
        if q == 'AC':
            c.append(p)
        elif q == 'WA' and (p in a) == True:
            t += 1

print(b, t)

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]*100100
#D = [0]*100100

d = 0

poi1 = 100100
# poi2 = 100100

owa = [0]* 100100


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

for i in xrange(M):
  if(B[i] == "AC"):
    C[A[i]] = 1
    # owa[A[i]] = 1
  elif(C[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())
taka = [input().split() for i in range(m)]
wa = [0]*n
ac = [0]*n

if m == 0:
  print(0,0)

else:  
  for j in range(m):
    if (taka[j][1] == 'AC'):
      ac[int(taka[j][0]) - 1] = 1
    if (taka[j][1] == 'WA') and (int(taka[j][0]) not in ac):
      wa[int(taka[j][0])-1] += 1
    
  for k in range(1,n+1):
    if k not in ac:
      wa[k-1] = 0
  
  print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, input().split())
ckn = set()
swa = 0
ac = 0

for i in sys.stdin:
  pm, c = i.split()
  
  if not pm in ckn:
    if c == 'WA':
      swa += 1

    else:
      ckn.add(pm)
      ac += 1

print(ac, swa)

Submission status: Wrong Answer

Solution code:
def main():
    _, M= map(int, input().split())
    ps = [(input().split()) for _ in range(M)]
    wa_count = 0
    ac_count = 0
    ac_p = 0
    for p, s in ps:
        if int(p) == ac_p:
            continue
        else:
            if s == "AC":
                ac_p = int(p)
                ac_count += 1
            elif s == "WA":
                wa_count += 1
            
    print(ac_count, wa_count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

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

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

p=[]
s=[]
for i in range(m):
    pp,ss=input().split()
    p.append(int(pp))
    s.append(ss)

p.insert(0,0)
s.insert(0,'a')

sei=0
pena=0
flag = 0
acflag=0
count=0

for i in range(1,m+1):
    if p[i]!=p[i-1]:
        flag=0
        if acflag==0:
            pena-=count
        else:
            acflag=0
    if flag==0 and s[i]=='AC':
        sei+=1
        flag=1
        acflag=1
        count=0
    elif flag==0 and s[i]=='WA':
        count+=1
        pena+=1
    
print(sei,pena)

Submission status: Wrong Answer

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

n, m = map(int, input().split())
#n 問題数 m 提出回数
list = []
for i in range(m):
    p, s = input().split()
    list.append((int(p), s))
succ = 0
pena = 0
a = []
for i in list:
    if i[1] != 'WA':
        if (i[0] in a) != True:
            succ += 1
            a.append(i[0])
        else:
            pass        
    else:
        if (i[0] in a) != True:
            pena += 1
        else:
            pass

print('{} {}'.format(succ, pena))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
seito = 0
penarty = 0
pena = [False for i in range(N+1)]
for i in range(M):
    p,s = input().split()
    p = int(p)
    if not pena[p]:
        if s == "AC":
            pena[p]=True
            seito += 1
        else:
            penarty += 1
print(seito,penarty)

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 = 0
sum_miss = 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:
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=[]

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

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

print(ac,pn)

Submission status: Wrong Answer

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

cmp = 0
pnt = 0
tmp = 0

for _ in range(M):
    p, s = map(str, input().split())
    if tmp < int(p) and s == 'AC':
      tmp = int(p)
      cmp+=1
    elif s == 'WA' and N > cmp:
      pnt+=1

print(cmp,pnt)

Submission status: Wrong Answer

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

args = input().split()
n = int(args[0])
m = int(args[1])
ok_list = []
ok_cnt = 0
ng_cnt = 0
args_results = [input().split() for i in range(m)]
for args_result in args_results:
    target = args_result[0]
    score = args_result[1]
    if target in ok_list:
        continue
    else:
        if score == 'AC':
            ok_cnt += 1
            ok_list.append(target)
        else:
            ng_cnt += 1
print ok_cnt, ng_cnt

Submission status: Wrong Answer

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

count_list = [0 for i in range(N)] #-1:already, 0-N:count
count_AC = 0
count_WA = 0

for i in range(M):
  num = int(pS_list[i][0])-1
  if(pS_list[i][1] == 'AC'):
    if(count_list[num] == -1):
      pass
    else:
      count_WA += count_list[num]
      count_list[num] = -1
      count_AC += 1
  else:
    if(count_list[num] == -1):
      pass
    else:
      count_list[num] += 1

for i in range(N):
  if count_list[i] > 0:
    count_WA += count_list[i]

#print(N)
#print(M)
print(str(count_AC)+' '+str(count_WA))

Submission status: Wrong Answer

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

ans = 0
pen = 0

A = list(map(list, set(map(tuple, A))))

for i in range(len(A)):
    if A[i][1]=='AC':
        ans += 1
        print(A[i])
        if i+1<=len(A)-1 and A[i+1] == (''.format(i), 'WA'):
          A.remove(A[i+1])
    if A[i][1] == 'WA':
        pen += 1

print(ans, pen)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N = a[0]
M = a[1]

list = []
for i in range(M):
    a,b=input().split()
    list.append((int(a), b))

ac = 0
wa = 0
num = 1
for j in range(N):
  for i in range(M):
    if list[i][0] == num:
      if list[i][1] == "AC":
        ac += 1
        num += 1
        break
      elif list[i][1] == "WA":
        wa += 1
    if i == M-1:
      num+=1

"""
correct = []
wa = 0
flagc = 0
flagw = 0
for i in range(M):
  if list[i][1] == "AC":
    if len(correct) == 0:
      correct.append(list[i][0])
    else:
      for j in range(len(correct)):
        if correct[j] == list[i][0]:
          flagc = 1
          break
      if flagc == 0:
        correct.append(list[i][0])
        flagc = 0
  elif list[i][1] == "WA":
    #print("wa", end=","),print(i),print("cor",end=","),print(correct),print("n_wa",end=","),print(wa)
    if len(correct) == 0:
      wa += 1
    else:
      for j in range(len(correct)):
        if correct[j] == list[i][0]:
          flagw = 1
          break
      if flagw == 0:
        wa += 1
        flagw = 0
"""
    
    
#print(len(correct), end=" "), print(wa)
print(ac, end=" "), print(wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if (M == 0):
    print(0,0)
    exit()
wacount = 0
account = 0
watmp = 0
actmp = 0
acFlg = False
for idx in range(M):
    p,s=input().split()
    if (actmp != p):
        actmp = p
        watmp = 0
        account += 1
        acFlg = False
    if (s == 'AC' and acFlg == False):
        wacount += watmp
        watmp = 0
        acFlg = True
    else:
        watmp += 1
print(account,wacount)

Submission status: Wrong Answer

Solution code:
[n, m] = [int(i) for i in input().split()]
ac = [0] * n
wa = [0] * n
for i in range(m):
  [p, s] = input().split()
  if s == "AC":
    ac[int(p)-1] = 1
  elif ac[int(p)-1] != 1:
    wa[int(p)-1] += 1

print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cleared = []
pl = []
sl = []
ac_counter = 0
wa_counter = 0
for i in range(m):
    p, s = input().split()
    pl.append(int(p))
    sl.append(s)

for j in range(len(pl)):
    if not pl[j] in cleared:
        if sl[j] == 'AC':
            ac_counter += 1
            cleared.append(pl[j])
        else:
            wa_counter += 1
print(' '.join([str(ac_counter), str(wa_counter)]))

Submission status: Wrong Answer

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

a=0
b=0
x=0
y=0
p=[]
S=[]
k=[]


if M==0:
  a=0
  b=0

if M!=0:
  for i in range(M):
    k=input().split()
    print(k)
    
    if x==k[0] and y==1:
      x=k[0]
    elif x==k[0] and y==0:
      if k[1]=="AC":
        a=a+1
        y=1
      else:
        b=b+1
    else:
      x=k[0]
      y=0
      if k[1]=="AC":
        a=a+1
      else:
        b=b+1
      
print(a,b)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    else:
        #今やっている問題がまだ正解していない
        if question_list[i] not in ac_list:
            if j == "WA":
                mistake += 1
            else:
                correct += 1
                ac_list.append(question_list[i])
        else:
            continue
            
        
print(correct,mistake)

Submission status: Wrong Answer

Solution code:
import sys

N, M = map(int, sys.stdin.readline().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = sys.stdin.readline().split()

AC = [0]*N
WA = 0

for i in range(M):
    if S[i] == "WA" and AC[int(P[i])-1] == 0:
        WA += 1
    if S[i] == "AC":
        if AC[int(P[i])-1] == 0:
            AC[int(P[i])-1] = 1

print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[]
s=[]
r=[]
for i in range(m):
    r.append(input().split())
    p.append(int(r[i][0]))
    s.append(r[i][1])

cp=0
cc=0
for i in range(m):
    if s[i]=='WA':cp+=1
    elif s[i]=='AC':
        cc+=1
        for j in range(i+1,m):
            if p[i]==p[j]:s[j]='AR'

print('{} {}'.format(cc,cp))

Submission status: Wrong Answer

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

n, m = map(int, input().split())
n = int(n)
p_s = [list(map(str, input().split())) for _ in range(m)]

ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]


for i in range(m):
    if p_s[i][1] == 'WA':
        if ac[int(p_s[i][0]) - 1] == 0:
            wa[int(p_s[i][0]) - 1] += 1
    else:
        ac[int(p_s[i][0]) - 1] = 1

print(sum(ac), sum(wa))

Submission status: Wrong Answer

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

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

str_lines = [x.strip("\n") for x in sys.stdin.readlines()]

list_str_P_S=[]
for S in str_lines:
  list_str_P_S.append( list(S.split()) )

#-----
#print("N,M=",N,M)
#print("list_str_P_S=",list_str_P_S)
#-----
#print(list(range(1,M+1)))

count_AC=0
count_WA=0
for i in range(1,M+1):
  
  
  for L in list_str_P_S:
    number = int(L[0])
    result = L[1]
    
    if number == i:
      if result == "WA":
        count_WA += 1
        #print("L",L,count_AC,count_WA)
      elif result == "AC":
        count_AC += 1
        #print("L",L,count_AC,count_WA)
        break

print(count_AC,count_WA)

Submission status: Wrong Answer

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

o = [l[i][0] for i in range(m)]
p = list(set(o))

t = 0
f = 0

for i in p:
  q = [l[j][1] for j in range(m) if l[j][0] == i ]
  if q.count("AC") != 0:
    t = t + 1
    f = f + q.index("AC")
  else: 
    f = f + len(q)
print(t,f)

Submission status: Wrong Answer

Solution code:
buf=input().split(" ")
 
N=int(buf[0])
M=int(buf[1])
clear=[]
ac=0
wa=0
 
for i in range(M):
  buf=input().split(" ")
  if int(buf[0]) not in clear:
    if buf[1] == "AC":
      clear.append(int(buf[0]))
      ac=ac+1
    elif buf[1] == "WA":
      wa=wa+1
print(str(ac)+" "+str(wa))

Submission status: Wrong Answer

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

result = set()
c_cnt = 0
w_cnt = 0
for i in range(m):
    p, s = input().split()
    if (p in result):
        continue

    if (s == 'AC'):
        result.add(p)
        c_cnt = c_cnt + 1
    else:
        w_cnt = w_cnt + 1

if len(result) == 0:
    print('0 0')
else:
    print('{} {}'.format(c_cnt, w_cnt))

Submission status: Wrong Answer

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

l = list(range(1, n+1))
ac = 0
wa = 0

for _ in range(m):
  p, s = input().split()
  p = int(p)
  
  if s == 'AC' and (p in l):
    ac += 1
    l.remove(p)
  elif (p in l):
    wa += 1
    
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = input().split()
ac = 0
wa = 0
tmp = 0
a = 0
list = []
if m != 0:
    for i in range(int(m)):
        p,s = input().split()
        if tmp != p:
            a = 0
            if p in list:
                a = 1
        if a == 0:
            if s == 'AC':
                ac = ac + 1
                a = 1
                list.append(p)
            elif s == 'WA':
                wa = wa + 1
        tmp = p
print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, input().split())
ckn = set()
swa = 0
ac = 0

for i in sys.stdin:
  pm, c = i.split()
  
  if not(pm in ckn):
    if c == 'WA':
      swa += 1

    else:
      ckn.add(pm)
      ac += 1

print(ac, swa)

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
r = 0
w = 0
a = []
b = []
tem = []
man = [0]
for i in range(m):
    ta,tb = map(str,input().split())
    a.append(ta)
    b.append(tb)
for i in range(m):
    if len(man) > 1:
        for k in range(len(man) - 1):
            z = man[k + 1]
            if b[i] == "AC" and int(a[i]) != int(z):
                r += 1
                tem.append(i)
                man.append(a[i])
    else:
        if b[i] == "AC":
                r += 1
                tem.append(i)
                man.append(a[i])
for j in range(len(tem)):
    for i in range(tem[j] + 1):
        #print(i)
        #print(j)
        if a[j] == a[i] and b[j] == "WA":
            w += 1
ans = (str(r) + " " + str(w))
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**5+100)
acl=[0]*(10**5+100)
for i in range(m):
    p[i],s[i]=map(str, input().split())

for i in range(m):
    if s[i]=="AC" and acl[int(p[i])]==0:
        acl[int(p[i])]=1
    if s[i]=="WA" and acl[int(p[i])]==0:
        wal[int(p[i])]+=1
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M = map(int, input().split())
#pS = [stdin.readline().split() for _ in range(n)]
#print(pS)
AC=[0]*N
WA=[0]*N
#print(AC,WA)
for _ in range(M):
    p,S=stdin.readline().split()
#    print('p={},S={}'.format(p,S))
    if S=='AC':
#        print('SはAC')
        if AC[int(p)-1]==0:
#            print('問題{}でACはまだないのでACに1加えます'.format(p,))
            AC[int(p)-1]+=1
        else:
#            print('問題{}で既にACがあるのでACには1加えません'.format(p,))
            pass
    elif S=='WA':
#        print('SはWA')
        if AC[int(p)-1]==0:
#            print('問題{}でACはまだないのでWAに1加えます'.format(p,))
            WA[int(p)-1]+=1
        else:
#            print('問題{}で既にACがあるのでWAに1加えません'.format(p,))
            pass
#print(AC,WA)
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n, m = input().split(" ")
n, m = int(n), int(m)
p_s = []
for i in range(m):
    inp = input().split(" ")
    inp[0] = int(inp[0])
    p_s.append(list(inp))
p_s.sort(key=lambda x: x[0])
end_problem = -1

ans_list = [0]*n
failure_list = [0]*n
if m == 0:
    pass
else:
    for p, s in p_s:
        if p != end_problem:
            if s == "AC":
                ans_list[p-1] = 1
                end_problem = p
            elif s == "WA":
                failure_list[p-1] += 1
        else:
            pass
print(sum(ans_list), sum(failure_list))

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
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      pn += 1
    elif i[1] == "AC":
      cr += 1
      plbnum = a
print(cr, pn)

Submission status: Wrong Answer

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

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()



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


for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1

#print(AC_list)
cor_count = len(set(AC_list))

print(cor_count,pen_count)

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0] * N
    num_penalty = 0
    for i in range(M):
        if S[i] == "WA":
            if wa_flag[p[i]-1] == 0:
                num_penalty += 1
        else:
            wa_flag[p[i]-1] = 1
    num_ac = sum(wa_flag)
    print(num_ac, num_penalty)
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, M = map(int, input().split())
    p = [None] * M
    S = [None] * M
    for i in range(M):
        pi, si = input().split()
        p[i] = int(pi)
        S[i] = str(si)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    input = stdin.readline
    N, M = map(int, input().split())
    SP = [tuple(input().split()) for i in range(M)]
    wa_num_temp = {}
    ac_num_temp = {}
    for sp in SP:
        if sp[0] not in wa_num_temp:
            wa_num_temp[sp[0]] = 0
        if sp[1] == "WA" and sp[0] not in ac_num_temp.keys():
            wa_num_temp[sp[0]] += 1
        elif sp[1] == "AC" and sp[0] not in ac_num_temp.keys():
            ac_num_temp[sp[0]] = 1

    print(sum(ac_num_temp.values()), sum(wa_num_temp.values()))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac_flag = [False]*n
wa_counts = [0]*n

for i in range(m):
  p,s = map(str,input().split())
  p = int(p)-1
  if s == 'AC':
    ac_flag[p] = True
  else:    
    if ac_flag[p] == False:
      wa_counts[p] += 1

wa_ans = 0
for i in range(n):
  if ac_flag:
    wa_ans += wa_counts[i]
print('{} {}'.format(sum(ac_flag), wa_ans))

Submission status: Wrong Answer

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

if m==0:
    print("0 0")
    exit()

for i in range(m):
    c=list(input().split())
    res=str(c[0]+c[1])
    if c[1]=="AC" and res not in ac:
        ac.append(res)
        acn+=1
    #elif c[1]=="AC" and res in ac:
        #continue
    elif c[1]=="WA" and str(c[0]+"AC") not in ac:
        wa+=1
    #else:
        #continue
    
print(acn, end=" ")
print(wa)

Submission status: Wrong Answer

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

acd = dict()
ac = 0
pc = 0
for i in range(M):
    p, S = input().split(' ')
    if 1 <= int(p) <= N and p not in acd:
        if S == 'AC':
            acd[p] = 1
            ac += 1
        elif S == 'WA':
            pc += 1

print("{} {}".format(ac, pc))

Submission status: Wrong Answer

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

n, m = map(int, input().split())
n = int(n)
p_s = [list(map(str, input().split())) for _ in range(m)]

ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]


for i in range(m):
    if ac[int(p_s[i][0]) - 1] == 1:
        continue
    else:
        if p_s[i][1] == 'WA':
            wa[int(p_s[i][0]) - 1] += 1
        else:
            ac[int(p_s[i][0]) - 1] = 1
print(sum(ac), sum(wa))

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
  if temp[1] == "AC":
    ac.add((temp[0]))
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      pass

    pen += t
  else:
    if not temp[0] in ac:
      t = 0
      try:
        t = pen_dic[temp[0]]
      except:
        pass
      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
sekai = 0
wrong = 0
problem = []

for i in range(M):
  p,S = map(str,input().split())
  if p not in problem:
    if S=="AC":
      problem.append(p)
      sekai += 1
    elif S =="WA":
      wrong += 1
print(sekai, wrong)

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 set(p):
#     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

ac = 0
wa = 0
ansed = []
for pn, sn in zip(p, s):
    if sn == 'AC':
        if pn not in ansed:
            ac += 1
            ansed.append(pn)
    if sn == 'WA':
        if pn not in ansed:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict

n,m=list(map(int,input().split()))
ac_counter=0
wa_counter=0
ac_list=[]
answer_counter=m
answer_dict=OrderedDict()
last_ac=''
counter=1
while answer_counter > 0:
  question_num,result = input().split()
  last_ac=question_num
  if result=='AC' and question_num not in ac_list:
    ac_counter+=1
  if result=='AC':
    ac_list.append(question_num)
  answer_dict[counter]=[question_num,result]
  answer_counter-=1
  counter+=1
dict_counter=1
for key, value in answer_dict.items():
  if value[0] !=last_ac:
    wa_counter+=1
  elif value[1]=='WA' and value[0] !=last_ac and answer_dict[dict_counter+1][1]=='AC':
    wa_counter+=1
    break
  dict_counter+=1

print (ac_counter,wa_counter)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
 
def main():
    NM = [int(i) for i in input().split(" ")]
    if NM[1] == 0:
        ans = "0 0"
    else:
        ans_ac = 0
        ans_wa = 0
        p = ""
        for i in range(NM[1]):
            ps = input().split(" ")
            #print(ps)

            if p != ps[0]:
                #print("A")
                p = ps[0]
                ac_flg = 0
                res = ps[1]
                if res == "AC\n":
                    if ac_flg == 0:
                        ans_ac += 1
                        ac_flg = 1
                else:
                    if ac_flg == 0:
                        ans_wa += 1
            else:
                #print("B")
                if ac_flg == 0:
                    res = ps[1]
                    if res == "AC\n":
                        if ac_flg == 0:
                            ans_ac += 1
                            ac_flg = 1
                    else:
                        if ac_flg == 0:
                            ans_wa += 1
                else:
                    pass
        ans = str(ans_ac) + " " + str(ans_wa)
    print(ans)
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
[n, m] = [int(i) for i in input().split()]
ac = [0] * n
wa = [0] * n
for i in range(m):
  [p, s] = input().split()
  if s == "AC":
    ac[int(p)-1] = 1
  else:
    wa[int(p)-1] = 1

print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, m = LI()
    was = [0 for i in range(n+1)]
    ans = [0 for i in range(n+1)]
    ps = []
    ss = []

    for i in range(m):
        p, s = LS()
        # print(p, s)
        ps.append(int(p[0]))
        ss.append(s[0])

    for p, s in zip(ps, ss):
        if s == "A":
            ans[p] = 1
        elif s == "W" and ans[p] == 0:
            was[p] += 1

    for i in range(n+1):
        if ans[i] == 0:
            was[i] = 0
    # print(sum(ans), sum(was))
    print(" ".join([str(sum(ans)), str(sum(was))]))



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
P=[]
S=[]

N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
for i in range(M):
#    PI,SI=map(input().split())
    PI,SI=input().split()
    P.append(int(PI))
    S.append(SI)
WACNT=[0]*N
ACCNT=[0]*N

for i in range(M):
    for ii in range(N):
        if P[i]==ii+1:
            if S[i]=="WA" and ACCNT[ii]!=1:
                WACNT[ii]=WACNT[ii]+1
            elif S[i]=="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 = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = 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(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1

        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break

print(all_AC, all_failure)

Submission status: Wrong Answer

Solution code:
li2 = []
li1 = []
total = []
i = 0
z = 0
a,rd = input().split()
rd = int(rd)
for i in range(rd):
    string = input().split()
    if string[1]=="AC":
        li1.append(tuple(string))
    else:
        li2.append(tuple(string))

print(len(set(li1)),len(set(li2)))

Submission status: Wrong Answer

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

n, m = map(int, input().split())
n = int(n)
p_s = [list(map(str, input().split())) for _ in range(m)]

ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]


for i in range(m):
    if ac[int(p_s[i][0]) - 1] == 1:
        continue
    if p_s[i][1] == 'WA':
        wa[int(p_s[i][0]) - 1] += 1
    else:
        ac[int(p_s[i][0]) - 1] = 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

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

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

answers = {}
wrongs = {}

for a in l:
    if a[1] == "AC":
        answers[a[0]] = a[1]
    elif a[1] == "WA":
        if not a[0] in answers:
            if a[0] in wrongs:
                wrongs[a[0]] = wrongs[a[0]] + 1
            else:
                wrongs[a[0]] = 1


# 集計
result = [len(answers.keys()), sum(wrongs.values())]

print(result[0], result[1])

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
temp = 1
flag =1
AC = 0
WA = 0
if M == 0:
    print(0,0)
else:
    while M > 0:
        temp_2 = 0
        p,s = (input().split())
        if int(p) == temp:
            if s == 'AC' and AC < flag :
                AC += 1
            elif s == 'WA' and WA < flag:
                WA += 1
        else:
            temp += 1
            flag += 1
            if s == 'AC' and AC < flag:
                AC += 1
            elif s == 'WA' and WA < flag:
                WA += 1
        M -= 1
print (AC,WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[input().split() for i in range(m)]
for i in range(m):
    a[i][0]=int(a[i][0])
#print(a)
miss=[0]*n
ans=[]
total=0
for i in range(m):
    if a[i][1]=="AC":
        ans.append(a[i][0])
        miss[a[i][0]-1]+=(10**9+7)
    if a[i][1]=="WA" and miss[a[i][0]-1]<10**9:
        miss[a[i][0]-1]+=1
cnt=len(set(ans))
#print(cnt)
#(miss)
for i in range(len(miss)):
  miss[i]=miss[i]%(10**9+7)
print(cnt,sum(miss))