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

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

Submission status: Wrong Answer

Solution code:
# 値の入力
N,M=map(int,input().split())

No=[]
Score=[]

inpn=""
inps=""

for i in range(M):
    inpn,inps=input().split()
    No.append(int(inpn))
    Score.append(inps)

result=0
Pena=0

RNo=[]
RScore=[]

# 処理
for j in range(M):
    if RNo.count(No[j])==0:
        RNo.append(No[j])
        RScore.append(0)
    if Score[j]=="AC":
        RScore[(RNo.index(No[j]))]="AC"
    else:
        if RScore[RNo.index(No[j])]!="AC":
            Pena+=1

print(RScore.count("AC"),Pena)

Submission status: Wrong Answer

Solution code:
from itertools import groupby
N, M  =map(int, input().split())
ps = [[] for i in range(M)]
for i in range(M):
    ps[i] = list(input().split())
if M == 0:
    print(0,0)
    exit()
listnum = []

for i in range(M):
    listnum.append(int(ps[i][0]))

newnumlist = list([list(g) for k, g in groupby(sorted(listnum))])
newAC = {}


for i in range(len(newnumlist)):
    newAC[newnumlist[i][0]] = [] 
    for j in range(M):
        if int(ps[j][0]) == newnumlist[i][0]:
            newAC[newnumlist[i][0]].append(ps[j][1])
#print(newAC)

countAC=0
counterror = 0
for i in range(len(newnumlist)):
    for j in range(len(newAC[newnumlist[i][0]])):
        if newAC[newnumlist[i][0]][j] == 'WA':
            counterror += 1
        else:
            countAC += 1
            break
    
print(countAC, counterror)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
penalty = 0
now = 0
flg = False
for i in range(0, m - 1):
    p, s = input().split()

    if p == now and flg:
        continue

    flg = False

    if s == 'WA':
        penalty += 1
    else:
        point += 1
        flg = True

    now = p

print(str(point) + " " + str(penalty))

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

#print(A)
#print(B)

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

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

poi1 -= c[0]
poi2 = d


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

Submission status: Wrong Answer

Solution code:
mondai, submit = map(int,input().split())
rc = [list(input().split()) for i in range(submit)]

now = 1
seitou = []
gotou = 0
temp = []

for i in range(submit):
    if rc[i][1] == 'AC':
        if rc[i][0] in seitou:
            continue
        else:
            seitou.append(rc[i][0])

for j in seitou:
    for k in range(submit):
        if rc[k][1] == 'WA':
            gotou +=1
        else:
            break

print(len(seitou),gotou)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
lst = [0 for _ in range(N+100)]
count1=0
count2=0
for i in range (M):
    a,b = input().split()
    a = int(a) -1
    if lst[a] == 0:
        if b=="WA":
            count1 =count1 + 1
        elif b=="AC":
            lst[a]=1
            count2=count2+1
print(str(count2)+" "+str(count1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1]

N,M = map(int,input().split(' '))
L = []
for i in range(M):
    L.append(list(map(str, input().split())))
VISITED = [False]*N
AC = 0
p = 0
for i in range(M):
    n,s = L[i]
    n = int(n) - 1
    if VISITED[n]:
        continue
    if s=='AC':
        VISITED[n] = True
        AC += 1
    else:
        p += 1
print(AC,p)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split(" "))
p = []
S = []
table = []
fAC = []
fWA = []

for i in range(M):
    inp = input().split(" ")
    p.append(inp[0])
    S.append(inp[1])
    table.append(p[i])
    fAC.append(0)
    fWA.append(0)

AC = 0
WA = 0

for i in range(M):
    if S[i] == "AC" and fAC[table.index(p[i])] == 0:
        fAC[table.index(p[i])] = 1
        AC = AC + 1
    if S[i] == "WA" and fAC[table.index(p[i])] == 0:
        WA = WA + 1

print(AC,WA)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
List = [input().split() for i in range(b)]
Wnum = 0
Cnum = 0
aclist = []
for i in range(len(List)):
  print(i)
  if List[i][1] == 'WA':
    if [List[i][0], 'AC']  in aclist:
      break
    else:
      Wnum += 1
#      print("WA", Wnum)
  else:
    if List[i] in aclist:
      break
    else:
      aclist.append(List[i])
      Cnum += 1
#      print(aclist)

print(Cnum, Wnum)

Submission status: Wrong Answer

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

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 int(k[0])>N:      
      c=0
    
    elif 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
        y=1
        
      else:
        b=b+1
      
print(a,b)

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 result!='AC': #前と同じ問題で初めて正解したときの処理
            result=s
            ac+=1
        elif p==problem and s=='WA' and result!='AC': #前と同じ問題でかつ今回も誤答のときの処理(まだ正答してない)
            result=s
            wa+=1
        elif p==problem and s==result=='AC': #前と同じ問題で2回目以降の正解の時の処理
            result=s
        elif p==problem and s=='WA' and result=='AC':
            continue
    print(ac,wa)

Submission status: Wrong Answer

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

for i in range(m):

    s[i][0] = int(ss[i][0])
    if ss[i][1] == "AC":
        s[i][1] = 1
    else:
        s[i][1] = 2

s = sorted(s, key=lambda x: x[0])
memo = 0
acc = 0
mis = 0
for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == 1:
            acc += 1
            memo = s[i][0]
        elif s[i][1] == 2:
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

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

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

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

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
        else:
            break
        
print(all_AC, all_failure)

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())
p = []
s = []
for i in range(m):
    a, b = input().split()
    p.append(int(a))
    s.append(0 if b=='WA' else 1)

ac = 0
pena = 0

for i in set(p):
    for j in range(m):
        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())
p = []
for i in range(m):
    p.append(input().split())

l_1 = []
l_2 = []
for x in p:
    l_1.append(x[0])
for y in p:
    l_2.append(y[1])
del_l = []
for j in range(m):
    if l_2[j] == 'AC' and l_1[j] not in del_l:
        del_l.append(p[j][0])
    if l_2[j] =='WA' and l_1[j] in del_l:
        l_1[j] = 'pass'
        l_2[j] = 'pass'
pen = 0
for s in range(m):
    if l_2[s] == 'WA':
        pen += 1
print(len(del_l),pen)

Submission status: Wrong Answer

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

pac = ''
ac = 0
pc = 0
for i in range(M):
    p, S = input().split(' ')
    if pac != p:
        if S == 'AC':
            pac = p
            ac += 1
        elif S == 'WA':
            pc += 1

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

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
pnum_list = []
ans_list = []
for j in range(m_sub):
    pi, si = input().split()
    pnum_list.append(int(pi))
    ans_list.append(si)

uniq_pnum = list(set(pnum_list))

for p in range(len(uniq_pnum)):
    cur_p_num = uniq_pnum[p]

    for j in range(m_sub):
        if ans_list[j] == 'WA':
            n_penalty += 1
        elif ans_list[j] == 'AC':
            n_answer += 1
            break

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

#print(N, M, p, S)
ac = 0
wa = 0

if M != 0:
    p_AC = []
    for i in range(M):#回答数
        if p[i] in p_AC:
            continue
        else:
            if S[i] == "WA":
                wa += 1
            if S[i] == "AC":
                ac += 1
                p_AC.append(p[i])

print(ac, wa)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
arr = []
pre_idx = '-1'
pre_s = 'start'
cnt = 0
errors = 0
ans = 0
for i in range(M):
  idx,s = input().split()
  arr.append([int(idx),s])
  
arr = sorted(arr)

flag = False
for idx,s in arr:
  if pre_idx != idx:
    cnt = 0
    flag = False
  if flag:
    continue
  else:
    if s=='WA':
      cnt += 1
    else:
      errors += cnt
      ans += 1
      flag = True
  pre_idx = idx
  pre_s = s
    
print(ans,errors)

Submission status: Wrong Answer

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

result = set()
wr = {}
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)
        w_cnt = wr.get(p, 0)
    else:
        wr[p] = wr.get(p, 0) + 1

print('{} {}'.format(len(result), w_cnt))

Submission status: Wrong Answer

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

acList = [False] * n
waCount = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p) - 1 # インデックスの調整
  if acList[p]:
    continue
  if s == 'WA':
    waCount += 1
    continue
  if s == 'AC':
    acList[p] = True

print(sum(acList), waCount)

Submission status: Wrong Answer

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

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

tmp=[]

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':
        if p[i] in tmp:
            continue
        else:
            sei+=1
            flag=1
            acflag=1
            count=0
            tmp.append(p[i])
    elif flag==0 and s[i]=='WA':
        if p[i] in tmp:
            continue
        else:
            count+=1
            pena+=1
    
print(sei,pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * 100000

now = 0
false_count = 0
ans_false = 0
ans = 0



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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
count_ac = 0
count_wa = 0
l = [('','')]*m
memo_n = []
idx = 0
for i in range(m):
    t = tuple(input().split())
    l[i] = t
    if t[1] == 'AC' and t[0] not in memo_n:
        memo_n.append(t[0])
        count_ac += 1
        count_wa += l[idx:i+1].count((t[0],'WA'))
        idx = i

print(str(count_ac) + " " + str(count_wa))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
count_ac = 0
count_wa = 0
l = [('','')]*m
memo_n = []
import collections
idx = 0
for i in range(m):
    t = tuple(input().split())
    l[i] = t
    if t[1] == 'AC' and t[0] not in memo_n:
        memo_n.append(t[0])
        count_ac += 1
        c = collections.Counter(l[idx:i+1])
        # count_wa += l.count((t[0],'WA'))
        count_wa += c[(t[0],'WA')]
        idx = i

print(str(count_ac) + " " + str(count_wa))

Submission status: Wrong Answer

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

p = [0] * M
S = [''] * M


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

dp = [[0] * 2 for i in range(N+1)]  # x問目の、score, penalty
#dp = [[0] * 2 for i in range(100005)]  # x問目の、score, penalty

for i in range(M):

    # 得点済
    if(dp[p[i]][0] > 0):
        continue

    if(S[i] == 'AC'):
        dp[p[i]][0] += 1
        continue

    elif(S[i] == 'WA'):
        dp[p[i]][1] += 1

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# INPUT
head = list(map(int, input().split()))

n = head[0]
m = head[1]

ac = 0
wa = 0
finished = []

for i in range(m):
    
    if len(finished) == n:
        break

    s = input().split()

    if s[0] not in finished:
        if s[1] == "WA":
                wa = wa + 1

        if s[1] == "AC":
                finished.append(s[0])
                ac = ac + 1

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

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 p > N:
        continue

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

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

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
n, m = map(int, input().split())

point = 0
penalty = 0
now = 0
flg = False
for i in range(0, m):
    p, s = input().split()

    if p == now and flg:
        continue

    flg = False

    if s == 'WA':
        penalty += 1
    else:
        point +=1
        flg = True

    now = p

print(str(point) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
d = []
a = 0
w = 0

if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    p,s = input().split()
    if (p,"AC") not in d:
        d.append((p,s))
        
        if s == "AC":
            a +=1
        elif s == "WA":
            w += 1
            del d[-1]
            
print(a,w)

Submission status: Wrong Answer

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

AC = [0]*(N+1)
WA = 0

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

print(sum(AC[1:]), WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
string_list=[input() for i in range(s[1])]
AC_count = 0
WA_count = 0

AC_list = []

for ele in string_list:
    l = ele.split()
    if l[1] == "AC":
        if not str(l[0]) in AC_list:
            AC_list.append(l[0])
            AC_count = AC_count+1
    elif l[1] == "WA":
        if not l[0] in AC_list:
            WA_count = WA_count+1

print(str(AC_count)+" "+str(WA_count))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n,m = map(int,input().split())
ac = wa = wa_another = 0
p_list = []

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

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

    if s == "WA":
        wa_another += 1
    
    if (s == "AC") and (not p in p_list):
        ac += 1
        wa += wa_another
        wa_another = 0
        p_list.append(p)

print(ac,wa)

Submission status: Wrong Answer

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

aclist = []
wac = 0

for i in range(m):
  a , b = input().split()
  if b == "AC":
    if not aclist.count(a):
      aclist.append(a)
  else:
    if not aclist.count(a):
      wac += 1

print(len(aclist),wac)

Submission status: Wrong Answer

Solution code:
import bisect

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return mid
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    return None


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

ac = 0
wa = 0

ac_list = []

for i in range(M):
    p, S = input().split()
    q_num = int(p) 
    if  type(binary_search(ac_list, q_num)) is int :
        continue
    else:
        if  S == 'AC':
            ac += 1
            x = int(p) 
            insert_index = bisect.bisect_left(ac_list,x)
            ac_list.insert(insert_index,x)
        else:
            wa += 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
input = sys.stdin.readline

N, M = list(map(int, input().split()))
ac = np.zeros(N, dtype=np.int)
wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if ac[p-1] == 1:
        continue
    if S == 'AC':
        ac[p-1] = 1
    else:
        wa += 1
ans = str(sum(ac)) + ' ' + str(wa)
print(ans)

Submission status: Wrong Answer

Solution code:
N,  M = map(int, input().split())
p = []; S = []; a = []
for _ in range(M):
    pi, Si = input().split()
    a.append([int(pi), Si])
 
correct = 0; penalty = 0; pre_num = 0; pre_code = ''
for pi, Si in sorted(a, key=lambda a:a[0]):
    if pre_num == pi and pre_code == 'AC':
        continue
    else:
        if Si == 'WA':
            penalty += 1
            pre_num = pi
            pre_code = 'WA'
        else:
            correct += 1
            pre_num = pi
            pre_code = 'AC'
    
print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = []
wa = 0
ac = 0
for i in range(m):
    p, s = input().split()
    if (p+"a") not in l:
        if s == "WA":
            wa += 1
        else:
            ac += 1
            l.append(p+"a")
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = []
wrong = []
for j in range(N):
    right.append(0)
    wrong.append(0)
for k in range(M):
    if right[p[k] - 1] == 0:
        if S[k] == 'WA':
            wrong[p[k] - 1] += 1
        elif S[k] == 'AC':
            right[p[k] - 1] += 1
print(str(sum(right)) + ' ' + str(sum(wrong)))

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 _ in range(M):
    p_S.append(input().split())
    
p = []
S = []

for i in range(M):
    p.append(p_S[i][0])
    S.append(p_S[i][1]=='AC')

p = list(map(int, p))
S = list(map(int, S))

flag_p = p[0]
flag_ac = 0
AC_sum = 0
WA_sum = 0
WA = 0

for i in range(M):

    if flag_p == p[i]:
        if S[i] == 0 and flag_ac == 0:
            WA += 1
        elif S[i] == 1 and flag_ac == 0:
            AC_sum += 1
            WA_sum += WA
            WA = 0
            flag_ac = 1
            
    else:
        flag_p = p[i]
        flag_ac = 0
        WA_sum += WA
        WA = 0
        if S[i] == 0 and flag_ac == 0:
            WA += 1
        elif S[i] == 1 and flag_ac == 0:
            AC_sum += 1
            WA_sum += WA
            flag_ac = 1

print(AC_sum, WA_sum)

Submission status: Wrong Answer

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

print(len(test_cnt))
print(false_cnt)

Submission status: Wrong Answer

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

#print(N,M)

num=[]
answer=[]
correct=[]
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
#print(num)
#print(answer)
    
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 == 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 = list(map(int, input().split()))

P = []
S = []

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

exs = list(set(P))

WAC = 0
ACC = 0
for ex in exs:
    for i in range(M):
        if P[i] == ex:
            if S[i] == 'WA':
                WAC += 1
            else:
                ACC += 1
                break

print(ACC, WAC)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ACE=[0]*(N+1)
W=0
A=0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if ACE[p]==0:
        if s=='WA':
            W+=1
        else:
            ACE[p]=1
            A+=1
print(A,W)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
count_ac = 0
count_wa = 0
l = [('','')]*m
memo_n = []
idx = 0
for i in range(m):
    t = tuple(input().split())
    l[i] = t
    if t[1] == 'AC' and t[0] not in memo_n:
        memo_n.append(t[0])
        count_ac += 1
        count_wa += l[idx:i].count((t[0],'WA'))
        idx = i

print(str(count_ac) + " " + str(count_wa))