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 = 0
WA = 0
AC_count = set()
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count.add(int(p))
    else:
        if S == 'AC' and not int(p) in AC_count:
            AC += 1
            AC_count.add(int(p))
        elif S == 'WA' and not  int(p) in AC_count:
            WA += 1

print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
AC_count = set()
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count.add(int(p))
    else:
        if S == 'AC' and not int(p) in AC_count:
            AC += 1
            AC_count.add(int(p))
        elif S == 'WA' and not  int(p) in AC_count:
            WA += 1
            AC_count.add(int(p))
print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
AC_count = 0
num = set()

for _ in range(M):
    p, S = input().split()
    if not int(p) in num:
        num.add(int(p))
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count = 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

AC = 0
WA = 0
AC_count = 0
num_lst = []

for _ in range(M):
    p, S = input().split()
    if not int(p) in num_lst:
        num_lst.append(int(p))
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count = 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

num = 0
AC = 0
WA = 0
AC_count = 0

for _ in range(M):
    p, S = input().split()
    if num != int(p):
        num = int(p)
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count = 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

num = 0
AC = 0
WA = 0
AC_count = 0

for _ in range(M):
    p, S = input().split()
    if num != p:
        num = p
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count = 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

num = 0
AC = 0
WA = 0
AC_count = 0

for _ in range(M):
    p, S = input().split()
    if num != p:
        num = p
        AC_count = 0
        if S == 'WA':
            WA += 1
        else:
            AC += 1
            AC_count = 1
    else:
        if S == 'AC' and AC_count == 0:
            AC += 1
            AC_count += 1
        elif S == 'WA' and AC_count == 0:
            WA += 1
print(AC, WA)

Submission status: Wrong Answer

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

ac = 0
wa = 0
acs = [0] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        if not acs[p]:
            ac += 1
            acs[p] = 1
    else:
        if not acs[p]:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def main():
    N, M = map(int, input().split())
    ans = [0, 0]
    A = [[0, 0] for _ in range(N)]

    for i in range(M):
        p, s = input().split()
        p = int(p)
        if s == 'AC':
            A[p - 1][1] = 1
        elif A[p - 1][1] == 0:
            A[p - 1][0] += 1
    
    for i, j in A:
        if i == 1:
            ans[0] += 1
            ans[1] += j

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def resolve():
    n,m = map(int,input().split())
    ac_list = [1]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and ac_list[int(p)-1]==1:
            wa += 1
        elif s == 'AC' and ac_list[int(p)-1]==1:
            ac += 1
            ac_list[int(p)-1] = 0
    print(f'{ac} {wa}')
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n,m = map(int,input().split())
    ac_list = []
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and p not in ac_list:
            wa += 1
        elif s == 'AC' and p not in ac_list:
            ac += 1
            ac_list.append(p)
    print(f'{ac} {wa}')
resolve()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac_cnt = []
wa_cnt = 0
for i in range(m):
    p,s = input().split()
    if s == "WA" and p not in ac_cnt:
        wa_cnt += 1
    elif s == "AC" and p not in ac_cnt:
        ac_cnt.append(p)
        
print(len(set(ac_cnt)),wa_cnt)

Submission status: Wrong Answer

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

ans_ac = set()
wa_cnt = 0
wa_sled = [i for i in range(1,n+1)]


for i in range(m):
  p,s = input().split()
  if s == "AC":
    ans_ac.add(p)
      
  if s == 'WA' and p not in wa_sled:
    wa_cnt += 1
    
print(len(ans_ac),wa_cnt)

Submission status: Wrong Answer

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

ans_ac = set()
wa_cnt = 0

for i in range(m):
  if len(ans_ac) == n:
    break
  p,s = input().split()
  if s == "AC":
    ans_ac.add(p)
      
  if s == 'WA' and p not in ans_ac:
    wa_cnt += 1
    
print(len(ans_ac),wa_cnt)

Submission status: Wrong Answer

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

ans_ac = set()
wa_cnt = 0

for i in range(m):
  p,s = input().split()
  if s == "AC":
    if p not in ans_ac:
      ans_ac.add(p)
      
  elif s == 'WA' and p not in ans_ac:
    wa_cnt += 1
    
print(len(ans_ac),wa_cnt)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [False] * (N + 1)
    for p, S in pS:
        res = int(p)
        if S == 'AC':
            ac[res] = True
        if ac[res]:
            continue
        score[res] += 1
    print(sum(ac), sum(score))
    # print(ac)
    # print(score)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [0] * (N + 1)
    for p, S in pS:
        p = int(p)
        if S == 'AC':
            ac[p] = 1
        if ac[p]:
            continue
        score[p] += 1
    print(sum(ac), sum(score))
    # print(score)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [False] * (N + 1)
    for p, S in pS:
        p = int(p)
        if ac[p]:
            continue
        if S == 'AC':
            ac[p] = True
            continue
        score[p] += 1
    print(sum(ac), sum(score))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i]
    if res[no-1] == 1:
        continue
    elif s[i] == 'WA':
        penalty += 1
    elif s[i] == 'AC':
        correct += 1
        res[no-1] = 1

print(correct, penalty)

Submission status: Wrong Answer

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


res = [0]*n
correct = 0
penalty = 0
for i in range(m):
    no = p[i] - 1
    if res[no] == 1:
        continue
    elif s[i] == 'WA':
        penalty += 1
    elif s[i] == 'AC':
        correct += 1
        res[no] = 1

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
WA = 0
q = []
ans = []
for i in range(m):
    p,s = input().split()
    if p in q:
        if p in ans:
            continue
        else:
            if s == 'WA':
                WA += 1
            else:
                ans.append(p)
    elif p not in q:
        q.append(p)
        if s == 'WA':
            WA += 1
        else:
            ans.append(p)
            
print(len(ans),WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
WA = 0
q = []
ans = []
for i in range(m):
    print(ans,WA,q)
    p,s = input().split()
    if p in q:
        if p in ans:
            continue
        else:
            if s == 'WA':
                WA += 1
            else:
                ans.append(p)
    elif p not in q:
        q.append(p)
        if s == 'WA':
            WA += 1
        else:
            ans.append(p)
            
print(len(ans),WA)

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)

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

for p, s in zip(P, S):
    if s == 'AC' and ac[p] == 0:
        ac[p] = 1
    elif s == 'WA' and ac[p] == 0:
        wa[p] += 1

for i in range(n + 1):
    if ac[i] != 1:
        wa[i] == 0

print(sum(ac), sum(wa))

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)
ac = {}
wa = {}

for p, s in zip(P, S):
    if s == 'AC':
        ac.setdefault(p, 1)
    else:
        wa.setdefault(p, 0)
        if wa[p] == 0:
            wa[p] += 1
        
n_ac = 0
n_wa = 0

for i in ac.values():
    n_ac += i

for i in wa.values():
    n_wa += i

print(n_ac,n_wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
AC = [0]*n
WA = [0]*n

for i in range(m):
  c,s = input().split()
  c = int(c)
  c -= 1
  if AC[c]: continue
  if s == 'AC':
    AC[c] = 1
  else:
    WA[c] +=  1

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ac = [False] * n
wa = [0] * n
for p, s in p_s:
    if ac[int(p)-1] is False:
        if s == 'AC':
            ac[int(p)-1] = True
        else:
            wa[int(p)-1] += 1
print(sum([1 for i in ac if i is True ]), sum([i for i in wa ]))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p,s = [],[]
for _ in range(m):
  a,b = map(str,input().split())
  p.append(a)
  s.append(b)
p = list(map(int,p))
checker = [0] * n
penalty = 0
for i,j in enumerate(s):
  if j == "AC" and checker[p[i]-1] == 0:
    checker[p[i]-1] = 1
  elif j == "WA" and checker[p[i]-1] == 0:
    penalty += 1
print(sum(checker),penalty)

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
ps=[input().split() for i in range(m)]

dic={}
anslst=[0]*n
for i in range(m):
    p,s=ps[i]
    if s=="AC":
        dic[p]=1
    else:
        if p in dic:
            continue
        else:
            anslst[int(p)-1]+=1

print(len(dic),sum(anslst))

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
ps=[input().split() for i in range(m)]

dic={}
anslst=[0]*n
for i in range(m):
    p,s=ps[i]
    if s=="AC":
        dic[p]=1
    else:
        if p in dic:
            continue
        else:
            anslst[int(p)-1]+=1

print(len(dic))
print(sum(anslst))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
P = [0]*n
AC = 0
WA = 0

for i in range(m):
    p, S = input().split()
    p = int(p)
    if S == "AC" and P[p-1] != -1:
        AC += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        WA += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [0] * N
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not p in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_list = []
wa_cnt, wa_cnt_ls = 0, [0] * N
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not p in ac_list:
        if p == 'AC':
            ac_list.append(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_list), wa_cnt)

Submission status: Wrong Answer

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

sum_wa = 0
sum_ac = 0
flag_ac = 0

for i in range(m):
    if flag_ac == 1:
        if ps[i][0] != ps[i-1][0]:
            flag_ac = 0
        else:
            break

    if flag_ac == 0:
        if ps[i][1] == 'WA':
            sum_wa += 1
        elif ps[i][1] == 'AC':
            flag_ac = 1
            sum_ac += 1

print(sum_ac, sum_wa)

Submission status: Wrong Answer

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

sum_wa = 0
sum_ac = 0
flag_ac = 0

for i in range(m):
    if flag_ac == 1:
        if ps[i][0] != ps[i-1][0]:
            flag_ac = 0

    if flag_ac == 0:
        if ps[i][1] == 'WA':
            sum_wa += 1
        elif ps[i][1] == 'AC':
            flag_ac = 1
            sum_ac += 1

print(sum_ac, sum_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls = [0] * N
wa_cnt = 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not s in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(idx)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt_ls = [0] * N
wa_cnt = 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not s in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(s)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

Submission status: Wrong Answer

Solution code:
[N, M] = [int(i) for i in input().split()]
dic = {}
ans_wa = 0
for i in range(M):
    s = input().split()
    if s[0] not in dic:
        if s[1] == 'AC':
            dic[s[0]] = 'o'
        elif s[1] =='WA':
            ans_wa += 1

ans_ac = len(dic)
print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)

for i in range (0, M):
    A, B = map(str, input().split())
    A = int(A)
    if B == 'WA':
        if AC[A] == 0:
            WA[A]+=1
    else:
        if AC[A] == 0:
            AC[A] = 1

Wronganswer = 0
for i in range (0, N):
    Wronganswer+=(AC[i]*WA[i])
print(sum(AC), Wronganswer)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)

for i in range (0, M):
    A, B = map(str, input().split())
    A = int(A)
    if B == 'WA':
        if AC[A] == 0:
            WA[A]+=1
    else:
        if AC[A] == 0:
            AC[A] = 1

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

Submission status: Wrong Answer

Solution code:
#nは問題数　mは提出した回数　
n,m = map(int,input().split())
submit = []
check = [0] * n

for x in range(m):
    a,b = input().split()
    a = int(a)
    x = [a,b]
    submit.append(x)

o = 0
x = 0


for y in submit:
    if check[y[0]-1] == 0:
        if y[1] == "AC":
            o += 1
            check[y[0]-1] = 1
        elif y[1] == "WA":
            x += 1

print(o,x)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
flag=[False]*(N+1)
ac=0
wa=[0]*(N+1)
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if flag[p]==False:
        if s=='AC':
            flag[p]=True
            ac+=1
        else:
            wa[p]+=1
print(ac,sum(wa))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
flag=[False]*(N+1)
ac=0
wa=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if flag[p]==False:
        if s=='AC':
            flag[p]=True
            ac+=1
        else:
            wa+=1
print(ac,wa)

Submission status: Wrong Answer

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

#%%

ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

print(sum(ACs), sum(WAs))

Submission status: Wrong Answer

Solution code:
[N, M] = [int(i) for i in input().split()]
dic = {}
ans_wa = 0
for i in range(M):
    s = input().split()
    if s[1] == 'WA':
        ans_wa += 1
    if s[0] not in dic:
        if s[1] == 'AC':
            dic[s[0]] = 'o'

ans_ac = len(dic)
print(ans_ac, ans_wa)

Submission status: Wrong Answer

Solution code:
[N, M] = [int(i) for i in input().split()]
dic = {}
ans_wa = 0
for i in range(M):
    s = input().split()
    if s[1] == 'WA' and s[0] not in dic:
        ans_wa += 1
    elif s[1] == 'AC' and s[0] not in dic:
        dic[s[0]] = 'o'

ans_ac = len(dic)
print(ans_ac, ans_wa)

Submission status: Wrong Answer

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

L = []
O = []
for i in range(M):
    p,S=input().split()
    L.append(int(p))
    O.append(S)

    

            
SET = set()
DICT_WRG = []

ANS = 0
WRG = 0


for i in range(M):
    if O[i] == 'AC':
        if L[i]  not in SET:
            I = int(L[i])
            SET.add(I)
            ANS = ANS + 1

        else:
            continue

        
    elif O[i] == 'WA':
        if L[i] in SET:
            continue
        else:
            DICT_WRG.append(L[i])
            WRG = WRG + 1
        




            
            
print(ANS)
print(WRG)

Submission status: Wrong Answer

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

L = []
O = []
for i in range(M):
    p,S=input().split()
    L.append(int(p))
    O.append(S)

    

            
SET = set()

ANS = 0
WRG = 0

for i in range(M):
    if O[i] == 'AC':
        if L[i]  not in SET:
            I = int(L[i])
            SET.add(I)
            ANS = ANS + 1

        else:
            continue

        
    elif O[i] == 'WA':
        if L[i] not in SET:
            WRG = WRG + 1
            
        else:
            continue


            
            
print(ANS)
print(WRG)

Submission status: Wrong Answer

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


def main():
    N, M = map(int, input().split())
    ans = 0
    passed = set([])
    for _ in range(M):
        p, S = input().split()
        if S == "WA" and p not in passed:
            ans += 1
        elif S == "AC":
            passed.add(p)
    print(len(passed), ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
x=[0]*N
P=[]
s=[]
b=0
for i in range(M):
    p,S=map(str,input().split())
    P.append(int(p))
    s.append(S)
for j in range(M-1,-1,-1):
    if s[j]=='AC':
        x[P[j]-1]=1
    elif s[j]=='WA':
        if x[P[j]-1]==1:
            b+=1
print(x.count(1),b)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
x=[0]*N
P=[]
s=[]
a=1
b=0
for i in range(M):
    p,S=map(str,input().split())
    P.append(int(p))
    s.append(S)
for j in range(M-1,-1,-1):
    if s[j]=='AC':
        x[P[j]-1]=1
    elif s[j]=='WA':
        if x[P[j]-1]==1:
            b+=1
print(x.count(1),b)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
l=[0]*N
a=1
b=0
for i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        l[p-1]=1
    elif S=='WA':
        if l[p-1]==0:
            b+=1
print(l.count(1),b)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from itertools import chain

# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N: int, M: int, P: "List[int]", S: "List[str]"):
    ac = [0] * N
    wa = [0] * N
    for p, s in zip(P, S):
        if s == "AC":
            ac[p - 1] = 1
        else:  # WA
            if ac[p - 1] == 0:
                wa[p - 1] += 1
    return sum(ac), sum(wa)


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N, M, p, S = map(int, input().split())
    # N, M, p, S = input().strip()
    # N, M, p, S = int(input())
    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)
    a1, a2 = solve(N, M, P, S)
    print(a1, a2)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from itertools import chain

# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N: int, M: int, P: "List[int]", S: "List[str]"):
    ac = [0] * N
    wa = [0] * N
    for p, s in zip(P, S):
        if s == "AC":
            ac[p - 1] = 1
        else:  # WA
            if ac[p - 1] != 1:
                wa[p - 1] += 1
    return sum(ac), sum(wa)


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N, M, p, S = map(int, input().split())
    # N, M, p, S = input().strip()
    # N, M, p, S = int(input())
    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)
    a1, a2 = solve(N, M, P, S)
    print(a1, a2)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
ACList=[0]*(N+1)
ansAC=0
ansP=0
for i in range(M):
	p,S=map(str, input().split())
	p=int(p)
	if S=="AC" and ACList[p]==0:
		ACList[p]=1
		ansAC+=1
	elif S=="WA" and ACList[p]==0:
		ansP+=1
	else:
		continue

print(ansAC,ansP)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_set = set()
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    if num not in ac_set:
        if res == 'AC':
            ac_cnt += 1
            ac_set.add(num)
        else:
            wa_cnt += 1
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))
ac_list = []
ac_cnt, wa_cnt = 0, 0
for i in range(M):
    num, res = input().split(' ')
    if num not in ac_list:
        if res == 'AC':
            ac_cnt += 1
            ac_list.append(num)
        else:
            wa_cnt += 1
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    n, m = [int(x) for x in input().rstrip().split(" ")]

    ac = [False for _ in range(n)]
    wa = [0 for _ in range(n)]

    for i in range(m):
        p, s = input().rstrip().split(" ")
        p = int(p) - 1
        if ac[p]:
            continue
        if s == "WA":
            wa[p] += 1
        else:
            ac[p] = True
    print(ac.count(True), sum(wa))


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
WA = [0]*N
AC = [False]*N
for _ in range(M):
    p, S = input().split()
    p = int(p)-1
    if S == 'WA':
        if AC[p] == False:
            WA[p] += 1
    else:
        AC[p] = True

print(AC.count(True), sum(WA))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
answer = 0
penalty = 0
ans = [0] * n

for x in range(m):
  p, s = input().split()
  pi = int(p) - 1
  if s == 'AC' and ans[pi] != 1:
    answer += 1
    ans[pi] = 1
    continue

  if s == 'WA' and ans[pi] != 1:
    penalty += 1
    continue

print(f'{answer} {penalty}')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l1 = [0]*n
l2 = [0]*n
for i in range(m):
        p,s=map(str,input().split())
        p= int(p)
        if s == 'AC':
                if l2[p-1] == 0:
                        l2[p-1] +=1
                else:
                        pass 
        else:
                if l2[p-1] == 0:
                        l1[p-1] +=1
                else:
                        pass
for i in range(n):
        if l2[i] == 0:
                l1[i] == 0
                
print(sum(l2),sum(l1))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l1 = [0]*n
l2 = [0]*n
for i in range(m):
        p,s=map(str,input().split())
        p= int(p)
        if s == 'AC':
                if l2[p-1] == 0:
                        l2[p-1] +=1
                else:
                        pass 
        else:
                if l2[p-1] == 0:
                        l1[p-1] +=1
                else:
                        pass
print(sum(l2),sum(l1))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l1 = [0]*n
l2 = [0]*n
for i in range(m):
        p,s=map(str,input().split())
        p= int(p)
        if s == 'AC':
                if l2[p-1] == 0:
                        l2[p-1] +=1
                else:
                        pass 
        else:
                if l2[p-1] == 0:
                        l1[p-1] +=1
                else:
                        pass
print(sum(l1),sum(l2))

Submission status: Wrong Answer

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


for i in range(M):
    p, S = list(map(str, input().split()))
    if S == 'AC' and (int(p) not in aclen) == True:
        ac += 1
        aclen.append(int(p))
    elif S == 'WA' and (int(p) not in aclen) == True:
        wa += 1
'''
for i in range(M):
    if int(L[i][0]) > N:
        pass
    else:
        print((int(L[i][0]) not in ac))
        if L[i][1] == 'AC':
            ac.append(int(L[i][0]))
        elif L[i][1] == 'WA' and ((int(L[i][0]) not in ac) == True):
            wa.append(int(L[i][0]))

print(len(set(ac)), len(wa))
'''

print(ac, wa)

Submission status: Wrong Answer

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

for i in range(M):
    pS = list(map(str, input().split()))
    L.append(pS)

for i in range(M):
    if int(L[i][0]) > N:
        pass
    else:
        if L[i][1] == 'AC':
            ac.append(int(L[i][0]))
        elif L[i][1] == 'WA' and ((int(L[i][0]) not in ac) == True):
            wa.append(int(L[i][0]))

print(len(set(ac)), len(wa))