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())
p = []
S = []
for i in range(M):
    pp, SS = map(str, input().split())
    p.append(pp)
    S.append(SS)

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

AC = 0
P = 0

Q = []
for i in range(N):
    Q.append(0)

for i in range(M):
    index = p[i] - 1
    if Q[index] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[index] = 1
    elif Q[index] == 0 and S[i] == 'WA':
        P = P + 1

print(AC, P)

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)
  elif f=="WA" and d not in B:
    A.append(d)
wa+=len(A)
p=set(A) ^ set(B)
for i in p:
  wa-=A.count(A)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=[int(_) for _ in input().split()]
PS=[input().split() for _ in range(M)]
count=[0]*(N+1)
isac=[0]*(N+1)
for p,s in PS:
 p=int(p)
 if s=='AC':
  isac[p]=1
 else:
  count[p]+=1
wa=0
ac=0
for i in range(N+1):
 if isac[i]==1:
  ac+=1
  wa+=count[i]
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A=[]
p = [0] * M
S = [0] * M
for i in range(M):
  p[i], S[i]= map(str, input().split())
  T=[int(p[i]),S[i]]
  A.append(T)
A.sort(key=lambda x: x[0])
wa=0
wa2=0
ac=0
tmp=0
for j in range(M):
  if A[j][0]>tmp:
    if A[j][1]=='WA':
      wa+=1
    else:
      ac+=1
      wa2+=wa
      wa=0
      tmp=A[j][0]
print(ac,wa2)

Submission status: Wrong Answer

Solution code:
mondaisu , teisyutukaisu = map(int,input().split())

flag = []
penalog = []

for i in range(mondaisu):
  flag.append(0)
  penalog.append(0)



for i in range(teisyutukaisu):
  bango , kekka = input().split()
  bango = int(bango)
  if flag[bango-1] == 1:
    continue
  if kekka == 'WA':
    penalog[bango-1] = penalog[bango-1] + 1
  elif kekka == 'AC':
    flag[bango-1] = 1
  
print(sum(flag),sum(penalog))

Submission status: Wrong Answer

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

ac = 0
wa = 0
wa_ = 0
ac_ = 0

if m > 0:
    p = 1
    for ps in psl:
        if p == int(ps[0]):
            if ps[1] == 'WA' and ac_ == 0:
                wa_ += 1
            elif ps[1] == 'AC' and wa_ == 0:
                ac_ += 1
            elif ps[1] == 'AC' and wa_ > 0:
                ac_ += 1
                wa += wa_
                wa_ = 0
        else:
            if ac_ > 0:
                ac += 1
            wa_, ac_ = 0, 0
            p = int(ps[0])
            if ps[1] == 'WA':
                wa_ += 1
            if ps[1] == 'AC':
                ac_ += 1
    if ac_ > 0:
        ac += 1

print(ac, wa)

Submission status: Wrong Answer

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

list = [True for i in range(n)]
cnt = 0
for i in range(m):
	tmp, s = input().split()
	p = int(tmp)
	if s == "AC":
		list[p-1] = False
	elif s == "WA":
		if list[p-1]:
			cnt += 1
			
print(list.count(False), cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = {}
ac = 0
wa = 0
flag = False
for i in range(M):
    p, s = input().split()
    if p not in ans:
        flag = False
        if s == "AC":
            ans[p] = [1, 0]
            flag = True
        else:
            ans[p] = [0,1]
    else:
        if flag == False:
            if s == "WA":
                a = ans[p]
                a[1] += 1
            if s == "AC":
                a = ans[p]
                a[0] = 1
                flag = True
for val in ans.values():
    ac += val[0]
    if val[0] == 0:
        continue
    wa += val[1]
print(ac, wa)

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])
        
            
        
print(correct,mistake)

Submission status: Wrong Answer

Solution code:
N, M = (int(x) for x in input().split())
ac_list = []
ac_count = 0
wa_count = 0
for _ in range(M):
  data = input().split()
  p = int(data[0])
  S = data[1]
  if S == 'AC':
    if p not in ac_list:
      ac_count += 1
      ac_list.append(p)
  elif S == 'WA':
    if p not in ac_list:
      wa_count += 1
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cleared = []
ac_counter = 0
wa_counter = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if not p in cleared:
        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:
N,M = map(int,input().split())
pis=[]
for i in range(M):
    p  = input().split(' ')
    pis += [(int(p[0]),p[1])]
wa=[0 for i in range(N+1)]
ac=[0 for i in range(N+1)]

if __name__ == '__main__':
   for p in pis:
      if p[1]=='WA':
        if ac[p[0]]<1:
          wa[p[0]]+=1
      elif p[1]=='AC':
        if ac[p[0]]<1:
          ac[p[0]]=1
   print('{} {}'.format(sum(ac),sum(wa)))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
P_S = []
AC = 0
WA = 0
for i in range(M):
  P_S.append(input().split())
a = {}
for l in P_S:
  a.setdefault(l[0], [])
  a[l[0]].append(l[1])

for t in a.items():
  for s in t[1]:
    if s == "WA":
      WA += 1
    elif s == "AC":
      AC += 1
      break
print(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
ca=[]
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:
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
    elif s_ == 'WA':
        sum_miss += 1
    else:
        continue 
print(sum_ok, sum_miss)

Submission status: Wrong Answer

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

result = {}
c_cnt = 0
w_cnt = 0
for i in range(m):
    p, s = input().split()
    if (p in result):
        continue
        
    if (s == 'AC'):
        result[p] = 1
        c_cnt = c_cnt + 1
    else:
        w_cnt = w_cnt + 1

print('{} {}'.format(c_cnt, w_cnt))

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
sub = [list(input().split()) for _ in range(M)]
sub = sorted(sub,key=lambda x:x[0])
A = 0
W = 0
num = []
for k in range(M):
    if sub[k][0] in num:
        continue
    if sub[k][1] == "AC":
            A += 1
            num.append(sub[k][0])
    elif sub[k][1] == "WA":
            W += 1
print(A,end=" ")
print(W)

Submission status: Wrong Answer

Solution code:
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())
L = [list(map(str,input().split())) for i in range(M)]
Lsort = sorted(L, key=lambda x: x[0])
AC =0
WA =0
index = 0
flag ='0'
WA_list = []
for l in reversed(Lsort):
    if index == l[0]:
        if l[1] == 'AC' and flag == '0':
            AC += 1
            flag = '1'
        if flag == '1' and l[1]=='WA':
            WA += 1
    else:
        index = l[0]
        flag = '0'
        if l[1] == 'AC':
            AC += 1
            flag = '1'
print(str(AC)+ ' '+str(WA))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
aclist = {}
for i in range(n):
    aclist[i + 1] = 0

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

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 and not a[0] in wrongs:
            wrongs[a[0]] = 1
        elif not a[0] in answers and a[0] in wrongs:
            wrongs[a[0]] = 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())
p = []
num = []
for i in range(m):
    input_p, input_s = input().split()
    p.append((int(input_p), input_s))
    num.append(int(input_p))
p.sort(key=lambda x: x[0])
wa_count = 0
ac_count = 0
num = list(set(num))

c = 0
while c < len(num):
    x = num[c]
    for i in p:
        if i[0] == x and i[1] == 'WA':
            wa_count += 1
        elif i[0] == x and i[1] == 'AC':
            ac_count += 1
            break
    c += 1
print(ac_count, wa_count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
seikai = 0
matigai = 0
oklist = []
for i in range(m):
    if len(oklist) == n:
        break
    a,b=input().split()
    if b == "WA" and a not in oklist:
        matigai += 1
    elif b == "AC" and a not in oklist:
        seikai += 1
        oklist.append(a)
            
print(str(seikai)+" "+str(matigai))

Submission status: Wrong Answer

Solution code:

inputA =  list(map(int,input().split()))

mondai = 0
wrong = 0
seikaicount = 0
seikai = False
seikailist = []

for count in range(0,inputA[1]):
    inputB = input().split()
    if count == 0:
        mondai = 1

    if int(inputB[0]) != mondai:
        if seikailist.index(int(inputB[0])) if int(inputB[0]) in seikailist else 100000 != 0:
            mondai = int(inputB[0])
            seikai = False
    if seikailist.index(int(inputB[0])) if int(inputB[0]) in seikailist else 100000 != 0:
        if inputB[1] == "AC":
            if seikai   == False:
                seikaicount += 1
            seikai = True
            seikailist.append(mondai)
        elif inputB[1] == "WA" and seikai == False:
            wrong += 1

print(seikaicount,wrong)

Submission status: Wrong Answer

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

ans_list = [False] * 100000

false_count = 0
ans = 0

for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if s == "WA":
        false_count += 1
    else:
        ans += 1
        ans_list[int(p) - 1] = True
 
print(ans, false_count)

Submission status: Wrong Answer

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

#print(N,M)

num=[]
answer=[]
correct=[]
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)

    
preNum=0
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0
for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        preCorrect = False
        temp_wrongCount = 0
        #if preCorrect:
        #   preCorrect = False
        #  temp_wrongCount = 0
        


    if preCorrect == False and answer[i] == "AC":
        answer_num = num[i]
        correctCount = correctCount + 1
        preCorrect = True
        wrongCount = wrongCount + temp_wrongCount
    elif preCorrect == False and answer[i] == "WA":
        temp_wrongCount = temp_wrongCount + 1

print(correctCount, wrongCount)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
List=[list(input().split()) for i in range(M)]
AC = set([])
accnt = 0
wacnt = 0

for i in range(M):
  num = List[i][0]
  res = List[i][1]
  
  if num in AC:
    a = 0
  else:
    if res == "AC":
      accnt = accnt + 1
      AC.add(num)
    if res == "WA":
      wacnt = wacnt + 1
  
ans = [int(accnt),int(wacnt)]
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
pS = [readline().decode('utf-8').split() for _ in range(M)]
cnt_list = [0] * (N + 1)
ACed_list = [0] * (N + 1)

for p_, s in pS:
    p_ = int(p_)

    if s == 'AC':
        if ACed_list[p_] == 0:
            ACed_list[p_] = 1
    else:
        if ACed_list[p_] == 0:
            cnt_list[p_] += 1

print(sum(ACed_list), sum(cnt_list))

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_n = 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_n = 0

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

print(AC,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] != 1:
        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())
X = [[str(i) for i in input().split()] for i in range(M)]
a=[]
count_ac = 0
count_wa = 0
for i in range(M):
    if X[i][0] in a:
        continue
    if X[i][1] == 'AC':
        a.append(X[i][0])
        count_ac += 1
    else:
        count_wa += 1
print(count_ac,count_wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
dic = {}
for i in range(10**5+1):
    dic[str(i)] = "0"
ac_dic = {}
wa_c = 0
check_dic = {}

for i in range(m):
    p,s = map(str,input().split())
    if dic[p] == "0":
        check_dic[p] = wa_c
        wa_c = 0

    if s =="AC":
        dic[p] = "AC"
        ac_dic[p] = "AC"

    if s == "WA" and dic[p] != "AC":
        wa_c += 1



#print(check_dic)
counter = 0
for k,v in check_dic.items():
    if dic[k] == "AC":
        counter += v

#print(ac_dic)
print(len(ac_dic),counter)

Submission status: Wrong Answer

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

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

else:  
  for j in range(m):
    if (taka[j][1] == 'AC') and (int(taka[j][0]) not in ac):
      ac.append(int(taka[j][0]))
    if (taka[j][1] == 'WA') and (int(taka[j][0]) not in ac):
      wa[int(taka[j][0])-1] += 1
    

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

Submission status: Wrong Answer

Solution code:
def solve():
    N,M=map(int,input().split())
    A=[]    
    ansAC=0
    ansWA=0

    for i in range(M):
        x,y=input().split()
        x=int(x)
    
        if x in A:
            continue
        elif y=="AC":
            ansAC+=1
            A.append(x)
        elif y=="WA":
            ansWA+=1
    print(ansAC,ansWA)
solve()

Submission status: Wrong Answer

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

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
for i in range(m):
    args_result = input().split()
    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())
TF=[0]*n
p=[0]*n
for _ in range(m):
    i,s =map(str,input().split())
    i=int(i)-1
    if (s=="WA") and (TF[i]==1):
        pass
    elif (s=="WA") and (TF[i]==0):
        p[i]+=1
    elif (s=="AC") and (TF[i]==0):
        TF[i]=1
    elif (s=="AC") and (TF[i]==1):
        pass
ac=sum(TF)
pe=sum(p)
print(ac,pe)

Submission status: Wrong Answer

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

ac = 0
wa = 0

for m in range(M):
    p, S = input().split()
    if p not in dic and S == 'WA':
        dic[p] = {'AC' : 0, 'WA' : 1}
    elif p not in dic and S == 'AC':
        dic[p] = {'AC' : 1, 'WA' : 0}
    elif p in dic and dic[p]['AC'] == 1:
        continue
    elif p in dic and dic[p]['AC'] != 1:
        if S == 'AC':
            dic[p]['AC'] += 1
        else :
            dic[p]['WA'] += 1 

for i in dic:
    ac += dic[i]["AC"]
    wa += dic[i]["WA"] 


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

Submission status: Wrong Answer

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

PS = []
qn = 1
ok, ng = (0, 0)
for _ in range(M):
    pp, S = input().split()
    p = int(pp)
    if qn <= p:
        if S == 'AC':
            qn = p + 1
            ok += 1
        else:
            ng += 1

print('{} {}'.format(ok, ng))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
y = []
z = 0
x = []
for i in range(1, m+1):
    p, s = input().split()
    if p not in x:
        if s == 'AC':
            x.append(p)
        else:
            y.append(p)
print(len(x), len(y))

Submission status: Wrong Answer

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

wa_answer=0
ac_list=[]
problem_num=0
tmp=0
for i in range(M):
    P, S = map(str, input().split())
    if not problem_num==int(P):
        tmp=0
        problem_num=int(P)
    if S=="WA":
        if int(problem_num) not in ac_list:
            tmp+=1
    if S=="AC":
        if int(problem_num) not in ac_list:
            wa_answer=wa_answer+tmp
            ac_list.append(int(problem_num))
    # print(tmp)
    # print(ac_answer)
    # print(wa_answer)
    # print(ac_list)

print(str(len(ac_list))+" "+str(wa_answer))

Submission status: Wrong Answer

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

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

problem = []

for j, ans in zip(P,s):
  if (ans == "AC") and (j not in problem):
    problem.append(j)
    sekai += 1
  elif (ans == "WA") and (j not in problem):
    wrong += 1
print(sekai, wrong)

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
p = []
s = []
for i in range(m):
    a, b = input().split()
    p.append(int(a))
    s.append(0 if b=='WA' else 1)
if m==0:
    print(0,0)
ac = 0
pena = 0

for i in set(p):
    si = [j for j , x in enumerate(p) if x == i]
    for j in si:
        if s[j] == 0:
            pena +=1 
        elif s[j] == 1:
            ac +=1
            break
print(ac,pena)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ansa=0
lip,lis=[],[]
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s=map(str,input().split())
        lip.append(p)
        lis.append(s)
        if s=="AC":
            if next!=p:
                ansa+=1
                next= p
    while lis[len(lis)-1] == "WA":
        lis[len(lis)-1]=[]

    print(ansa,lis.count("WA"))

Submission status: Wrong Answer

Solution code:
a=input().split()
N=int(a[0])
M=int(a[1])
B=[]
for i in range(M):
    b=input().split()
    B.append(b)
A=0
d=0
W=0
if M==0:
    print("0 0")
else:
    c=B[0][0]
    for i in range(M):
        if B[i][0]==c and d==0:
            if B[i][1]=="AC":
                A+=1
                d+=1
            else:
                W+=1
        elif B[i][0]!=c:
            c=B[i][0]
            d=0
            if B[i][0]==c and d==0:
                if B[i][1]=="AC":
                    A+=1
                    d+=1
                else:
                    W+=1
    print(str(A)+" "+str(W))

Submission status: Wrong Answer

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

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)
            
print(count1,count3)

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_list[num] = -1
      count_AC += 1
  else:
    if(count_list[num] == -1):
      pass
    else:
      count_list[num] += 1
      count_WA += 1


#print(N)
#print(M)
print(str(count_AC)+' '+str(count_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
ac_set = list()
if li != []:
  for j, k in li:
    jk = str(j)+'AC'
    if(jk not in ac_set):
      if k == 'WA':
        wa_i += 1
      else:
        ac_i += 1
        ac_set.append(jk)
    else:
      break
      
print(ac_i, wa_i)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
slst = sorted(lst, key=lambda x: x[0])
pn = 0
cr = 0
plbnum = 0
for i in slst:
  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:
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 wal[int(p[i])]==0:
        wal[int(p[i])]=1
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
[n, m] = [int(x) for x in input().split()]
d = {}
ac = 0
wa = 0
for i in range(m):
    [num, ans] = [x for x in input().split()]
    num = int(num)
    if num in d:
        # 正解済み
        if d[num]:
            continue
        else:  # 不正解
            if ans == "AC":  # 初めて正解した
                ac += 1
                d[num] = True
                continue
            else:  # 重ねて不正解だった
                wa +=1
                continue
    # 未回答
    d[num] = (ans == "AC")
    if d[num]:
        ac += 1
    else:
        wa += 1
print(ac, wa)

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 wa_flag[p[i]-1] == 0:
            if S[i] == "WA":
                num_penalty += 1
        if S[i] == "AC":
            wa_flag[p[i]-1] = -1
    num_ac = wa_flag.count(-1)
    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:
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] == "AC":
        if AC[int(P[i])-1] == 0:
            AC[int(P[i])-1] += 1
            for j in range(i):
                if P[j] == P[i] and S[j] == "WA":
                    WA += 1
"""


for i in range(M):
    if AC[int(P[i])-1]==0 and S[i] == "WA":
        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:
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

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

if m == 0:
  print('0 0')
else:
  w = []
  ac = 0
  wa = 0
  s = [input().split() for i in range(m)]
  for i in range(len(s)):
    if s[i][1] == 'AC':
      ac += 1
      w.append(wa)
      wa = 0
    elif s[i][1] == 'WA':
      wa += 1
  p = get_unique_list(s)

  ac = 0
  wa = 0

  for i in range(len(p)):
    if p[i][1] == 'AC':
      ac += 1
  print(str(ac)+" "+str(sum(w)))

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 n + 1 > int(pm):
    if not(pm in ckn):
      if c == 'WA':
        swa += 1

      elif c == 'AC':
        ckn.add(pm)
        ac += 1
  
print(ac, swa)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc151/tasks/abc151_c
n_prob, m_sub = map(int, input().split())

n_answer = 0
n_penalty = 0
p_prev = 0
for j in range(m_sub):
    pi, si = input().split()
    if si == 'WA':
        if p_prev == int(pi):
            continue
        n_penalty += 1
    elif si == 'AC':
        if p_prev == int(pi) and res_prev == 'AC':
            continue
        n_answer += 1
    else:
        a = 1
    p_prev = int(pi)
    res_prev = si

print("{} {}".format(n_answer, n_penalty))

Submission status: Wrong Answer

Solution code:
pro_number, submit_number = [s for s in input().split()]
AC = [0] * int(pro_number)
WA = [0] * int(pro_number)
for i in range(int(submit_number)):
  section,output = [s for s in input().split()]
  if AC[int(section)-1]==0 and output=="WA":
    WA[int(section)-1]=WA[int(section)-1]+1
  
  elif output=="AC":
    AC[int(section)-1]=1

AC_number=0
WA_number=0
for i in range(int(pro_number)):
  AC_number=AC_number+AC[i]
  WA_number=WA_number+WA[i]

print(AC_number,WA_number)

Submission status: Wrong Answer

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

ans_list = [False] * 100000
if M == 0:
    print(0,0)
    exit()
 
false_count = 0
ans = 0

for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if s == "WA":
        false_count += 1
    else:
        ans += 1
        ans_list[int(p) - 1] = True
 
print(ans, false_count)

Submission status: Wrong Answer

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

ok = []
wrong = 0
for _ in range(m):
    p, s = input().split(" ")
    if not p in ok:
        if s == "WA":
            wrong += 1
        else:
            ok.append(p)
    else:
        pass

print(len(ok), wrong)

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 S == 'AC':
        if p not in acd:
            acd[p] = 1
            ac += 1
    elif S == 'WA':
        if p not in acd:
            pc += 1

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

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)