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:
from collections import defaultdict
N,M = map(int,input().split())
d = defaultdict(lambda:False)
ans = [0,0]
for i in range(M):
    p,s = input().split()
    if s == 'WA':
        if not d[p]:
            ans[1] += 1
    else:
        if not d[p]:           
            d[p] = True
            ans[0] += 1
print(*ans)

Submission status: Wrong Answer

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime
def run_length_encode(s):
    count = 1
    code = []
    target = s[0]
    for i in range(1, len(s)):
        if target == s[i]: count += 1
        else:
            code.append((target, count))
            target = s[i]
            count = 1
    code.append((target, count))
    return code

N,M = imn()
PS = [input().split() for _ in range(M)]
AC = set()
WA = set()
for i in range(M):
    if PS[i][1] == 'AC':
        AC.add(PS[i][0])
    else:
        WA.add(PS[i][0])
print(len(AC), len(WA), sep=' ')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

def main():
    n,m = mi()

    t = [[] for i in range(n+1)]

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

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


    accnt = 0
    wacnt = 0

    for i in range(1,n+1):
        if not t[i]:
            continue
        for k in t[i]:
            if k == "AC":
                accnt+=1
                break
            else:
                wacnt+=1

    print(accnt,wacnt)






main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
done = set()
ac = 0
wa = 0
for _ in range(M):
    p, s = map(str, input().split())
    if s == "WA":
        if p not in done:
            wa += 1
    elif s == "AC":
        if p not in done:
            ac += 1
            done.add(p)
print(ac, wa)

Submission status: Wrong Answer

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

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

print(cleared.count(True), penalties)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

pr = [False]*N

ac = 0
wa = 0

for i in range(M):
    p, S = input().split()
    p = int(p)
    if pr[p-1] == True:
        continue
    if S == "AC":
        ac += 1
        pr[p-1] = True
    else:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

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

print(sum(data),count)

Submission status: Wrong Answer

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

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

for p, s in ps:
    p = int(p)

    if ac[p]:
        continue

    if s == "WA":
        wa[p] += 1
    else:
        ac[p] = 1

ans = sum(ac), sum(wa)
print(*ans)

Submission status: Wrong Answer

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

wa, ac = 0, 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if p not in a:
        if s == "WA":
            wa += 1
        else:
            a.add(p)
            ac += 1
print(ac,wa)

Submission status: Wrong Answer

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

sc = 0
pc = 0
SG = set()
for p,s in PS:
  if p not in SG:
    if s == 'AC':
      sc += 1
      SG.add(p)
    else:
      pc += 1
print(sc,pc)

Submission status: Wrong Answer

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

for i in range(m):
    p, s = input().split()
    if not p in q:
        if s == 'AC':
            ac += 1
            q.append(p)
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    ok = 0
    penalty = 0

    problems = [False]*(N+1)
    for i in range(M):
        if problems[p[i]]:
            continue
        
        if S[i] == "WA":
            penalty += 1
        else:
            ok += 1
            problems[p[i]] = True
    
    print(ok,penalty)
    return


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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# A happy new year, AtCoder !
N, M = map(int, input().split())
pS = [input().split() for _ in range(M)]

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

for i, (pi_str, Si) in enumerate(pS):
    pi = int(pi_str)
    if Si == 'AC':
        ac[pi - 1] = 1
    else:
        if ac[pi - 1] == 0:
            wa[pi - 1] += 1
        else:
            pass

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

Submission status: Wrong Answer

Solution code:
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep = ' ', end = '\n'):
    print(*var, file=sys.stderr, end = end, sep = sep)

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, m = I()

a = [0] * (n + 1)
b = [0] * (n + 1)

for i in range(m):
    p, v = input().split()
    p = int(p)
    if b[p] == 0 and v == 'WA':
        a[p] += 1
    elif b[p] == 0 and v == 'AC':
        b[p] = 1

print(sum(b), sum(a))

Submission status: Wrong Answer

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

pS = [input().split() for _ in range(M)]

ac = set()
penalty = 0
for p, S in pS:
    if p not in ac:
        if S == "AC":
            ac.add(p)
        else:
            penalty += 1

print(len(ac), penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = {i: [0, 0] for i in range(1, N + 1)}

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and PS[p][0] == 0:
        PS[p][0] += 1
    else:
        if PS[p][0] == 0:
            PS[p][1] += 1

ac_num = sum([PS[i][0] for i in range(1, N + 1)])
wc_num = sum([PS[i][1] for i in range(1, N + 1)])
print(ac_num, wc_num)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pen = [0] * N
AC = [False] * N
for _ in range(M):
    p, s = input().split()
    if s == "AC": AC[int(p) - 1] = True
    else:
        if AC[int(p) - 1] == False : pen[int(p) - 1] += 1
ACcount = AC.count(True)
Pcount = sum(pen)
print(ACcount, Pcount)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    # n, k, m = map(int, input().split())
    # a = list(map(int, input().split()))
    # if sum(a) / (n - 1) >= m:
    #     print(0)
    #     exit()
    
    # ans = n * m - sum(a)
    # if ans > k:
    #     print(-1)
    # else:
    #     print(ans)
    
    n, m = map(int, input().split())
    ps = [list(input().split()) for i in range(m)]

    c = 1
    ac, wa = 0, 0
    d = defaultdict(int)
    for i in range(m):
        if ps[i][1] == "AC" and d[int(ps[i][0])] == 0:
            ac += 1
            d[int(ps[i][0])] = 1
        elif ps[i][1] == "WA" and d[int(ps[i][0])] == 0:
            wa += 1
    print(ac,wa)
            
                

        




    


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
li=[0]*(n+1)
ac=wa=0
for _ in range(m):
  x,y=input().split()
  x=int(x)
  if y=="AC":
    if li[x]!=1:
      li[x]=1
      ac+=1
  else:
    if li[x]!=1:
      wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
PS = []
AC_counter = [0 for i in range(N)]
WA_counter = [0 for i in range(N)]
for i in range(M):
    p,s = input().split()
    p = int(p)-1
    if s == 'AC':
        AC_counter[p] = 1
    else:
        if AC_counter[p] == 0:
            WA_counter[p] += 1
print(sum(AC_counter),sum(WA_counter))

Submission status: Wrong Answer

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

cnt = [0] * (N+1)
flg = [0] * (N+1)
cnt_AC = 0
for i in range(M):
	cp = p[i]
	if flg[cp] == 1:
		continue
	else:
		if s[i] == 'AC':
			cnt_AC += 1
			flg[cp] = 1
		else:
			cnt[cp] += 1
print(cnt_AC, end = " ")
print(sum(cnt))

Submission status: Wrong Answer

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

problem = [False] * n
count_wa = [0] * n


for _ in range(m):
    num, res = input().split()
    num = int(num) - 1

    if res == 'AC':
        problem[num] = True

    else:
        if problem[num] == False:
            count_wa[num] += 1
        else:
            continue

print(sum(problem), sum(count_wa))

Submission status: Wrong Answer

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

D = [0] * N
cnt = 0
for p, S in ps:
  p = int(p) - 1
  if D[p] == 0:
    if S == "WA":
      cnt += 1
    else:
      D[p] = 1

print(sum(D), cnt)

Submission status: Wrong Answer

Solution code:

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

flag = [True] * N
wa = [0] * N

for i in range(M):

    p,s = input().split()
    p = int(p)
    p -= 1

    if s == "WA":

        if flag[p]:
            wa[p] += 1

    if s == "AC":

        flag[p] = False

ac = 0
for i in range(N):
    if not flag[i]:
        ac += 1

print (ac,sum(wa))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=[0]*(n+1)
t=[0]*(n+1)
for i in range(m):
    a,b=map(str,input().split())
    a=int(a)
    if not s[a]:
        if b=="WA":
            t[a]+=1
        else:
            s[a]=1
print(sum(s),sum(t))

Submission status: Wrong Answer

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

for i in range(m):
    a, b = input().split()
    a = int(a) - 1
    l[a].append(b)

ac = 0
wa = 0

for i in range(n):
    f = False
    for j in range(len(l[i])):
        if l[i][j] == 'AC':
            if f:
                pass
            else:
                ac += 1
                f = True
        else:
            if f:
                pass
            else:
                wa += 1

print(ac, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ac = [0]*N
wa = 0
for i in range(M):
    p,s = input().split()
    p = int(p)-1
    if s == "AC":
        ac[p] = 1
    elif ac[p] == 0:
        wa += 1
    
print(sum(ac),wa,sep=" ")

Submission status: Wrong Answer

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

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

print(n-ac.count(0), sum([wa[i] for i in range(n) if ac[i] >= 1]))

Submission status: Wrong Answer

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

N, M = map(int, input().split())
P = [0]*(N+1)
Q = [0]*(N+1)

for _ in range(M):
    f, b = map(str, input().rstrip().split())
    a = int(f)
    if b == "WA":
        if not Q[a]:
            P[a] += 1
    else:
        Q[a] = 1

print(sum(Q), sum(P))

Submission status: Wrong Answer

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

f = [0]*N
pena = 0
for ps in PS:
    p,s = ps
    p = int(p)
    s = str(s)
    if f[p-1] == 0:
        if s == "AC":
            f[p-1] = 1
        else:
            pena+=1
print(sum(f),pena)

Submission status: Wrong Answer

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

n_ac = [0] * n
n_wa = [0] * n
for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == 'AC':
        n_ac[p] += 1
    elif n_ac[p] == 0:
        n_wa[p] += 1

print(len(list(filter(lambda x: x > 0, n_ac))), sum(n_wa))

Submission status: Wrong Answer

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

print(sum(ACflags), sum(WAcounts))

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

N,M = m()

c = [0 for i in range(N)]
ca = [0 for i in range(N)]
cw = [0 for i in range(N)]


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

print(sum(ca),sum(cw))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
a=b=0
n,m=map(int,input().split())
ans=[0]*n
for i in range(m):
	p,s=input().rstrip().split()
	p=int(p)
	if ans[p-1]==0:
		if s=="AC":
			a+=1
			ans[p-1]=1
		else:
			b+=1
print(a,b)

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
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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

N, M = MAP()
p = [0]*M
S = [""]*M
for i in range(M):
	p[i], S[i] = input().split()
	p[i] = int(p[i])

ac = 0
wa = 0
dic = defaultdict(int)
for i in range(M):
	if S[i] == "AC":
		if dic[p[i]] == -1:
			continue
		ac += 1
		wa += dic[p[i]]
		dic[p[i]] = -1
	else:
		dic[p[i]] += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
_set = set()
ac = 0
wa = 0
for i in range(m):
    p, s = [i for i in sys.stdin.readline().split()]
    if s == "AC":
        if p not in _set:
            _set.add(p)
            ac += 1
    else:
        if p not in _set:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

    cnt = [0] * n
    not_solved = [True] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if s == 'AC':
            if not_solved[p]:
                not_solved[p] = False
        else:
            if not_solved[p]:
                cnt[p] += 1

    print(n - sum(not_solved), sum(cnt))


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()

# int(input())
# map(int, input().split())

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = [0 for i in range(n)]
a = 0
b = 0
for i in range(m):
  s,t = map(str,input().split())
  if ac[int(s)-1] == 0:
    if t == "WA":
      b += 1
    else:
      a += 1
      ac[int(s)-1] = 1
print(a,b)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
alist=[0]*n
pena=0
ok=0

for i in range(m):
    p, s =input().split()
    toi=int(p)-1
    if s=='AC':
        if alist[toi]!=1:
            alist[toi]=1
            ok+=1
    else:
        if alist[toi]!=1:
            pena+=1

print(ok, pena)

Submission status: Wrong Answer

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

for _ in range(M):
    p,S = input().split()
    p = int(p)-1
    if not AC[p]:
        if S == 'AC':
            AC[p] = 1
        else:
            WA[p] += 1
    else:
        continue
print(sum(AC),sum(WA))

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n,m=MI()
    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 not ac[p]:
                wa+=1
    print(sum(ac),wa)

main()

Submission status: Wrong Answer

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

N, M = map(int, input().split())
is_AC = [False]*N
pena = [0]*N

for _ in range(M):
    pi, si = input().split()
    pi = int(pi)
    
    if si=='AC':
        is_AC[pi-1] = True
    else:
        if is_AC[pi-1]:
            continue
        else:
            pena[pi-1] += 1

ans0 = is_AC.count(True)
ans1 = sum(pena)

print(ans0, ans1)

Submission status: Wrong Answer

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

problems = [False]*N
AC = 0
WA = 0
for p, S in pS:
    p = int(p)
    if problems[p-1] == True:
        continue
    else:
        if S == "AC":
            problems[p-1] = True
            AC += 1
        else:
            WA += 1
print(AC, 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 not ac[p]:
        if s=="AC": ac[p] = 1
        else: wa[p] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
def main():

    N, M = map(int, input().split())
    solved = [0 for _ in range(N)]
    penal = 0
    for _ in range(M):
        p, S = input().split()
        p = int(p)
        if S == "AC":
            solved[p-1] = 1
        else:
            if solved[p-1] == 0:
                penal += 1
    return " ".join(map(str, [sum(solved), penal]))

if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

a = [0 for _ in range(n)]
b = [False for _ in range(n)]

ac_count = 0

for _ in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not b[p-1]:
        a[p-1] += 1
    elif s == 'AC' and not b[p-1]:
        ac_count += 1
        b[p-1] = True

print(ac_count,sum(a))

Submission status: Wrong Answer

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

ans = 0
flag = [0] * n

for _ in range(m):
    P, s = input().split()
    p = int(P) - 1
    if s == 'AC':
        flag[p] = 1
    elif flag[p] == 0:
        ans += 1

print(flag.count(1), ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
t = [0] * (N + 1)
vis = set()
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if p in vis: continue
  if s == "AC":
    vis.add(p)
  else:
    t[p] += 1
print(len(vis), sum(t))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

acs = set()
ac = pena = 0
for p,s in ps:
    if p in acs: continue
    if s=='AC':
        acs.add(p)
        ac += 1
    else:
        pena += 1
print(ac, pena)

Submission status: Wrong Answer

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

memo = {}
wa = 0
ans = 0
for i in range(m):
    num, name = info[i]
    num = int(num)
    if num not in memo:
        if name == "AC":
            memo[num] = 1
            ans += 1
        else:
            wa += 1
print(ans, wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

ac, wa = 0, 0
solved = defaultdict(int)

for p, S in pS :
  if solved[p] == 1 :
    continue
    
  if S == 'WA' :
    wa += 1
    
  else :
    ac += 1
    solved[p] = 1
    
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
l = [0] * n
f = [True] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'WA':
        if f[p]:
            l[p] += 1
    else:
        f[p] = False
print(f.count(False), sum(l))

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    AC=set()
    WA=defaultdict(int)
    ans = 0
    for _ in range(M):
        p,s = ST().split()
        if s=="AC":
            if s in AC:
                continue
            ans += WA[p]
            AC.add(p)
        else:
            WA[p]+=1
    print(len(AC),ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, M = read_ints()
flgs = [False] * N  # N問をACしたか
n_ac = 0
n_wa = 0
for m in range(M):
    p, s = input().split()
    p = int(p) - 1
    if flgs[p]:
        continue
    elif s == 'AC':
        n_ac += 1
        flgs[p] = True
    elif s == 'WA':
        n_wa += 1

print(n_ac, n_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())
A = [False]*N
P = 0
for i in range(M):
  p, S = raw_input().split()
  p = int(p)-1
  if S=="AC":
    A[p] = True
  else:
    if not A[p]:
      P += 1
print sum(A), P

Submission status: Wrong Answer

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

for _ in range(m):
  p, s = input().split()
  p = int(p) - 1
  if s == 'WA':
    if ac[p] == 0:
      pen[p] += 1
  else:
    ac[p] = 1
print(str(sum(ac)) + ' ' + str(sum(pen)))

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nas = lambda: list(map(str, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
aced = [0] * n
pen = 0
for i in range(m):
    p, s = nas()
    p = int(p)
    if s == "AC":
        aced[p-1] = 1
    else:
        if not aced[p-1]:
            pen += 1
print(sum(aced), pen)