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:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys
#from fractions import gcd
setrecursionlimit(10**6)
input=stdin.readline

n,m=map(int,input().split())
c=[False]*n
ac,pena=0,0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if c[p]: continue
    if s=="AC":
        if c[p]:
            continue
        else:
            c[p]=True
    elif s=="WA":
        if c[p]:
            continue
        else:
            pena+=1
print(c.count(True),pena)

Submission status: Wrong Answer

Solution code:
N,M = [int(x) for x in input().split()]
import collections
s = []
for i in range(M):
    array = list(map(str,input().split()))
    s.append(array)
a = 0
b = 0
c = 0
t = []
for i in range(M):
    t.append(s[i][0])
d = collections.Counter(t)
#print(len(d))
for j in range(len(d)):
    for i in range(1,M):
        if s[i-1][0] == s[i][0]:
            if s[i-1][1] == "WA":
                b = b + 1
            else:
                a = a + 1
                break
        else:
            if s[i-1][1] == "AC":
                a = a + 1
            else:
                b = b + 1
print(str(a) + " " + str(b))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

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])
        if len(ac_list) == n:
            break
            
        
print(correct,mistake)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)

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

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 and wal[int(p[i])]==0:
        wal[int(p[i])]+=1
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import collections
lines = stdin.readlines()
 
N, M = map(int, lines[0].split())
 
a_cnt = 0
w_cnt = 0
op = 'null'
oS = 'null'
for i in range(M):
  p, S = map(str, lines[i].split())
  if S == 'WA':
    w_cnt += 1
  elif S == 'AC' and oS != 'AC':
    a_cnt += 1
  op = p
  oS = S
 
print(a_cnt)
print(w_cnt)

Submission status: Wrong Answer

Solution code:
#python3
from collections import defaultdict
n,m = map(int, input().split())
a = []
dic = defaultdict(list)
for _ in range(m):
  x,y = map(str, input().split())
  dic[int(x)].append(y)

acc=0
for i, j in dic.items():
  if 'AC' in j:
    acc+=1;

cnt=0
for li in dic.values():
  for j in li:
    if j == 'AC':
      break
    cnt+=1

ans = str(acc) + ' ' + str(cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
num=[]
TF=[]
accurate_num=[]
WA_num=0
for i in range(M):
    tmp_num,tmp_TF=input().split()
    tmp_num=int(tmp_num)
    if tmp_TF=="AC":
        accurate_num.append(tmp_num)
    if (tmp_TF=="WA")&(tmp_num not in accurate_num):
        WA_num+=1
accurate_num=list(set(accurate_num))


print(len(accurate_num),WA_num)

Submission status: Wrong Answer

Solution code:
N,M=(int(i) for i in input().split())
ps=[input().split() for j in range(M)]
ac=0
pt=0
flag=0
for k in range(len(ps)):
  if ps[k][1]=="WA" and flag<int(ps[k][0]):
    pt+=1
  elif ps[k][1]=="AC" and flag<int(ps[k][0]):
    ac+=1
    flag=int(ps[k][0])
print(ac,pt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(" "))
nac = 0
npe = 0
cp = 0
is_ac = False
for i in range(m):
  p_s, s = input().split(" ")
  p = int(p_s)
  if cp < p:
    cp = p
    is_ac = False
  if is_ac:
    continue
  if s == "AC":
    nac += 1
    is_ac = True
  else:
    npe += 1
print(str(nac)+" "+str(npe))

Submission status: Wrong Answer

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

def f(s):
  lst = s.split()
  return int(lst[0]),lst[1]



for i in range(M):
  p, s = f(input())
  P.append(p)
  S.append(s)

correct = 0
penalty = 0
q = []

for i, j in enumerate(S):
  if 'AC' in j:
    if P[i] not in q:
      q.append(P[i])
      correct += 1
    else:
      continue
  if 'WA' in j:
    if P[i] not in q:
        penalty += 1
    else:
      continue

for i, j in enumerate(S):
  if 'WA' in j:
    if P[i] not in P:
      penalty -= 1

print(correct, penalty)

Submission status: Wrong Answer

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

answerd = [0] * 100100
WA_count = 0
AC_count = 0

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

    # if s == 'WA' and answerd[p] == 0:
    if s == 'WA':
        WA_count += 1

    elif s == 'AC' and answerd[p] == 0:
        AC_count += 1
        answerd[p] = 1

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())
S = []
for _ in range(W):
    S.append(input().split())
WAcount=0
ans=[]
for i in range(W):
	p=int(S[int(i)][0])
	pd=S[int(i)][1]
	if p in ans:
		pass
	else:
		if pd=='WA':
			WAcount+=1
		else:
			ans.append(int(p))
            
print(len(ans),WAcount)

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:
            wa_num_temp[sp[0]] += 1
        elif sp[1] == "AC" and sp[0] not in ac_num_temp:
            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())

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):
        if int(P) in ac_list:
            continue
        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())
ac,wa=0,0
if m==0:
    print(ac,wa)
else:
    problem=0
    result='AC'
    for i in range(m):
        pa,s=map(str, input().split())
        p=int(pa)
        if p!=problem and s=='AC':
            problem=p
            result=s
            ac+=1
        elif p!=problem and s=='WA':
            problem=p
            result=s
            wa+=1
        elif p==problem and s=='AC' and s!=result:
            result=s
            ac+=1
        elif p==problem and s=='WA' and result!='AC':
            result=s
            wa+=1
        else:
            result=s
    print(ac,wa)

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:
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:
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 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:
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

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

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 clear.count(int(buf[0])) == 0:
    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())
if (M == 0):
    print(0,0)
    exit()
wacount = 0
account = 0
watmp = 0
actmp = 0
for idx in range(M):
    p,s=input().split()
    if (actmp != p):
        actmp = p
        watmp = 0
        account += 1
    if (s == 'AC'):
        wacount += watmp
        watmp = 0
    else:
        watmp += 1
print(account,wacount)

Submission status: Wrong Answer

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


array_flag = [False] * N
array_cnt = [0] * N
for i in p:
    (pos, result) = i.split()
    pos = int(pos) - 1
    
    if result == 'AC':
        array_flag[pos] = True
    else:
        if array_flag[pos] == True:
            continue
        else:
            array_cnt[pos] += 1

answerd_cnt = 0
penalty_cnt = 0
for i in range(len(array_flag)):
    penalty_cnt += array_cnt[i]
    if array_flag[i] == True:
        answerd_cnt += 1

print(answerd_cnt, penalty_cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_count = 0
penalty_count = 0
penalty_count_wa = 0
ac_number_list = set()

for i in range(M):
    temp_str_number, temp_result = map(str, input().split())
    temp_number = int(temp_str_number)
    if temp_number not in ac_number_list :
        if temp_result == 'AC' :
            ac_count += 1
            penalty_count_wa = 0
            ac_number_list.add(temp_number)
        else :
            penalty_count += 1
            penalty_count_wa += 1

penalty_count -= penalty_count_wa
print('{} {}'.format(ac_count, penalty_count))

Submission status: Wrong Answer

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

AC=[]
WA=[]
for i in range(M):
  p,s=input().split()
  if s=='AC':
    if not p in AC:
      AC.append(p)
  else:
    if not p in WA:
      WA.append(p)

print(len(AC),len(WA))

Submission status: Wrong Answer

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

problems = [0 for _ in range(n)]
was = 0
for _ in range(m):
  num, ans = input().split()
  num = int(num) - 1
  if ans == 'AC':
    if problems[num] == 0:
      problems[num] = 1
  else:
    if problems[num] == 0:
      was += 1

print('{} {}'.format(sum(problems), was))

Submission status: Wrong Answer

Solution code:
N,  M = map(int, input().split())
p = []; S = []
for _ in range(M):
    pi, Si = input().split()
    p.append(pi)
    S.append(Si)


correct = 0; penalty = 0; idx = 0; lock_num = []
for i in range(M):
    if p[i] not in lock_num and S[i] == 'WA':
        penalty += 1
    elif p[i] not in lock_num and S[i] == 'AC':
        correct += 1
        lock_num.append(p[i])
    
print(correct, penalty)

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 a == 0:
            if s == 'AC' and not p in list:
                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:
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'):
      wa[int(taka[j][0])-1] += 1
    
  for k in range(1,n+1):
    if k not in ac:
      wa[k-1] = 0
  
  print(len(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
def solve(N, M, A):
    if M == 0:
        return 0, 0
    A = [[int(x[0]), x[1]] for x in A]
    Unsolve = {}
    Solved = []
    a = 0
    w = 0
    ac = 0
    wa = 0
    check = 0
    num = A[0][0]
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                w += 1
                Unsolve[A[i][0]] = 0
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.append(A[i][0])
                Unsolve.setdefault(A[i][0], 0)
                wa += Unsolve[A[i][0]]
                w = 0
                ac += 1


    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
input_list = list(map(int, input().split()))
quest_num = input_list[0]
ans_num = input_list[1]
end_quest = []
miss_time = 0
quest = 0
result = 1
for _ in range(ans_num):
    ans_list = list(map(str, input().split()))
    if ans_list[quest] in end_quest:
        continue
    else:
        if ans_list[result] == 'AC':
            end_quest.append(ans_list[quest])
        else:
            miss_time += 1
print(str(len(end_quest)) + ' ' + str(miss_time))

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

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:
N, M = map(int, input().split())
p = [0] * M
S = [""] * M
for i in range(M):
    p[i], S[i] = map(str, input().split())
    p[i] = int(p[i]) - 1

A = [0] * N
Pen = [0] * N

for i, j in zip(p, S):
    if A[i] == 0 and j == "AC":
        A[i] = 1
    elif A[i] == 1 and j == "AC":
        continue
    elif A[i] == 0 and j == "WA":
        Pen[i] += 1
    elif A[i] == 1 and j == "WA":
        continue
print(sum(A), sum(Pen))

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()
    
    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]
      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())
p = [0] * M
s = [0] * M
b = [0] * N
for i in range(M):
    p[i], s[i] = input().split()
sort_p = sorted(p)
set_p = list(set(sort_p))
for i in range(len(set_p)):
    b[i] = False

seikai = 0
pena = 0
for i in range(M):
  if False not in b:
    break
  for n in range(len(set_p)):
    if p[i] == set_p[n]:
      if s[i] == "AC":
        if b[n] == False:
          seikai += 1
          b[n] = True
      else:
        if b[n] == False:
          pena += 1

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

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(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
problems = {}
reject_count = 0
for P, S in A:
    if not problems.get(P):
        if S == 'WA':
            reject_count += 1
        else:
            problems[P] = S
print(len(problems), reject_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
num=[]
TF=[]
accurate_num=[]
WA_num=0
for i in range(M):
    tmp_num,tmp_TF=input().split()
    if tmp_TF=="AC":
        accurate_num.append(i)
    if (tmp_TF=="WA")&(tmp_num not in accurate_num):
        WA_num+=1
accurate_num=list(set(accurate_num))


print(len(accurate_num),WA_num)

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:
n, m = map(int, input().split())

cor = pen = temp_pen = 0
temp_p = "0"
pen_dic={}
ac=[]

for _ in range(m):
  temp=input().split()
  if set(temp[0]) & set(ac):
    continue
  if temp[1] == "AC":
    ac.append(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())
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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d={}
ans=0
pen=0

for i in range(m):
  s=input().split()
  if s[0] not in d:
    if s[1]=='WA':
      d[s[0]]=[0,1,1]
    else:
      d[s[0]]=[1,0,1]
      d[s[0]][2]*=0
  else:
    if s[1]=='WA' and d[s[0]][2]==1:
      d[s[0]][1]+=1
    elif s[1]=='AC' and d[s[0]][2]==1:
      d[s[0]][0]+=1
      d[s[0]][2]*=0

for i in d:
  ans+=d[i][0]
  pen+=d[i][1]
      
print(ans,pen)

Submission status: Wrong Answer

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

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

right = 0
wrong = 0

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

print(right, wrong)

Submission status: Wrong Answer

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

pen=0
sco=0
e=0
ans=0
fl=0

for n in range(M):
  if S[n]=="AC":
    if ans==0:
      pen+=n
      ans+=1
      e=n
      fl=P[n]
    elif P[n]==fl:
      continue
    else:
      pen+=n-e-1
      ans+=1
      e=n
      fl=P[n]
print(ans,pen)

Submission status: Wrong Answer

Solution code:
P=[]
S=[]

N,M=map(int,input().split())
if N==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())

wa = 0
ac = []
for i in range(M):
  p,S = map(str, input().split())
  if not (p in ac):
    if S == "AC":
      ac.append(p)
    else:
      wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a=0
b=0
if m==0:
    print(0,0)
    exit()
p = [[str(i) for i in input().split()] for _ in range(m)]

c = sorted(p,key=lambda x:x[0])

now = c[0][0]
d = 1
aa=0
bb=0
f = 0

for i in c:
    if i[0] == now:
        if i[1]=='AC':
            if d:
                a += 1
                f = 1
                d = 0
        else:
            if not f:
                bb+=1
    else:
        now = i[0]
        d = 1
        if f:
            b += bb
            f = 0
            bb = 0
        if i[1]=='AC':
            if d:
                a+=1
                f=1
                d = 0
        else:
            if not f:
                bb+=1
b += bb
print(a,b)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
List = [0]*N
correct , penalties = 0,0
res = 0
for i in range(M):
    p,s = input().split()
    pro = int(p)-1
    if List[pro]=="AC":
        res = res + penalties
        continue
    if s == "WA":
        penalties+=1
        List[pro]=s
    else:
        List[pro]=s
        correct+=1
print("%d %d"%(List.count("AC"),res))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
l = list([input().split() for i in range(m)])
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
l = get_unique_list(l)
s = [l[i][1] for i in range(len(l))]
acount = s.count('AC')
wcount = s.count('WA')
print('{} {}'.format(acount,wcount))

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 (S == "AC") and(p not in problem):
    problem.append(p)
    sekai += 1
  elif(S=="WA") and (p not in problem):
    wrong += 1
print(sekai, wrong)

Submission status: Wrong Answer

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

answerd = [0] * 100100
WA_count = 0
AC_count = 0

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

    if s == 'WA' and answerd[p] == 0:
        WA_count += 1

    elif s == 'AC' and answerd[p] == 0:
        AC_count += 1
        answerd[p] = 1

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = []
p = []
for _ in range(m):
    _p, _s = map(str, input().split())
    _p = int(_p)
    ps.append([_p, _s])
    if _p not in p:
        p.append(_p)
p.append(-1)
cur_p = p.pop(0)
cur = 0
ac = 0
wa = 0

for i in range(m):
    if ps[i][1] == "AC" and ps[i][0] == cur_p:
        ac += 1
        wa += i - cur
        cur = i+1
        cur_p = p.pop(0)

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split()) 
listA = []
co_AC = 0
co_WA = 0
try:
  while True:
      try:
          listA.append(input().split())
      except:
          break;

  co_Index = int(listA[0][0])    

  for m in listA:
    if N < int(m[0]):
      break
    if int(m[0]) < co_Index:
      continue
    if m[1] == "WA":
      co_WA += 1
      
    elif m[1] == "AC":
      co_AC += 1
      co_Index += 1 
      continue
    else:
      co_AC = 0
      co_WA = 0
      break
  print(co_AC , co_WA) 
except:
  print("0 0")

Submission status: Wrong Answer

Solution code:
import sys
s = sys.stdin.readlines()

c = []
a = 0
b = 0
N, M = map(int, s[0].split())
for e in s[1:M + 1]:
  p, S = e.split()
  if p not in c:
    if S == 'AC':
        c.append(p)
        a += 1
    else:
        b += 1

print('{} {}'.format(a, b))

Submission status: Wrong Answer

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

ACSet = set([])
WAcnt = 0

for i in range(M):
    s = input().split()
    # N問と決まっているので、N問分のACが出た時点で判定不要となる
    if len(ACSet) != N:
        if s[1] == 'AC':
            ACSet.add(s[0])
        # WAはまだ正当してない問題についてのみカウントする
        elif s[1] == 'WA' and s[0] not in ACSet:
            WAcnt += 1

print("{} {}".format(len(ACSet), WAcnt))

Submission status: Wrong Answer

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

P = 1

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

    if P == p:
        if S == "WA":
            wa += 1

        else:
            ac += 1
            P += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

N, M = map(int, input().split())
if N == 0 or M == 0:
    print("0","0")
    sys.exit()

Clist = [list(input().split()) for _ in range(M)]
ans = 0
answa = 0
acf = 0
pi = Clist[0][0]

if Clist[0][1] == "AC":
    ans += 1

for al in range(M):
    if pi != Clist[al][0]:
        acf = 0
    if acf == 0 and Clist[al][1] == "WA":
        answa += 1
    elif  acf == 0 and Clist[al][1] == "AC":
        ans += 1
        acf = 1
    pi = Clist[al][0]

print(ans,answa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m==0:
    print(0,0)
    exit()
p=[]
s=[]
for i in range(m):
    x,y=input().split()
    p.append(int(x))
    s.append(y)
ac=0
wa=0
t=[0]*n

for i in range(m):
    if t[p[i]-1]==1:
        continue
    if t[p[i]-1]==0 and s[i]=="WA":
        wa+=1
    elif t[p[i]-1]==0 and s[i]=="AC":
        ac+=1
        t[p[i]-1]+=1
print(ac,wa)

Submission status: Wrong Answer

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

wa_num = 0
ac_q = []
for i in range(m):
    if score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
        wa_num = wa_num + 1
    elif score_list[i][1] == "AC" and score_list[i][0] not in ac_q:
        ac_q.append(score_list[i][0])

ac_num = len(ac_q)

print(ac_num,wa_num)

Submission status: Wrong Answer

Solution code:
N, M = [int(item) for item in input().split()]
ans_list = [input().split() for _ in range(M)]
# print(ans_list)

res_ac = 0
ans_stack = []
wa_stack = []

for q, ans in ans_list:
    print(q, ans)
    if ans == 'AC':
        if q not in ans_stack:
            res_ac += 1
        ans_stack.append(q)
    else:
        if q not in ans_stack:
            wa_stack.append(q)

res_list = []
for i in wa_stack:
    if i in ans_stack:
        res_list.append(i)


print(res_ac, len(res_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:
            WA_n = 0
    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())
AC=[0]*(N+1)
WA=0
A=0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        if AC[p]==0:
            WA+=1
    if s=='AC':
        if AC[p] == 0:
            AC[p]=1
            A+=1


print(A,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 S[i] == "WA":
            if wa_flag[p[i]-1] == 0:
                num_penalty += 1
        else:
            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 numpy as np

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

A=[0 for _ in range(N)]
B=[0 for _ in range(N)]

for i in range(M):
    p,S = input().split()
    p = int(p)-1
    if S == "AC":
        A[p] = 1
    elif A[p]==0:
        B[p] += 1
    
A = np.array(A)
B = np.array(B)
print(np.sum(A), np.sum(B))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
a3 = []
for j in reversed(al):
  if j[0] in al_a and j[1] == 'AC':
    a3.append(j[0])
  elif j[0] in a3 and j[1] == 'WA':
    r2 += 1
    
print(r1 ,r2)