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=list(map(int,input().split()))
x=[list(input().split())for i in range(n[1])]
wwa,wa,ac=0,0,0
notused=[]
for i in range(n[1]):
  if(x[i][0] not in notused):
    if(x[i][1]=="WA"):
      wwa+=1
    else:
      ac+=1
      wa=wa+wwa
      wwa=0
      notused.append(x[i][0])
  else:
    wwa=0
print('{0} {1}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
input_arg = list(map(int, input().split()))
ac_list = []
wa = 0
 
for i in range(input_arg[1]):
  rec_input_arg = input().split()
  if rec_input_arg[1] == 'AC' and not rec_input_arg[0] in ac_list:
    ac_list.append(rec_input_arg[0])
  elif rec_input_arg[1] == 'WA' and not rec_input_arg[0] in ac_list:
    wa += 1
    
print("{0} {1}".format(len(ac_list), wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
count = 0
ans = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1
    if len(ans) == n:
        break

ans = list(set(ans))

if penal < 0:
    penal = 0

print("{}".format(len(ans)) + " {}".format(penal))

Submission status: Wrong Answer

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

for i in range(M):
	p, S = input().split()
	p = int(p)
	if S == "AC":
		if ac[p-1] == 1:
			continue
		elif ac[p-1] == 0:
			ac[p-1] = 1
			ac_cnt += 1
			continue
	elif S == "WA":
		if ac[p-1] == 1:
			continue
		elif ac[p-1] == 0:
			wa += 1
			
print(ac_cnt, wa)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
wa={i:0 for i in range(1,a+1)}
ac=wa
g=0
if b==0:
    print("0 0")
    g=1
for i in range(b):
    c,d=input().split()
    if d=="WA" and ac[int(c)]==0:
        wa[int(c)]+=1
    else:
        ac[int(c)]=1
if g==0:
    print(str(sum(wa.values()))+" "+str(sum(ac.values())))

Submission status: Wrong Answer

Solution code:

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

#print(N,M)

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

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

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

print(correctCount, wrongCount)

Submission status: Wrong Answer

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

S=[[] for _ in range(N)]
done=[]
AC,WA=0,0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if  not p in done:
        if s=="WA":
            WA+=1
        if s=="AC":
            done.append(p)
            AC+=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ans = {'AC':0, 'WA':0}
ac_list = {'AC':[], 'WA':[]}
if m==0:
    print(0,0)
else:
    for i in range(m):
        p,s = input().split()
        if ac_list['AC'].count(p) !=0:
            pass
        else:
            ans[s] += 1
            ac_list[s].append(p)
    print(ans['AC'], ans['WA'])

Submission status: Wrong Answer

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

def qa(s):
    qa_dict = {}
    WAs=0
    ACs=0
    for qa in s:
        qa_dict[qa[0]] = 0
    for qa in s:
        if qa_dict[qa[0]] <= 0:
            if qa[1] == 'WA':
                qa_dict[qa[0]] -= 1
            elif qa[1] == 'AC':
                qa_dict[qa[0]] *= -1
    for v in qa_dict.values():
        WAs += v
        ACs += 1
    return ACs, WAs

if m == 0:
    ac, wa = 0, 0
else:
    ac, wa = qa(s)
print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
lis = [tuple(map(str,input().split())) for i in range(M)]
ans = [0]*N
answ = [0]*N
for i in range(0,M):
    an = lis[i][1]
    if an == 'AC':
        ans[int(lis[i][0])-1] = 1
    elif an == 'WA' and ans[int(lis[i][0])-1] == 0:
        answ[int(lis[i][0])-1] = 1
print(sum(ans),end=' ')
print(sum(answ))

Submission status: Wrong Answer

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

aclist={}
p=0
ac=wa=0

for i in [input() for i in range(m)]:
    x,y=i.split()
    if not aclist.get(x):
        if y=='AC':
            aclist[x] = True
            ac+=1
        elif y=='WA':
            wa+=1

print(ac,wa)

Submission status: Wrong Answer

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

ans_list = []

for i in range(M):
    ans_list.append(input().split())

wa = 0
wa_tmp = 0
ac = 0
ac_tmp = 0
flag = 0
counter = 0


if M == 0:
    wa = 0
    ac = 0

elif M == 1:
    if ans_list[0][1] == "AC":
        ac += 1

else:
    for n in range(int(ans_list[0][0]), int(ans_list[-1][0])+1):
        for t in range(counter, M):
            if ans_list[t][0] == str(n):
                if ans_list[t][1] == "AC":
                    ac_tmp += 1
                    counter += 1
                    break

                elif str(n) and ans_list[t][1] == "WA":
                    wa_tmp += 1
                    counter += 1

            elif ans_list[t][0] == str(n+1):
                    break
            

        if ac_tmp == 0:
            wa_tmp = 0
        
        wa += wa_tmp
        ac += ac_tmp

        wa_tmp = 0
        ac_tmp = 0


print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[];s=[]
if m==0:
    print(0,0)
    exit()
for i in range(m):
    x,y=input().split()
    p.append(int(x))
    s.append(y)
ac=0
wa=0
t=[0]*(n+1)
for i in range(m):
    if t[p[i]]>=1:
        continue
    elif t[p[i]]==0 and s[i]=="WA":
        wa+=1
    elif t[p[i]]==0 and s[i]=="AC":
        t[p[i]]+=1
        ac+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#C
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_pre = p[0]
    flag = False
    for i in range(M):#回答数
        if flag == False:
            if S[i] == "WA":
                wa += 1
            else:
                ac += 1
                flag = True
        else:
            if p[i] == p_pre:
                break
            else:
                if S[i] == "WA":
                    wa += 1
                flag = False
        p_pre = p[i]
else:
    print(ac, wa)

Submission status: Wrong Answer

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

ac = []
wa = {}

for _ in range(M):
    pS = input().split()
    p = int(pS[0])
    S = pS[1]
    if S == 'AC' and p not in ac:
        ac.append(p)
    elif S == 'WA' and p not in ac:
        wa.setdefault(p, 0)
        wa[p] += 1

sum_ac = len(ac)
sum_wa = sum(wa.values())
print(sum_ac, sum_wa)

Submission status: Wrong Answer

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

    if p[i] == c[j] and s[i] == "AC":
        ac += 1
        j += 1
        if c[j] == 0 or c[j] == -11:
            break
    else :
        wa += 1
        
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

Solution code:
N, M = [int(num) for num in input().split()]
c = []
f_sum = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        if p not in c:
            c.append(p)
    else:
        if p in c:
            continue
        else:
            f_sum += 1
print("{} {}".format(len(c), f_sum))

Submission status: Wrong Answer

Solution code:

def main():
    N, 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
        if s == "WA":
            wa_count += 1
        if s == "AC":
            ac_count += 1
            ac_p = int(p)
    print(ac_count, wa_count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m == 0:
  print('0 0')
else:
  lst = []
  for i in range(m):
    lst.append(input().split())

  taskLst = [lst[0][0]]
  temp = lst[0][0]
  for i in lst:
    if i[0] == temp:
      continue
    else:
      taskLst.append(i[0])
      temp = i[0]
      
  resLst = []
  for i in range(len(taskLst)):
    tempLst = []
    for j in range(len(lst)):
      if lst[j][0] == taskLst[i]:
        if lst[j][1] == 'WA':
          tempLst.append(lst[j][1])
        else:
          tempLst.append(lst[j][1])
          break
    resLst.append(tempLst)
    
  finalLst = []
  for i in range(len(resLst)):
    for j in range(len(resLst[i])):
      finalLst.append(resLst[i][j])

  print(str(finalLst.count('AC')) + ' ' + str(finalLst.count('WA')))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = []
s = []
for i in range(m):
    P,S = map(str,input().split())
    p.append(int(P))
    s.append(S)
Bool = [0 for i in range(n)]
count = [0 for i in range(n)]

for i in range(m):
    if not Bool[p[i]-1]:
        if s[i] == "WA":
            count[p[i]-1] += 1
        else:
            Bool[p[i]-1] = 1

print(sum(Bool),sum(count))

Submission status: Wrong Answer

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

for _ in range(m):
    p, s = input().split()
    if (not ac[int(p)]) and s == 'WA':
        wa[int(p)] += 1
    elif s == 'AC':
        ac[int(p)] = 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pena = 0
AC = 0
question = [False for i in range(N)]

for i in range(M):
    S = input().split()
    num = int(S[0]) -1
    if S[1] == 'AC' and question[num]==False:
        question[num] = True
        AC+=1
        continue
    if S[1]== 'WA' and question[num]==False:
        pena+=1
        
print(AC,pena)

Submission status: Wrong Answer

Solution code:
[N,M]=map(int,input().split())
dic={}
nAC=0
nWA=0

for _ in range(M):

    p,S=input().split()
    
    if p not in dic:
        if S=="AC":
            nAC += 1
            dic[p]="AC"
        if S=="WA":
            nWA += 1
            dic[p]="WA"
    
    else:
        if dic[p]=="WA":
            if S=="WA":
                nWA += 1
            if S=="AC":
                nAC += 1
                dic[p]="AC"


print("{0} {1}".format(nAC,nWA))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N,M = map(int,input().split())
p = [0] * M
S = [0] * M
BUF = [[0 for i in range(2)] for i in range(M)]

for i in range(M) :
    p[i],S[i] = map(str,input().split())
    p[i] = int(p[i])
    BUF[i][0] = p[i]
    BUF[i][1] = S[i]
BUF_new = sorted(BUF,key=itemgetter(0))
#print(BUF_new)

Flag = False
buf_goal = 0
buf_pena = 0
buf = -1

for i in range(M) : #余分な情報削除
    if Flag == True :
        if BUF_new[i][0] == buf :
            #BUF_new.pop(i)
            BUF_new[i][1] = 'NULL'
        else :
            Flag = False
            buf = -1
    if Flag == False :
        if BUF_new[i][1] == 'AC' :
            Flag = True
            buf = BUF_new[i][0]

for i in range(M) :
    if BUF_new[i][1] == 'WA' :
        buf_pena += 1
    if BUF_new[i][1] == 'AC' :
        buf_goal += 1

#print(BUF_new)
print(buf_goal,buf_pena)

Submission status: Wrong Answer

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

solved = set()
correct = 0
penalty = 0

for _ in range(m):
    p,s = input().split()
    p = int(p)

    if p not in solved:
        if s == "WA":
            penalty += 1
        else:
            correct += 1
            solved.add(p)

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

poi1 = 100100
poi2 = 100100

owa = -1

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

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

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

poi1 -= c[0]
poi2 -= d[0]


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

Submission status: Wrong Answer

Solution code:
import sys

scan = sys.stdin.readline
n, m = map(int, scan().split(' '))
ans = [0] * n
wa = 0
ac = 0
for i in range(m):
    q, r = map(str, scan().strip('\n').split(' '))
    if r == 'AC':
        if ans[int(q) - 1] == 0:
            ans[int(q) - 1] = 1
            ac += 1
    else:
        if ans[int(q) - 1] == 0:
            wa += 1
print(ac, wa, sep=' ')

Submission status: Wrong Answer

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

A = []
for i in range(M):
    A.append(input().split())

AC = []
WA = []

for j in range(M)[::-1]:
    if A[j][1] == 'AC' and (A[j][0] in AC) is False:
        AC.append(A[j][0])
    elif A[j][1] == 'WA' and (A[j][0] in AC) is True:
        WA.append(A[j][0])

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[0]*M
S=[0]*M

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

fin=[0]*(N+1)
count_AC=0
count_WA=0

if(M!=0):
    for i in range(0,M):
        if(S[i]=="AC"):
            if(fin[int(p[i])]!=-1):
                count_AC+=1
                fin[int(p[i])]=-1
        else:
            if(fin[int(p[i])]!=-1):
                count_WA+=1
    
    print(count_AC,count_WA)

else:
    print(count_AC,count_WA)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
R = lambda : input().split()

n, m = map(int, R())
a = [False] * n
b = [0] * n
for _ in range(m):
  p, s = R()
  p = int(p) - 1
  if s == 'AC':
    a[p] = True
  elif not a[p]:
    b[p] += 1
b =  [y for x, y in zip(a, b) if a]
print(len(b), sum(b))

Submission status: Wrong Answer

Solution code:
x = input().split()
n = int(x[0])
m = int(x[1])

d = {}

ac = 0
pe = 0

c = 0

for i in range(m):
    k = input().split()
    pi = int(k[0])
    s = k[1]
    if pi in d:
        continue
    if s == "AC":
        ac += 1
        d[pi] = True
        pe += c
        c = 0
    else:
        c += 1

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
 
N,M = list(map(int, sys.stdin.readline().strip().split()))
counter = {"WA":0, "AC":0}
solv = defaultdict(int)
pre = None
for i in range(M):
  p, s = sys.stdin.readline().strip().split()
  if solv[p]==1: continue
  elif solv[p]==0:
    counter[s] += 1
  if s=="AC" and solv[p]==0:
    solv[p] = 1

print(counter["AC"], counter["WA"])

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC = 0
WA = 0
data = [0]*100001
for i in range(M):
    x, y = map(str,input().split())

    if data[int(x)] == 1:
            continue
    if y == 'WA':
        WA += 1
    else:
        AC += 1
        data[int(x)] = 1
print(AC,WA)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

class problem():
  def __init__(self, n, s):
    self.num = n
    self.result = s


n, m = map(int, input().split())
ckn = []
flag = 0
fac = 0
swa = 0
ac = 0

for i in sys.stdin:
  pm, c = i.split()
  if not(int(pm) in ckn):
    if c == 'WA':
      swa += 1
      if flag == 0:
        fac += 1
    elif c == 'AC':
      ckn.append(int(pm))
      ac += 1
      if flag == 0:
        flag += 1

if ac == 0:
  fac = -1
  
print(fac + 1, swa)

Submission status: Wrong Answer

Solution code:
def main(n, m, p_s: list):
    data = {"AC": set(), "WA": 0}
    for p, s in p_s:
        if s == "AC":
            data["AC"].add(int(p))
        else:
            if int(p) in data["AC"]:
                continue
            else:
                data["WA"] += 1

    print(len(data["AC"]), data["WA"])


if __name__ == "__main__":
    n, m = map(int, input().split())
    p_s = [input().split() for _ in range(m)]

    main(n, m, p_s)

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 a[0] not in qnum:
    qnum.append(a[0])
    stopnum = 0
    if a[1] == "WA":
      wacount += 1
    elif a[1] =="AC":
      account += 1
      stopnum = 1
  else:
    if stopnum == 1:
      break
    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:
n, m = map(int, input().split())
p_list = []
s_list = []
ac_list = [0] * (n + 1)
ac, wa = 0, 0
if m == 0:
    print(0, 0)
else:
    for i in range(m):
        p, s = map(str, input().split())
        p = int(p)
        p_list.append(p)
        s_list.append(s)
        if s == "WA":
            wa += 1
            #if i == m-1:
            #    continue
            #else:
            #    wa += 1
        elif s == "AC":
            if ac_list[p] == 0:
                ac += 1
                ac_list[p] = 1
            else:
                continue
    for i in reversed(s_list):
        if i == "AC":
            break
        else:
            wa -= 1
    print(ac, wa)

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())
s=[input().split() for _ in range(m)]
c=[False]*n
ac,pena=0,0
for i in s:
    p,b=int(i[0])-1,i[1]
    if b=="AC" and not c[p]:
        ac+=1
        c[p]=True
    if b=="WA" and not c[p]:
        pena+=1
print(ac,pena)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = [list(map(str, input().split())) for i in range(m)]
max_num = min_num = wa_i = ac_i = 0
if li != []:
  max_num = int(li[-1][0])
  min_num = int(li[0][0])
for i in range(min_num, n+1):
  if i <= max_num:
    for j, k in li:
      if i == int(j):
        if k == 'WA':
          wa_i += 1
        else:
          ac_i += 1
          break
      else:
        continue
  else:
    break
print(ac_i, wa_i)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
corrects = []
wrongs = 0
for m in range(M):
  p, s = input().split()
  if p not in corrects:
    if s == "WA":
      wrongs += 1
    elif s == "AC":
      corrects.append(p)
      
print(len(corrects), wrongs)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
l = list([input().split() for i in range(m)])
count = 0
a = 0
for i,j in l:
    if a!=int(i) and j=='AC':
        count += 1
        a = int(i)
print(count)

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
string_list=[input() for i in range(M)]
checkAC=np.zeros((N,2),np.int16)
for i in string_list:
    Ni,Si = i.split()
    Ni = int(Ni)-1
    if checkAC[Ni,0]==0:
        if Si=='AC':
            checkAC[Ni,0]=1
        else:
            checkAC[Ni,1]=checkAC[Ni,1]+1
strlist = checkAC.sum(axis=0)
print(str(strlist[0])+' '+str(strlist[1]))

Submission status: Wrong Answer

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


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

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

cor_count = 0
pen_count = 0
AC_flag = False



if s[0] == 'AC':
	AC_flag =True
	cor_count += 1
else:
	pen_count += 1

for i in range(M-1):
	if p[i] == p[i+1]:
		if AC_flag == False:
			if s[i+1] =='AC':
				cor_count += 1
				AC_flag =True
			else:
				pen_count += 1
	else:
		AC_flag = False
		if s[i+1] =='AC':
			cor_count += 1
			AC_flag =True
		else:
			pen_count += 1

if M != 0:
	print(cor_count,pen_count)

Submission status: Wrong Answer

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

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(p)
    S.append(s)


if M>0:

    wa=0
    ac=[]
    for i in range(M):
        if P[i] not in ac:
            if S[i]=="WA":
                wa+=1
            else:
                ac.append(P[i])
    
    
    print(len(ac),wa)
else:
    print(0,0)

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
AC=[0]*(N+1)
WA=[0]*(N+1)
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        if AC[p]==0:
            WA[p]+=1
    elif s=='AC':
        if AC[p] == 0:
            AC[p]+=1


print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, M = map(int, input().split())
#problems = [[] for i in range(N)]

c = p = 0
prev_ac_num = None
prev_wa_num = None

wa_count = 0

for i in range(M):
    num, state = map(str, input().split())

    if state == 'WA':
        wa_count += 1

    # penaltyのカウント
    if state == 'AC' and prev_ac_num != num:
        p += wa_count
        wa_count = 0

    # acceptのカウント
    if state == 'AC' and prev_ac_num != num:
        c += 1

    if state == 'AC':
        prev_ac_num = num

    if state == 'WA':
        prev_wa_num = num

print(c, p)

Submission status: Wrong Answer

Solution code:
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

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

if m == 0:
  print('0 0')
else:
  s = [input().split() for i in range(m)]

  p = get_unique_list(s)

  ac = 0
  w = []
  wa = 0

  for i in range(len(p)):
    if p[i][1] == 'AC':
      ac += 1
      w.append(wa)
      wa = 0
    elif p[i][1] == 'WA':
      wa += 1
  print(str(ac)+" "+str(sum(w)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
mem = set()
wrong = set()
ac =0;wa =0
for i in range(m):
    a,b = input().split()
    if a not in mem:
        if b == 'AC':
            mem.add(a)
            ac+=1
        else:
            wrong.add(a)
            c = mem.union(wrong)
            wa = len(c)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = []
for _ in range(m):
    p, s = map(str, input().split())
    ps.append([int(p), s])

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

print(ac, wa)

Submission status: Wrong Answer

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

for i in range(1, M + 1):
    temp_number, temp_result = map(str, input().split())
    if temp_number in ac_number_list :
            pass
    else :
        if temp_result == 'AC' :
            ac_count += 1
            ac_number_list.append(temp_number)
        else :
            penalty_count += 1    

print('{} {}'.format(ac_count, penalty_count))

Submission status: Wrong Answer

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

ac_list = [False] * (N+1)
ac_count = 0
wa_count = 0

for p, s in ps_list:
    p = int(p)
    if ac_list[p]:
        continue
    if s == 'AC':
        ac_list[p] = True
        ac_count += 1
    else:
        wa_count += 1

print(str(ac_count) + ' ' + str(wa_count))

Submission status: Wrong Answer

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

aclist={}
p=0
ac=wa=0

for i in [input() for i in range(m)]:
    x,y=i.split()
    if not aclist.get(x):
        if y=='AC':
            aclist[x] = True
            ac+=1
        else:
            wa+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
li = []
for i in range(M):
  liin = input().split()
  li.append([int(liin[0]), liin[1]])

ans = [0, 0]
done = []
miss = {}
bf = 0

for i in range(M):
  if bf != li[i][0]:
    done = []
    miss = {}
  if li[i][0] in done:
    continue
  if li[i][1] == "AC":
    ans[0] += 1
    done.append(li[i][0])
    if li[i][0] in miss:
      ans[1] += miss[li[i][0]]
      del miss[li[i][0]]
  else: # "WA"
    if li[i][0] in miss:
      miss[li[i][0]] += 1
    else:
      miss[li[i][0]] = 1
  bf = li[i][0]

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

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

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


    p_S = []
    for i in range(M):
        p_S.append(input().split())

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

    ac = 0
    wa = 0
    for arr in p_S:
        if arr[1] == 'AC':
            ac += 1
        else:
            wa += 1

    print(ac, wa)

main()

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]

answers = []
for x in range(m):
    answers.append(input().split())

correct_answers = set([answer[0] for answer in answers if answer[1] == "AC"])

temp = {k[0]: [] for k in answers}
for x in answers:
    temp[x[0]].append(x[1])

penalties = 0
for x in temp:
    if (temp[x].count("AC") > 0):
        G = temp[x][:temp[x].index("AC")]
        penalties += len(G)
    else:
        penalties += temp[x].count("WA")


print(len(correct_answers), penalties)

Submission status: Wrong Answer

Solution code:
if __name__=="__main__":
    n, m = map(int, input().split())
    p, s=[], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = 0
    cnt_ac = 0
    ac_gotten = False
    for i in range(m):

        if i>=1 and p[i]>p[i-1]:
            ac_gotten = False

        if not ac_gotten:
            if s[i]=="WA":  
                cnt_wa += 1
            else:
                cnt_ac += 1
                ac_gotten = True
                if ac_gotten and p[i]==n:
                    break
        
    print("{} {}".format(cnt_ac, cnt_wa))

Submission status: Wrong Answer

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

np, cl = "", False
ac, wa = 0, 0
for i in range(M):
  p, s = input().split()
  # 初めての問題
  if np != p:
    if s == "WA":
      wa += 1
      cl = False
    elif s == "AC":
      ac += 1
      cl = True
    np = p
  # 継続問題
  else:
    if cl == True:
      continue
    else:
      if s == "WA":
        wa += 1
      elif s == "AC":
        ac += 1
        cl = True
    np = p
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from itertools import groupby
from operator import itemgetter
def print_ans(N, M, ar):
    """Test Case
    >>> print_ans(2, 5, [['1', 'WA'], ['1', 'AC'], ['2', 'WA'], ['2', 'AC'], ['2', 'WA']])
    2 2
    >>> print_ans(100000, 3, [['7777', 'AC'], ['7777', 'AC'], ['7777', 'AC']])
    1 0
    >>> print_ans(6, 0, [])
    0 0
    """
    correct = 0
    wrong = 0
    if M == 0:
        print(0, 0)
    else:
        for (k, g) in groupby(ar, key=itemgetter(0)):
            tmp_wrong = 0
            ac_flg = False
            for item in g:
                if item[1] == "AC":
                    correct += 1
                    ac_flg = True
                    break
                else:
                    tmp_wrong += 1
            # if ac_flg == True:
            wrong += tmp_wrong
        print("{} {}".format(correct, wrong))

if __name__ == '__main__':
    N, M = map(int, input().rstrip().split())
    if M == 0:
        ar = []
    else:
        ar = [list(map(str, input().rstrip().split())) for i in range(M)]
    print_ans(N, M, ar)

Submission status: Wrong Answer

Solution code:
n, m = input().split()
n = int(n)
m = int(m)
results = []
for i in range(m):
    results.append(list(input().split()))

wa = 0
ac = 0

dic = {}
for q, a in results:
    if q not in dic.keys():
        dic[q] = {"ac": False}
    if dic[q]["ac"] is True:
        pass
    elif dic[q]["ac"] is False and a == "WA":
        wa += 1
    elif dic[q]["ac"] is False and a == "AC":
        ac += 1
        dic[q]["ac"] = True

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M=input().split()
answer=0
penalty=0
PS=[]
check=[]
for _ in range(int(M)):
    PS.append(input())
for i in PS:
    if ((str(i[0])+' AC') in check)==False:
        if i[2]=="W":
            penalty+=1
        elif i[2]=="A":
            answer+=1
            check.append(str(i))
print(str(answer)+" "+str(penalty))