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())
temp = 1
AC = 0
WA = 0
if M == 0:
    print(0,0)
else:
    while M > 0:
        p,s = (input().split())
        if int(p) == temp:
            if s == 'AC' and AC < temp:
                AC += 1
            elif s == 'WA' and WA < temp:
                WA += 1
        else:
            temp += 1
            if s == 'AC' and AC < temp:
                AC += 1
            elif s == 'WA' and WA < temp:
                WA += 1
        M -= 1
print (AC,WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
aclist = []
walist = []
wac = 0


for i in range(m):
  a , b = input().split()
  str(b)
  int(a)
  if b == "AC":
    if not aclist.count(a):
      aclist.append(a)
  elif b == "WA":
    if not aclist.count(a):
      aclist.append(a)
      wac += 1


print(len(aclist),wac)

Submission status: Wrong Answer

Solution code:
[n,m] = [int(x) for x in input().split()]
ok=[]
s=[]
p=[]
c_ok=0
c_ng=0
for i in range(m):
	[a,b]=[x for x in input().split()]
	p.append(a)
	s.append(b)

for i in reversed(range(m)):
	if s[i]=="AC" and (p[i] in ok)==False:
		c_ok+=1
		ok.append((p[i]))
	elif s[i]=="WA" and (p[i] in ok) == True: 
		c_ng+=1

print(int(c_ok),int(c_ng))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
p=[];s=[]
if m==0:
    print(0,0)
    exit()
for i in range(m):
    x,y=input().split()
    p.append(int(x))
    s.append(y)
ac=0
wa=0
t=[0]*n
for i in range(m):
    if t[p[i]-1]>=1:
        continue
    elif t[p[i]-1]==0 and s[i]=="WA":
        wa+=1
    elif t[p[i]-1]==0 and s[i]=="AC":
        t[p[i]-1]+=1
        ac+=1
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
    else:
        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(' '))
wa_count = [0] * N
ac = [False] * N
rest_ac_num = N

WA = 'WA'

for i in range(M):
    #print()
    #print('wa_count', wa_count)
    #print('ac', ac)
    #print('rest_ac_num', rest_ac_num)
    #print()

    _p, S = input().split(' ')
    p = int(_p) - 1

    if ac[p]:
        continue

    if S == WA:
        wa_count[p] += 1
    else:
        ac[p] = True
        rest_ac_num -= 1

    #if rest_ac_num == 0:
    #    break

wa_total = 0
for c in wa_count:
    wa_total += c

print(N - rest_ac_num, wa_total)

Submission status: Wrong Answer

Solution code:
import sys
from functools import reduce

n, m = map(int, input().split())
ps = [r.split() for r in sys.stdin.read().split('\n') if r != '']
ps.sort(key=lambda t: int(t[0]))
ac = {}
wa = {}
for j in range(0, m):
    i = int(ps[j][0])
    if i in ac:
        continue
    if ps[j][1] == 'AC':
        ac[i] = 1
        continue
    if i not in wa:
        wa[i] = 1
    else:
        wa[i] += 1
wacount = reduce(lambda a, b: a + b, wa.values()) if len(wa) > 0 else 0
print(len(ac), wacount)

Submission status: Wrong Answer

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

ac_set = set()
ac = 0
wa = 0

for i in range(m):
  p, s = input().split()
  
  if s == 'WA' and (p not in ac_set):
    wa += 1
  
  if s == 'AC':
    ac_set.add(p)

print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
d={}
ans=0
pen=0

for i in range(m):
  s=input().split()
  if s[0] not in d:
    if s[1]=='WA':
      d[s[0]]=[0,1,False]
    else:
      d[s[0]]=[1,0,True]
  else:
    if s[1]=='WA' and d[s[0]][2]==False:
      d[s[0]][1]+=1
    elif s[1]=='AC' and d[s[0]][2]==False:
      d[s[0]][0]+=1
      d[s[0]][2]=True

for i in d:
  ans+=d[i][0]
  pen+=d[i][1]
      
print(ans,pen)

Submission status: Wrong Answer

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

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

answers = {}
wrongs = {}
for a in l:
    if a[1] == "AC":
        answers[a[0]] = a[1]
    elif a[1] == "WA":
        if not a[1] in answers and not a[1] in wrongs:
            wrongs[a[0]] = 1
        elif not a[1] in answers and a[1] in wrongs:
            wrongs[a[0]] = wrongs[a[0]] + 1
        else:
            pass
# 集計
result = [len(answers.keys()), sum(wrongs.values())]

print(result[0], result[1])

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())
cor = 0
mis = 0
sameNum = 0

for _ in range(M):
    num,res = input().split()
    if num != sameNum:
        if res == 'AC':
            cor += 1
            sameNum = num
        else:
            mis += 1

print(cor,mis)

Submission status: Wrong Answer

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

t = 0
f = 0
k = []
for i in range(len(l)):
  p = l[i]
  if p[1] == "AC" and p[0] in k:
    pass
  elif p[1] == "AC":
    t = t + 1
    k.append(p[0])
  
  if  p[1] == "WA" and p[0] not in k:
    f = f + 1
print(t,f)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
S = []
total = []
pena = 0
ok = 0
for i in range(M):
    a,b = map(str,input().split())
    if not a in total:
        if b=='AC':
            ok+=1
            total.append(a)
        elif b=='WA':
            pena+=1
print(str(ok)+' '+str(pena))

Submission status: Wrong Answer

Solution code:
[n, m] = [int(i) for i in input().split()]
ac = [0] * n
wa = [0] * n
for i in range(m):
  [p, s] = [i for i in input().split()]
  if s == "ac":
    ac[int(p)-1] = 1
  else:
    wa[int(p)-1] = 1

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
#n 問題数 m 提出回数
list = []
for i in range(m):
    p, s = input().split()
    list.append((int(p), s))
#print(list)
succ = 0
pena = 0
a = []
b = []
for i in list:
    if i[1] != 'WA' and (i[0] in a) != True:
        succ += 1
        a.append(i[0])
    elif i[1] != 'WA' and (i[0] in a) == True:
        pass
    elif i[1] == 'WA' and (i[0] in b) != True:
        pena += 1
        b.append(i[0])
    else:
        pass

print('{} {}'.format(succ, pena))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
#import numpy as np
wa = 0
ans = 0
for j in range(1,N+1):
  #print(j)
  for i in range(len(A)):
    if int(A[i][0]) == j:
      if A[i][1] == 'WA':
        wa +=1
      if A[i][1] == 'AC':
        ans += 1
        break
print(ans,wa)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(' ')))
r = [0] * N

pena = 0
co = 0

for i in range(M):
  pi, Si = input().split(' ')
  p = int(pi)
  if r[p - 1] == 0:
    if Si == 'WA':
      pena += 1
    else:
      co += 1
      r[p - 1] = 1

print (str(co) + ' ' + str(pena))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
s = [0] * M
b = [0] * N
for i in range(M):
    p[i], s[i] = input().split()
sort_p = sorted(p)
set_p = list(set(sort_p))
for i in range(len(set_p)):
    b[i] = False

seikai = 0
pena = 0
for i in range(M):
  for n in range(len(set_p)):
    if p[i] == set_p[n]:
      if s[i] == "AC":
        if b[n] == False:
          seikai += 1
          b[n] = True
      else:
        if b[n] == False:
          pena += 1

print("{0} {1}".format(seikai, pena))

Submission status: Wrong Answer

Solution code:
from itertools import groupby
N, M  =map(int, input().split())
ps = [[] for i in range(M)]
for i in range(M):
    ps[i] = list(input().split())
if M == 0:
    print(0,0)
    exit()
listnum = []
listAC = []
for i in range(M):
    listnum.append(int(ps[i][0]))
for i in range(M):
    listAC.append(ps[i][1])
newnumlist = list([list(g) for k, g in groupby(listnum)])
newlistAC = [[] for i in range(len(newnumlist))]
for i in range(len(newnumlist[0])):
    newlistAC[0].append(ps[i][1])
lenth = 0
if len(newnumlist) > 1:
    for i in range(1,len(newnumlist)):
        lenth += len(newnumlist[i-1])
        for j in range(len(newnumlist[i])):
            newlistAC[i].append(ps[j+lenth][1])
countAC=0
counterror = 0
for i in range(len(newlistAC)):
    for j in range(len(newlistAC[i])):
        if newlistAC[i][j] == 'WA':
            counterror += 1
        else:
            countAC += 1
            break
    
print(countAC, counterror)

Submission status: Wrong Answer

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

ac = []
wa = {}

for _ in range(M):
    pS = input().split()
    p = int(pS[0])
    S = pS[1]
    if p in ac:
        continue
    if S == 'WA':
        wa.setdefault(p, 0)
        wa[p] += 1
        continue
    if S == 'AC':
        ac.append(p)
    if len(ac) >= N:
        break

sum_ac = len(ac)
sum_wa = sum(wa.values())
print(sum_ac, sum_wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = {}
ac = 0
wa = 0
flag = False
for i in range(M):
    p, s = input().split()
    if p not in ans:
        flag = False
        if s == "AC":
            ans[p] = [1,0]
            flag = True
        else:
            ans[p] = [0,1]
            flag = False
    else:
        if flag == False:
            if s == "WA":
                a = ans[p]
                a[1] += 1
            if s == "AC":
                a = ans[p]
                a[0] = 1
                flag = True

for val in ans.values():
    ac += val[0]
    wa += val[1]
print(ac, wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
AC=[False]*N
P=[0]*N
pena=0
for i in range(M):
  p,s=map(str,input().split())
  p=int(p)-1
  if s=='WA' and AC[p]==False:
    P[p] +=1
  elif s=='AC':
    AC[p]=True
    pena += P[p]
answer=0
for i in range(N):
  if AC[i]==True:
    answer +=1
print(answer,pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
Alist = [[]]*M
for i in range(M):
  Alist[i] = list(map(str, input().split()))
collect = [False]*N
NP = 0
NAC = 0
results = [False]*N
for k in range(M):
  if Alist[k][1] == 'AC':
    results[int(Alist[k][0])-1] = True

for j in range(M):
  if Alist[j][1] == 'WA' and results[int(Alist[j][0])-1] == True:
    NP += 1
  elif collect[int(Alist[j][0])-1] == False and Alist[j][1] == 'AC':
    NAC += 1
    collect[int(Alist[j][0])-1] = True
print(NAC, " ", NP)

Submission status: Wrong Answer

Solution code:
from sys import exit
N, M = map(int,input().split())
if M == 0:
  print(0,0)
  exit()
P_S = []
AC = 0
WA = 0
for i in range(M):
  P_S.append(input().split())

a = {}
for l in P_S:
  a.setdefault(l[0], [])
  a[l[0]].append(l[1])

for t in a.items():
  for s in t[1]:
    if s == "WA":
      WA += 1
    elif s == "AC":
      AC += 1
      break
print(AC, WA)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
pS = [readline().decode('utf-8').split() for _ in range(M)]

acc = 0
tmp_cnt = 0

AC_list = []
AC_cnt = 0
WA_cnt = 0
for p_, s in pS:
    p_ = int(p_)
    if p_ != acc:
        tmp_cnt = 0
        acc = p_
    if s == 'AC':
        if p_ not in AC_list:
            AC_cnt += 1
            WA_cnt += tmp_cnt
            AC_list.append(p_)
    else:
        tmp_cnt += 1

print(AC_cnt, WA_cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
problem_d = {}
score, penalty = 0, 0
for i in range(M):
	p_i, S_i = input().split()
	if S_i == 'WA' and p_i not in problem_d:
		penalty += 1
	elif S_i == 'AC' and p_i not in problem_d:
		score += 1
		problem_d[p_i] = True
print(str(score)+' '+str(penalty))

Submission status: Wrong Answer

Solution code:
N, H = [int(x) for x in input().split()]
S=[list(map(str,input().split())) for i in range(H)] 
A = []
ansAC = 0
ansWA = 0
for i in range(N):
  i += 1
  A.append([j for j in S if j[0] == str(i)])
for i in A:
  for j in i:
    if j[1] == 'WA':
      ansWA += 1
    else:
      ansAC += 1
      break
  
print(ansAC, ansWA)

Submission status: Wrong Answer

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

for i in range(M) :
    p[i],S[i] = map(str,input().split())
    p[i] = int(p[i])
    BUF[i][0] = p[i]
    BUF[i][1] = S[i]
BUF_new = sorted(BUF,key=itemgetter(0))
#print(BUF_new)

Flag = False
buf_goal = 0
buf_pena = 0
buf = -1
buf_2 = 0

for i in range(M) : #余分な情報削除
    if Flag == True :
        if BUF_new[i][0] == buf :
            #BUF_new.pop(i)
            BUF_new[i][1] = 'NULL'
        else :
            Flag = False
            buf = -1
    if Flag == False :
        if BUF_new[i][1] == 'AC' :
            Flag = True
            buf = BUF_new[i][0]

for i in range(M) :
    if BUF_new[i][1] == 'WA' :
        buf_2 += 1
    if BUF_new[i][1] == 'AC' :
        buf_goal += 1
        buf_pena += buf_2
        buf_2 = 0

#print(BUF_new)
print(buf_goal,buf_pena)

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

sum_ok = 0
sum_miss = 0
former_ok = [0]*n

for i in range(m):
    if p[i] in former_ok:
        continue
    elif s[i] == 'AC':  
        former_ok[sum_ok] = p[i]
        sum_ok += 1
        if sum_ok == n:
            break
    elif s[i] == 'WA':
        sum_miss += 1
    else:
        continue 
print(sum_ok, sum_miss)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
q = []
j = 1

seitou = 0
pena = 0
fin = False
for i in range(M):
    p, s = input().split()
    if fin == False:
        if q.count(p) == 0:
            if s == "AC":
                q.append(p)
                seitou += 1
                if seitou >= N:
                    fin = True
            if s == "WA":
                pena += 1
else:
    print(seitou, pena)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if M == 0:
    print(0,0)
    exit()
 
false_count = 0
ans = 0
 
now = 0
for i in range(M):
    p, s = input().split()
    if int(p) > now:
        now = int(p)
    if int(p) == now:
        if s == "WA":
            false_count += 1
        elif s == "AC":
            ans += 1
            now += 1
 
print(ans, false_count)

Submission status: Wrong Answer

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

def main():
    NM = [int(i) for i in input().split(" ")]
    if NM[1] == 0:
        ans = "0 0"
    else:
        pss = [input().split(" ") for j in range(NM[1])]
        pss_t = list(zip(*pss))
        probs = list(pss_t[0])
        answs = list(pss_t[1])

        probs_uniq = list(set(probs))

        #print(probs_uniq)
        ans_ac = 0
        ans_wa = 0
        for p in probs_uniq:
            #print(p)
            res = [answs[r] for r in range(NM[1]) if probs[r] == p]
            print(res)
            if "AC\n" in res:
                ind_ac = res.index("AC\n")
                ans_ac += 1
                ans_wa += ind_ac
            else:
                pass
        ans = str(ans_ac) + " " + str(ans_wa)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = []
s = []
for i in range(m):
    P,S = map(str,input().split())
    p.append(int(P))
    s.append(S)
Bool = [0 for i in range(n)]
count = [0 for i in range(n)]

for i in range(m):
    if not Bool[p[i]-1]:
        if s[i] == "WA":
            count[p[i]-1] += 1
        else:
            Bool[p[i]-1] = 1
ans = 0
for i in range(m):
    if Bool[p[i]-1]:
        ans += count[p[i]-1]

print(sum(Bool),ans)

Submission status: Wrong Answer

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

p = [0] * M
S = [''] * M

for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

penalty = 0
right_ans = 0
for pp in set(p):
    for i in range(M):
        if(pp == p[i]):
            if(S[i] == 'AC'):
                right_ans += 1
                break
            if(S[i] == 'WA'): penalty += 1

print(right_ans, penalty)

Submission status: Wrong Answer

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

acs = [0] * N
was = [0] * N 

for i in range(M):
    p, s = input().split()
    j = int(p) - 1
    if s == 'AC':
        acs[j] = 1
    elif s == 'WA':
        if acs[j] == 0:
            was[j] += 1

ac, wa = 0, 0
for i in range(N):
    ac += acs[i]
    wa += was[i]

print(ac, wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0

hist_ac = set()
for _ in range(M):
    p, s = input().split()
    if p not in hist_ac:
        if s == 'AC':
            ac += 1
            hist_ac.add(p)
        elif s == 'WA':
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, input().split())
ckn = []
flag = 0
swa = 0
ac = 0

for i in sys.stdin:
  pm, c = i.split()
  if not(int(pm) in ckn):
    if c == 'WA':
      swa += 1

    elif c == 'AC':
      ckn.append(int(pm))
      ac += 1
      if flag == 0:
        flag = 1
  
print(ac, swa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input() for _ in range(m)]
p = [0] * m
s = [''] * m
for i in range(m):
  x, y = ps[i].split()
  p[i] = int(x)
  s[i] = y
ac_flag = [0]*100000 # AC出したかどうかのflag
ac_count = 0
wa_count = 0
for j in range(m):
  if ac_flag[p[j]-1] == 1:
    continue
  if s[j] == 'AC':
    ac_flag[p[j]-1] = 1
    ac_count+=1
  if s[j] == 'WA':
    wa_count+=1
print(ac_count,wa_count)

Submission status: Wrong Answer

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

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

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

for i in range(M):
  if list[i][1] == "AC":
    ac_list[int(list[i][0])-1] = 1
    #print(i, ac_list)
  else:
    #print(i, ac_list)
    if ac_list[N-1] == 0:
      wa_list[int(list[i][0])-1] += 1

for i in range(N):
  if ac_list[i] == 0:
    wa_list[i] = 0

print(sum(ac_list), sum(wa_list))

Submission status: Wrong Answer

Solution code:
n,m = input().split()
ac = 0
wa = 0
tmp = 0
a = 0
w = 0
if m != 0:
    for i in range(int(m)):
        p,s = input().split()
        if tmp != p:
            a = 0
            w = 0
        if a == 0 or w == 0:
            if s == 'AC' and a == 0:
                ac = ac + 1
                a = 1
            elif s == 'WA' and w == 0:
                wa = wa + 1
                w = 1
        tmp = p
print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

Solution code:
def sum(arg):
  ans = 0
  for i in arg:
    ans += i
  return ans

N, M = map(int, input().split())
ac = [0]*N
wa = [0]*N
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if si == "AC" and ac[pi-1] == 0:
    ac[pi-1] += 1
  if si == "WA" and ac[pi-1] == 0:
    wa[pi-1] += 1
print(sum(ac), sum(wa))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
q = [input().split() for _ in range(m)]
ac = [False for _ in range(n+1)]
wa = 0
for p, s in q:
	p = int(p)
	if s == "WA" and not ac[p]:
		wa += 1
	if s == "AC":
		ac[p] = True
print(sum(ac), wa)

Submission status: Wrong Answer

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

for i in range(m):
    ipt=input().split()
    p=int(ipt[0])
    s=ipt[1]
    if l==[]:
        l.append([p,[s]])
    else:
        if l[-1][0] != p:
            l.append([p,[s]])
        else:
            l[-1][1].append(s)

a=0
p=0
for i in range(len(l)):
    k=len(l[i][1])
    for j in range(k):
        if l[i][1][j]=="AC":
            a+=1
            break
        else:
            p+=1
print(a,p)

Submission status: Wrong Answer

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

cor = pen = temp_pen = 0
ac=[]

for _ in range(m):
  temp=input().split()
  if temp[1] == "AC":
    ac.append(temp[0])
    pen += temp_pen
    temp_pen=0
  else:
    if not temp[0] in ac:
      temp_pen += 1
  
print(len(set(ac)), pen)

Submission status: Wrong Answer

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

ans = 0
pen = 0

A=list(map(list, set(map(tuple, A))))

for a in A:
    if a[1]=='AC':
        ans += 1
    if a[1] == 'WA':
        pen += 1

print(ans, pen)

Submission status: Wrong Answer

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

for i in range(M):
    p[i] = int(p[i])

AC = 0
P = 0

Q = []
for i in range(N):
    Q.append(0)

for i in range(M):
    if Q[p[i] - 1] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[p[i] - 1] = 1
    elif Q[p[i] - 1] == 0 and S[i] == 'WA':
        P = P + 1
    else:
        AC = AC
        P = P
    
print(AC, P)

Submission status: Wrong Answer

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

for _ in range(M):
  round,result = input().split()
  round = int(round)
  if result == 'AC' and dic[round][0] == 0:
    dic[round][0] = 1
  if result == 'WA' and dic[round][0] == 0:
    dic[round][1] += 1

right = 0
wrong = 0

for item in dic.values():
  right += item[0]
  wrong += item[1]

print(right, wrong)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
List = [0]*N
correct , penalties = 0,0
for i in range(M):
    p,s = input().split()
    pro = int(p)-1
    if pro > len(List):
        penalties+=1
        continue
    #elif List[pro]=="AC":
        #continue
    elif s == "WA":
        penalties+=1
        List[pro]=s
    elif s == "AC":
        List[pro]=s
        correct+=1
print("%d %d"%((List.count("AC")+1),penalties))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
pS = [list(input().split()) for _ in range(M)]
A = [0]*N
P = [0]*N
for p,S in pS:
    p = int(p)
    if S == 'AC':
        A[p-1] = 1
    else:
        if A[p-1] == 0:
            P[p-1] += 1
print(sum(A),sum(P))

Submission status: Wrong Answer

Solution code:
class Question:
    def __init__(self, num, result):
        self.num = int(num)
        self.result = result


n, m = map(int, input().split())
p_list = [input().split() for _ in range(m)]
questions = [Question(num, result) for num, result in p_list]

collect_list = set()
wa_count = 0

for q in questions:
    if not(q.num in collect_list):
        if q.result == 'AC':
            collect_list.add(q.num)
        else:
            wa_count += 1
print('{} {}'.format(len(collect_list), wa_count))

Submission status: Wrong Answer

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


li = []

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

wa = 0

se = {i for i in li if i[1]=='AC'}
ac = len(se)

flag = True
for i in range(m-1):
    if li[i][0]!=li[i+1][0]:
        flag = True
    elif li[i][0]==li[i+1][0] and li[i][1]=='AC':
        flag = False
    elif li[i][0]==li[i+1][0] and li[i][1]=='WA' and flag:
        wa += 1
    elif li[len(li)-1]==li[len(li)-2] and li[i][1]=='WA' and flag:
        wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
slst = sorted(lst, key=lambda x: x[0])
pn = 0
cr = 0
plbnum = 0
for i in slst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      pn += 1
    else:
      cr += 1
      plbnum = a
print(cr, pn)

Submission status: Wrong Answer

Solution code:
N, H = [int(x) for x in input().split()]
S=[list(map(str,input().split())) for i in range(H)] 
A = []
ansAC = 0
ansWA = 0
for i in range(2):
  i += 1
  A.append([j for j in S if j[0] == str(i)])
for i in A:
  for j in i:
    if j[1] == 'WA':
      ansWA += 1
    else:
      ansAC += 1
      break
  
print(ansAC, ansWA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
psl = [list(input().split()) for _ in range(m)]
 
ac = 0
wa = 0
wa_ = 0
ac_ = 0
 
if m > 0:
    p = 1
    p_count = 0
    for ps in psl:
        if p == int(ps[0]):
            p_count += 1
            if ps[1] == 'WA':
                wa_ += 1
            elif ps[1] == 'AC' and wa_ == 0:
                ac_ += 1
            elif ps[1] == 'AC' and wa_ > 0:
                ac_ += 1
                wa += wa_
                wa_ = 0
        else:
            if ac_ > 0:
                ac += 1
            wa_, ac_ = 0, 0
            if ps[1] == 'WA':
                wa_ += 1
    if ac_ > 0:
        ac += 1
 
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
A=[]
for i in range(M):
  A.append(tuple(map(str,input().split())))
check=np.zeros((N,2))
for i in range(M):
  if check[int(A[i][0])-1,0]==0:
    if A[i][1]=='WA':
      check[int(A[i][0])-1,1]+=1
    else:
      check[int(A[i][0])-1,0]+=1
sum=check.sum(axis=0)
print(int(sum[0]),int(sum[1]))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
aclist = []
wac = 0


for i in range(m):
  a , b = input().split()
  str(b)
  int(a)
  if b == "AC":
    if not aclist.count(a):
      aclist.append(a)
  elif b == "WA":
    wac += 1


print(len(aclist),wac)

Submission status: Wrong Answer

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

ac_set = set()
ac = 0
wa = 0

for i in range(m):
  p, s = input().split()
  
  if s == 'WA' and (p not in ac_set):
    wa += 1

  ac_set.add(p)

print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
N,M=[int(i) for i in input().split()]
done=[]
AC,WA=0,0
for i in range(M):
    p,s=input().split()
    p=int(p)
    if  not p in done:
        if s=="WA":
            WA+=1
        if s=="AC":
            done.append(p)
            AC+=1
print(AC,WA)

Submission status: Wrong Answer

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

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

for i in range(m):
    if l[i][1] == "WA" and ans[int(l[i][0])-1] != 1:
        pena[int(l[i][0])-1] += 1

    if l[i][1] == "AC" and ans[int(l[i][0])-1] != 1:
        ans[int(l[i][0])-1] += 1

print(sum(ans), sum(pena))

Submission status: Wrong Answer

Solution code:
nm = input().split()
wa = 0
ac = 0
db = [0]*int(nm[0])
for i in range(int(nm[1])):
 tmp = input().split()
 if db[int(tmp[0])-1] == 0:
  if tmp[1] == "AC":
   db[int(tmp[0])-1]=1
   ac+=1
  elif tmp[1] == "WA":
   wa+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
#C
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(N, M, p, S)
ac = 0
wa = 0

if M != 0:
    p_pre = p[0]
    flag = False
    for i in range(M):#回答数
        if flag == False:
            if S[i] == "WA":
                wa += 1
            else:
                ac += 1
                flag = True
        else:
            if p[i] == p_pre:
                break
            else:
                if S[i] == "WA":
                    wa += 1
                    flag = False
                if S[i] == "AC":
                    ac += 1
        p_pre = p[i]
else:
    print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M =[int(n) for n in input().split()]
p = {}
s = {}
for i in range(M):
    P, S = input().split()
    if S=='WA' and P not in p:
        c = s.setdefault(P, 0)
        c += 1
        s[P] = c
    else:
        if not p.setdefault(P, 0):
            p[P] = 1
print(sum(p.values()), sum(s.values()))

Submission status: Wrong Answer

Solution code:
import collections
n,m = map(int,input().split())
alist = []
ac_counter = 0
wa_counter = 0
for _ in range(m):
  t = tuple(input().split())
  checkac = (t[0],"AC")
  if t[1] == "WA" and not checkac in alist:
    wa_counter += 1
  elif t[1] == "AC" and not checkac in alist:
    alist.append(t)
    ac_counter += 1
print(ac_counter,wa_counter)

Submission status: Wrong Answer

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

quiz_dict = {}
wa_dict = {}

for i in range(M):
  tmp = input().split()
  
  quiz = tmp[0]
  res = tmp[1]
  
  quiz_dict[quiz] = 0
  wa_dict[quiz] = 0
  if res == "AC":
    quiz_dict[quiz] = 1
  if res == "WA":
    if quiz_dict[quiz] == 0:
      wa_dict[quiz] += 1

wa_n = sum(wa_dict.values())

  
print(len(quiz_dict), wa_n)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
s=[list(map(str,input().split())) for i in range(b)] 
for i in range(b):
    s[i][0]=int(s[i][0])
if b==0:
    print("0 0")
    exit()
aans=0
wans=0
c1=0
count=0
for i in range(b-1,-1,-1):
    if s[i][1]=="AC":
        count=i
        break
for i in range(count):
    if s[i][1]=="WA":
        wans+=1

s= list(map(list, set(map(tuple, s))))
for i in range(len(s)):
    if s[i][1]=="AC":
        aans+=1
print(aans,end=" ")
print(wans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
penalty = 0
answers = 0
mydict  = {}
for i in range(M):
    tmp1,tmp2 = input().split()
    if tmp1 in mydict.keys():
        if mydict[tmp1][0] == "WA" and tmp2 == "wA":
            mydict[tmp1][1] = mydict[tmp1][1] + 1
        elif mydict[tmp1][0] == "WA" and tmp2 == "AC":
            penalty = penalty + mydict[tmp1][1] 
            mydict[tmp1][0] = tmp2
            answers = answers + 1
        else:
            continue 
    else:
        mydict[tmp1] = [tmp2,0] #keyの登録
        if tmp2 == "WA":
            mydict[tmp1][1] = mydict[tmp1][1] + 1
        else:
            answers = answers + 1
    #print(mydict)

ans = str(answers)
pen = str(penalty)
print(ans+" "+pen)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = []
for i in range(m):
  li.append(list(input().split()))
a = []
b = 0
for j in range(m):
  if li[j][1] == "AC":
    a.append(int(li[j][0]))
  elif li[j][1] == "WA" and int(li[j][0]) not in a:
    b += 1
d = []
for k in range(m):
  if int(li[k][0]) not in a:
    d.append(int(li[k][0]))
b -= len(set(d))
c = str(len(set(a)))
bn = str(b)
print(c + " " + bn)