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

Submission status: Wrong Answer

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

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

for _ in range(m):
  temp=input().split()
  if temp[1] == "AC":
    ac.append(temp[0])
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      pass
    
    pen += t
  else:
    if not temp[0] in ac:
      t = 0
      try:
        t = pen_dic[temp[0]]
      except:
        pass

      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)

Submission status: Wrong Answer

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

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

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

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N,M = map(int, readline().decode("utf-8").split())

aclist = [0 for _ in range(0, N+1)]
walist = [0 for _ in range(0, N+1)]

inputlist = []
for line in readlines():
    p,s = line.decode('utf-8').split()
    p = int(p)
    inputlist.append([p,s])

for p,s in inputlist:
    if s == "AC":
        aclist[p] = 1
    if s == "WA" and aclist[p] == 0:
        walist[p] += 1
        print(walist[p])

sum_wa = 0
for i,wa in enumerate(walist):
    if aclist[i] == 1:
        sum_wa += wa

print(sum(aclist), sum_wa)

Submission status: Wrong Answer

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

aclist = []
wacount = 0

for i in range(M):
  if len(aclist) == N:
    break
  elif in2[i][0] in aclist:
    continue
  else:
    if in2[i][1] == "WA":
      wacount += 1
    if in2[i][1] == "AC":
      aclist.append(in2[i][0])

print(len(aclist), wacount)

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_list = []


if s[0] == 'AC':
	AC_list.append(p[0])
	cor_count += 1
else:
	pen_count += 1

for i in range(M-1):
	if not p[i+1] in AC_list:
		if s[i+1] =='AC':
			AC_list.append(p[i+1])
		else:
			pen_count += 1

#print(AC_list)
cor_count = len(set(AC_list))
if M != 0:
	print(cor_count,pen_count)

Submission status: Wrong Answer

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

for val in ans.values():
    ac += val[0]
    if val[0] == 0:
        continue
    wa += val[1]
print(ac, wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, M = map(int, input().split())
P = (input().split() for _ in range(M))
X = defaultdict(int)
ac = 0
wa = 0
for pi in P:
    i = int(pi[0])
    s = pi[1]
    if X[i-1] == 0:
        if s == 'WA':
            wa += 1
        else:
            ac += 1
            X[i-1] = 1

print(ac, wa)

Submission status: Wrong Answer

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

not_AC_ls=[]
pn_num=0

AC_list=[0]*N

for _ in range(M):
    
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        AC_list[pi-1]=1
    
    if Si=='WA':
        if AC_list[pi-1]==0:
            pn_num+=1
    
print(sum(AC_list),pn_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    
    dp = [['OT', 0] for i in range(N+1)]
    # print(dp[:10])
    # print(dp[0][0], dp[0][1])
    for i in range(M):
        if S[i] == 'AC':
            dp[p[i]][0] = 'AC'
            
        else:
            if dp[p[i]][0] != 'AC':
                dp[p[i]][1] = 1

    ac = [dp[i][0] for i in range(1, N+1)].count('AC')
    wa = sum([dp[i][1] for i in range(1, N+1) if dp[i][0] == 'AC'])
    # print(dp[:10])
    # print([dp[i][0] for i in range(1, N+1)])
    print(ac, wa)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

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

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

for i in xrange(M):
  if(B[i] == "AC"):
    C[A[i]] += 1
    owa[A[i]] = 1
  elif(owa[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:
N,M = map(int,input().split())
X = [[str(i) for i in input().split()] for i in range(M)]
a=[]
count_ac = 0
count_wa = 0
for i in range(M):
    if X[i][1] == 'AC':
        if X[i][0] in a:
            continue
        a.append(X[i][0])
        count_ac += 1
    else:
        if X[i][0] in a:
            continue
        count_wa += 1
print(count_ac,count_wa)

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()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))
p2 = [1 if i in N1 else 0 for i in p1]
p2 = np.array(p2)
p3 = list(p1 * p2)
p4 = [i for i in p3 if i != 0]

A = 0
B = 0
j = 0
for i in p4:
    if i in N1:
        A += S1[j]
        B += (1-S1[j])
        j +=1
        if S1[j] ==1:
            N1.remove(i)
print(str(A)+" "+str(B))

Submission status: Wrong Answer

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

#print(ps)
ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

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

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=[0]*N
ans=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  elif p not in AC:
    WA[int(p)-1]+=1
for i in AC:
  ans+=WA[int(i)-1]
print(len(set(AC)),ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans_ac = 0
ans_wa = 0
lst = [[False, 0]] * n
for i in range(m):
  p, s = input().split()
  p = int(p)
  if lst[p-1][0]:
    continue
  if s == 'WA':
    lst[p-1][1] += 1
  else:
    ans_ac += 1
    ans_wa += lst[p-1][1]
    lst[p-1][0] = True
print(ans_ac, ans_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 = []
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:
        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),T+sum(moumuri))

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":
            if ac_list[p] == 0:
                wa += 1
            else:
                continue
        elif s == "AC":
            if ac_list[p] == 0:
                ac += 1
                ac_list[p] = 1
            else:
                continue
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
import numpy as np

N,M = map(int,input().split())
P = np.zeros(M, dtype=int)
S = np.zeros(M, dtype=int)
for i in range(M):
    p,s = map(str,input().split())
    P[i] = int(p)
    if s == 'AC':
        S[i] = 1
    
cOK = 0
cNG = 0
aP = np.argsort(P)
P = P[aP]
S = S[aP]
i = 0
while i<M:
    Q = list(S[P==P[i]])
    if 1 in Q:
        cOK += 1
        cNG += Q.index(1)
    i += len(Q)

print(cOK, cNG)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
p = []
s = []
ansS = 0
ansP = 0
count = []

if M != 0:
    for x in range(M):
        a,b = list(map(str, input().split()))
        p.append(a)
        s.append(b)

for x in range(M):
    if p[x] in count:
        pass
    else:
        if s[x] == 'WA':
            ansP += 1
        elif s[x] == 'AC':
            ansS += 1
            count.append(p[x])

print(ansS,ansP)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
aclist = []
walist = []
wac = 0


for i in range(m):
  a , b = input().split()
  int(a)
  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:
from operator import itemgetter
import collections
import numpy as np

N,  M = map(int, input().split())
if M == 0:
  print(0,0)
else:
  S = [input().split() for i in range(M)]
  S1 = sorted(S, key=itemgetter(0))
  W = np.array(S1)

  d = collections.Counter(W[:,0])
  keylist = list(d.keys())
  WA_cnt = 0
  AC_cnt = 0
  for num in range(len(keylist)):
      tmp = W[W[:,0] == keylist[num]]
      if len([i for i, x in enumerate(tmp[:,1]) if x == 'AC'] ) == 0:
          WA_cnt += len([i for i, x in enumerate(tmp[:,1]) if x == 'WA'] )
      else:
        MIN = min([i for i, x in enumerate(tmp[:,1]) if x == 'AC'] ) 
        WA_cnt += len([i for i, x in enumerate(tmp[:MIN+1,1]) if x == 'WA'] )
        AC_cnt += len([i for i, x in enumerate(tmp[:MIN+1,1]) if x == 'AC'] )
  print(AC_cnt,WA_cnt)

Submission status: Wrong Answer

Solution code:
import sys

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

for i in sys.stdin:
  pm, c = i.split()
  if not(pm in ckn):
    if c == 'WA':
      swa += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = [0]*(N+1)
w = [0]*(N+1)
ac = 0
wa = 0
for i in range(M):
	p, S = input().split()
	p = int(p)
	if a[p] == 0:
		if S == "AC":
			a[p] += 1
			ac += 1
		else:
			w[p] += 1
			wa += 1
	else:
		continue
print(ac, wa)

Submission status: Wrong Answer

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

ok = [False for _ in range(n)]
ok_num = 0
wrong = 0
for _ in range(m):
    p, s = input().split(" ")
    if ok[int(p) - 1]:
        pass
    else:
        if s == "AC":
            ok[int(p) - 1] = True
            ok_num += 1
        else:
            wrong += 1

print(len(list(filter(lambda x: x, ok))), wrong)

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_list = []


if s[0] == 'AC':
	AC_list.append(p[0])
	cor_count += 1
else:
	pen_count += 1

for i in range(M-1):
	if not p[i+1] in AC_list:
		if s[i+1] =='AC':
			AC_list.append(p[i+1])
		else:
			pen_count += 1
	if s[i+1] =='AC':
		AC_list.append(p[i+1])
	else:
		pen_count += 1
#print(AC_list)
cor_count = len(set(AC_list))
if M != 0:
	print(cor_count,pen_count)

Submission status: Wrong Answer

Solution code:
def sum(arg):
  ans = 0
  for i in arg:
    ans += i
  return ans

N, M = map(int, input().split())
ac = [0]*N
wa = [0]*N
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if si == "AC" and ac[pi-1] == 0:
    ac[pi-1] = 1
  if si == "WA" and ac[pi-1] == 0:
    wa[pi-1] = 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

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

if m == 0:
    print(0, 0)
else:
    check_list = [0]*(n+1)
    wa = 0
    ac = 0
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if check_list[p] == 1:
            continue
        if check_list[p] == 0 and s == 'AC':
            check_list[p] = 1
            ac += 1
        #elif check_list[p] == 0 and s == 'WA':                                          
        else:
            wa += 1
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
x=[input().split() for i in range(b)]
#print(x)
arr = list(map(list, set(map(tuple, x))))
#print(arr)
import numpy as np
 
y = np.array(arr)

m=np.argwhere(y=="AC")
n=np.argwhere(y=="WA")

print(len(m),end=" ")
print(len(n))

Submission status: Wrong Answer

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

ac = 0
wa = 0

p = []
s = []

ac_cnt = []

ac_list = [0] * N
for i in range(M):
    pp, SS = input().split()
    pp = int(pp)

    p.append(pp)
    s.append(SS)

P = 1
for i in range(M):
    if s[i] == "WA":
        if p[i] == P:
            wa += 1

    elif s[i] == "AC":
        if p[i] not in ac_cnt:
            ac += 1
        ac_cnt.append(p[i])
        P += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M = map(int, input().split())
#pS = [stdin.readline().split() for _ in range(n)]
#print(pS)
AC=[0]*N
WA=[0]*N
#print(AC,WA)
for _ in range(M):
    p,S=stdin.readline().split()
#    print('p={},S={}'.format(p,S))
    if S=='AC':
#        print('SはAC')
        if AC[int(p)-1]==0:
#            print('問題{}でACはまだないのでACに1加えます'.format(p,))
            AC[int(p)-1]=+1
        else:
#            print('問題{}で既にACがあるのでACには1加えません'.format(p,))
            pass
    elif S=='WA':
#        print('SはWA')
        if AC[int(p)-1]==0:
#            print('問題{}でACはまだないのでWAに1加えます'.format(p,))
            WA[int(p)-1]=+1
        else:
#           print('問題{}で既にACがあるのでWAに1加えません'.format(p,))
            pass
#print(AC,WA)
print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
p_s = [input().split() for i in range(m)]
dic = {}
penalty = 0
acc = 0
num_list=[]
for i in range(m):
  num = int(p_s[i][0])
  if p_s[i][1] == "WA":
    if num in dic:
      dic[num]+=1
    else:
      dic[num]=1
  else:
    if num not in num_list:
      num_list.append(num)
      acc += 1
    if num in dic:
      penalty += dic[num]

    
print("{} {}".format(acc,penalty))

Submission status: Wrong Answer

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

solved = set()
correct = 0
penalty = 0
tmp_p = 0

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

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

print(correct, penalty)

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)

AC=[]
WA=[]
for i in range(len(P)):
  if S[i]=='AC':
    if not P[i] in AC:
      AC.append(P[i])
  else:
    if not P[i] in WA:
      WA.append(P[i])

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

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    c = {"AC": {}, "WA": {}}
    
    for m in range(M):
        p, S = input().split()
        p = int(p)
        
        if p not in c[S].keys():
            c[S][p] = 1
        else:
            if p not in c["AC"].keys():
                c[S][p] += 1

    ac = 0
    wa = 0
    for p in c["AC"].keys():
        print("AC keys:", p)
        ac += 1
        if p in c["WA"].keys():
            wa += c["WA"][p]
    
    print(ac, wa)
        
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

a = [0]*(N+1)
w = [0]*(N+1)
ac = 0
wa = 0
for i in range(M):
	p, S = input().split()
	p = int(p)
	print(p, S)
	if a[p] == 0:
		if S == "AC":
			a[p] += 1
			ac += 1
		else:
			w[p] += 1
			wa += 1
	else:
		continue
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
qu = []
count = 0
AC,WA = 0,0
for i in x:
  qu.append(i[0])

qu_set = list(set(qu))
for i in qu_set:
  
  #ACがあるかどうか、あった場合そのインデックス
  if [i,"AC"] in x:
    index = x.index([i,"AC"])
    WA += (index-count)
    AC += 1
  else:
    pass
  
  count += qu.count(i)
  
print(AC, WA)

Submission status: Wrong Answer

Solution code:

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

#print(N,M)

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

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


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

print(correctCount, wrongCount)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
c=[]
t=defaultdict(list)
score=0
penalties=0
for i in range(m):
    c.append(list(input().split()))

g=[x for x in range(1,n+1)]

for i in range(len(c)):
    a=int(c[i][0])
    b=c[i][1]
    if a in g:
        if b=='WA':
            t[a].append(b)
        else:
            t[a].append(b)
            g.remove(a)
q=list(t.values())
for i in range(len(q)):
    for j in range(len(q[i])):
        if q[i][j]=='WA':
            penalties+=1
        else:
            score+=1
print(score,penalties)

Submission status: Wrong Answer

Solution code:
N, M= map(int, input().split())
p = [0]*M
S = [0]*M
correct_list = []
sum = 0
for i in range(M):
  p[i], S[i]= list(input().split())
  if S[i] == "AC":
    if p[i] not in correct_list:
      correct_list.append(p[i])
    if S[i] == "WA":
      if p[i] not in correct_list:
        sum += 1

print(len(correct_list), sum)

Submission status: Wrong Answer

Solution code:
def main():
    n,m=map(int,input().split())
    f =[0]*n
    p=[]
    s=[]
    for i in range(m):
        pp,ss=input().split()
        ppp=int(pp)-1
        p.append(ppp)
        s.append(ss)


    cntA = 0
    cntW = 0

    for i in range(m):
        ptmp=p[i]
        stmp=s[i]
        if f[ptmp] == 0:
            if stmp == 'WA':
                cntW += 1
            elif stmp == 'AC':
                cntA +=1
                f[ptmp] =1

    print(str(cntA) + ' ' + str(cntW))
    # print(cntA)
    # print(cntW)
if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N = a[0]
M = a[1]

list = []
for i in range(M):
    a,b=input().split()
    list.append((int(a), b))


correct = []
wa = 0
flagc = 0
flagw = 0
for i in range(M):
  if list[i][1] == "AC":
    if len(correct) == 0:
      correct.append(list[i][0])
    else:
      for j in range(len(correct)):
        if correct[j] == list[i][0]:
          flagc = 1
          break
      if flagc == 0:
        correct.append(list[i][0])
        flagc = 0
  elif list[i][1] == "WA":
    #print("wa", end=","),print(i),print("cor",end=","),print(correct),print("n_wa",end=","),print(wa)
    if len(correct) == 0:
      wa += 1
    else:
      for j in range(len(correct)):
        if correct[j] == list[i][0]:
          flagw = 1
          break
      if flagw == 0:
        wa += 1
        flagw = 0
    
    
print(len(correct), end=" "), print(wa)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
p = []
S = []
for i in range(M):
    p1,S1=[i for i in input().split()]
    p.append(p1)
    S.append(S1)
correct = 0
wrong = 0

for j in range(N):
    for k in range(M):
        if int(p[k]) == j+1:
            if S[k] == 'WA':
                wrong += 1
            elif S[k] == 'AC':
                correct += 1
                break

print(correct,wrong)

Submission status: Wrong Answer

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

ac = []
acn,wan = 0,0
for i in range(m):
  if ans[i][0] not in ac:
    if ans[i][1] == 'AC' :
      ac += [ans[i][0]]
      acn += 1
    else :
      wan += 1
print(acn,wan)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最大公約数 
def gcd(a, b):
  if a < b:
      a, b = b, a
  while a % b != 0:
      a, b = b, a % b
  return b

# 最小公倍数
def lcm(a, b):
  y = a*b / gcd(a, b)
  return int(y)

n, m = MAP()


L = []
for i in range(m):
  l = S_LIST()
  L.append(l)

# wa

wa = [0] * (n+1)
ac = [0] * (n+1)


for i in range(m):
  p = int(L[i][0])
  ans = L[i][1]
  if ans == "WA":
    # まだacない
    if ac[p] == 0:
      wa[p] = wa[p] + 1
  # acあった
  if ans == "AC":
    ac[p] = 1
print(sum(ac), sum(wa))


# for p in range(1, n+1):
#   if L[i][0] == str(p):
#     for i in range(m):
#       if L[i][1] == "WA":
#         wa += 1

#     for i in range(m):
#       if L[i][1] == "AC":
#         ac += 1
#   print(wa)
#   print(ac)

Submission status: Wrong Answer

Solution code:
N, M =[int(n) for n in input().split()]
p = {}
s = {}
for i in range(M):
    P, S = input().split()
    if S=='WA' and P not in p:
        c = s.setdefault(P, 0)
        c += 1
        s[P] = c
    else:
        if not p.setdefault(P, 0):
            p[P] = 1
for k in s:
    if k not in p:
        s[P] = 0 
print(sum(p.values()), sum(s.values()))

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
for i in range(M):
  p, S = map(str, lines[i].split())
  if S == 'WA':
    w_cnt += 1
  elif S == 'AC' and op == p:
    a_cnt += 1
  op = p

print(a_cnt)
print(w_cnt)

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):#回答数
        #print("P,S:",p[i],S[i],ac,wa)
    
        if flag == False:
            if S[i] == "WA":
                wa += 1
            else:
                ac += 1
                flag = True
        else:
            if p[i] == p_pre:
                p_pre = p[i]
                break
            else:
                if S[i] == "WA":
                    wa += 1
                    flag = False
                if S[i] == "AC":
                    ac += 1
        p_pre = p[i]

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M=[int(i) for i in input().split()]
done=[]
AC,WA=0,0
for i in range(M):
    p,s=input().split()
    if  p in done:
        continue
    else:
        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())
P = []
s = []
sekai = 0
wrong = 0

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

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

Submission status: Wrong Answer

Solution code:
# ABC151 C

N, M = map(int, input().split())
p = []
S = []
AC = [0] * N
WA = [0] * N

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

for q, res in zip(p, S):
    if res == "WA" and AC[q-1] == 0:
        WA[q-1] += 1
    elif res == "AC" and AC[q-1] == 0:
        AC[q-1] += 1
    else:
        continue

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

Submission status: Wrong Answer

Solution code:
qus = list(map(int, input().split()))
data  = {}
sum = 0
pe = 0
for i in range(0, qus[1]):
  int_data = list(map(str, input().split()))
  n = int_data[0]
  if n in  data:
    if int_data[1] == 'WA':
      data[n] += 1
    else:
      sum += 1
      pe += data[n]
  else:
    if int_data[1] == 'AC':
      sum += 1
    else:
      data[n] = 1
print(sum,' ',pe)

Submission status: Wrong Answer

Solution code:
args = raw_input().split()
n = int(args[0])
m = int(args[1])
ok_list = []
ok_cnt = 0
ng_cnt = 0
for i in range(m):
    args_result = raw_input().split()
    target = args_result[0]
    score = args_result[1]
    if target in ok_list:
        continue
    else:
        if score == 'AC':
            ok_cnt += 1
            ok_list.append(target)
        else:
            ng_cnt += 1
print ok_cnt, ng_cnt

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for i in range(m)]
from collections import defaultdict
cnt_ac=defaultdict(lambda:0)

count_wa=0
new_wa=0
count_ac=0
for i in range(m):
    if cnt_ac[l[i][0]]==0:
        
        if l[i][1]=='WA':
            count_wa+=1
        
        else:
            cnt_ac[l[i][0]]=1
            count_ac+=1
            new_wa+=count_wa
            count_wa=0
    
    
print(count_ac,new_wa)