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

AC = [False] * (N + 1)
WA = [0] * (N + 1)
for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        AC[p] = True
    elif not AC[p]:
        WA[p] += 1

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

Submission status: Wrong Answer

Solution code:

class Result:
    def __init__(self, num, result):
        self.num = num
        self.result = result


def WelcomeTo():
    N, M = map(int, input().split())
    resultlist = []
    for _ in range(M):
        templist = input().split()
        resultlist.append(Result(int(templist[0]), templist[1]))
    WAnum = 0
    AClist = []
    for lst in resultlist:
        if lst.result == 'WA' and lst.num not in AClist:
            WAnum += 1
        else:
            if lst.num not in AClist:
                AClist.append(lst.num)

    print('{} {}'.format(len(AClist), WAnum))


WelcomeTo()

Submission status: Wrong Answer

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

for i in range(m):
    p, s = map(str,input().split())
    if p not in list_ac:
        if s =='AC':
            list_ac.append(p)
        else:
            count_wa +=1
print(len(set(list_ac)), count_wa)

Submission status: Wrong Answer

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

def main():
    NM = [int(i) for i in input().split(" ")]
    if NM[1] == 0:
        ans = "0 0"
    else:
        pss = np.array([np.array(input().split(" ")) for j in range(NM[1])])

        probs = pss[:,0]
        answs = pss[:,1]

        #print(probs)
        #print(answs)
        ans_ac = 0
        ans_wa = 0

        probs_uniq = list(set(probs))
        for p in probs_uniq:
            #print(p)
            res = list(answs[probs == p])
            #print(res)
            if "AC\n" in res:
                ind_ac = res.index("AC\n")
                ans_ac += 1
                ans_wa += ind_ac
            else:
                ans_wa += len(res)
        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())
pn = [0] * n
aw = [0] * n

for i in range(m):
    p,s = input().split()
    p = int(p) - 1
    if s == "WA":
        if aw[p] == 0:
            pn[p] += 1
    else:
        aw[p] = 1

print ("%d %d" % (sum(aw),sum(pn)))

Submission status: Wrong Answer

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

AC_flags = [[0, 0] for _ in range(N)]

for p, s in zip(P, S):
    if AC_flags[p - 1][0] == 0 and s == "WA":
        AC_flags[p - 1][1] += 1
    elif AC_flags[p - 1][0] == 0 and s == "AC":
        AC_flags[p - 1][0] += 1

sum_ac, sum_wa = 0, 0
for ac, wa in AC_flags:
    sum_ac += ac
    sum_wa += wa

print(sum_ac, sum_wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    nm = list(map(int, input().split()))
    p = np.zeros(nm[0], dtype=int)
    ac = np.zeros_like(p)
    for i in range(nm[1]):
        ps = input().split()
        if ac[int(ps[0])-1] == 0:
            if ps[1] == "WA":
                p[int(ps[0])-1] += 1
            elif ps[1] == "AC":
                ac[int(ps[0])-1] += 1

    print(np.sum(ac), np.sum(p))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

p = [int(i[0]) for i in pS]
S = [i[1] for i in pS]

aced = [False for _ in range(N)]
penalty = [0 for _ in range(N)]

for i in pS:
    if not aced[int(i[0])-1]:
        if i[1] == 'WA':
            penalty[int(i[0])-1] += 1
        if i[1] == 'AC':
            aced[int(i[0])-1] = True

print(aced.count(True), sum(penalty))

Submission status: Wrong Answer

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

wa = 0
ac_number = []
for i in range(M):
  if S[i] == "AC" and not P[i] in ac_number:
    ac_number.append(P[i])
  else:
    if not P[i] in ac_number:
      wa += 1

print(len(ac_number), wa)

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)

num = 1
# wa
wa = 0
ac = 0

wa = [0] * n
ac = [0] * n


for i in range(m):
  p = int(L[i][0])-1
  ans = L[i][1]
  if ac[p] == 0:
    if ans == "WA":
      wa[p] = wa[p] + 1
    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= map(int,input().split())
ps = [list(map(str,input().split())) for i in range(M)]

er_c = 0
ac_c = 0
ac_list = []
'''
for i in range(M):
    if i == 0:
        if ps[i][1] == 'WA':
            er_c += 1
        else:
            ac_c += 1
            ac_list.append(ps[i][0])
            last_ac = i+1
    elif ps[i][1] == 'WA' and :
        er_c += 1
    elif ps[i][1] == 'AC':
        last_ac = i+1
        if ps[i][0] not in ac_list:
            ac_c += 1
            ac_list.append(ps[i][0])
if M == 0:
    print(0, 0)
    exit(0)
print(ac_c, er_c-(M-last_ac))
'''

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

cnt = M-1
while ps[cnt][1] == 'WA':
    if cnt == -1:
        break
    cnt -= 1

if cnt == -1:
    print(0, 0)
    exit(0)

for i in reversed(range(cnt+1)):
    if ps[i][1] == 'AC':
        if ps[i][0] not in ac_list:
            ac_c += 1
            ac_list.append(ps[i][0])
    elif ps[i][0] in ac_list:
        er_c += 1

print(ac_c, er_c)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(str,input().split())) for i in range(M)]

ac = [0]*N
wa = [0]*N

for i in range(M):
    num = int(List[i][0])-1
    result = List[i][1]
    if ac[num] == 0:
        if result == 'AC':
            ac[num] = 1
        else:
            wa[num] += 1

total_ac = 0
total_wa = 0

for i in range(N):
    total_ac += ac[i]
    total_wa += wa[i]
    
print(total_ac, total_wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
sub_ls = []
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)-1
    sub_ls.append([p,s])
ac_cnt = []
wa_cnt = []
for i in range(n):
    ac_cnt.append(0)
    wa_cnt.append(0)
#print(ac_cnt, wa_cnt)
for i in range(m):
    if ac_cnt[sub_ls[i][0]] == 0:
        #print(sub_ls[i][1], ac_cnt[i])
        if sub_ls[i][1] == "AC":
            ac_cnt[sub_ls[i][0]] = 1
        else:
            wa_cnt[sub_ls[i][0]]+=1
ac_sum = 0
wa_sum = 0
for i in range(n):
    #print(ac_cnt[i], wa_cnt[i])
    ac_sum+=ac_cnt[i]
    wa_sum+=wa_cnt[i]
print(ac_sum, wa_sum)

Submission status: Wrong Answer

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

correct = [0 for _ in range(n)]
penal = [0 for _ in range(n)]

for i in range(m):
    if s[i] == 'AC':
        correct[p[i]-1] = 1
    else:
        if correct[p[i]-1] != 1:
            penal[p[i]-1] += 1




c = sum(correct)
pen = sum(penal)
print(c, pen)

Submission status: Wrong Answer

Solution code:
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x]:
    wa[x]=1
print(sum(l),sum(wa))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
total = []
for i in range(1,N+1):
    total.append(str(i))

for i in range(M):
    a,b = map(str,input().split())
    P.append(a)
    S.append(b)
ok = 0
pena = 0

for (i,j) in zip(P,S):
    if  i in total:
        
        if j=='WA':
            pena+=1
        else:
            ok+=1
            total.remove(i)
print(str(ok)+' '+str(pena))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa_check=[0 for _ in range(n+1)]
ac_check=[0 for _ in range(n+1)]
for i in range(m):
    p,s=input().split()
    p=int(p)
    if(ac_check[p]==0):
        if(s=='AC'):
            ac_check[p]=1
        else:
            wa_check[p]+=1
print(sum(ac_check),sum(wa_check))

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = map(int, input().split())
P = np.array([0]*N)
ac = 0
wa = 0
for i in range(M):
    li = input().split()
    if P[int(li[0])-1] == 0:
        if li[1] == 'WA':
            wa += 1
        else:
            ac += 1
            P[int(li[0])-1] = 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = 0
WA = 0
lis = []
for i in range(M):
  A = list(input().split())
  if A[0] not in lis:
    if A[1] == 'AC':
      lis.append(A[0])
      AC += 1
    else:
      WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

ans_count = 0
err_count = 0

dict = {}
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if not (p in dict.keys()) :
        dict[p] = s
        if s == 'WA' :
            err_count += 1
        elif s == 'AC' :
            ans_count += 1

    elif (p, 'WA') in dict.items() and s == 'WA':
        err_count += 1
    elif (p, 'WA') in dict.items() and s == 'AC':
        dict[p] = s
        ans_count += 1

print(ans_count,err_count)

Submission status: Wrong Answer

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

ac = 0
wa = 0

li_2 = []
for i in range(n):
  li_2.append(0)
  
for i in range(m):
  s = list(input().split())
  s[0] = int(s[0])
  if li_2[s[0]-1] == 0:
    if s[1] == "AC":
      ac+=1
      li_2[s[0]-1] =1
    else:
      wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int, input().split()))
p = []
s = []
for i in range(M):
  temp = list(map(str, input().split()))
  p_temp = int(temp[0])
  p.append(p_temp)
  s.append(temp[1])

ac_list = []
ac_num = 0
wa_num = 0
ques_list = []
for i in range(N):
  ques_list.append(0)

for i in range(M):
  if(s[i]=="AC" and ques_list[p[i]-1]==0):
    ac_num += 1
    ques_list[p[i]-1] = 1
  elif(s[i]=="WA" and ques_list[p[i]-1]==0):
    wa_num += 1
    
print(ac_num, wa_num)

Submission status: Wrong Answer

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

seitou=0
pena=0
cont=0
q=[0]*(n+1)
for i in range(m):
    
    p,s=input().split()
    p=int(p)
    if q[p]==0:
        if s=="WA":pena+=1
        if s=="AC":
            seitou+=1
            q[p]=1    

print(sum(q),pena)

Submission status: Wrong Answer

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

ans = []
num = []
ac = 0
wa = 0

for i in range(m):
  ans.append(list(input().split()))

for a in ans:
  if a[0] not in num:
    if a[1] == "WA":
      wa += 1
    else:
      ac += 1
      num.append(a[0])

print(str(ac) + " " + str(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)
    
from collections import defaultdict
correct = defaultdict(bool)

ac = 0
wa = 0

for pp, ss in zip(p,s):
    if correct[pp]:
        pass
    else:
        if ss == 'AC':
            correct[pp] = True
            ac += 1
        elif ss == 'WA':
            wa += 1
print(ac, wa)

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):
    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 False:
        WA.append(A[j][0])

print(len(AC), len(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])
        ans = list(set(ans))
    elif x[i] == "WA":
        for j in range(len(ans)):
            if p[i] == ans[j]:
                penal -= 1
                break
        penal += 1

if penal < 0:
    penal = 0

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

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    SP = [input().split() for i in range(M)]
    wa_num = 0
    wa_num_temp = 0
    ac_num = 0
    ansed = []
    for sp in SP:
        if sp[1] == "WA" and sp[0] not in ansed:
            wa_num_temp += 1
        elif sp[1] == "AC" and sp[0] not in ansed:
            ac_num += 1
            wa_num += wa_num_temp
            wa_num_temp = 0
            ansed.append(sp[0])

    print(ac_num, wa_num)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p_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)
        if s == "WA":
            if i == m-1:
                continue
            else:
                wa += 1
        if s == "AC":
            if ac_list[p] == 0:
                ac += 1
                ac_list[p] = 1
            else:
                continue
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True


ans=0

n,m=LI()

a=[0]*n
w=[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC':
        a[p]=1
    elif s=='WA':
        if a[p]==0:
            w[p]+=1



print(sum(a),sum(w))

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    nm = list(map(int, input().split()))
    p = np.zeros(nm[0], dtype=int)
    ac = np.zeros_like(p)
    for i in range(nm[1]):
        ps = input().split()
        if ac[int(ps[0])-1] == 0:
            if ps[1] == "WA":
                p[int(ps[0])-1] += 1
            elif ps[1] == "AC":
                ac[int(ps[0])-1] += 1

    print(np.sum(p), np.sum(ac))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'


for i in range(m):
    p, s = map(str, input().split())
    if quest == p and result == s and result == 'AC':
        pass
    elif quest == p and s == 'WA' and result == 'WA':
        wa += 1
    elif quest == p and s == 'AC' and result == 'WA':
        ac += 1
    elif quest != p and s == 'WA':
        wa += 1
    elif quest != p and s == 'AC':
        ac += 1

    quest = p
    result = s

print(ac, wa)

Submission status: Wrong Answer

Solution code:
def solve(N, M, A):
    if M == 0:
        return 0, 0
    A = [[int(x[0]), x[1]] for x in A]
    wa = 0
    ac = 0
    c = 0
    num = A[0][0]
    for i in range(M):
        if A[i][0] == num and A[i][1] == 'WA' and not c:
            wa += 1
            c = 0
        elif A[i][0] == num and A[i][1] == 'AC' and not c:
            ac += 1
            c = 1
        elif A[i][0] != num and A[i][1] == 'WA':
            wa += 1
            num = A[i][0]
            c = 0
        elif A[i][0] != num and A[i][1] == 'AC':
            ac += 1
            num = A[i][0]
            c = 1
    return ac, wa

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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


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

memo = 0

acc = 0
mis = 0

for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == "AC":
            acc += 1
            memo = s[1][0]
        elif s[i][1] == "WA":
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=0
W=0
li=[0]*n
for i in range(m):
    p,s=map(str,input().split())
    p=int(p)
    if s=="AC":
        if li[p-1]==0:
            li[p-1]+=1
            A+=1
    else:
        if li[p-1]==0:
            W+=1

print(A,W)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac=0
wa=0
pp=set()
for i in range(0,m):
    p,s = input().split()
    if p in pp:
        continue
    if s == 'AC':
        pp.add(p)
        ac=ac+1
    wa=wa+1 if s == 'WA' else wa
print(ac, wa)

Submission status: Wrong Answer

Solution code:
hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = 0
wa = 0
    
for j in range(0, nm[0]):
    for i in range(0, nm[1]):
        if (hist[i][0] == j+1 and hist[i][1] == "WA"):
            wa = wa + 1
        elif (hist[i][0] == j+1 and hist[i][1] == "AC"):
            ac = ac + 1
            break
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a_list = []
b_list = ["f"] * (10**5+1)
count_ac = 0
count_wa = 0
for i in range(m):
    a,b = map(str, input().split())
    a_list.append((int(a),b))
for i in range(m):
    if a_list[i][1] == "WA" and b_list[a_list[i][0]] == "f":
        count_wa += 1
    if a_list[i][1] == "AC":
        if b_list[a_list[i][0]] == "f":
            count_ac += 1
        b_list[a_list[i][0]] = "t"
print(count_ac,count_wa)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    N, M = MAP()

    ac = defaultdict(bool)
    wa = defaultdict(int)

    for i in range(M):
        p, S = S_MAP()
        p = int(p)

        if S == "AC":
            ac[p] = True
        else:
            if not ac[p]: wa[p] += 1

    print(len(ac), sum(wa.values()))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:


n ,m = list(map(int, input().split()))
flg = [False] * n
wa = 0
ac = 0

for _ in range(m):
    p, s = input().split()
    p = int(p) -1
    if not flg[p]:
        if s == 'WA':
            wa = wa + 1
        else:
            ac = ac + 1
            flg[p] = True

print("%d %d" % (ac, wa))

Submission status: Wrong Answer

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

	num = []
	ans = []
	for i in range(m):
		na,a = input().split()
		num.append(na)
		ans.append(str(a))
	
	ac = 0
	wa = 0
	ac_temp = 0
	wa_temp = 0
	for i in range(m):
		if ans[i] == "WA":
			if i > 0 and num[i] != num[i-1] and ans[i-1] == "WA":
				wa_temp = 0
			else:
				wa_temp += 1
		if ans[i] == "AC" and ac_temp != num[i]:
			ac += 1
			wa += wa_temp
			wa_temp = 0
			ac_temp = num[i]

	print(ac,wa)
 
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = []
s = []

for i in range(0, m):
    pi, si = map(str, input().split())
    p.append( int(pi) )
    s.append( si )


done = []
for i in range(0,n):
    done.append(False)

wa = 0
ac = 0
for i in range(0, m):
    num = p[i] - 1
    if not done[num]:
        if s[i] == 'WA':
            wa += 1
        else: # 'AC':
            ac += 1
            done[num] = True

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
c=[]
score=0
penalties=0
for i in range(m):
    c.append(list(input().split()))
problems_count=0
t=[i for i in range(1,n+1)]

for i in range(len(c)):
    if int(c[i][0]) in t:
        if c[i][1]=='WA':
            penalties+=1
        elif c[i][1]=='AC':
            score+=1
            t.remove(int(c[i][0]))
print(score,penalties)

Submission status: Wrong Answer

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

T = [0] * (N + 1)
ans = [0,0]

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

for i in range(M):
  p = PS[i][0]
  s = PS[i][1]
  
  if T[p] == 0:
    if s == "AC":
      ans[0] += 1
      T[p] = "AC"
    elif s == "WA":
      ans[1] += 1
      T[p] = "WA"
      
  elif T[p] == "AC":
    continue

  elif T[p] == "WA":
    if s == "AC":
      T[p] = "AC"
      ans[0] += 1
    elif s == "WA":
      ans[1] += 1
      continue

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

Submission status: Wrong Answer

Solution code:
class Question:
    def __init__(self, num, result):
        self.num = int(num)
        self.result = result


n, m = map(int, input().split())
p_list = [input().split() for _ in range(m)]
questions = [Question(num, result) for num, result in p_list]

collect_list = []
wa_count = 0
for q in questions:
    if len(collect_list) >= n:
        break

    if not(q.num in collect_list):
        if q.result == 'AC':
            collect_list.append(q.num)
        elif q.result == 'WA':
            wa_count += 1
print('{} {}'.format(len(collect_list), wa_count))

Submission status: Wrong Answer

Solution code:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

a = []
for i in range(m):
    a.append(input().split())

result_dic = {}

for i in range(n):
    result_dic[str(i+1)] = {'AC': 0, 'WA': 0}

for aa in a:
    if result_dic[aa[0]]['AC'] == 0:
        result_dic[aa[0]][aa[1]] += 1


ac_sum = 0
wa_sum = 0
for i in range(n):
    if result_dic[str(i+1)]['AC'] > 0:
        ac_sum += 1
    if result_dic[str(i+1)]['WA'] > 0:
        wa_sum += result_dic[str(i+1)]['WA']

print(str(ac_sum) + ' ' + str(wa_sum))

Submission status: Wrong Answer

Solution code:
x = str(input())
x1 = x.split()
n = int(x1[0])
m = int(x1[1])
pn = 1
wa = 0
ac = 0
dum = 0
while m > 0:
	m -= 1
	y = str(input())
	y1 = y.split()
	p = int(y1[0])
	s = str(y1[1])
	if ac == n:
	    print(ac,wa)
	    dum = 1
	elif p == pn:
		if s == "WA":
			wa += 1
		else:
			pn +=1
			ac += 1
	else:
		pn += 1
		if s == "WA":
			wa += 1
		else:
			pn += 1
			ac +=1 
if dum == 0:
    print(ac,wa)
else:
    pass

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
P = [0] * M
S = ["a"] * M
flg = [0] * N
C = 0
D = 0

for i in range(M):
	tmp, S[i] = map(str, input().split())
	P[i] = int(tmp)

	if S[i]=="AC":
		if flg[P[i]-1]==0:
			C += 1
			flg[P[i]-1] = 1
	elif S[i]=="WA":
		if flg[P[i]-1]==0:
			D += 1


print(C, D)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = [[0,0] for i in range(n)]
for i in range(m):
    p, m = input().split()
    if l[int(p)-1][0] == 0:
        if m == 'WA':
            l[int(p)-1][1] = l[int(p)-1][1] + 1
        else:
            l[int(p)-1][0] = 1
ac = 0
wa = 0
for i in range(n):
    if l[i][0] == 1:
        ac = ac + 1
        wa = wa + l[i][1]
print(l)
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    # dic = {}
    has_been_solved = set()
    pen = 0
    cor = 0
    for i in inputs:
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            cor += 1
            has_been_solved.add(num)
        elif i[1] == 'WA':
            pen += 1
    print('{} {}'.format(cor, pen))
    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

List=[list(input().split()) for i in range(M)]

AC = set([])
accnt = 0
wacnt = 0

for i in range(M):
  num = List[i][0]
  res = List[i][1]
  
  if num in AC:
    a = 0
  else:
    
    if res == "AC":
      accnt = accnt + 1
      AC.add(num)

    if res == "WA":
      wacnt = wacnt + 1
  
ans = [int(accnt),int(wacnt)]
print(*ans)

Submission status: Wrong Answer

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

to_i = dict(AC=1, WA=0)
cs = list()
cnt_c, cnt_w = 0, 0
for i in range(m):
  p, s = input().split()
  p, s = int(p), to_i[s]
  if p in cs:
    continue
  if s:
    cnt_c += 1
    cs.append(p)
  else:
    cnt_w += 1

print(cnt_c, cnt_w)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = [list(input().split()) for i in range(m)]
wa = 0
ac = 0
for j in range(1, n+1):
    for i in range(m):
        if j == int(l[i][0]):
            if l[i][1] == "WA":
                wa += 1
            else:
                ac += 1
                break
print(ac, wa)

Submission status: Wrong Answer

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        (n, m) = [int(e) for e in lines[0].split(" ")]
        for _ in range(m):
            lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        (n, m) = [int(e) for e in lines[0].split(" ")]


    ps = [] 
    for i in range(1, m + 1):
        e = lines[i].split(" ")
        p = int(e[0])
        s = e[1]
        ps.append((p, s))

    return (n, m, ps)


def solve(n, m, ps):

    
    submits = dict()
    for (p, s) in ps:

        ans_list = submits.get(p, [])
        ans_list.append(s)
        submits[p] = ans_list
    
    ac = 0
    wa = 0
    for (p, ans_list) in submits.items():

        for ans in ans_list:
            if ans == 'WA':
                wa = wa + 1
            elif ans == 'AC':
                ac = ac + 1
                break

    result = [ac, wa] 

    return result


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        print("%d %d" % (result[0], result[1]))
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = []
s = []
seikai = [0]*n
penalty = [0]*n

for i in range(m):
    a,b = input().split()#文字
    p.append(int(a))
    s.append(b)

for i in range(m):
    if s[i] == 'AC':
        seikai[p[i]-1] = 1
    elif s[i] == 'WA' and seikai[p[i]-1]==0:
        penalty[p[i]-1] = penalty[p[i]-1]+1

c = sum(seikai)
d = sum(penalty)

print(c, end=' ')
print(d)

Submission status: Wrong Answer

Solution code:
N, M = [int(s) for s in input().split()]
AC_list = [0 for i in range(N)]
n_WA = 0 
for i in range(M):
  Ai = input().split()
  n_problem = int(Ai[0])-1
  if Ai[1] == "WA" and AC_list[n_problem] == 0:
    n_WA += 1
  elif Ai[1] == "AC" and AC_list[n_problem] == 0:
    AC_list[n_problem] = 1
print(sum(AC_list), n_WA)