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())
p = []
S = []
for i in range(M):
    a,b = input().split()
    p.append(int(a))
    S.append(b)
#print(p)
#print(S)
res=[0]*N
wa=0
ac=0
#print(res)
for i in range(M):
  #print(i,p[i]-1,res[p[i]-1],S[i])
  if res[p[i]-1]==0 and S[i]=='WA':
    wa+=1
  elif res[p[i]-1]==0 and S[i]=='AC':
    ac+=1
    res[p[i]-1]=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p = []
S = []
for i in range(M):
    a,b = input().split()
    p.append(int(a))
    S.append(b)
#print(p)
#print(S)
res=[0]*N
wa=0
ac=0
#print(res)
for i in range(M):
  #print(i,p[i]-1,res[p[i]-1],S[i])
  if res[p[i]-1]==0 and S[i]=='WA':
    wa+=1
    print(wa)
  elif res[p[i]-1]==0 and S[i]=='AC':
    ac+=1
    res[p[i]-1]=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p = []
S = []
for i in range(M):
    a,b = input().split()
    p.append(int(a))
    S.append(b)
#print(p)
#print(S)
res=[0]*N
wa=0
ac=0
#print(res)
for i in range(M):
  print(i,p[i]-1,res[p[i]-1],S[i])
  if res[p[i]-1]==0 and S[i]=='WA':
    wa+=1
    print(wa)
  elif res[p[i]-1]==0 and S[i]=='AC':
    ac+=1
    res[p[i]-1]=1
print(ac,wa)

Submission status: Wrong Answer

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

ok = [False] * n
ac_cnt = 0
wa_cnt = 0
for i in range(m):
    p, m = input().split()
    if ok[int(p) - 1]:
        continue
    if m == 'WA':
        wa_cnt += 1
    else:
        ac_cnt += 1
        ok[int(p) - 1] = True

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

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

ok = [False] * (n + 1)
ac_cnt = 0
wa_cnt = 0
for i in range(m):
    p, m = input().split()
    if ok[int(p)]:
        continue
    if m == 'WA':
        wa_cnt += 1
    else:
        ac_cnt += 1
        ok[int(p)] = True

print(ac_cnt,wa_cnt)

Submission status: Wrong Answer

Solution code:
N,M=input().split()
n,m=int(N),int(M)
b=[]
c=[0 for i in range(n+1)]

cnt_AC=0
cnt_pe=0

for case in range(m):
    a=input().split()
    b.append(a)


for i in range(m):
    b[i][0]=int(b[i][0])


for i in range(m):
    if b[i][1]=='WA' and c[b[i][0]]!=True:
        c[b[i][0]]=False
        cnt_pe+=1
    
    if b[i][1]=='AC':
        c[b[i][0]]=True
    
    else:
        continue

for i in range(n+1):
    if c[i]==True:
        cnt_AC+=1

print(cnt_AC, cnt_pe)

Submission status: Wrong Answer

Solution code:
N,M=input().split()
n,m=int(N),int(M)
b=[]
c=[0 for i in range(n+1)]

cnt_AC=0
cnt_pe=0

for case in range(m):
    a=input().split()
    b.append(a)


for i in range(m):
    b[i][0]=int(b[i][0])


for i in range(m):
    if b[i][1]=='WA' and c[b[i][0]]!=True:
        c[b[i][0]]=False
        cnt_pe+=1
    
    if b[i][1]=='AC':
        c[b[i][0]]=True

for i in range(n+1):
    if c[i]==True:
        cnt_AC+=1


print(cnt_AC, cnt_pe)

Submission status: Wrong Answer

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

a = [0 for i in range (n)]

ans = 0
pnl = 0

for i in range (m) :
    p , s = input().split()
    p = int(p) - 1
    if s == 'WA' :
        a[p] += 1
    else :
        ans += 1
        pnl += a[p]

print( str(ans) + ' ' + str(pnl))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
li = [[0]*2 for _ in range(n)]
for _ in range(m):
    p_, s = Ss()
    p = int(p_) - 1
    if s == "AC":
        li[p][0] = 1
    elif s == "WA" and li[p][0] == 1:
        li[p][1] += 1

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

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

Submission status: Wrong Answer

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

ac_set= set([int(l[i][0]) for i in range(M) if l[i][1] == "AC"])
wa_lst = [int(l[i][0]) for i in range(M) if l[i][1] == "WA"]
pen = 0

for a in ac_set:
  pen += wa_lst.count(a)

ac = len(ac_set)

print('{} {}'.format(str(ac),str(pen)))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
li = [[0]*2 for _ in range(n)]
for _ in range(m):
    p_, s = Ss()
    p = int(p_) - 1
    if li[p][0] == 1:
        continue
    elif s == "AC":
        li[p][0] += 1
    elif s == "WA":
        li[p][1] += 1

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n, m = Is()
li = [[0]*2 for _ in range(n)]
for _ in range(m):
    p_, s = Ss()
    p = int(p_) - 1
    if s == "AC":
        li[p][0] = 1
    if s == "WA" and li[p][0] == 0:
        li[p][1] += 1

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

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

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder

N, M = map(int, input().split())
AC = {}
WA = {}
for _ in range(M):
    p, s = input().split()
    if p not in WA and p not in AC:
        WA[p], AC[p] = 0, 0
    if AC[p] < 1:
        if s == 'AC':
            AC[p] += 1
        elif s == 'WA':
            WA[p] += 1

print(sum(AC.values()), sum(WA.values()))

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder

N, M = map(int, input().split())
AC = {}
WA = {}
for _ in range(M):
    p, s = input().split()
    if p not in WA and p not in AC:
        WA[p], AC[p] = 0, 0
    if 1 <= AC[p]:
        continue
    if s == 'AC':
        AC[p] += 1
    if s == 'WA':
        WA[p] += 1

print(sum(AC.values()), sum(WA.values()))

Submission status: Wrong Answer

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

seito = [0] * (N+1)
pena  = 0
teisyutu = [''] * (M+1)

for i in range(1, M+1) :
    teisyutu[i] = input().split()

    if seito[int(teisyutu[i][0])] == '1' :
        continue

    if teisyutu[i][1] == 'AC' :
        seito[int(teisyutu[i][0])] = '1'
    elif teisyutu[i][1] == 'WA' :
        pena += 1
    else :
        continue

cnt = 0
for s in seito :
    if s == '1' :
        cnt += 1

print('%s %s' % (cnt, pena))

Submission status: Wrong Answer

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

seito = [0] * (N+1)
pena  = 0
teisyutu = [''] * (M+1)

for i in range(1, M+1) :
    teisyutu[i] = input().split()

    if seito[int(teisyutu[i][0])] == '1' :
        continue

    if teisyutu[i][1] == 'AC' :
        seito[int(teisyutu[i][0])] = '1'
    else :
        pena += 1

cnt = 0
for s in seito :
    if s == '1' :
        cnt += 1

print('%s %s' % (cnt, pena))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [0] * m
for i in range(m):
    ps[i] = list(map(str,input().split()))
if m == 0:
    print(0,0)
    exit()
countA = [0] * n
countW = [0] * n
cn = 0
for item in ps:
    if item[1] == 'AC':
        countA[int(item[0])-1] = 1
        cn += countW[int(item[0])-1]
    else:
        countW[int(item[0])-1] += 1
print(sum(countA),cn)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [0] * m
p = [0] * m
s = [0] * m
for i in range(m):
    ps[i] = list(map(str,input().split()))
if m == 0:
    print(0,0)
    exit()
cp=int(ps[0][0])
countA = [0] * n
countW = [0] * n
cn = 0
for item in ps:
    if item[1] == 'AC':
        countA[int(item[0])-1] = 1
        cn += countW[int(item[0])-1]
    else:
        countW[int(item[0])-1] += 1
print(sum(countA),cn)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [0] * m
p = [0] * m
s = [0] * m
for i in range(m):
    ps[i] = list(map(str,input().split()))
if m == 0:
    print(0,0)
    exit()
cp=int(ps[0][0])
countA = [0] * n
countW = 0
cn = 0
for item in ps:
    if item[1] == 'AC':
        countA[int(item[0])-1] = 1
        countW += cn
        cp += 1
        cn = 0
    else:
        cn+=1
print(sum(countA),countW)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
PS=[list(input().split()) for _ in range(m)]

AC=[]
WA=[0 for i in range(n)]
for i in range(m):
  if PS[i][1] == "AC":
    if  int(PS[i][0]) in AC:
      continue
    AC.append(int(PS[i][0]))
  elif PS[i][1] == "WA" and not(int(PS[i][0]) in AC):
    WA[int(PS[i][0])-1]+=1

sum_WA=0
for i in range(len(WA)):
  sum_WA+=WA[i]
print(len(AC), sum_WA)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=set()
d={}
for i in range(m):
  i,s=input().split()
  if int(i) not in ac:
    if  s=='AC':
      ac.add(int(i))
    else:
      d[int(i)]=d.get(int(i),0)+1
print(len(ac),sum(d.values()))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ANS=[[0]*2 for _ in range(n+1)]
for _ in  range(m):
  i,s=input().split()
  if ANS[int(i)][0]==0:
    if s=='AC':
      ANS[int(i)][0]+=1
    else:
      ANS[int(i)][1]+=1
print(sum([row[0] for row in ANS]),sum([row[1] for row in ANS]))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=0
W=0
ANS=[[0]*2 for _ in range(n+1)]
for _ in  range(m):
  i,s=input().split()
  if ANS[int(i)][0]==0:
    if s=='AC':
      ANS[int(i)][0]+=1
    else:
      ANS[int(i)][1]+=1
print(sum([row[0] for row in ANS]),sum([row[1] for row in ANS]))

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()
  if s=='AC' and ac[int(p)-1]==0:
    ac[int(p)-1]+=1
  elif s=='WA' and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
print(sum(ac),sum(wa))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N,M = list(map(int, input().rstrip().split()))
pS_list = []

for i in range(M):
    inp = input().rstrip().split()
    pS_list.append( [int(inp[0]), inp[1]] )

#-----
problem_AC_set = set()
problem_WA_dic = {}

for p,S in pS_list:
    if (S == "AC") and (p not in problem_AC_set):
        problem_AC_set.add(p)
    
    if (S == "WA") and (p not in problem_AC_set):
        problem_WA_dic.setdefault(p, 0)
        problem_WA_dic[p] += 1

cnt_AC = len(problem_AC_set)
cnt_WA = sum([i for i in problem_WA_dic.values()])

print(cnt_AC, cnt_WA)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mapAC = [False]*(n+1)
#mapWA = [True]*(n+1)
countWA = [0]*(n+1)

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        mapAC[p] = True
#        mapWA[s] = False
    else:
        countWA[p] += 1*(not mapAC[p])
print(mapAC.count(True), sum(countWA))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
pss = [list(input().split()) for _ in range(m)]
ac = [0] * n
ans1 = 0
ans2 = 0
for i in range(m):
    if ac[int(pss[i][0]) - 1] == 0:
        if pss[i][1] == 'AC':
            ans1 += 1
            ac[int(pss[i][0]) - 1] = 1
        else:
            ans2 += 1
    else:
        continue
print(str(ans1) + ' ' + str(ans2))

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())
memo = [0]*n
pena = 0
for i in range(m):
    p,s = (str(x) for x in input().split())
    p = int(p)
    if s=="AC":
        memo[p-1] = 1
    else:
        if memo[p-1]==0:
            pena += 1
print("{} {}".format(sum(memo),pena))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
num = [0]*m
acwa = [0]*m
for i in range(m):
    num[i], acwa[i] = input().split()
account = 0
wacount = 0
sumi = {}
for i in range(m):
    if num[i] in sumi:
        if sumi[num[i]]=='WA':
            if acwa[i] == 'AC':
                account += 1
                sumi[num[i]]= 'AC'
            else:
                wacount += 1
    else:
        if acwa[i] == 'AC':
            account += 1
            sumi[num[i]]= 'AC'
        else:
            wacount += 1
            sumi[num[i]]= 'WA'

print(account,wacount)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

for i in range(m):
  p, s = input().split()
  if s == "AC":
    if ac[int(p)-1] == 0:
      ac[int(p)-1] += 1
  if 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())

lps = list()

for i in range(M):
    p, s = input().split()
    lps.append([int(p), s])
#print(lps)

lcor = [0] * N
cornum = 0
wrgnum = 0
for i in range(M):
    if lps[i][1] == "AC":
        if lcor[lps[i][0]-1] == 0:
            lcor[lps[i][0]-1] += 1
            cornum += 1
    elif lps[i][1] == "WA":
        if lcor[lps[i][0]-1] == 0:
            wrgnum += 1

print(cornum, wrgnum)

Submission status: Wrong Answer

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

lps = list()

for i in range(M):
    p, s = input().split()
    if s == "WA":
        s = 0
    else:
        s = 1
    lps.append([int(p), int(s)])
#print(lps)

lcor = [0] * N
cornum = 0
wrgnum = 0
for i in range(M):
    if lps[i][1] == 1:
        if lcor[lps[i][0]-1] == 0:
            lcor[lps[i][0]-1] += 1
    elif lps[i][1] == 0:
        if lcor[lps[i][0]-1] == 0:
            wrgnum += 1

print(sum(lcor), wrgnum)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
ac = [0]*N
wa = [0]*N
ans = 0
for i in range(M):
  temp = input().split()
  if temp[1] == "AC":
    ac[int(temp[0])-1] = 1
  elif ac[int(temp[0])-1] ==0:
    wa[int(temp[0])-1] += 1
 

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

Submission status: Wrong Answer

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

lps = list()

for i in range(M):
    p, s = input().split()
    if s == "WA":
        s = 0
    else:
        s = 1
    lps.append([int(p), int(s)])
#print(lps)

lps1 = sorted(lps, key=lambda x:x[0])
#print(lps1)

cor = 0
wrg = 0
for i in range(1, N+1):
    if [i, 1] in lps1:
        cor += 1
        lpsi = lps[:lps.index([i, 1])]
        wrg += lpsi.count([i, 0])
    else:
        wrg += lps.count([i, 0])

print(cor, wrg)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
ac = [0]*N
wrong = 0
for i in range(M):
  temp = input().split()
  if temp[1] == "AC":
    ac[int(temp[0])-1] = 1
  elif ac[int(temp[0])-1] ==0:
    wrong+=1

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=['WA' for i in range(N)]
crt=0
mis=0
for i in range(M):
    p,S=map(str,input().split())
    if ans[int(p)-1]=='WA':
        if S=='WA':
            mis+=1
        else:
            crt+=1
            ans[int(p)-1]='AC'
    else:
        continue
print(crt,mis)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

penal = [0] * n
check = [0] * n

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

print(sum(check), sum(penal))

Submission status: Wrong Answer

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

penal = [0] * n
check = [0] * n

for i in range(m):
    if check[int(ps[i][0])-1] == 1:
        continue
    if ps[i][1] == 'AC':
        check[int(ps[i][0])-1] = 1
    else:
        penal[int(ps[i][0])-1] += 1

print(sum(check), sum(penal))

Submission status: Wrong Answer

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

penal = [0] * n
check = [0] * n

for i in range(m):
    if check[int(ps[i][0])-1] == 0 and ps[i][1] == 'WA':
        penal[int(ps[i][0])-1] += 1
    if check[int(ps[i][0])-1] == 0 and ps[i][1] == 'AC':
        check[int(ps[i][0])-1] += 1

print(sum(check), sum(penal))

Submission status: Wrong Answer

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

penal = [0] * n
check = [0] * n

for i in range(m):
    if check[int(ps[i][0])-1] == 0 and ps[i][1] == 'WA':
        penal[int(ps[i][0])-1] += 1
    if check[int(ps[i][0])-1] == 0 and ps[i][1] == 'AC':
        check[int(ps[i][0])-1] += 1

print(sum(penal), sum(check))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N, M = list(map(int, input().split(' ')))
    accepted = [0 for _ in range(N)]
    wa_count = [0 for _ in range(N)]
    for _ in range(M):
        p, S = input().split(' ')
        p = int(p) - 1
        if accepted[p] == 1:
            continue
        # non-accepted cases
        if S == 'WA':
            wa_count[p] += 1
        else:
            accepted[p] = 1
    print('{} {}'.format(sum(accepted), sum(wa_count)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ok = [0] * (N + 1)
resX = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and ok[p] == 0:
        ok[p] = 1
    elif s == 'WA' and ok[p] == 0:
        resX += 1

print(sum(ok), resX)

Submission status: Wrong Answer

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

ok = [0] * (N + 1)
resX = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        ok[p] = 1
    else:
        if ok[p] == 0:
            resX += 1

print(sum(ok), resX)

Submission status: Wrong Answer

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

ok = [0] * N
resX = 0
for i in range(M):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC':
        ok[p] = 1
    else:
        if ok[p] == 0:
            resX += 1

print(sum(ok), resX)

Submission status: Wrong Answer

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

d = []
w = 0
a = 0
for i in range(m):
    P,S = input().split()
    P = int(P)
    if(S == 'WA'):
        if(P not in d):w += 1
    elif(S == 'AC'):
        if(P not in d):
            d.append(P)
            a += 1

print(a,w)

Submission status: Wrong Answer

Solution code:
N , M = map(int,input().split())
p = [''] * M
S = [''] * M
A = [0] * N
W = [0] * N
for i in range(M):
    p[i],S[i] = map(str,input().split())
    p[i] = int(p[i])
    if A[p[i]-1] == 0:
        if S[i] == 'WA':
            W[p[i]-1] += 1
        else:
            A[p[i]-1] += 1


print(sum(A),sum(W))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ls = []
la = ls.append
for _ in [0] * m:
    p = input().split()
    la((int(p[0]), p[1]))
okay = []
bad = []
okay_app = okay.append
bad_app = bad.append
for x in ls:
    if x[1] == "WA" and x[0] not in okay:
        bad_app(x[0])
    elif x[1] == "AC" and x[0] not in okay:
        okay_app(x[0])
print(len(okay), len(bad))

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])



ac_num = [0] * n
wa_num = [0] * n

for i in range(m):
    if s[i] == "AC":
        ac_num[p[i]-1] = 1
    elif s[i] == "WA":
        if ac_num[p[i]-1] == 0:
            wa_num[p[i]-1] += 1

for i in range(n):
    if ac_num[i] == 0:
        wa_num[i] == 0


print(sum(ac_num),sum(wa_num))

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])



ac_num = [0] * n
wa_num = [0] * n

for i in range(m):
    if s[i] == "AC":
        ac_num[p[i]-1] = 1
    elif s[i] == "WA":
        if ac_num[p[i]-1] == 0:
            wa_num[p[i]-1] += 1

print(sum(ac_num),sum(wa_num))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
li = ['NO']*n
wa = 0
ac = 0

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

print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
c = {}
for i in range(n):
    c[i] = 0
ac = [False] * n
acn = 0
for _ in range(m):
    p,s = tuple(input().split())
    p = int(p)
    if s == 'AC' and ac[p-1]==False:
        ac[p-1] = True
        acn+=1
    elif s== 'WA' and ac[p-1]==False:
        c[p-1]+=1
print(acn, sum(tuple(c.values())), sep=' ')

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
s = list(tuple(input().split()) for _ in range(m))
t = set(s)
ac = len([k for k in t if k[1] == 'AC'])
pe = 0
for i in t:
    if i[1] == 'AC':
        for j in s:
            if  i == j:
                pe += s[: s.index(i)].count((i[0], 'WA'))
    else:
        pass
print(ac, pe)

Submission status: Wrong Answer

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

result = [[0] * 2 for i in range(n)]

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

print(sum([result[i][0] for i in range(n)]),
      sum([result[i][1] for i in range(n)]))

Submission status: Wrong Answer

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

result = [[0] * 2 for i in range(n)]

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

print(sum([result[i][0] for i in range(n)]),
      sum([result[i][1] for i in range(n)]))

Submission status: Wrong Answer

Solution code:
#C
n, m = map(int, input().split())
probrem = [0] * n
warn = [0] * n
for i in range(m):
    a, b = map(str, input().split())
    a=int(a)
    if probrem[a - 1] == 0 and b == 'AC':
        probrem[a - 1] = 1
    if probrem[a - 1] == 0 and b == "WA":
        warn[a - 1] += 1
# print(probrem,warn)
print(sum(probrem),sum(warn))

Submission status: Wrong Answer

Solution code:
#C
n, m = map(int, input().split())
probrem = [0] * n
warn = [0] * n
for i in range(m):
    a, b = map(str, input().split())
    a=int(a)
    if probrem[a - 1] == 0 and b == 'AC':
        probrem[a - 1] += 1
    if probrem[a - 1] == 0 and b == "WA":
        warn[a - 1] += 1
# print(probrem,warn)
print(sum(probrem),sum(warn))

Submission status: Wrong Answer

Solution code:
_, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    i = int(p)
    if not (i in result):
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
        result [i] = s
    else:
        if result[i] == "WA":
            result[i] = s
            if s == "WA":
                WA += 1
            elif s == "AC":
                AC += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    p = int(p)
    if not (p in result):
        result [p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
    else:
        if result[p] == "WA":
            result[p] = s
            if s == "WA":
                WA += 1
            elif s == "AC":
                AC += 1
print(AC, WA)
result

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    p = int(p)
    if not (p in result):
        result [p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
    elif result[p] == "AC":
        continue
    else:
        result[p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    p = int(p)
    if not (p in result):
        result [p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
    elif result[p] == "AC":
        continue
    else:
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
print(AC, WA)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = [{"AC":0, "WA":0} for _ in range(N)]
for p,s in PS:
    i = int(p) - 1
    if result[i]["AC"] == 1:
        continue
    else:
        result[i][s] += 1
for r in result:
    AC = len([e for e in result if e["AC"] >= 1])
    WA = sum([e["WA"] for e in result])

Submission status: Wrong Answer

Solution code:
def line(n):
  for _ in range(n):
    p,S = map(str,input().split())
    yield p,S

def main():
  N,M = map(int,input().split())
  X = list(line(M))
  li = []
  AC = 0
  WA = 0
  for p,S in X:
    if S == 'AC':
      if not p in li:
        li.append(p)
        AC += 1
    if S == 'WA' and not p in li:
      WA += 1
  print(int(AC),int(WA))

main()

Submission status: Wrong Answer

Solution code:
def line(n):
  for _ in range(n):
    p,S = map(str,input().split())
    yield p,S

def main():
  N,M = map(int,input().split())
  X = list(line(M))
  li = []
  AC = 0
  WA = 0
  for p,S in X:
    if S == 'AC':
      if not p in li:
        li.append(p)
        AC += 1
    if S == 'WA' and not p in li:
      WA += 1
  return AC,WA

print(main())