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())
lp, ls = [0] * m, [0] * m
for i in range(m):
    lp[i], ls[i] = input().split()

lpu = list(set(lp))
lac = [0] * len(lpu)
lwa = [0] * len(lpu)

for e, i in enumerate(lpu):
    if lac[e] == 0:
        for j in range(m):
            if lp[j] == i and ls[j] == 'WA':
                lwa[e] += 1
            if lp[j] == i and ls[j] == 'AC':
                lac[e] = 1
                break
    else:
        break

print(sum(lac), sum(lwa))

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:
    continue
  elif S == "WA":
    pen += 1
  else:
    score += 1
    table[p] = 1
print(score,pen)

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

for i in range(submit):
    if rc[i][1] == 'AC':
        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())
ps = [input().split() for i in range(M)]
ac = 0
wa = 0
ansed = []
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed.append(psn[0])
    else:
        if psn[0] not in ansed:
            wa += 1

print(ac, wa)

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("%d %d"%(correct,penalties))

Submission status: Wrong Answer

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

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

print(sum_ac,sum_wa_with_ac)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
ac = 0
wa = 0;
sub = []
for i in range(0, nm[1]):
    sub.append([i for i in input().split()])
sub = list(set(map(tuple, sub)))
for i in range(0, len(sub)):
    if sub[i][1] == "AC":
        ac += 1
    elif sub[i][1] == "WA":
        wa += 1
    else:
        continue

print(ac, end=" ")
print(wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
BB = []
tigau = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append((ans[i][1],ans[i][0]))
        BB.append(i)
    else:
        tigau.append(i)
#print(BB)
#print(tigau)
if BB == []:
    cnt += 0
elif tigau == []:
    cnt += 0
else:
    for b in BB:
        for v in tigau:
            if v < b:
                if ans[v][0] == ans[b][0]:
                    cnt += 1
kotae = set(hantei)
print(len(kotae),cnt)

Submission status: Wrong Answer

Solution code:
import itertools

def main() :
  N, M = map(int, input().split())
  p = []
  S = []

  for i in range(M) :
    tmp = input().split()
    p.append(int(tmp[0]))
    S.append(tmp[1])

  s = set(p)
  dict = {}
  for i in s :
    dict[i] = 0
  # print(dict)
  w_cnt = 0
  a_cnt = 0
  skip = []
  cnt = 0
  for key, value in itertools.groupby(p) :
    pre_cnt = cnt
    cnt += len(list(value))
    if key in skip :
      continue
    if 'AC' in S[pre_cnt:cnt] :
      ac_index = S[pre_cnt:cnt].index('AC')
      a_cnt += 1
      skip.append(key)
      w_cnt += len(S[pre_cnt:ac_index+pre_cnt])
    
  # for i in range(M) :
    # if p[i] not in skip :
    #   if S[i] == 'WA' :
    #     dict[p[i]] += 1
    #     continue
    #   else :
    #     a_cnt += 1
    #     w_cnt += dict[p[i]]
    #     skip.append(p[i])
    #     continue

  print(a_cnt, w_cnt)

if __name__ == '__main__' :
  main()

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:
    P = int(P)
    if P<= N and not problems.get(P):
        if S != 'AC':
            reject_count += 1
        else:
            problems[P] = S
print(len(problems), reject_count)

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 Liste[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())
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'
WC = 0
for l in L:
    if l[0] == index and flag == '0':
        if l[1] =='AC':
            AC += 1
            flag = '1'
            WA += WC
            WC =0
        elif l[1] == 'WA' and flag == '0':
            WC += 1
    elif l[0] != index:
        flag = '0'
        if l[1] == 'AC':
            AC += 1
            flag = '1'
            WA += WC
            WC = 0
            index = l[0]
        else:
            WC += 1
            index = l[0]
print(str(AC)+ ' '+str(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac_cnt, wa_cnt = 0, 0
n_and_ac = {}
for n in range(N):
  n_and_ac[str(n + 1)] = 0
for ps in PS:
  if ps[1] == "AC" and n_and_ac[ps[0]] == 0:  
    n_and_ac[ps[0]] += 1
    ac_cnt += 1
  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:
IN = input().split()
N, M = int(IN[0]), int(IN[1])

MEM = []
MEM.append(-1)
MEM.append("DUMMY")

wrong = 0
correct = 0
count = 0

for i in range(M):

  IN = input().split()
  P = int(IN[0])
  S = IN[1]

  if MEM[0] != P:
    correct = 0
    RES = []
    RES.append(S)
    
  else:
    RES.append(S)


  if S == "AC":
    correct += 1
    if correct == 1:
      count += 1
    
  if correct == 0:
    wrong += 1

  MEM = []
  MEM.append(P)
  MEM.append(S)
  
print(count,wrong)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = []
s = []
ac = [0 for i in range(n)]
wa = [0 for i in range(n)]
for i in range(m):
    p_i,s_i = input().split()
    if ac[int(p_i)-1] == 0:
        if s_i == "WA":
            wa[int(p_i)-1] += 1
        elif s_i == "AC":
            ac[int(p_i)-1] += 1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = 0
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn
      plbnum = a
      temp_pn = 0
print(cr, pn)

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
    if s == "AC":
        List[pro]=s
        correct+=1
print("%d %d"%(correct,penalties))

Submission status: Wrong Answer

Solution code:
buf=raw_input().split(" ")
N=int(buf[0])
M=int(buf[1])
clear=[]
ac=0
wa=0

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans_n = 0
penalty_n = 0

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

print(ans_n, penalty_n)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]
ac = 0
wa = 0
ansed = ()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed + (psn[0],)
    else:
        if psn[0] not in ansed:
            wa += 1

print(ac, wa)

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:
            break
        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:
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 + 1].split())
  #print(op, oS, p, S)
  if S == 'WA' and ( op == p or op == 'null' ):
    w_cnt += 1
  elif S == 'AC' and ( ( op == p or op == 'null') and ( oS == 'WA' or oS == 'null' )):
    a_cnt += 1
  op = p
  oS = S
 
print(a_cnt)
print(w_cnt)

Submission status: Wrong Answer

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

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

#str_lines = [x.strip("\n") for x in sys.stdin.readlines()]
str_lines = [input() for i in range(M)]

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

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

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

print(count_AC,count_WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ac = 0
wa = 0
ans = {}

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

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

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

Submission status: Wrong Answer

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

print(ac_num,wa_num)

Submission status: Wrong Answer

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

ac = 0
wa = 0
ansed = ()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed + (psn[0],)
    else:
        if psn[1] not in ansed:
            wa += 1

print(ac, wa)

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 = 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
    if s == "AC":
        List[pro]=s
        correct+=1
print("%d %d"%(List.count("AC"),penalties))

Submission status: Wrong Answer

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

        probs = []

        for i in range(NM[1]):
            ps = input().split(" ")
            #print(ps)

            if p != ps[0]:
                #print("A")
                p = ps[0]
                res = ps[1]
                if p in probs:
                    pass
                else:
                    if res == "AC\n":
                        ans_ac += 1
                        probs.append(p)
                    else:
                        ans_wa += 1
            else:
                #print("B")
                res = ps[1]
                if p in probs:
                    pass
                else:
                    if res == "AC\n":
                        ans_ac += 1
                        probs.append(p)
                    else:
                        ans_wa += 1

        ans = str(ans_ac) + " " + str(ans_wa)
    print(ans)
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split( ))
wa = [0] * (n + 1)
ac = [0] * (n + 1)
for i in range(m):
    no_s, res = map(str, input().split( ))
    no = int(no_s)
    if ac[no] == 0 and res == "AC":
        ac[no] = 1
    elif ac[no] == 0 and res == "WA":
        wa[no] += 1
for i in range(1, n):
    if ac[i] == 0:
        wa[i] = 0
acsum = 0
wasum = 0
for i in ac:
    acsum += i
for i in wa:
    wasum += i
print(str(acsum) + " " + str(wasum))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter


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

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

l = []
for i in range(m):
    p, s = map(str, input().split())
    l.append([int(p), s])
l.sort(key = itemgetter(0))

numAC = 0
numWA = 0
countWA = 0
AC = False
last = l[0][0]

for i in range(m):
    if last == l[i][0]:
        if AC:
            continue
        elif l[i][1] == "AC":
            numAC += 1
            numWA += countWA
            AC = True
        else:
            countWA += 1
    else:
        last = l[i][0]
        AC = False
        if l[i][1] == "AC":
            numAC += 1
            AC = True
        else:
            countWA = 1

Submission status: Wrong Answer

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

ok, ng = (0, 0)
oks = set()

for _ in range(M):
    pp, S = input().split()
    if not pp in oks:
        if S == 'AC':
            oks.add(pp)
            ok += 1
        else:
            ng += 1

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

Submission status: Wrong Answer

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

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


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

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

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

print(a, wa_n)

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()
        if x in A:
            continue
        elif y=="AC":
            ansAC+=1
            A.append(x)
        else:
            ansWA+=1
    print(ansAC,ansWA)
solve()

Submission status: Wrong Answer

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

account = 0
wacount = 0
qnum = []
for i in range(m):
  a = input().split()
  if int(a[0]) not in qnum:
    qnum.append(int(a[0]))
    stopnum = 0
    if a[1] == "WA":
      wacount += 1
    elif a[1] =="AC":
      account += 1
      stopnum = 1
  else:
    if stopnum == 1:
      ac = 1
    else:
      if a[1] == "WA":
        wacount += 1
      elif a[1] =="AC":
        account += 1
        stopnum = 1
print(str(account)+" "+str(wacount))

Submission status: Wrong Answer

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

N = Input[0]
M = Input[1]

Ar = []

for i in range(M):
  Input = list(map(str,input().split()))
  Ar.append([])
  Ar[i].append(int(Input[0]))
  Ar[i].append(Input[1])

ac = 0
pn = 0

ac_ar=[]
pn_ar=[]

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

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

print(ac,pn)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
arr = []
#pre_idx = '-1'
pre_s = 'start'
cnt = 0
errors = 0
ans = 0
visited = []
flag = False
for i in range(M):
  idx,s = input().split()
  #if pre_idx != idx:
  if idx not in visited:
    cnt = 0
    flag = False
  if flag:
    continue
  else:
    if s=='WA':
      cnt += 1
    else:
      errors += cnt
      ans += 1
      flag = True
  visited.append(idx)
  pre_s = s
    
print(ans,errors)

Submission status: Wrong Answer

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

ac = 0
wa = 0
ansed = ()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed + (psn[1],)
    else:
        if psn[1] not in ansed:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

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

    arr = [input().split() for i in range(M)]
    for j in arr:
        j[0] = int(j[0])

    ac, wa = 0, 0

    AC_lis = []
    for k in arr:
        if k[1] == 'WA' and k[0] not in AC_lis:
            wa += 1
        if k[1] == 'AC' and k[0] not in AC_lis:
            ac += 1
            AC_lis.append(k[0])

    print(ac, wa)

main()

Submission status: Wrong Answer

Solution code:
import sys

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

p_S = []
for _ 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
            flag_ac = 1
    else:
        flag_p = p[i]
        flag_ac = 0
        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 = input().split(" ")
n, m = int(n), int(m)
p_s = []
for i in range(m):
    inp = input().split(" ")
    inp[0] = int(inp[0])
    p_s.append(list(inp))
p_s.sort(key=lambda x: x[0])
end_problem = -1
ans = 0
fail = 0
if m == 0:
    pass
else:
    for p, s in p_s:
        if p != end_problem:
            if s == "AC":
                ans += 1
                end_problem = p
            elif s == "WA":
                fail += 1
        else:
            pass
print(ans, fail)

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)
if M==0:
    print(zero,zero)
else:
    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:
N,M = map(int,input().split())
pis=[]
wa,ac={},{}
for i in range(M):
    p  = input().split(' ')
    pis += [(int(p[0]),p[1])]
for p in pis:
    wa[p[0]]=0
    ac[p[0]]=0
if __name__ == '__main__':
   for p in pis:
      if 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.values()),sum(wa.values())))

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 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())
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
t=[0]*(n+1)

for i in range(m):
    if t[l[i][0]]==1:
        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
        t[l[i][0]]+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
hako = []
BB = []
moumuri = []
tigau = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append((ans[i][1],ans[i][0]))
        BB.append(i)
        hako.append(i)
    else:
        tigau.append(i)
#print(BB)
#print(tigau)
if BB == []:
    cnt += 0
elif tigau == []:
    cnt += 0
else:
    for b in BB:
        for v in tigau:
            if v < b:
                if ans[v][0] == ans[b][0]:
                    cnt += 1


if BB == []:
    T = 0
else:
    T = BB[0]
for m in range(len(BB)-1):
    moumuri.append(BB[m+1]-BB[m]-1)

kotae = set(hantei)
kari=[ans[i][1] for i in range(len(ans))]
kari.reverse()
kouho = []
for j in range(len(kari)):
    if kari[j] == "AC":
        kouho.append(j)
if kouho == []:
    K = cnt
else:
    K=kouho[0]
print(len(kotae),cnt)

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":
        if AC[int(P[i])-1] == 0:
            WA += 1
    else:
        AC[int(P[i])-1] = 1

print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
c = 0
p = 0
l = [(lambda s_lst: (int(s_lst[0]), s_lst[1]))(input().split()) for i in range(M)]
ls = list(map(list, set(map(tuple, l))))
for k in ls:
    if k[1] == "AC":
        c += 1
        
for j in range(1, N+1):
    for i in range(M):
        if l[i][0] == j:
            if l[i][1] == "WA":
                p += 1
            else:
                break

print(c, p)

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()
#sort_p = sorted(p)
#set_p = list(set(sort_p))
sort_p = list(set(p))
set_p = sorted(sort_p)
b = [0] * len(set_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())

aclist = []
wac = 0

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

print(len(aclist),wac)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    p[i],s[i]=input().split()
    p[i]=int(p[i])
sum_ok,sum_miss=0,0
former_ok=[0]*n
for p_,s_ in zip(p,s):
    if p_ in former_ok or p_>n:continue
    elif s_=='AC':
        former_ok[sum_ok]=p_
        sum_ok+=1
        if sum_ok==n:break
    else:sum_miss+=1
print(sum_ok,sum_miss)

Submission status: Wrong Answer

Solution code:
N, M = 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_all = []
ACC_all = []

for ex in exs:
    WAC = 0
    ACC = 0

    for i in range(M):
        if P[i] == ex:
            if S[i] == 'WA':
                WAC += 1
            else:
                ACC = 1
                break
    WAC_all.append(WAC)
    ACC_all.append(ACC)

print(sum(ACC_all), sum(WAC_all))

Submission status: Wrong Answer

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

ac = 0
wa = 0
ans = {}

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

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