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())
L = []
ac = []
wa = []

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

for i in range(M):
    if L[i][1] == 'AC' and ((int(L[i][0]) not in ac) == True):
        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(ac), len(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 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))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
status = {}
pen_count = {}

for i in range(M):
    p, S = input().split()
    p = int(p)
    if status.get(p) == None:
        status[p] = S
        if S == "WA":
            pen_count[p] = 1
        else:
            pen_count[p] = 0
    elif status[p] == 'WA':
        status[p] = S
        if S == "WA":
            pen_count[p] += 1
    else:
        pass

# print(dic, dic2)

AC = list(status.values()).count("AC")
penalty = sum(list(pen_count.values()))
print(AC, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
dic = {}
dic2 = {}

for i in range(M):
    p, S = input().split()
    p = int(p)
    if dic.get(p) == None:
        dic[p] = S
        dic2[p] = 1
    elif dic[p] == 'WA':
        dic[p] = S
        dic2[p] += 1
    else:
        pass

# print(dic, dic2)

AC = list(dic.values()).count("AC")
submit_count = sum(list(dic2.values())) - AC
print(AC, submit_count)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
d = {'AC':0,'WA':0,}
b = 0
for i in range(N + 1):
  d[i] = 0
for j in range(M):
  p,s = input().split()
  p = int(p)
  if s == 'AC':
    if d[p] != -1:
      b = d[p]
      d[p] = -1
      d['AC'] += 1
      d['WA'] += b
      b = 0  
  if s == 'WA':
    if d[p] != 10**10:
       d[p] += 1
print(d['AC'],end = ' ')
print(d['WA'])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
def main():
    n, m = map(int, input().split(" "))
    d = defaultdict(lambda:"")
    cnt_p=0
    cnt_ca=0
    for i in range(m):
        p,s = input().split(" ")
        if d[p] == "":
            if s == "AC":
                d[p] = 1
                cnt_ca += 1
            else:
                cnt_p += 1
    print(f"{cnt_ca} {cnt_p}")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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

flag = [0]*(n+1)
AC = 0
WA = 0
for i in range(m):
    if flag[int(ps[i][0])] == 1:
        continue

    if ps[i][1] == 'WA':
        WA += 1
    else:
        AC += 1
        flag[int(ps[i][0])] = 1

print(AC,end = " ")
print(WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count1 = 0
count2 = 0
lis = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    count2 += 1
  elif lis[p-1] == 0 and S == "AC":
    count1 += 1
    lis[p-1] = 1
  elif lis[p-1] == 1 and S == "WA":
    continue
  elif lis[p-1] == 1 and S == "AC":
    continue
print(str(count1) + " " + str(count2))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count1 = 0
count2 = 0
n = 1
AC_check = False
lis = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    count2 += 1
  elif lis[p-1] == 0 and S == "AC":
    count1 += 1
    lis[p-1] = 1
print(str(count1) + " " + str(count2))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count = 0
n = 1
AC_check = False
lis = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    count += 1
  elif lis[p-1] == 0 and S == "AC":
    lis[p-1] = 1
print(count)

Submission status: Wrong Answer

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

c = [0] * n
wa = 0
ac = 0
for p, s in ps:
    if c[int(p)-1] == 0:
        if s == 'WA':
            wa += 1
        else:
            ac += 1
            c[int(p)-1] = 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = [int(i) for i in input().split()]
    ans = set()
    pen = 0
    arr = [0] * N
    for _ in range(M):
        p, s = input().split()
        if s == 'AC':
            ans.add(int(p))
            pen += arr[int(p) - 1]
        if s == 'WA':
            arr[int(p) - 1] += 1
    print(f'{len(ans)} {pen}')

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
acli = [0]*n
wali = [0]*n
acsi = 0
wasi = 0
for i in range(m):
    p,s = map(str,input().split())
    if acli[int(p)-1] == 0:
        if s == 'AC':
            acli[int(p)-1] = 1
            acsi += 1
        elif s == 'WA':
            wali[int(p)-1] = 1
for j in range(n):
    if acli[j] == 1 and wali[j] != 0:
        wasi += wali[j]
print(acsi,wasi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
flg = [0]*n
ac = 0
pe = 0

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, M = map(int, input().split())
wa = defaultdict(int)
ac = {}
for i in range(M):
    p, S = input().split()
    if S == 'AC':        
        ac[p] = True
    else:
        if p not in ac:
            wa[p] += 1
print(len(ac), sum(wa.values()))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
results = [0 for _ in range(N+1)]
wa_cnt = 0
ac_cnt = 0
for _ in range(M):
  problem, result = input().split()
  if results[int(problem)] == 0 and result == 'AC':
    ac_cnt += 1
    results[int(problem)] = 1
  elif results[int(problem)] == 0 and result == 'WA':
    wa_cnt += 1
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

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

    n,m=map(int, readline().rstrip().split())

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

    for i in range(m):
        p,s=readline().rstrip().split()
        p=int(p)-1
        if s=="AC":
            ac[p]=1
            continue
        if ac[p]==0:
            wa[p]+=1
    
    print(sum(ac),sum(wa))

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
ck = set()
pe = 0
ac = 0
penalty = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if p in ck:
        continue

    if s == 'WA':
        pe += 1
    else:
        penalty += pe
        pe = 0
        ac += 1
        ck.add(p)

print(ac, penalty)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dic
n, m = map(int, input().split())
ac = 0
pena = 0
d = dic(list)
for i in range(m):
    pi, si = input().split()
    d[pi].append(si)


print(d)
for (k, v) in d.items():
    pe = 0
    flag = False
    for aw in v:
        if aw == 'WA':
            pe += 1
        else:
            ac += 1
            flag = True
            break

    if flag:
        pena += pe

print(ac, pena)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
num_AC,num_WA = 0,0
res = [list(input().split()) for i in range(M)]
check = ['v']*N
for i,j in res:
  i = int(i)
  if check[i-1] == 'v':
    if j == 'WA':
      num_WA += 1
    if j == 'AC':
      num_AC += 1
      check[i-1] = '.'
print(num_AC,num_WA)

Submission status: Wrong Answer

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

for m in range(M):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC' and ac[p] == 0:
        ac[p] += 1
    elif s == 'AC' and ac[p] != 0:
        ac = ac
    elif s == 'WA' and wa[p] == 0:
        wa[p] += 1
    elif s == 'WA' and wa[p] != 0:
        wa = wa

print(ac.count(1), wa.count(1))

Submission status: Wrong Answer

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

for m in range(M):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC' and ac[p] == 0:
        ac[p] += 1
    elif s == 'WA' and wa[p] == 0:
        wa[p] += 1
print(ac.count(1), wa.count(1))

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())
AC = [False]*N
WA_count = 0
AC_count = 0

for i in range(M):
  p,S = (y for y in input().split())
  if AC[int(p)-1] == False:
    if S == 'AC':
      AC[int(p)-1] = True
      AC_count += 1
    else:
      WA_count += 1

print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[0]*(n+1)
miss=[0]*(n+1)
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if l[p]==0:
        if s=='AC':
            l[p]+=1
        else:
            miss[p]+=1
a=l.count(1)
b=sum(miss)
print(a,b)

Submission status: Wrong Answer

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

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

p_state = [0 for i in range(N)]
pena = 0
ans = 0

for i in range(M):
    if p_state[p_list[i]-1] == 0 and s_list[i] == "WA":
        pena += 1
    elif p_state[p_list[i]-1] == 0 and s_list[i] == "AC":
        p_state[p_list[i]-1] = 1
        ans += 1
    else:
        continue

print(ans, pena)

Submission status: Wrong Answer

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

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ac_cnt[p] == 0:
    if S == "WA":
      wa_cnt[p] += 1
    else:
      ac_cnt[p] += 1
    
print(sum(ac_cnt), sum(wa_cnt))

Submission status: Wrong Answer

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

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ac_cnt[p] == 0 and S == "WA":
    wa_cnt[p] += 1
    
  elif ac_cnt[p] == 0 and S == "AC":
    ac_cnt[p] += 1
    
print(sum(ac_cnt), sum(wa_cnt))

Submission status: Wrong Answer

Solution code:
P,N = map(int,input().split())
dac = {}
dwa = {}
for _ in range(N):
  p,s = input().split()
  if s == "AC":
    if p not in dac:
      dac[p] = 1
  else:
    if p not in dac:
      if p not in dwa:
        dwa[p] = 1
      else:
        dwa[p] += 1

score = len(dac)
penalty = sum([val for i,val in dwa.items()])
print(score,penalty)

Submission status: Wrong Answer

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

for i in range(M):
    P, S = map(str, input().split())
    P = int(P)-1
    if ac[P] != 1 and S == "AC":
        wa += abs(ac[P])
        ac[P] = 1
    elif ac[P] != 1 and S == "WA":
        ac[P] -= 1
    print(ac.count(1), wa)
    print(ac)
    print(wa)

Submission status: Wrong Answer

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

for i in range(m):
    p,s = input().split()
    p = int(p)-1

    if not AC[p]:
        if s == 'WA':
            WA += 1
        else:
            AC[p] = True


print(AC.count(True),WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A, W = [], []
num, j = 0, 0

for i in range(M):
    P, S = map(str, input().split())
    if P not in A:
        if S == "AC":
            A.append(P)
            num += W.count(j)
            j += 1
        else:
            W.append(j)

print(len(A), num)

Submission status: Wrong Answer

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

for i in range(M):
    P, S = map(str, input().split())
    if P not in A:
        if S == "AC":
            A.append(P)
        else:
            W.append(0)

print("{} {}".format(len(A), len(W)))

Submission status: Wrong Answer

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

for i in range(M):
    P, S = map(str, input().split())
    P = int(P)
    if x[P-1] == 0 and S == "AC":
        x[P-1] = 1
    elif x[P-1] == 0 and S == "WA":
        cnt += 1

print("{} {}".format(x.count(1), cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
x = []
Pena, OK = 0, 0

for i in range(M):
    P, S = map(str, input().split())
    if int(P) not in x:
        if S == "AC":
            OK += 1
            x.append(int(P))
        else:
            Pena += 1

print("{} {}".format(OK, Pena))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
x = [i for i in range(1, N+1)]
Pena, OK = 0, 0

for i in range(M):
    P, S = map(str, input().split())
    if int(P) in x:
        if S == "AC":
            OK += 1
            x[int(P)-1] = 0
        else:
            Pena += 1

print("{} {}".format(OK, Pena))

Submission status: Wrong Answer

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

ok = [False]*N
wa = [0]*N

for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if ok[p] == False:
        if S == "WA":
            wa[p] += 1
        else:
            ok[p] = True
    else:
        pass
pena = 0
for i in wa:
    pena += i
print(sum(ok), pena)

Submission status: Wrong Answer

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

AC = [0 for i in range(N+1)]
WA = [0 for i in range(N+1)]

for i in range(M):
    a,b=input().split()
    a2 = int(a)
    if b == 'AC':
      AC[a2 - 1] = 1
    elif b == 'WA' and AC[a2 - 1] == 0:
      WA[a2-1]+= 1
    
print(sum(AC), 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):
    a,b=input().split()
    a2 = int(a)
    if b == 'AC':
      AC[a2 - 1] = 1
    elif b == 'WA' and AC[a2 - 1] == 0:
      WA[a2-1]+= 1
    
print(sum(AC), sum(WA))

Submission status: Wrong Answer

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

list = []
clear = []
ac = 0
wa = 0
for i in range(M):
    a,b=input().split()
    if a not in clear:
      if b == 'AC':
        ac = 1
        clear.append(a)
      elif b != 'AC':
        wa += 1
    
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

list = []
clear = []
ac = 0
wa = 0
for i in range(M):
    a,b=input().split()
    if a not in clear:
      if b == 'AC':
        ac += 1
        clear.append(a)
      elif b != 'AC':
        wa += 1
    
print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[0]*(n+1)
w=0
a=0
for i in range(m):
  p,c=input().split()
  if c=='AC' and ac[int(p)]==0:
    ac[int(p)]=1
    a+=1
  elif c=='WA' and ac[int(p)]==0:
    w+=1
print(a,w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=[]
w=0
a=0
for i in range(m):
  p,c=input().split()
  if c=='AC' and p not in ac:
    ac.append(p)
    a+=1
  elif c=='WA' and p not in ac:
    w+=1
print(a,w)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p_S = [input().split() for _ in range(M)]
 
AC = [0]*N
WA = [0]*N
 
# i番目の提出において、
# (1) まだACされておらず、提出がWAだった場合：WA += 1
# (2) まだACされておらず、提出がACだった場合：AC += 1 
# (3) すでにACされている場合：何もしない
for i in range(M):    
  num = int(p_S[i][0])-1
  if AC[num] == 0 and p_S[i][1] == 'WA': WA[num] += 1
  elif AC[num] == 0 and p_S[i][1] == 'AC': AC[num] = 1
  else: continue

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    pi,si=input().split()
    p[i]=int(pi)
    s[i]=si
judge=[0]*(n+1)
ac=0
wa=0
for i in range(m):
    if judge[p[i]]==0:
        if s[i]=='WA':
            wa+=1
        else:
            judge[p[i]]=1
            ac+=1
print(ac,wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ansct=0
ansflag=[0]*n
missct=0
for i in range(m):
    p,s=map(str,input().split())
    if (s=='AC')and(ansflag[int(p)-1]==0):
        ansflag[int(p)-1]=1
        ansct+=1
    elif ansflag[int(p)-1]==0:
        missct+=1
print(str(ansct)+' '+str(missct))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import sys
n,m=map(int,input().split())
ans=[]
penalty=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA" and (p not in ans):
        penalty+=1
    elif s=="WA" and (p in ans):
        continue
    elif s=="AC" and (p not in ans):
        ans.append(p)
    elif s=="AC" and (p in ans):
        continue
print(len(ans),penalty)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import sys
n,m=map(int,input().split())
ans=[]
penalty=0
ok=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA" and (p not in ans):
        penalty+=1
    elif s=="WA" and (p in ans):
        continue
    elif s=="AC" and (p not in ans):
        ans.append(p)
        ok+=1
    elif s=="AC" and (p in ans):
        continue
print(ok,penalty)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import sys
n,m=map(int,input().split())
ans=[]
penalty=0
ok=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        if p not in ans:
            penalty+=1
    else:
        ans.append(p)
        if ans.count(p)==1:
            ok+=1
print(ok,penalty)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans_list = [False for _ in range(n+1)]
ac=0
pe=0
for _ in range(m):
    p,s = input().split()
    if not ans_list[int(p)]:
        if s == 'AC':
            ac+=1
            ans_list[int(p)]=True
        else:
            pe+=1
print(ac,pe)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(M):
  j = li[i][0] - 1
  if ac[j] == 0 and li[i][1] == "AC":
    ac[j] = 1
    continue
  if ac[j] == 1 and li[i][1] == "WA":
    wa[j] += 1

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

Submission status: Wrong Answer

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

ac = []
wa = [0] * N

for i in range(M):
  j = li[i][0] - 1
  if not j + 1 in ac and li[i][1] == "AC":
    ac.append(j + 1)

  if j + 1 in ac and li[i][1] == "WA":
    wa[j] += 1

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

Submission status: Wrong Answer

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

c = []
wa = [0] * N

for i in range(M):
  j = li[i][0] - 1
  if not j in c and li[i][1] == "WA":
    wa[j] += 1
    continue
  if not j in c and li[i][1] == "AC":
    c.append(j)

print(len(c), sum(wa))

Submission status: Wrong Answer

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

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

for i in range(M):
  j = li[i][0] - 1
  if ac[j] == 0 and li[i][1] == "WA":
    wa[j] += 1
  elif ac[j] == 0 and li[i][1] == "AC":
    ac[j] += 1

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,M = map(int,input().split())
AC_List = defaultdict(int)
WA_List = defaultdict(int)

for i in range(M):
    Num,Sta = map(str,input().split())
    if Num in AC_List:
        continue
    else:
        if Sta == "WA":
            WA_List[Num] += 1
        else:
            AC_List[Num] += 1

print(str(len(AC_List))+" " +str(sum(WA_List.values())))

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    ans_dict = dict()
    ac_count = 0
    wa_count = 0

    for _ in range(m):
        p, s = input().split()
        
        if p not in ans_dict:
            if s == "AC":
                ans_dict[p] = 1
                ac_count += 1
            else:
                wa_count += 1

    print(ac_count, wa_count)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

list = []
for i in range(M):
    a,b=input().split()
    list.append((int(a), b))
    
clear = []
ac = 0
wa = 0

for i in range(M):
  if list[i][0] not in clear:
    if list[i][1] == 'AC':
      ac += 1
      clear.append(list[i][0])
    else:
      wa += 1

print(str(ac) + ' ' + str(wa))

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    ps_lst = [list(map(str, input().split())) for _ in range(m)]
    lst = [0] * n
    penalty = 0

    for i in range(m):
        problem_number = int(ps_lst[i][0]) - 1
        result = ps_lst[i][1]

        if lst[problem_number] == 1:
            continue
        else:
            if result == 'AC':
                lst[problem_number] = 1
            else:
                penalty += 1

    correct = 0
    for i in range(n):
        if lst[i] == 1:
            correct += 1

    print(correct, penalty)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
WA = 0
AC = [0 for i in range(N+1)]
for i in range(M):
  p, q = input().split()
  p = int(p)
  if q == "AC":
    AC[p] = 1
  else:
    if AC[p] == 0:
      WA += 1
print(sum(AC), WA)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    p = [0] * M
    S = [0] * M
    for i in range(M):
        p[i] , S[i] = map(str, input().split())
    for i in range(M):
        p[i] = int(p[i])

    AC = 0
    WA = 0
    l = [0] * N
    for i in range(M):
        if l[p[i] - 1] == 0:
            if S[i] == 'WA':
                WA += 1
            elif S[i] == 'AC':
                l[p[i] - 1] = 1
                AC += 1
    print(AC, WA)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    p = [0] * M
    S = [0] * M
    for i in range(M):
        p[i] , S[i] = map(str, input().split())
    for i in range(M):
        p[i] = int(p[i])

    AC = 0
    WA = 0
    l = [0] * (N + 1)
    for i in range(M):
        if l[p[i]] == 0:
            if S[i] == 'WA':
                WA += 1
            elif S[i] == 'AC':
                l[p[i]] = 1
                AC += 1
    print(AC, WA)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    p = [0] * M
    S = [0] * M
    for i in range(M):
        p[i] , S[i] = map(str, input().split())
    for i in range(M):
        p[i] = int(p[i])

    AC = 0
    WA = 0
    l = [0] * (N + 1)
    for i in range(M):
        if S[i] == 'WA' and l[p[i]] == 0:
            WA += 1
        elif S[i] == 'AC' and l[p[i]] == 0:
            l[p[i]] = 1
            AC += 1
    print(AC, WA)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = map(int, input().split())
    p = [0] * M
    S = [0] * M
    for i in range(M):
        p[i] , S[i] = map(str, input().split())
    for i in range(M):
        p[i] = int(p[i])

    AC = 0
    WA = 0
    l = [0] * (N + 1)
    for i in range(M):
        if S[i] == 'WA' and l[p[i]] != 1:
            WA += 1
        elif S[i] == 'AC' and l[p[i]] <= 0:
            l[p[i]] += 1
            AC += 1
    print(AC, WA)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
Prob = [1]*(N+1)
Ans = [0,0]
for i in range(M):
  p, S = map(str,input().split())
  p = int(p)
  if S == 'AC':
    Ans[0] += Prob[p]
    Prob[p] = 0
  else:
    Ans[1] += Prob[p]
print(*Ans,end="\t")

Submission status: Wrong Answer

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

ac = 0
wa = 0

aclist = set()

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if p in aclist:
        continue
    
    if s == 'AC':
        ac += 1
        aclist.add(p)
    else:
        wa += 1

print(f'{ac} {wa}')

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
Prob = [1]*(N+1)
Ans = [0,0]
for i in range(M):
  p, S = map(str,input().split())
  p = int(p)
  if S == 'AC':
    Ans[0] += Prob[p]
    Prob[p] = 0
  else:
    Ans[1] += Prob[p]
print(*Ans,end="\t")

Submission status: Wrong Answer

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

ac = 0
wa = 0

aclist = set()

for i in range(m):
    p, s = input().split()
    p = int(p)
    if p in aclist:
        continue
    
    if s == 'AC':
        ac += 1
        aclist.add(p)
    else:
        wa += 1

print(ac,wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

aclist = []

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

print(ac,wa)

Submission status: Wrong Answer

Solution code:
# input here
_INPUT = """\
2 5
1 WA
1 AC
2 WA
2 AC
2 WA
2 AC
"""

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

    seikai = [False] * n
    matigai = [0] * n

    for i in range(m):
        p,q = map(str, input().split())
        p = int(p)-1

        if q == "AC":
            seikai[p] = True
        else:
            if seikai[p] != True:
                matigai[p] += 1


    correct = seikai.count(True)
    mistake = sum(matigai)
    print(correct, mistake)
            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

Submission status: Wrong Answer

Solution code:
import sys


def resolve(in_):
    N, M = map(int, next(in_).split())
    PS = tuple(line.strip().split() for line in in_)
    
    ac = set()
    wa = {}

    for p, s in PS:
        if s == 'AC':
            ac.add(p)
        if s == 'WA' and p not in ac:
            wa[p] = wa.setdefault(p, 0) + 1
    
    return '{} {}'.format(len(ac), sum(wa.values()))


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()