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())
PS = [list(input().split()) for i in range(M)]
PS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]
AC = 0
WA = 0
prob = [0]*N

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

print(AC,WA)

Submission status: Wrong Answer

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

if(m != 0):
    for i in range(m):
        tp = list(map(str, input().split()))
        tp[0] = int(tp[0])
        an.append(tp)

    # print(an

    sc = 0
    er = 0

    flag = 0
    prob = an[0][0]
    for i in range(m):
        pr = an[i][0]
        ans = an[i][1]
        if (prob != pr):
            flag = 0
            prob = pr
        if(flag == 0 and ans == "AC"):
            sc += 1
            flag = 1
        elif (flag == 0 and ans == "WA"):
            er += 1

else:
    sc = 0
    er = 0

print("{} {}".format(sc, er))

Submission status: Wrong Answer

Solution code:
from sys import stdin 
n,m = [int(x) for x in stdin.readline().rstrip().split()]
a = []
for i in range(m):
    a.append([x for x in stdin.readline().rstrip().split()])
ac = [0] * n
wa = [0] * n
WA = 0
for i in range(m):
    if a[i][1] == 'WA':
        wa[int(a[i][0])-1] += 1
    if a[i][1] == 'AC':
        ac[int(a[i][0])-1] = 1
        WA += wa[int(a[i][0])-1]
print(sum(ac),WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
source_list = []
for i in range(m):
    instr = input()
    source_list_mini = []
    source_list_mini.append(instr.split(" ")[0])
    source_list_mini.append(instr.split(" ")[1])
    source_list.append(source_list_mini)

finish_dic = {}
pena_count_dic = {}
for source in source_list:
    pena_count_dic[source[0]] = 0
    finish_dic[source[0]] = False

for source in source_list:
    if source[1] == "AC":
        finish_dic[source[0]] = True
    else:
        if finish_dic[source[0]] == False:
            pena_count_dic[source[0]] += 1
        

ans_count = len(finish_dic.values())
pena_count = sum(list(pena_count_dic.values()))
print(ans_count, pena_count)

Submission status: Wrong Answer

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

a = []
t = 0

for i in range(m):
    p, q = input().split()

    if (p in a) == True:
        continue
    else:
        if q == 'WA':
            t += 1
        else:
            a.append(p)

print(len(a), t)

Submission status: Wrong Answer

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

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

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

print(str(ac) + " " + str(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 = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append(ans[i][0])

    else:
        cnt += 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(count-(count-len(kotae)),cnt-K)

Submission status: Wrong Answer

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

    cntA = 0
    cntW = 0
    for i,a in enumerate(p):
        flg = 0
        for j,s in enumerate(a):
            if  s == 'WA':
                cntW += 1
            elif s == 'AC':
                cntA += 1
                break
    print(str(cntA) + ' ' + str(cntW))

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split(" ")]
corect_list = []
wa_num = 0
ac_num = 0

for i in range(M):
    line = input().split(" ")
    p = int(line[0])
    S = line[1]
    if S == "WA":
        if p not in corect_list:
            wa_num += 1
    else:
        if p not in corect_list:
            ac_num += 1
            corect_list.append(p)
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
pS = [input().split() for i in range(int(M))]
ans = {}
for i in pS:
    if i[0] not in ans.keys():
        ans[i[0]] = [0, 0]
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] > 0:
                pass
            else:
                ans[i[0]][1] += 1
    else:
        if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] > 0:
                pass
            else:
                ans[i[0]][1] += 1
ac = 0
wa = 0
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys, re
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,copy
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 LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, m = MAP()
    ac = defaultdict(int)
    wa = defaultdict(int)
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac[p] += 1
        else:
            if ac[p] == 0:
                wa[p] += 1

    # print(ac)
    # print(wa)
    print(len(ac), len(wa))


if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

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

for _ in range(m):
    p, s = input().split()
    p = int(p)
    p = p - 1
    
    # print(p)
    # print(s)
    
    if s == 'WA':
        if ac[p] == 0:
            wa[p] += 1
        
    if s == 'AC':
        ac[p] = 1
        
print("{} {}".format(sum(ac), sum(wa)))

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split(" "))
    ac = 0
    wa = 0
    answer = ["C"] * N  # C: 適当な初期値
    for _ in range(M):
        ps = input().split(" ")
        p = int(ps[0]) - 1
        if not answer[p][-1] == "A":
            answer[p] = answer[p] + ps[1][0]
    if M > 0:
        for a in answer:
            if a[-1] == "A":
                ac += 1
                wa += (len(a) - 2)
            else:
                wa += (len(a) - 1)
    print(ac, wa)


if __name__ == '__main__':
    main()

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 s =='AC':
        if int(p) not in list_ac:
            list_ac.append(int(p))
    else:
        if int(p) not in list_ac:
            count_wa +=1
print(len(set(list_ac)), count_wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
P = []
S = []
result = {}

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

ac = 0
wa = 0

for i in range(M):
    if S[i] == 'AC':
        if P[i] in result:
            if result[P[i]] == 'WA':
                ac += 1
                result[P[i]] = 'AC'
        else:
            result[P[i]] = 'AC'
            ac += 1
    elif S[i] == 'WA':
        if P[i] in result:
            if result[P[i]] == 'WA':
                wa += 1
        else:
            result[P[i]] = 'WA'
            wa += 1
    
    #print(result)

print('{} {}'.format(ac,wa))

Submission status: Wrong Answer

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

wa = 0
ac = set()

for i, j in ps:
    if j == "AC":
        ac.add(i)
    else:
        if i not in ac:
            wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
N, M = map(int, input().split())
L = []
for _ in range(M) :
  L.append(list(map(str, input().split())))
#print(L)
  
D = {}
for i in range(M) :
  if L[i][0] not in D :
    D[L[i][0]] = L[i][1]
  else :
    if L[i][1] == "AC" :
      D[L[i][0]] = L[i][1]

ACsum = 0
ACList = []
for mykey, myvalue in D.items() :
  if myvalue == "AC" :
    ACsum += 1
    ACList += [mykey]
    
WAsum = 0
for k in range(len(ACList)) :
  for i in range(M) :
    if L[i][1] == "WA" :
      WAsum += 1
    else :
      break

print(str(ACsum) + " " + str(WAsum))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
nset=set()
acount=0
pcount=0
for i in range(m):
    s,p=map(str,input().split())
    if int(s) not in nset:
        if p=="WA":
            pcount+=1
        else:
            nset.add(int(s))
            acount+=1
print(acount,pcount)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
a = []
for i in range(m):
    a.append([str(i) for i in input().split()])

ac = []
for i in range(m):
    if a[i][1] == "AC":
        ac.append(a[i][0])
ans1 = len(set(ac))

ans2 = 0
tmp = []
for i in range(m):
    if a[i][1] == "AC":
        tmp.append(a[i][0])
    if a[i][1] == "WA" and not(a[i][0] in tmp):
        ans2 += 1

print(ans1, end = " ")
print(ans2)

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:
        if i[0] in has_been_solved:
            continue

        if i[1] == 'AC':
            cor += 1
            has_been_solved.add(i[0])
        else:
            pen += 1

    print('{} {}'.format(cor, pen))
    



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
fin=[False]*(10**5+10)
pena=0
corr=0
for _ in range(m):
  p,s=input().split()
  p=int(p)
    
  if fin[p]==True:
    continue
    
  if s=="WA":
    pena+=1;
  if s=="AC":
    corr+=1
    fin[p]=True
        
print(corr,pena)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A={}
for i in range(m):
    num,result=input().split()
    if num not in A:
        A[num]=[result]
    else:
        A[num] +=[result]

ans,cnt=0,0
for v,m in A.items():
    for i in m:
        if i=="AC":
            ans +=1
            break
        if i=="WA":
            cnt +=1

print(ans,cnt)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
AC=[False]*n
WA=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC':
        AC[p]=True
    else:
        if AC[p]:
            continue
        WA+=1
print(sum(AC),WA)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
pSlist = []
for i in range(M):
    buff = input().split()
    p = int(buff[0])-1
    S = str(buff[1])
    pSlist.append([p,S])

AClist = [0 for i in range(N)]
WAlist = [0 for i in range(N)]
AClist_dummy = [0 for i in range(N)]

for p,S in pSlist:
    if S=="AC":
        AClist_dummy[p]+=1
    if AClist[p]==0 and S=="AC":
        AClist[p]=1
    elif AClist[p]==0 and S=="WA":
        WAlist[p]+=1



print(sum([1 if i>=1 else 0 for i in AClist_dummy]),sum(WAlist))

Submission status: Wrong Answer

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

an1=0
an2=0
li=[]

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

for i in range(m):
    p,s = map(str,input().split())
    
    if s=="AC":
        if p not in li:
            li.append(p)
            an1+=1
    else:
        if p not in li:
            an2+=1

print(an1,an2)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

    
    
print(ac,wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, M = map(int, input().split())
P = []
S = []
for i in range(M):
  p, s = input().split()
  P.append(int(p))
  S.append(s)
d = defaultdict(int)
d1 = defaultdict(int)
for i in range(M):
  if S[i] == "WA":
    if d[P[i]] != 1:
      d1[P[i]] += 1
  elif S[i] == "AC":
    d[P[i]] = 1
print(sum(d.values()), sum(d1.values()))

Submission status: Wrong Answer

Solution code:
import numpy as np

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

answer = [[False, 0] for i in range(n)]

for i in range(m):
  p, s = input().split()
  p = int(p) - 1
  if answer[p][0] == True:
    continue

  if s == 'AC':
    answer[p][0] = True
  else:
    answer[p][1] += 1

arr = np.array(answer)

print(*sum(arr))

Submission status: Wrong Answer

Solution code:
import sys


def main():
    n, m = map(int, sys.stdin.readline().split(" "))
    mem = dict()
    try_count = 0
    wrong_count = 0
    for _ in range(m):
        test_no, result = sys.stdin.readline().strip().split(" ")
        if test_no in mem:
            if not mem[test_no]:
                if result == "WA":
                    wrong_count += 1
                else:
                    mem[test_no] = True
        else:
            try_count += 1
            mem[test_no] = result == "AC"
            if result == "WA":
                wrong_count += 1
    print("%d %d" % (try_count, wrong_count))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8

N, M = map(int, input().split(' '))
ac_stk = [0 for _ in range(N)]
wa_stk = [0 for _ in range(N)]
pair = []
for _ in range(M):
    p, s = input().split(' ')
    pair.append((int(p), s))
ac = 0
wa = 0

for p, s in pair:
    if s == 'WA':
        wa_stk[p-1] += 1
    elif s == 'AC':
        ac_stk[p-1] = 1
        wa += wa_stk[p-1]

print('{} {}'.format(sum(ac_stk), wa))

Submission status: Wrong Answer

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

ac = []
now = 0

cnt_ac = 0
cnt_pen = 0
cnt = 0

for i in range(m):
    p, s = map(str, input().split())
    #まだ未正解の問題
    if p not in ac:
        
        if s == 'AC':
            ac.append(p)
            cnt_ac += 1
            cnt_pen += cnt
            cnt = 0
            
        if s == 'WA':
            cnt += 1
    
    #既に正解している問題
    if p in ac:
        
        if s == 'AC':
            continue
        
        if s == 'WA':
            continue

print(cnt_ac, cnt_pen)

Submission status: Wrong Answer

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

ac = 0
wa = 0
problems = [[0,0] for _ in range(n)]
for i in l:
    if i[1] == 'WA' and problems[int(i[0])-1][1] == 0:
        problems[int(i[0])-1][0] += 1
    elif i[1] == 'AC' and problems[int(i[0])-1][1] == 0:
        problems[int(i[0])-1][1] += 1
    else:
        pass
    

for i in problems:
    ac += i[0]
    wa += i[1]
    
print(wa,ac)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ST=['WA'] * N
WA=[0] * N
OK=0
NG=0
for i in range(M):
  c,s = map(str,input().split())
  c = int(c)
  if s == 'WA':
    if ST[c-1] != 'AC':
      #WA[c-1] += 1
      NG += 1
  else:
    if ST[c-1] != 'AC':
      ST[c-1] = 'AC'
      OK += 1
  if OK == N:
    break
print("{} {}".format(OK,NG))

Submission status: Wrong Answer

Solution code:
def main():
    n,m = map(int, input().split())
    
    ac = [0]*n
    wa = [0]*n
    for i in range(m):
        p,s = input().split()
        if ac[int(p)-1] == 1:
            continue
        if s == 'WA':
            wa[int(p)-1] += 1
        if s == 'AC':
            ac[int(p)-1] = 1
    print(sum(ac),sum(wa))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ac = 0
wa = 0
q_nums = []
for s in s_list:
  if s[0] in q_nums:
    break
  elif s[1] == 'AC':
    ac += 1
    q_nums.append(s[0])
  elif s[1] == 'WA':
    wa += 1

print('{} {}'.format(ac, 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
        elif 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:
n, m = [int(x) for x in input().split(" ")]
ac = [0 for i in range(0, n)]
wa_count = [0 for i in range(0, n)]

for i in range(0, m):
    pi, si = [x for x in input().split(" ")]
    pi = int(pi)
    if si == "WA" and not ac[pi-1]:
        wa_count[pi-1] += 1
    elif si == "AC":
        ac[pi-1] = 1

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

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)
cnt_wa=defaultdict(lambda:0)

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

Submission status: Wrong Answer

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

answered = []

ac_count = 0
wa_count = 0

for n in range(M):
    result = input().split(" ")
    p = result[0]
    if p in answered:
        continue
    s = result[1]
    if s == "WA":
        wa_count += 1
    else:
        ac_count += 1
        answered.append(p)
        if len(answered) == N:
          break

print(ac_count, wa_count)

Submission status: Wrong Answer

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

pen= [0] * (n+1)
result=[False] * (n+1)
cnt = 0
for i in range(m):
    p1, s1 = input().split()
    p1 = int(p1)

    if s1 == "AC" and not result[p1]:
        result[p1] = True
        cnt += 1
    if s1 == "WA" and not result[p1]:
        pen[p1] += 1
print("{} {}".format(cnt, sum(pen)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
q_re = set()
ac = 0
wa = 0
for i in range(m):
    q, re = input().split()
    if(re == "WA" and q not in q_re): 
        wa += 1
    if(re == "AC" and q not in q_re): 
        ac += 1
        q_re.add(q)
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
arr = [input().split() for i in range(M)]
s = [0 for i in range(N)]
p = 0
for i, j in arr:
    if j == 'AC':
        s[int(i)-1] = 1
    elif j == 'WA':
        if s[int(i)-1] == 1: # if done
            pass
        else:
            p += 1
print(sum(s), p)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = []
count_WA = 0
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    if p not in li_AC:
        if S == "AC":
            li_AC.append(p)
            count_WA_total += count_WA
            count_WA = 0
        if S == "WA":
            count_WA += 1
print(len(li_AC ), count_WA_total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

wa = 0

for i in range(m):
    t1, t2 = input().split()
    t1 = int(t1)
    if t1 in solved:
        pass
    elif t2 == 'WA':
        wa += 1
    else: # t2 == AC
        solved.append(t1)

print(len(solved), 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":
			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())
status = {str(i): 0 for i in range(1, N+1)}
# submission = [(input().split()) for _ in range(M)]
error = 0
for _ in range(M):
  q, r = input().split()
  if r == "AC": status[q] = 1
  elif r =="WA":
    if status[q] == 0: error += 1

print(sum(status.values()), error)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

suc = [0 for i in range(N+1)]
pen = [0 for i in range(N+1)]

for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == "WA" and suc[p] == 0:
        pen[p] += 1
    elif s == "AC":
        suc[p] = 1

print( sum(suc), sum(pen) )

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
S = [''] * M
for i in range(M):
    p_i, S[i] = input().split()
    p[i] = int(p_i)

penal_ct = 0
ac_count = 0
prev_ac_num = -1
for i in range(1, M)[::-1]:
    if S[i] == 'AC' and p[i] != prev_ac_num:
        prob_num = prev_ac_num = p[i]
        ac_count += 1
        for j in range(0, i)[::-1]:
            if p[j] == prob_num and S[j] == 'WA':
                penal_ct += 1
print(ac_count, penal_ct)

Submission status: Wrong Answer

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

a = []
t = 0

for i in range(m):
    p, q = input().split()
    #p = int(p)

    if (p in a) == True:
        continue
    else:
        if q == 'WA':
            t += 1
        else:
            a.append(p)

print(len(a), t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for _ in range(n)]
wa_list = [0 for _ in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        wa_list[p - 1] += 1
    cnt += 1
for i in range(n):
    if wa_list[i] == 1 and ac_list[i] == 1:
        wa_cnt += wa_list[i]
print(sum(ac_list), wa_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li=[]
p_li=[0]*n
ac = 0
wa = 0
for _ in range(m):
    a,b = input().split()
    li.append([int(a),b])

for i in li:
    if i[1] == "AC":
        if p_li[i[0]-1] == 0:
            ac += 1
            p_li[i[0]-1] = 1
    else:
            if p_li[i[0]-1] == 0:
                wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
# import itertools
# import math

# N = int(input())
# S = input()
N, M = map(int, input().split())
# A = list(map(int, input().split()))

ans_p = [0] * N
ans_s = [0] * N

for i in range(M):
    input_sp = input().split()
    P = int(input_sp[0]) - 1
    S = input_sp[1]

    if S == 'AC':
        ans_s[P] = 1
    elif S == 'WA' and ans_p[P] == 0:
        ans_p[P] += 1

print(str(sum(ans_s)) + " " + str(sum(ans_p)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
k = []
ac_count = 0
miss_count = 0
for i in range(M):
    s = input().split()
    if s[1] == "AC":
        if int(s[0]) not in k:
            k.append(int(s[0]))
            ac_count += 1
    else:
        if int(s[0]) not in k:
            miss_count += 1
print(ac_count,miss_count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = []
for i in range(M):
  l.append(list(map(str, input().split())))
for i in range(M):
  l[i][0] = int(l[i][0])
check_l = [0] * N

penalty = 0
ans_count = 0

for i in range(M):
  if check_l[l[i][0]-1] == 0:
    if l[i][1] == 'AC':
      check_l[l[i][0]-1] = 1
      ans_count += 1
    else:
      penalty += 1

print(ans_count, penalty)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
pS = [input().split()[:2] for _ in range(m)]

AC = [0]*n
WA = [0]*n

for p, S in pS:
    p = int(p)
    print(p)
    if AC[p-1] == 0:
        if S == 'AC':
            AC[p-1] = 1
        else:
            WA[p-1] += 1

for i in range(n):
    if WA[i] > 0 and AC[i] == 0:
        WA[i] = 0
print(sum(AC), sum(WA))

Submission status: Wrong Answer

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

l=[input().split() for i in range(m)]
clear=[]
ACcount=0
WAcount=0
for i in range(m):
  if l[i][0] not in clear:
    if l[i][1]=="WA":
      WAcount+=1
    else:
      ACcount+=1
      clear.append(l[i][0])
    
print(ACcount,WAcount)

Submission status: Wrong Answer

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

ac,wa = 0,0
score = {i+1:'WA' for i in range(n)}

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

print(ac,wa)

Submission status: Wrong Answer

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

c = 'AC'
w = 'WA'

cnt_c, cnt_w = 0, 0
ps = [i for i in range(1, n+1)]
for p, s in ans:
  if p not in ps:
    continue
  if s == w:
    cnt_w += 1
  else:
    cnt_c += 1
    ps.remove(p)

print(cnt_c, cnt_w)

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
for i in range(M):
  if(p[i] not in ac_list):
    if(s[i]=="AC"):
      ac_num += 1
      ac_list.append(p[i])
    else:
      wa_num += 1
  
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ok_list = []
for p, s in result_list:
    if p not in ok_list:
        if s == 'WA':
            WA_total += 1
        else:
            AC_total += 1
            ok_list.append(p)
print('{} {}'.format(AC_total, WA_total))

Submission status: Wrong Answer

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

submit = []
for i in range(m):
    temp = [x for x in input().split()]
    submit.append(temp)

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

for i in range(m):
    if submit[i][1] == 'AC' and done[int(submit[i][0])] == 0:
        done[int(submit[i][0])] = 1
        ac += 1
    if submit[i][1] == 'WA' and done[int(submit[i][0])] == 0:
        wa += 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(n):
    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
        if b == 'AC':
            aclist[a] = 1
            ac += 1

print(ac, wa, end=" ")

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li = []
ac = 0
wa = 0
b = 0
for i in range(m):
  s = list(input().split())
  s[0] = int(s[0])
  li.append(s)
for i in range(n):
  b = 0
  for k in li:
    if b==1:
      break
    if k[0] == i+1:
      if k[1] == "AC":
        ac+=1
        b=1
      if k[1] == "WA":
        wa+=1
print(ac,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 = int(p)
    P.append(p)
    S.append(s)
#print(P)
#print(S)
AC = 0
WA = 0
AC_f = [0] * (N + 1)
WA_f = [0] * (N + 1)
#print(AC_f)
for i in range(M):
    if AC_f[P[i]] == 0:
        if S[i] == "AC":
            AC += 1
            AC_f[P[i]] = 1
        else:
            WA += 1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
PS = sorted([input().split() for i in range(m)], key=lambda x:x[0])
PS += [["",""]]
ac = 0
wa = 0

pre = ""
wa_tmp=0
ac_tmp=0

if PS[0][1] == "WA":
    wa_tmp += 1

for p,s in PS:
    if pre != p:
        if ac_tmp:
            ac+=1
            wa+=wa_tmp
            ac_tmp=0
            wa_tmp=0
    else:
        if s == "AC":
            ac_tmp+=1
        elif s == "WA":
            wa_tmp+=1
    pre = p
    

print(ac,wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = map(int, input().split(' '))
suc_list = np.zeros(N, dtype=np.uint8)
fai_count = 0
for i in range(M):
    p, s = input().split(' ')
    p = int(p) - 1
    if suc_list[p] == 0:
        if s == 'WA':
            fai_count += 1
        else:
            suc_list[p] = 1

print('{} {}'.format(np.sum(suc_list), fai_count))