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:
import collections
import sys
N,M = map(int,input().split())
P = []
S = []
for i in range(M):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)
if M == 0:
    print(0,0)
    sys.exit()
c = collections.Counter(P)
values, counts = zip(*c.most_common())
result = [0]*len(values)
penalty = 0
d  = dict(zip(values,result))
for i in range(M):
    if S[i] == 'WA' and d[P[i]] == 0:
        penalty += 1
    elif S[i] == 'AC':
        d[P[i]] = 1
sum = 0
for i in values:
    sum += d[i]

print(sum,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
#if 'AC':{1:-1}
#if 'WA'*2:{1:2}
problems = {}
correct = 0
penalty = 0
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
   
    if p not in problems.keys():
        if s == 'AC':
            problems[p] = -1
            correct += 1
        else: #if s == 'WA' and not ACed yet 
            problems[p] = 1
    else: 
        if s == 'AC' and problems[p] != -1: #first AC
            penalty += problems[p]
            problems[p] = -1
            correct += 1
        elif s == 'WA':
            problems[p] += 1
            
print(correct,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
#if 'AC':{1:-1}
#if 'WA'*2:{1:2}
problems = {}
correct = 0
penalty = 0
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if p not in problems.keys():
        if s == 'AC':
            problems[p] = -1
            correct += 1
        else: #if s == 'WA' and not ACed yet 
            problems[p] = 1
    else: 
        if s == 'AC' and problems[p] != -1: #first AC
            penalty += problems[p]
            problems[p] = -1
            correct += 1
        else:
            problems[p] += 1
            
print(correct,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
#if 'AC':{1:-1}
problems = {}
correct = 0
penalty = 0
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if p not in problems.keys():
        if s == 'AC':
            problems[p] = -1
            correct += 1
        else: #if s == 'WA' and not ACed yet 
            penalty += 1
    #else: pass #already ACed 
print(correct,penalty)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
charge=0
ans=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    charge+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
    ans+=1
    cnt+=charge
    charge=0
print(ans,cnt)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
ans=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
    ans+=1
print(ans,cnt)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[0])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[0])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[0])]!="A" and q[-2]=="W":
    dp[int(q[0])]="W"
    cnt+=1
  elif dp[int(q[0])]!="A" and q[-2]=="A":
    dp[int(q[0])]="A"
print(dp.count("A"),cnt)

Submission status: Wrong Answer

Solution code:
def main():
    n, m = [int(i) for i in input().strip().split()]
    accepted = set()
    ac = 0
    wa = 0
    for _ in range(m):
        p, s = input().strip().split()
        if int(p) in accepted:
            continue
        else:
            if s == "AC":
                accepted.add(int(p))
                ac += 1
            elif s == "WA":
                wa += 1
    print(ac, wa)

    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    n, m = [int(i) for i in input().strip().split()]
    mem = set()
    ac = 0
    wa = 0
    for _ in range(m):
        p, s = input().strip().split()
        if p in mem:
            continue
        else:
            if s == "AC":
                mem.add(p)
                ac += 1
            elif s == "WA":
                wa += 1
    print(ac, wa)

    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def solver():
    pass


def main():
    n, m = [int(i) for i in input().strip().split()]
    mem = set()
    ac = 0
    wa = 0
    for _ in range(m):
        p, s = input().strip().split()
        if p in mem:
            continue
        else:
            if s == "AC":
                mem.add(p)
            else:
                wa += 1
    ac = len(mem)
    print(ac, wa)

    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float("inf")


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    ac = [1 for _ in range(N)]
    wa = 0
    for x in zip(p, S):
        ac[x[0] - 1] &= x[1] == "WA"
        wa += ac[x[0] - 1]
    return f'{len(set(x[0] for x in zip(p,S) if x[1] == "AC"))} {wa}'


def main():

    sys.setrecursionlimit(10 ** 6)

    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)
    print(f"{solve(N, M, p, S)}")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def mapt(fn, *args):
    return tuple(map(fn, *args))

  
def main():
    n, m = mapt(int, input().split(" "))
    # if m == 0: print(0, 0); exit()
    ac = defaultdict(int)
    pena = 0
    for _ in range(m):
        index, symbol = input().split(" ")
        index = int(index)
        if ac[index]: continue

        if symbol == "AC": ac[index] = 1
        elif symbol == "WA": pena += 1
    print(len(ac), pena)

main()

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())
wac,acc = 0,0
S = set()
plb = 0
flag = False
for i in range(b):
    c,d = input().split()
    c = int(c)
    if c != plb and flag == False:
        flag = True
        plb = c
    if d == "WA" and flag == True and (c,d) not in S:
        wac +=1
    elif d == "AC":
        if (c,d) not in S:
            S.add((c,d))
            flag = False
            acc +=1
        else:
            flag = False
            S = set()
            plb = 0
            break
print(wac,acc)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def mapt(fn, *args):
    return tuple(map(fn, *args))


def main():
    n, m = mapt(int, input().split(" "))
    if m == 0: print(0, 0); exit()
    d = defaultdict(list)
    accounter = wacounter = 0
    for _ in range(m):
        index, symbol = input().split(" ")
        if "AC" in d[index]: continue
        d[index].append(symbol)
    for row in d.values():
        for i in row:
            if i == "WA": wacounter += 1
            else: accounter += 1
    print(accounter, wacounter)

main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter

def mapt(fn, *args):
    return tuple(map(fn, *args))

def main():
    n, m = mapt(int, input().split(" "))
    if m == 0: print(0, 0); exit()
    d = defaultdict(list)
    accounter = wacounter = 0
    for _ in range(m):
        index, symbol = input().split(" ")
        if "AC" in d[index]: continue
        d[index].append(symbol)
    # print(d)
    # print(accounter, wacounter)
    for row in d.values():
        for i in row:
            if i == "WA": wacounter += 1
            else: accounter += 1
    print(accounter, wacounter)

Submission status: Wrong Answer

Solution code:
def mapt(fn, *args):
    return tuple(map(fn, *args))
  

def main():
    n, m = mapt(int, input().split(" "))
    if m == 0: print(0, 0); exit()
    count = 1
    accounter = wacounter = 0
    data = [input().split(" ")for i in range(m)]
    print(data)
    for i in range(1, n+1):
        for index, symbol in data:
            if i != int(index): continue
            if int(index) == count and symbol == "AC":
                accounter += 1
                count += 1
            if int(index) == count and symbol == "WA":
                wacounter += 1
        count += 1
    print(accounter, wacounter)
main()

Submission status: Wrong Answer

Solution code:
number = list(map(int,input().split()))
prob = ['']*number[0]
ac = 0
wa = 0
for i in range(number[1]):
    word = list(map(str,input().split()))
    if word[1] == 'AC':
        prob[int(word[0])-1] += 'A'
    else:
        prob[int(word[0])-1] += 'W'
for j in range(number[0]):
    if len(prob[j]) != 0:
        for k in range(len(prob[j])):
            if prob[j][k] == 'W':
                wa += 1
            elif prob[j][k] == 'A':
                ac += 1
                break
            else:
                break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
number = list(map(int,input().split()))
prob = ['']*number[0]
ac = 0
wa = 0
for i in range(number[1]):
    word = list(map(str,input().split()))
    if word[1] == 'AC':
        prob[int(word[0])-1] += 'A'
    else:
        prob[int(word[0])-1] += 'W'
for j in range(number[0]):
    for k in range(len(prob[j])):
        if prob[j][k] == 'W':
            wa += 1
        elif prob[j][k] == 'A':
            ac += 1
            break
        else:
            break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
number = list(map(int,input().split()))
prob = ['']*number[0]
ac = 0
wa = 0
for i in range(number[1]):
    word = list(map(str,input().split()))
    if word[1] == 'AC':
        prob[int(word[0])-1] += 'A'
    else:
        prob[int(word[0])-1] += 'W'
for j in range(number[0]):
    for k in range(len(prob[j])):
        if prob[j][k] == 'W':
            wa += 1
        else:
            ac += 1
            break
print(ac,wa)

Submission status: Wrong Answer

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

for i in range(M):
    pS = list(input().split())
    if pS[1] == 'AC':
        if pS[0] not in yes:
            yes.append(pS[0])
    else:
        if pS[0] not in yes:
            no += 1
            

x = len(yes)

print(x, no)

Submission status: Wrong Answer

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

for i in range(M):
    pS = list(input().split())
    if pS[1] == 'AC':
        if pS[0] not in yes:
            yes.append(pS[0])
    else:
        if pS[0] not in yes:
            no.append(pS[0])
            

x = len(yes)
y = len(no)
print(x, y)

Submission status: Wrong Answer

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

yes = []
no = []


for i in A:
    if i[1] == 'AC':
        if i[0] not in yes:
            yes.append(i[0])
    else:
        if i[0] not in yes:
            no.append(i[0])

x = len(yes)
y = len(no)
print(x, y)

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,m = inpm()

P = []
S = []
for i in range(m):
    tmp = input().split()
    P.append(int(tmp[0]))
    S.append(tmp[1])

AC = [0]*100001
WA = [0]*100001

for i in range(m):
    if S[i] == 'AC':
        AC[P[i]] = 1
    elif S[i] == 'WA' and AC[P[i]] != 1:
        WA[P[i]] += 1

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, M = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    S = tuple(tuple(input().split()) for i in range(M)) #改行行列
    l=[0]*N
    wa=0
    for p,s in S:
        p=int(p)-1
        if s=="AC":
            l[p]=1
        else:
            if not l[p]:
                wa+=1
    print(sum(l),wa)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans, pen = 0, 0
for i in range(n):
    if ac[i]:
        ans += 1
        pen += wa[i-1]
print(ans, pen)

Submission status: Wrong Answer

Solution code:
N=list(map(int,input().split()))
ac=0
wa=0
lis=[]
for i in range(N[1]):
  p=input().split()
  a=int(p[0])
  if a in lis:
    continue
  elif p[1]=="AC":
    lis.append(a)
    ac+=1
  elif p[1]=="WA":
    wa+=1
L=[str(ac),str(wa)]
print(' '.join(L))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0 for i in range(n)]
penalty=0
acc=0
for i in range(m):
  a,b=input().split()
  a=int(a)
  a-=1

  if (p[a]==0 or p[a]=='WA') and b=='AC':
    acc+=1
    p[a]='AC'
  elif (p[a]==0 or p[a]=='WA') and b=='WA':
    penalty+=1
    p[a]='WA'

print(acc,penalty)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[[0,0] for _ in range(n+1)]
x=[]
for i in range(m):
    x.append(list(input().split()))
    x[i][0]=int(x[i][0])
for i in range(m):
    if x[i][1]=="AC":
        a[x[i][0]][1]=1
    else:
        if a[x[i][0]][1]==1:
            continue
        else:
            a[x[i][0]][0]+=1
c=0
d=0
for i in range(1,n+1):
    c+=a[i][0]
    d+=a[i][1]
print(d,c)

Submission status: Wrong Answer

Solution code:

n, m = (int(x) for x in input().split())

# 0 = まだACなし, 1 = AC済み
ans_list = [0] * (n + 1)

ans = 0
penalty = 0

for id in range(m):
    # listを紐付けて要素を抜き出すことができる
    query = list(map(str, input().split()))
    # ACだった場合
    if query[1] == 'AC':
        if ans_list[int(query[0])] == 0 :
            ans_list[int(query[0])] = 1
            ans += 1
    # WAだった場合 
    else:
        if ans_list[int(query[0])] == 0 :
            penalty += 1

print("{0} {1}".format(ans, penalty))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[list(input().split()) for _ in range(m)]
for i in range(m):
    a[i][0]=int(a[i][0])
a.sort(key=lambda x:x[0])
b=set()
WA=0
count=0
for i in range(m):
    if a[i][1]=="WA":
        count+=1
    else:
        if a[i][0] in b:
            count=0
            continue
        else:
            b.add(a[i][0])
            WA+=count
            count=0
print(len(b),WA)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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
WA = [0]*N

for i in range(M):
    if AC[P[i]-1] == 0:
        if S[i] == 'WA':
            WA[P[i]-1] += 1
        else:
            AC[P[i]-1] += 1

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

N, M = map(int, input().split())
ans = []
AC_cnt = 0

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

    if _ == 0:
        prev_p = int(p)

    if int(p) != prev_p:
        AC_cnt = 0

    if AC_cnt == 0:
        ans.append(s)

    if s == 'AC':
        AC_cnt += 1    

    prev_p = int(p)

cnt = Counter(ans)

print(cnt['AC'], cnt['WA'])

Submission status: Wrong Answer

Solution code:
from collections import Counter

N, M = map(int, input().split())
ans = []
chk = 0
for _ in range(M):
    p, s = input().split()
    if _ == 0:
        ind = int(p)
    intp = int(p)

    # reset chk when next index
    if intp != ind:
        chk = 0
    
    # Add data only when chk = 0
    if chk == 0:
        ans.append(s)

    # chk = 1 when first 'AC' 
    if intp == ind and s == 'AC':
        chk = 1


    
    ind = intp
        

cnt = Counter(ans)

print(cnt['AC'], cnt['WA'])

Submission status: Wrong Answer

Solution code:
from collections import Counter

N, M = map(int, input().split())
ans = [[] for _ in range(N)]
chk = 0
for _ in range(M):
    p, s = input().split()
    if _ == 0:
        ind = int(p)
    intp = int(p)

    # reset chk when next index
    if intp != ind:
        chk = 0
    
    # Add data only when chk = 0
    if chk == 0:
        ans[intp-1].append(s)

    # chk = 1 when first 'AC' 
    if intp == ind and s == 'AC':
        chk = 1


    
    ind = intp
        

cnt = Counter(sum(ans, []))

print(cnt['AC'], cnt['WA'])

Submission status: Wrong Answer

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

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
a = [False] * N
w = [0] * N
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        a[int(p)-1] = True
    elif not a[int(p)-1]:
        w[int(p)-1] += 1
print(a.count(True), sum(w))

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    P = [0] * M
    S = [""] * M
    for i in range(M):
        PS = input().split()
        P[i], S[i] = int(PS[0]), PS[1]

    AC = [False] * (N + 1)
    n_AC = 0
    n_WA = 0
    for p, s in zip(P, S):
        if AC[p]:
            continue
        if s == "AC":
            n_AC += 1
            AC[p] = True
        else:
            n_WA += 1

    print(n_AC, n_WA)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans = [[] for i in range(N)]
WA, AC = 0, 0
for p, S in zip(p, S):
    if ans[p - 1].count("AC") != 0:
        pass
    else:
        ans[p - 1].append(S)
        if S == "WA":
            WA += 1
        if S == "AC":
            AC += 1

print(AC, WA)

Submission status: Wrong Answer

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

ans = [[] for i in range(N)]

for p, S in zip(p, S):
    if ans[p - 1].count("AC") != 0:
        pass
    else:
        ans[p - 1].append(S)

WA = 0
AC = 0
for ans in ans:
    WA += ans.count("WA")
    AC += ans.count("AC")
print(AC, WA)

Submission status: Wrong Answer

Solution code:
line1 = input()
aryLine1 = line1.split()

N = int(aryLine1[0])
M = int(aryLine1[1])

ans_ac = 0
ans_pt = 0
acdict = {}

for i in range(0, M):
    line = input()
    aryLine = line.split()
    p = aryLine[0]
    S = aryLine[1]
    if S == "AC":
        if acdict.get(p) is None:
            acdict[p] = "1"
            ans_ac = ans_ac + 1
    else:
        if acdict.get(p) is None:
            ans_pt = ans_pt + 1
    #print(acdict)
    #print(str(ans_ac) + " " + str(ans_pt))

print(str(ans_ac) + " " + str(ans_pt))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pd=[0 for i in range(1,N+1)]
CA = 0
IA = 0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        CA += 1
        pd[p-1] = CA
    else:
        if pd[p-1] == 0:
            IA += 1
a = pd.count(0)

print(N-a, IA)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pd=[0 for i in range(1,N+1)]
CA = 0
IA = 0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        CA += 1
        pd[p-1] = CA
    else:
        if pd[p-1] == 0:
            IA += 1
a = pd.count(0)

print(N-a, IA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
corret_list = [0] * (N+1)
true_ans = 0
penalty = 0
for i in range(M):
    P, S = input().split()
    P = int(P)
    if S == 'AC':
        if corret_list[P] == 0:
            true_ans += 1
            corret_list[P] = 1
            continue
        else:
            continue
    else:
        if corret_list[P] == 0:
            penalty += 1
            continue
print(true_ans,penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*(10**5)
for _ in range(m):
	a, b = input().split()
	if check[int(a)]==0:
		if b == "WA":
			wa+=1
		else:
			ac+=1
			check[int(a)]=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*10**5
for _ in range(m):
	a, b = input().split()
	if check[int(a)]==0:
		if b == "WA":
			wa+=1
		else:
			ac+=1
			check[int(a)]=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
flag=0
for _ in range(m):
	a, b = input().split()
	if flag == 0:
		if b == "WA":
			wa+=1
		else:
			ac+=1
			flag=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check=0
for _ in range(m):
    a, b = input().split()
    if int(a) != check:
      if b =="WA":
          wa+=1
      else:
          ac+=1
          check=int(a)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check=0
for _ in range(m):
    a, b = input().split()
    if int(a) == check:
      if b =="WA":
          wa+=1
      else:
          ac+=1
          check=int(a)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
wa=0
ac=0
check=[]
for _ in range(m):
    a, b = input().split()
    if int(a) not in check:
      if b =="WA":
          wa+=1
      else:
          ac+=1
          check.append(int(a))
print(ac,wa)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    a = [input().split() for _ in range(M)]
    ac_count = [0] * (N + 1)
    wa_count = defaultdict(lambda:0)
    ac, wa = 0, 0

    for q_no, ans in a:
        if ac_count[int(q_no)] == 0:
            if ans == "AC":
                ac_count[0] = 1
                ac += 1
                wa += wa_count.get(q_no, 0)
            else:
                wa_count[q_no] += 1
    
    print(ac, wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    a = [input().split() for _ in range(M)]
    fin = []
    ac, wa = 0, 0

    for q_no, ans in a:
        if q_no not in fin:
            if ans == "AC":
                fin.append(q_no)
                ac += 1
            else:
                wa += 1
    
    print(ac, wa)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for _ in range(m)]
wa=0
ac=0
d=[0]*n
for p,s in ps:
  if s=='WA':
    if d[int(p)-1]==0:
      wa+=1
  else:
    if d[int(p)-1]==0:
      ac+=1
      d[int(p)-1]=1
print(ac,wa)

Submission status: Wrong Answer

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

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        answa += 1
    elif S[i] == 'AC':
        ansac += 1
        pen += answa
        answa = 0
        flg[p[i]-1] = 1

print(ansac, pen)

Submission status: Wrong Answer

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

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        answa += 1
    elif S[i] == 'AC':
        ansac += 1
        pen += answa
        flg[p[i]-1] = 1

print(ansac, pen)

Submission status: Wrong Answer

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

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        answa += 1
    elif S[i] == 'AC':
        ansac += 1
        pen = answa
        flg[p[i]-1] = 1

print(flg.count(1), pen)

Submission status: Wrong Answer

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

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 1:
        continue
    if S[i] == 'WA':
        answa += 1
    elif S[i] == 'AC':
        ansac += 1
        pen = answa
        flg[p[i]-1] = 1

print(ansac, pen)

Submission status: Wrong Answer

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

ansac = answa = pen = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 0:
        if S[i] == 'WA':
            answa += 1
        elif S[i] == 'AC':
            ansac += 1
            pen = answa
            flg[p[i]-1] = 1

print(ansac, pen)

Submission status: Wrong Answer

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

ansac = answa = 0
flg = [0] * N

for i in range(M):
    if flg[p[i]-1] == 0:
        if S[i] == 'WA':
            answa += 1
        elif S[i] == 'AC':
            ansac += 1
            flg[p[i]-1] = 1

print(ansac, answa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
S = ['a'] * M

ansac = answa = 0
flg = [0] * N

for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])
    if flg[p[i]-1] == 0:
        if S[i] == 'WA':
            answa += 1
        elif S[i] == 'AC':
            ansac += 1
            flg[p[i]-1] = 1

print(ansac, answa)