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 = [list(input().split()) for i in range(m)]
ans1 = int(0)
ans2 = int(0)

N = list(range(n+1))
M = int(0)

for i in range(m):
  N[M] = 100000000
  for j in N:
      if j != int(l[i][0]):
          continue
      if "AC" == l[i][1]:
          M = j
          ans1 +=1
          break
      if "WA" == l[i][1]:
          ans2 += 1
          break

print(ans1, ans2)

Submission status: Wrong Answer

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

l = [list(input().split()) for i in range(m)]
ans1 = int(0)
ans2 = int(0)

N = list(range(n+1))
M = int(0)

for i in range(m):
  N[M] = 100000000
  for j in N:
      if j != int(l[i][0]):
          continue
      if j == int(l[i][0]) and "AC" == l[i][1]:
          M = j
          ans1 +=1
          break
      if j == int(l[i][0]) and "WA" == l[i][1]:
          ans2 += 1
          break

print(ans1, ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  x = int(c) - 1
  if list[x] == 0:
    if d == 'AC':
        list[x] = 1
        t_cnt += 1
    else:
        f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac = [0]*n
ans = 0
miss = 0
for i in range(m):
  a,b = map(str, input().split())
  a = int(a)
  if ac[a-1]==0 and b == "WA":
    miss += 1
  elif ac[a-1]==0 and b == "AC":
    ac[a-1] = 1
    ans += 1
    
print("%d %d" %(ans, miss))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
list = [0]*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if list[int(c)-1] == 0:
      list[int(c)-1] = 1
      t_cnt += 1
  else:
    if list[int(c)-1] == 0:
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
list = []*a
t_cnt = 0
f_cnt = 0
for i in range(b):
  c, d = map(str,input().split())
  if d == 'AC':
    if not (c in list):
      list.append(c)
      t_cnt += 1
  else:
    if not (c in list):
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Wrong Answer

Solution code:
a,b=(int(x) for x in input().split())
list = []
t_cnt = 0
f_cnt = 0
for i in range(b):
  s = input().split()
  if s[1] == 'AC':
    if not (s[0] in list):
      list.append(s[0])
      t_cnt += 1
  else:
    if not (s[0] in list):
      f_cnt += 1
print("{} {}".format(t_cnt, f_cnt))

Submission status: Wrong Answer

Solution code:
def main():
    n,m = map(int,input().split())
    flag = [False for i in range(n+1)]
    AC = 0
    WA = 0
    for i in range(m):
        input_line = input().split()
        p,s = int(input_line[0]), input_line[1]
        if flag[p] == False:
            if s == "AC":
                AC += 1
                flag[p] = True
            else:
                WA += 1
    print(AC,WA)
    return 0


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a_cnt,p_cnt = [0]*n,[0]*n #正答数、ペナルティ数
for i in range(m):
	p,s = input().split()
	if a_cnt[int(p)-1] == 0: #まだ正答してなかったら
		if s == "AC":
			a_cnt[int(p)-1] = 1
		elif s== "WA": #"WA"
			p_cnt[int(p)-1] += 1
print(sum(a_cnt),sum(p_cnt))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ps = []
for i in range(m):
    tmp = input().split()
    ps.append([int(tmp[0]), tmp[1]])

ac = [False] * (n + 1)
wa = [0] * (n + 1)
for i in range(m):
    if not ac[ps[i][0]]:
        if ps[i][1] == "WA":
            wa[ps[i][0]] += 1
        elif ps[i][1] == "AC":
            ac[ps[i][0]] = True

print(str(ac.count(True)) + " " + str(sum(wa)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
k = {}
for i in range(M):
  p,s = input().split()
  if p not in k:
    k[p] = [s]
  else:
    k[p].append(s)
ac = 0
wa = 0
for l in k:
  now = 0
  if l == "WA":
    now += 1
  elif l == "AC":
    ac += 1
    wa += now
    break
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ps = []
for i in range(m):
    tmp = input().split()
    ps.append([int(tmp[0]), tmp[1]])

if m == 0:
    print("0 0")
    exit()
now = ps[0][0]
wa_tmp = 0
wa = 0
ac_tmp = False
ac = 0
for i in range(m):
    if ps[i][0] == now:
        if not ac_tmp:
            if ps[i][1] == "WA":
                wa_tmp += 1
            elif ps[i][1] == "AC":
                ac_tmp = True
    else:
        if ac_tmp:
            ac += 1
            wa += wa_tmp
        ac_tmp = False
        wa_tmp = 0
        now = ps[i][0]
        if ps[i][1] == "WA":
            wa_tmp += 1
        elif ps[i][1] == "AC":
            ac_tmp = True
if ac_tmp:
    ac += 1
    wa += wa_tmp

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
# p,s = [0]*m,[""]*m #AC or WA
a_cnt,p_cnt = [0]*n,[0]*n #正答数、ペナルティ数
for i in range(m):
	p,s = (x for x in input().split())#map(input().split())
	if a_cnt[int(p)-1] == 0: #まだ正答してなかったら
		if s == "AC":
			a_cnt[int(p)-1] = 1
		else: #"WA"
			p_cnt[int(p)-1] += 1
print(sum(a_cnt),sum(p_cnt))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
penalty =0
AC_list = []
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if pi in AC_list:
    continue
  else:
    if si == 'WA':
      penalty += 1
    else:
      AC_list.append(pi) 
AC = len(list(set(AC_list)))
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
lastP = -1
still = 0
correnct = 0
penalty = 0
CurrectAnsors = 0
for i in range(M):
    P,S = input().split()
    if lastP != int(P):
        correnct = 0
    if S == "WA":
        if correnct == 0:
            penalty += 1
    if S == "AC":
        if correnct != 1:
            CurrectAnsors += 1
        correnct = 1
    
    lastP = int(P)

print(CurrectAnsors,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
penalty =0
AC_list = []
for i in range(M):
  pi, si = input().split()
  if pi in AC_list:
    continue
  elif si == 'WA':
    penalty += 1
  else:
    AC_list.append(pi)
AC = len(list(set(AC_list)))
print(AC,penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
penalty =0
AC_list = []
for i in range(M):
  pi, si = input().split()
  if si == 'AC':
      AC_list.append(pi)
AC = len(list(set(AC_list)))
penalty = M -AC
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
f=set()
a,b=0,0
for i in range(m):
    x,y=input().split()
    z=int(x)
    if z not in f:
        if y=='AC':
            a+=1
            f.add(z)
        else:
            b+=1
print(str(a)+' '+str(b))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
penalty =0
AC_list = []
for i in range(M):
  pi, si = input().split()
  if si == 'WA':
    penalty += 1
  else:
    AC_list.append(pi)
AC = len(list(set(AC_list)))
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
penalty =0
AC_list = []
for i in range(M):
  pi, si = input().split()
  if si == 'WA':
    penalty += 1
  else:
    AC_list.append(pi)
AC = list(set(AC_list))
print(AC,penalty)

Submission status: Wrong Answer

Solution code:
import copy
import heapq
import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


n,m = ips()
correct = [0 for i in range(n+1)]
wasu = [0 for i in  range(n+1)]
for loop in range(m):
    q,r = input().split()
    q = int(q)
    if r == "WA":
        if correct[q]==0:
            wasu[q]+=1
    else:
        correct[q] = 1
print(sum(correct),sum(wasu))

Submission status: Wrong Answer

Solution code:
NM = input().split()
N = int(NM[0])
M = int(NM[1])
P = []
S = []
for i in range(M):
  PS = input().split()
  P.append(int(PS[0]))
  S.append(PS[1])

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

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
prb = [0 for x in range(N)]
ac_cnt = 0
wa_cnt = 0
for x in range(M):
    p, s = input().split()
    print(p, s)
    if prb[int(p) - 1] == 0 and s == "WA":
        wa_cnt += 1
    elif prb[int(p) - 1] == 0 and s == "AC":
        ac_cnt += 1
        prb[int(p) - 1] = 1
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
p, s = [], []
a = [False] * n
cor = 0
fai = 0

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if a[p - 1] == False:
            a[p - 1] = True
            cor += 1
    else:
        if a[p - 1]:
            pass
        else:
            fai += 1
print(cor, end=' ')
print(fai)

Submission status: Wrong Answer

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

if M == 0:
  print(0,0)
  exit();

AC = []  
WA = []  
for i in range(M):
  a,w = map(str,input().split())
  if w == 'AC' and (a,w) not in AC:
    AC.append((a,w))
  elif w == 'WA' and (a,w) not in WA:
    WA.append((a,w))
    
print(len(AC),len(WA))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
prb = [0 for x in range(N)]
ac_cnt = 0
wa_cnt = 0
for x in range(M):
    p, s = input().split()
    if prb[int(p) - 1] == 0:
        if s == "WA":
            wa_cnt += 1
        else:
            ac_cnt += 1
            prb[int(p) - 1] = 1
    else:
        pass
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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

pen_cnt = [0] * n
ac_flg = [0] * n

for _ in range(m):
    sub = input().split()
    p = int(sub[0]) - 1
    s = sub[1]
    if s == "AC":
        ac_flg[p] = 1
    elif s == "WA" and ac_flg[p] == 0:
        pen_cnt[p] += 1

print(sum(ac_flg), sum(pen_cnt))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
prb = [0 for x in range(1, N+1)]
ac_cnt = 0
wa_cnt = 0
for x in range(M):
    p, s = input().split()
    if prb[int(p) - 1] == 0:
        if s == "WA":
            wa_cnt += 1
        else:
            ac_cnt += 1
            prb[int(p) - 1] = 1
    else:
        pass
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
l = dict()
t, f = 0, 0
n, m = map(int, input().split(" "))
for _ in range(m):
  p, s = input().split(" ")
  if not p in l:
    l[p] = None
  if s == "WA":
    if l[p] != True:
      f += 1
  elif s == "AC":
    if l[p] != True:
      l[p] = True
      t += 1  

print(t, f)

Submission status: Wrong Answer

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

current = 0
penalty = 0
state = [False] * (N+1)
for i in pS:
    if i[1] == "WA" and (not state[int(i[0])]):
        penalty += 1
    elif i[1] == "AC" and (not state[int(i[0])]):
        current += 1
        state[int(i[0])] = True
print(current, penalty)

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

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

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

Submission status: Wrong Answer

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

cor_count = 0
pen_count = 0
AC_list = []

p = [0]*M#問題の番号
s = [0]*M#結果 AC,WA

if M == 0 or N==0:
	print('0 0')
	sys.exit()


l = []
for i in range(M):
	p[i],s[i] = input().split()
	
for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
			cor_count += 1
		else:
			pen_count += 1
#print(AC_list)
print(cor_count,pen_count)

Submission status: Wrong Answer

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

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

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

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

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if m == 0: print("{0} {1}".format(0, 0))
else:
    ps = []
    for _ in range(m):
        ps.append([x for x in input().split()])
    p, ans = [], [0, 0]
    for ps_i in ps:
        if ps_i[0] in p: continue
        else:
            if ps_i[1] == "AC":
                p.append(ps_i[0])
                ans[0] += 1
            else:
                ans[1] += 1
    print(*ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split(" "))
p = []
S = []
index = []
fAC = []
fWA = []

for i in range(M):
    inp = input().split(" ")
    p.append(inp[0])
    S.append(inp[1])
    if not inp[0] in index:
        index.append(inp[0])
        fAC.append(0)
        fWA.append(0)

AC = 0
WA = 0

for i in range(M):
    if S[i] == "AC": #もし問題pがACになったなら
        fAC[index.index(p[i])] = 1
    elif fAC[index.index(p[i])] == 0: #もし問題pが未ACなら
        fWA[index.index(p[i])] = fWA[index.index(p[i])] + 1

for i in range(len(index)):
    if fAC[index.index(p[i])] == 1:
        AC = AC + 1
        WA = WA + fWA[index.index(p[i])]

print(AC,WA)

Submission status: Wrong Answer

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

grid = []

for i in range(M):
    array = list(map(str, input().strip().split()))
    grid.append(array)

ac_list = [0] * N
wa_list = [0] * N

for a in grid:
    if a[1] == 'AC':
        ac_list[int(a[0]) - 1] = 1
    elif a[1] == 'WA' and ac_list[int(a[0]) - 1] == 0:
        wa_list[int(a[0]) - 1] += 1

print(str(sum(ac_list)) + ' ' + str(sum(wa_list)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
 
count = 0
sset = set()
 
for i in range(m):
  qn,res = input().split()
  if int(qn) <= n:
    if res == "AC":
      sset.add(qn)
    else:
      if qn not in sset:
        count+=1
      
print("{} {}".format(len(sset),count))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
 
count = 0
sset = set()
 
for i in range(m):
  qn,res = input().split()
  if res == "AC":
    sset.add(qn)
  else:
    if qn not in sset:
      count+=1
      
print("{} {}".format(len(sset),count))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
p=[list(input().split()) for _ in range(M)]
AC_count=0
WA_count=0
AC_flag=0
if M==0:
  print(0,0)
  exit()
if p[0][1]=="WA" and AC_flag==0:
  WA_count+=1
else:
  AC_count+=1
  AC_flag=1

for i in range(1,M):
  if p[i-1][0]!=p[i][0]:
    AC_flag=0
  if p[i][1]=="WA" and AC_flag==0:
    WA_count+=1
  elif p[i][1]=="AC" and AC_flag==0:
    AC_count+=1
    AC_flag=1
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cur = []
pen=m
ans=0
for i in range (n+1): cur.append(0)
for i in range (m):
    a, b = input().split()
    a = int(a)
    if b=="AC":
        if cur[a]==0: ans+=1
        cur[a]=1
    if cur[a]==1: pen-=1
print(ans, pen, sep=' ')

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cur = []
pen=m
ans=0
for i in range (n+1): cur.append(0)
for i in range (m):
    a, b = input().split()
    a = int(a)
    if b=='AC':
        if cur[a]==0: ans+=1
        cur[a]=1
    if cur[a]: pen-=1
print(ans, pen, sep=' ')

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
wa = 0
pr = 0
ac = 0
bool_arr = [False] * (n+1)
for _ in range(m):
	p, v = map(str, input().split())
	pr = int(p)
	if v == 'WA' and bool_arr[pr] == False:
		wa += 1
	elif v == 'AC' and bool_arr[pr] == False:
		ac += 1
		bool_arr[pr] = True
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
import itertools
lll=[]
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
ll=[l[i][0] for i in range(m)]
import itertools
lll=[]
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(input().split() for _ in range(m))
l=sorted(l,key=lambda x:x[0])
ll=[l[i][0] for i in range(m)]
import itertools
lll=[]
for (k,g) in itertools.groupby(l,key=lambda x:x[0]):
    lll.append(list(g))
ans=0
re=0
a=0
w=0
for i in range(len(lll)):
    for j in lll[i]:
        if j[1]=="WA":
            w+=1
        elif j[1]=="AC":
            a+=1
            break
print(a,w)

Submission status: Wrong Answer

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

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

for i in range( m ):
  p = input().split()
  prob_no =int( p[ 0 ])
  if p[ 1 ] == "WA":
    wa[ prob_no - 1 ] += 1
  else:
    ac[ prob_no - 1 ] = True

wa_cnt = 0
for i in range( n ):
  if ac[ i ]:
    wa_cnt += wa[ i ]
ac_cnt = sum( ac )

print( ac_cnt, wa_cnt )

Submission status: Wrong Answer

Solution code:
n, m = map( int, input().split())
 
wa_cnt = 0
ac_cnt = 0
no = -1
solv_effective = False

for _ in range( m ):
  a = input().split()
 
  if no != a[0]:
    if solv_effective: #kitanai ko-do nanoha wakatteimasu
      wa_cnt -= wa_cnt_now
    solv_effective = True
    wa_cnt_now = 0
 
  if solv_effective:
    if a[1] == "WA":
      wa_cnt += 1
      wa_cnt_now += 1
    else:
      ac_cnt += 1
      solv_effective = False
    no = a[0]
 
print( ac_cnt, wa_cnt )

Submission status: Wrong Answer

Solution code:
n, m = map( int, input().split())
 
wa_cnt = 0
ac_cnt = 0
no = -1
for _ in range( m ):
  a = input().split()
 
  if no != a[0]:
    solv_effective = True
 
  if solv_effective:
    if a[1] == "WA":
      wa_cnt += 1
    else:
      ac_cnt += 1
      solv_effective = False
    no = a[0]
 
print( ac_cnt, wa_cnt )

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa,ansb=0,0
wa=0
for i in range(m):
    p,s=input().split()
    if i==0:
        old=p
        if s=="AC": #1問目がACの時
            ansa+=1
        else:
            wa+=1
            old=0
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
print(ansa,ansb)

Submission status: Wrong Answer

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

tree = []
wa_cnt = 0
ac_cnt = 0
no = -1
for i in range( m ):
  a = list( input().split())

  if no != a[0]:
    solv_effective = True

  if solv_effective:
    if a[1] == "WA":
      wa_cnt += 1
    else:
      ac_cnt += 1
      solv_effective = False
    no = a[0]

print( ac_cnt, wa_cnt )

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa,ansb=0,0
wa=0
for i in range(m):
    p,s=input().split()
    if i==0:
        old=p
        if s=="AC": #1問目がACの時
            ansa+=1
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Submission status: Wrong Answer

Solution code:
input_ = input().split()
N = int(input_[0])
M = int(input_[1])
 
d = {} #問題番号がキー、不正解回数のリストが値
clear = 0
wa = 0
 
for i in range(M):
  input_ = input().split()
  p = int(input_[0])
  S = input_[1]
  
  
  tmp = d.get(p,[False,0])
  
  if S == "WA":
    if not tmp[0]:
      # もしWAで、まだ未正解なら、カウントを増やす
      d[p] = [False,tmp[1] + 1]
  if S == "AC":
    if not tmp[0]:
      # もしACで、まだ未正解なら、正解のカウントを増やす
      clear += 1
      d[p] = [True,tmp[1]]
            
for i in d:
  wa += d[i][1]
  
print(clear,wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa,ansb=0,0
wa=0
for i in range(m):
    p,s=input().split()
    if i==1:
        old=1
        if s=="AC": #1問目がACの時
            ansa+=1
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Submission status: Wrong Answer

Solution code:
input_ = input().split()
N = int(input_[0])
M = int(input_[1])

d = {} #問題番号がキー、正答したか、不正解回数のリストが値

for i in range(M):
  input_ = input().split()
  p = int(input_[0])
  S = input_[1]
  
  tmp = d.get(p)
  
  if tmp is None:
    if S == "WA":
      d[p] = [False,1]
    else:
      d[p] = [True,0]
  else:
    if S == "WA":
      if not d[p][0]:
      	d[p] = [False,tmp[1] + 1]
    else:
      d[p][0] = True
      
clear = 0
wa = 0
      
for i in d:
  if d[i][0]:
    clear += 1
  wa += d[i][1]
  
print(clear,wa)

Submission status: Wrong Answer

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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
      print(*[a, b])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa,ansb=0,0
wa=0
for i in range(1,m):
    p,s=input().split()
    if i==1:
        if s=="AC": #1問目がACの時
            ansa+=1
            old=p
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa,ansb=0,0
wa=0
for i in range(1,m):
    p,s=input().split()
    lip.append(p)
    lis.append(s)
    if len(lip)==1:
        if s=="AC": #1問目がACの時
            ansa+=1
            old=lip[0]
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Submission status: Wrong Answer

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

ac = 0
wa = 0

for i in range(M):
  if a[int(P[i][0])-1] == 0:
    if P[i][1] == "AC":
      ac += 1
      a[int(P[i][0])-1] = 1
    else:
      wa += 1

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

Submission status: Wrong Answer

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

tac = 0
tpe = 0
target_pi = str(1)

for pi, si in PS:
	if pi == target_pi:
		if (si == "WA") :
			tpe += 1
		elif (si == "AC"):
			tac += 1
			target_pi = str(int(target_pi)+1)
			continue

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,M = map(int,input().split())
dic = defaultdict(list)
for i in range(M):
    p,s = input().split()
    dic[p].append(s)

nAC = 0
nWA = 0
for k in dic.keys():
    for s in dic[k]:
        if s == 'AC':
            nAC += 1
            break
        nWA += 1
print(nAC,nWA)

Submission status: Wrong Answer

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

tac = 0
tpe = 0

for target_pi in range(1, N+1):
	target_pi = str(target_pi)
	first_ac = False
	
	
	for pi, si in PS:
		#print(pi, si)
		if pi == target_pi:
			if (si == "WA") and (first_ac is not True):
				tpe += 1
			elif (si == "AC") and (first_ac is not True):
				tac += 1
				first_ac = True
				break

print(tac, tpe)

Submission status: Wrong Answer

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        for j in range(M):
            if S[j] == 'AC':
                count_wa += 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        for i in range(M):
            if S[i] == 'AC':
                count_wa += 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'AC' and p[i] in a:
        continue
    if S[i] == 'WA' and p[i] in a:
        continue
    if S[i] == 'WA' and p[i] not in a:
        count_wa += 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

count_ac = 0
count_wa = 0
a = set()

for i in range(M):
    if S[i] == 'AC' and p[i] not in a:
        a.add(p[i])
        count_ac += 1
    if S[i] == 'WA' and p[i] not in a:
        count_wa += 1

print(count_ac, count_wa)

Submission status: Wrong Answer

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

acc = [ False ] * N
pena = [ 0 ] * N 
for p, S in results:
  p = int(p) - 1
  if acc[p] < 1 and p <= N:
    acc[p] = True if S == 'AC' else False 
    pena[p] = pena[p] + 1 if S == 'WA' else pena[p] 

wa = 0
for i in range(N):
  wa += pena[i] if acc is True else 0
    
print(sum(acc), wa)

Submission status: Wrong Answer

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

acc = [ 0 for i in range(N)]
pena = [ 0 for i in range(N)]
for p, S in results:
  p = int(p) - 1
  if acc[p] < 1 and p <= N:
    acc[p] = acc[p] + 1 if S == 'AC' else acc[p] 
    pena[p] = pena[p] + 1 if S == 'WA' else pena[p] 
  	
print(sum(acc), sum(pena))

Submission status: Wrong Answer

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

acc = [ 0 for i in range(N + 1)]
pena = [ 0 for i in range(N + 1)]
for p, S in results:
  p = int(p)
  if acc[p] < 1 and p <= N:
    acc[p] = acc[p] + 1 if S == 'AC' else acc[p] 
    pena[p] = pena[p] + 1 if S == 'WA' else pena[p] 
  	
print(sum(acc), sum(pena))

Submission status: Wrong Answer

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

acc = [ 0 for i in range(N + 1)]
pena = [ 0 for i in range(N + 1)]
for p, S in results:
  p = int(p)
  if acc[p] < 1:
    acc[p] = acc[p] + 1 if S == 'AC' else acc[p] 
    pena[p] = pena[p] + 1 if S == 'WA' else pena[p] 
  	
print(sum(acc), sum(pena))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

AC = [False for _ in range(N)]

n_AC = 0
n_WA = 0

for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if not AC[p]:
        if S == "AC":
            AC[p] = True
            n_AC += 1
        elif S == "WA":
            n_WA += 1
        else:
            raise ValueError

print(n_AC, n_WA)