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=(int(i) for i in input().split())
ps=[input().split() for j in range(M)]
flag=0
ac=0
pt=0
for k in range(len(ps)):
  if ps[k][1]=="WA" and flag==int(ps[k][0])-1:
    pt+=1
  elif ps[k][1]=="AC" and flag<int(ps[k][0]):
    ac+=1
    flag=int(ps[k][0])

print(ac,pt)

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
question_dict_ac={}
question_dict_wa={}
question_list=[]
question_counter=0
answer_counter=m
while answer_counter > 0:
  question_num,result = input().split()
  if result=='AC':
    question_dict_ac[question_num]=[result]
  if result=='WA':
    question_dict_wa[question_num]=[result]
  answer_counter-=1

print (len(question_dict_ac),len(question_dict_wa))

Submission status: Wrong Answer

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

acList = [False] * n
waCount = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p) - 1 # インデックスの調整
  if acList[p]:
    continue
  if s == 'WA':
    waCount += 1
    continue
  acList[p] = True

print(sum(acList), waCount)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split(" ")]
P = []
correct = 0
penalty = 0
for x in range(M):
    temp = [x for x in input().split(" ")]
    if temp[1] == "AC" and temp not in P:
        correct += 1
    elif temp[1] == "WA" and temp not in P:
        penalty += 1
    P.append(temp)

print(correct, end=" ")
print(penalty)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    SP = [input().split() for i in range(M)]
    wa_num = 0
    wa_num_temp = 0
    ac_num = 0
    ansed = []
    for sp in SP:
        if sp[1] == "WA":
            wa_num_temp += 1
        elif sp[1] == "AC" and sp[0] not in ansed:
            ac_num += 1
            wa_num += wa_num_temp
            wa_num_temp = 0
            ansed.append(sp[0])

    print(ac_num, wa_num)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac = 0
wa = 0
i = 0

while i < m :
    flag = False
    tmp = ps[i][0]
    p = ps[i][0]
    s = ps[i][1]
    while tmp == p and i < m:
        if s == "WA" and not flag:
            wa += 1
        elif s == "AC" and not flag:
            ac += 1
            flag = True
        i += 1
        if i < m:
            p = ps[i][0]
            s = ps[i][1]

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

Submission status: Wrong Answer

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

ac_list = [0] * (N+1)
wa_list = [0] * (N+1)
wa_cnt = 0
ac_cnt = 0

for _ in range(M):
  p, S = map(str, input().split())
  if S == 'AC':
    if ac_list[int(p)] == 0:
      ac_cnt += 1
      ac_list[int(p)] = 1
    else:
      pass
  else:
    if ac_list[int(p)] == 0:
      wa_list[int(p)] += 1
    else:
      pass
wa_cnt = sum(wa_list)
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'


for i in range(m):
    p, s = map(str, input().split())
    if quest == p and result == s and result == 'AC':
        pass
    elif quest == p and s == 'WA' and result == 'AC':
        pass
    elif quest == p and s == 'AC':
        ac += 1
    elif quest != p and s == 'WA':
        wa += 1
    elif quest != p and s == 'AC':
        ac += 1

    quest = p
    result = s

print(ac, wa)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lp=[]
lc=[]
pen=0
corr=0
for _ in range (m):
  a,s = input().split()
  a=int(a)
  if s=='AC':
    if a not in lc:
      corr+=1
      lc.append(a)
  else:
    if a not in lc:
      if a not in lp:
        pen+=1
        lp.append(a)
print(corr,pen)

Submission status: Wrong Answer

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

c_l = list()
a = 0
w = 0

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

Submission status: Wrong Answer

Solution code:
import sys
bbn=1000000007
	
#+++++

		
def main():
	n,m = map(int, input().split())
	ac_list=[False]*n
	wa_list=[0]*n
	for i in range(m):
		a,b=input().split()
		a=int(a)-1
		if not ac_list[a] and b=='WA':
			wa_list[a]+=1
		elif b =='AC':
			ac_list[a]=True
	ra=sum(ac_list)
	rb=sum(wa_list)
	print(ra,rb)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

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

list = [True for i in range(n)]
cnt = [0 for i in range(n)]
for i in range(m):
	tmp, s = input().split()
	p = int(tmp)
	if s == "AC":
		if list[p-1]:
			list[p-1] = False
	elif s == "WA":
		if list[p-1]:
			cnt[p-1] += 1
			
print(list.count(False), sum(cnt))

Submission status: Wrong Answer

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

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 List[pro]=="AC":
        continue
    if s == "WA":
        penalties+=1
        List[pro]=s
    else:
        List[pro]=s
        correct+=1
print("%d %d"%(List.count("AC"),penalties))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
correct=[0]*n
penalty=0

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

print(sum(correct),penalty)

Submission status: Wrong Answer

Solution code:

a,b = map(int,input().split())
dp = [0]*10**5
qp = [0]*10**5
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if tb == 'WA' and qp[ta-1] == 0 :dp[ta-1]+=1
    if tb == 'AC' and qp[ta-1] == 0 :qp[ta-1]+=1
print(sum(qp),sum(dp))

Submission status: Wrong Answer

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

D=['WA']*N
p=0
a=0
for i in range(M):
  if D[P[i]-1]=='WA':
    if A[i]=='WA':
      p+=1
    else:
      if D[P[i]-1]=='WA':
        a+=1
        D[P[i]-1]='AC'

print(a,p)

Submission status: Wrong Answer

Solution code:
temp=list(map(int, input().split()))
N=temp[0]
M=temp[1]
f=[0]*N
cnt=0
ac=0
for i in range(M):
  temp=input().split()
  if f[int(temp[0])-1]==0:
    if temp[1]=='WA':
      cnt+=1
    else:
      f[int(temp[0])-1]=1
      ac+=1
print(str(ac)+' '+str(cnt))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = [0 for i in range(n)]
wa = [0 for i in range(n)]

for i in range(m):
    check = input().split()
    if ac[int(check[0])-1]==0:
        if check[1]=='AC':
            ac[int(check[0])-1]=1
        else:
            wa[int(check[0])-1]+=1
ans = [sum(ac),sum(wa)]
print(*ans,sep=' ')

Submission status: Wrong Answer

Solution code:
# 2020/01/12
# AtCoder Beginner Contest 151 - C

# Input
n, m = map(int,input().split())

# Calc
acstat = [0] * (n+1)

wk_p = -1
ac_cnt = 0
wa_cnt = 0
for i in range(m):
    p, s = input().split()
    if s == "AC":
        if acstat[int(p)] == 0:
            ac_cnt = ac_cnt + 1
            acstat[int(p)] = 1
        
    elif s == "WA":
        if acstat[int(p)] == 0:
            wa_cnt = wa_cnt + 1

# Output
print(ac_cnt, wa_cnt)

Submission status: Wrong Answer

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


m = {}

N, M = list(map(int, input().split()))
penalty = 0
for _ in range(M):
    p, s = input().split()
    if s == "AC":
        if p not in m:
            m[p] = 1
    else:
        if p not in m:
            penalty += 1


print(str(len(m.keys())) + " " + str(penalty))

Submission status: Wrong Answer

Solution code:
# 問題数と提出数
input_data = input().split()
n, m = map(int, input_data)

# 正解状況のリスト
col_list = [0 for i in range(n)]
# 正解回数
col = 0
# ペナルティ回数
penal = 0

# 提出数分取得
for i in range(m):
  input_data = input().split()
  
  # チェックする問題
  chk_index = int(input_data[0]) - 1
  
  # 正解済みのため、チェックしない
  if(col_list[chk_index] == 1):
    continue
  if(input_data[1] == "AC"):
    col_list[chk_index] = 1
    col += 1
  else:
    penal += 1

print(str(col) + " " + str(penal))

Submission status: Wrong Answer

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

PS = {}
for _ in range(m):
    p, s = input().split()
    try:
        PS[int(p)].append(s)
    except KeyError:
        PS[int(p)] = [s]
# print(PS)

a, b = 0, 0
for ps in PS.values():
    for s in ps:
        if s == "AC":
            a += 1
            break
        if s == "WA":
            b += 1

print(a, b)

Submission status: Wrong Answer

Solution code:
def main():
    n,m=map(int,input().split())
    p =[[] for i in range(n)]
    s =[]
    for i in range(m):
        pp,ss=input().split()
        ppp=int(pp)
        p[ppp-1].append(ss)
    

    cntA = 0
    cntW = 0
    for i,a in enumerate(p):
        flg = 0
        for j,s in enumerate(a):
            if  s == 'WA':
                cntW += 1
            elif s == 'AC':
                cntA += 1
                break
    print(str(cntA) + ' ' + str(cntW))
    # print(cntA)
    # print(cntW)
if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
AC=[]
WA=0
for _ in range(M):
  p,S=input().split()
  if S=="AC":
    AC.append(p)
  else:
    if p not in AC:
      WA+=1
print(len(set(AC)),WA)

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin
N, M = map(int, f.readline().split(' '))
p_list = []
S_list = []
penalty = {}
correct = {}
for i in range(M):
    p, S = f.readline().split(' ')
    p, S = int(p), S[:-1]
    p_list.append(p)
    S_list.append(S)
    penalty[p] = 0
    correct[p] = 0
for i in range(M):
    p, S = p_list[i], S_list[i]
    if S == 'AC':
        correct[p] = 1
    else:
        if correct[p] == 0:
            penalty[p] += 1

# print(N, M, p_list, S_list)
print(sum(correct.values()), sum(penalty.values()))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ac=0
wa=0
pp=None
for i in range(0,m):
    p,s = input().split()
    if pp == p:
        continue
    if s == 'AC':
        pp = p
        ac=ac+1
    wa=wa+1 if s == 'WA' else wa
print(ac, wa)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import math
inf = [ int(a) for a in input().rstrip().split(' ')]
# print(inf)
results = [[a for a in input().rstrip().split(' ')] for i in range(inf[1])]
# print(results)

solved = []
pennalty = 0

for sub in results:
    if sub[1] == 'AC':
        if not(sub[0] in solved):
            solved.append(sub[0])
    else:
        if not(sub[0] in solved):
            pennalty += 1
            
print('{} {}'.format(len(solved), pennalty))

Submission status: Wrong Answer

Solution code:
ac = 0
wa = 0
result = []
check = []

n, m = map(int, input().split())
for _ in range(m) :
    p, s = map(str, input().split())
    result += [[int(p), s]]

for i in result :
    if not i[0] in check :
        if i[1] == "WA" :
            wa += 1
        else :
            ac += 1
            check += [i[0]]

print(ac, wa)

Submission status: Wrong Answer

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

flags = [0]*(N+1)

AC = 0
WA = 0

for i in range(M):
  if X[i][1] == 'AC':
    if flags[int(X[i][0])] == 0:
      AC += 1
      flags[int(X[i][0])] = 1
  if X[i][1] == 'WA':
    if flags[int(X[i][0])] == 0:
      WA += 1
      
print(AC,WA,sep=' ')

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())
#print N, M

state = [-1 for i in range(N)]
WA = [0 for i in range(N)]

pena = 0
for i in range(M):
    s = raw_input().split()
    p = int(s[0])
    sc = s[1]
    #print p, sc
    p -= 1
    if (state[p] == 0):
        continue
    if sc == 'WA':
        pena += 1
    else:
        state[p] = 0

ok = 0
for i in range(N):
    if state[i] == 0:
        ok += 1

print ok, pena

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
x=[input().split() for i in range(b)]
#print(x)

import numpy as np
 
y = np.array(x)
z=np.argwhere(y=="WA")
 
print(len(z))

Submission status: Wrong Answer

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

li = [[]] * n
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if "AC" not in li[p-1] and s == "AC":
    li[p-1].append(s)
  elif "AC" not in li[p-1] and s != "AC":
    li[p-1].append(s)
for i in li:
  if "AC" in i:
    ans += 1
    wa += i.count("WA")


print(ans,wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
p = []
S = []
for i in range(M):
    a, b = map(str,input().split())
    a = int(a)
    p.append(a)
    S.append(b)
ac_ans = 0
pn_ans = 0
tmp_dict = dict()
ac_dict = dict()
pn_dict = dict()
for i in range(M):
    tmp_dict[p[i]] = 0
    ac_dict[p[i]] = 0
    pn_dict[p[i]] = 0

for i in range(M):
    if S[i] == "AC":
        #tmp_dict[p[i]] = pn_dict[p[i]]
        if ac_dict[p[i]] == 0:
            ac_dict[p[i]] += 1
        else:
            pass
    else:
        if ac_dict[p[i]] == 0:
            pn_dict[p[i]] += 1
        else:
            pass
for i in range(len(ac_dict)):
    ac_ans += ac_dict[p[i]]
for i in range(len(pn_dict)):
    pn_ans += pn_dict[p[i]]
ac_ans = str(ac_ans)
pn_ans = str(pn_ans)
print(ac_ans + " " + pn_ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ps = [list(input().split()) for _ in range(m)]
wa = 0
ac = 0
flag = -1
wa_flag = 0
for i in range(m):
  if abs(int(ps[i][0])-int(flag))>1:
    wa_flag = 0
    flag = str(int(ps[i][0])-1)
  if flag == ps[i][0]:
    continue
  else:
    if ps[i][1] == "AC":
      ac += 1
      wa += wa_flag
      flag = ps[i][0]
      wa_flag = 0
    else:
      wa_flag += 1
print(ac,wa)

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
print(str(len(set(a))) + " " + str(b))

Submission status: Wrong Answer

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

AC_num = 0
WA_num = 0
AC_map = []
for i in range(M):
    p,S = map(str, input().split())
    p = int(p)
    if S == 'AC' and (p not in AC_map):
        AC_num += 1
        AC_map.append(p)
    elif S == 'WA':
        if p in AC_map:
            continue
        else:
            WA_num += 1

print(str(AC_num)+' '+str(WA_num))

Submission status: Wrong Answer

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

solved = []
correct = 0
penalty = 0

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

    if p not in solved:
        if s == "WA":
            penalty += 1
        elif s == "AC":
            correct += 1
            solved.append(p)

print(correct, penalty)

Submission status: Wrong Answer

Solution code:
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

N, M = map(int, input().split())
nAC = [False for i in range(N)]
nWA  = 0

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

    if S == 'AC':
        if nAC[p]:
            pass
        else:
            nAC[p] = True
    else: #WA
        if nAC[p]:
            pass
        else:
            nWA += 1

print(sum(nAC), nWA)

Submission status: Wrong Answer

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

ans_list = []
pen_num = 0
cor_num = 0

for i in range(M):
  p_i, S_i = input().split()
  p_i = int(p_i)
  
  if not (p_i in ans_list):
    if(S_i == "WA"):
      pen_num += 1
    elif(S_i == "AC"):
      cor_num += 1
      ans_list.append(p_i)
      
print("{} {}".format(cor_num,pen_num))

Submission status: Wrong Answer

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

ac_p = []
ac = 0
wa = 0
for _ps in ps:
    if _ps[0] not in ac_p:
        if _ps[1] == "AC":
            ac += 1
            ac_p.append(_ps[0])
        else:
            wa += 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
input1 = input().split()
problem = int(input1[0])
num_sub = int(input1[1])
list_sub = set()
for i in range(num_sub):
  input2 = input().split()
  list_sub.add((input2[0], input2[1]))
right = 0
for i in list_sub:
  if(i[1] == "AC"):
    right = right + 1
print(str(right) + " " + str(len(list_sub)-right))

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
ac = [0] * (n + 1)
wa = [0] * (n + 1)

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

print(sum(ac), sum([p for a, p  in zip(ac, wa) if a == 1]))

Submission status: Wrong Answer

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

ACList = []
firstACcnt = 0
WAcnt = 0
for i in range(M):
    s = input().split()
    if s[1] == 'AC' and s[0] not in ACList:
        ACList.append(s[0])
        firstACcnt += 1
    if s[1] == 'WA' and s[0] not in ACList:
        WAcnt += 1

print("{} {}".format(firstACcnt, WAcnt))

Submission status: Wrong Answer

Solution code:
all_question, submission_count = map(int, input().split())
results = {}
for _ in range(submission_count):
    question_num, res = input().split()
    if question_num not in results:
        results[question_num] = []
    results[question_num].append(res)


def get_index(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

clear_count = penalty_count = 0

for questuin_num, res_list in results.items():
    index = get_index(res_list, "AC")
    if index == -1:
        penalty_count += len(res_list)
        continue
    penalty_count += index
    clear_count += 1

print(clear_count, penalty_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
pro_lst = []
ans_lst = []
ac_num = 0
wa_num = 0
for i in range(m):
    p, s = input().split()
    if p not in pro_lst:
        pro_lst.append(p)
        if s == 'AC':
            ans_lst.append(p)
            ac_num += 1
        else:
            wa_num += 1
    elif p in pro_lst:
        if p in ans_lst:
            pass
        elif p not in ans_lst:
            if s == 'AC':
                ans_lst.append(p)
                ac_num += 1
            else:
                wa_num += 1

print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
source_list = []
for i in range(m):
    instr = input()
    source_list_mini = []
    source_list_mini.append(instr.split(" ")[0])
    source_list_mini.append(instr.split(" ")[1])
    source_list.append(source_list_mini)

finish_dic = {}
pena_count_dic = {}
for source in source_list:
    pena_count_dic[source[0]] = 0
    finish_dic[source[0]] = False

for source in source_list:
    if source[1] == "AC":
        finish_dic[source[0]] = True
    else:
        if finish_dic[source[0]] == False:
            pena_count_dic[source[0]] += 1
        
ans_count = 0
for flag in finish_dic.values():
    if flag == True:
        ans_count += 1
        
pena_count = 0
for pro_num, pena in pena_count_dic.items():
    if finish_dic[pro_num] == True:
        pena_count += pena
     
pena_count = sum(list(pena_count_dic.values()))
print(ans_count, pena_count)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
sub = [list(input().split()) for _ in range(M)]
A = 0
W = 0
num = 1
for k in range(M):    
    if (sub[k][0] == str(num)) and (sub[k][1] == "AC"):
            A += 1
            num += 1
            continue
    elif (sub[k][0] == str(num)) and (sub[k][1] == "WA"):
            W += 1
print(A,end=" ")
print(W)

Submission status: Wrong Answer

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

N, M = map(int, input().split())

ac_dict = {}

wa_count = 0
for i in range(M):
    p, s = input().split()

    #  ACだった時の処理
    if s == 'AC':
        ac_dict[p] = 1
    elif s == 'WA' and ac_dict.get(p) is None:
        wa_count += 1

ac_count = len(ac_dict)

print('{} {}'.format(ac_count, wa_count))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
x = []
y = []
for i in range(1, m+1):
    p, s = input().split()
    if s == 'AC':
        x.append(p)
    else:
        y.append(p)
x = len(set(x))
y = len(set(y))
print(x, y)

Submission status: Wrong Answer

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

x = []
for i in range(m):
  x.append(list(map(str,input().split())))
  
x_arr = list(map(list, set(map(tuple, x))))

AC = [i for i in x_arr if i[1] == "AC"]
WA = [i for i in x_arr if i[1] == "WA"]

print(len(AC), len(WA))

Submission status: Wrong Answer

Solution code:
N, M=list(map(int, input().split()))
problem = []
result  = []
for _ in range(M):
    str_list = input().split(' ')
    problem.append(int(str_list[0]))
    result.append(str_list[1])

#first_AC = [False]*N
#pena     = [0]*N
first_AC = [False for i in range(N)]
pena     = [0     for i in range(N)]
for (p, r) in zip(problem, result):
    if first_AC[p-1]==False:
        if r=='WA':
            pena[p-1] += 1
        elif r=='AC':
            first_AC[p-1]=True
collect    = sum(first_AC)
total_pena = sum(pena)
#print('%d %d' % (collect, total_pena))
print(str(collect)+' ', end='')
print(total_pena)

Submission status: Wrong Answer

Solution code:
N, M = input().split()
pS = [input().split() for i in range(int(M))]
ans = {}
for i in pS:
    if i[0] not in ans.keys():
        ans[i[0]] = [0, 0]
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] >= 1:
                pass
            else:
                ans[i[0]][1] += 1
    else:
        if ans[i[0]][0] == 0:
                ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] >= 1:
                pass
            else:
                ans[i[0]][1] += 1
ac = 0
wa = 0
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
print(ac, wa)

Submission status: Wrong Answer

Solution code:
l = input().split(" ")
N = int(l[0])
M = int(l[1])
 
answered = set()
 
ac_count = 0
wa_count = 0
 
for n in range(M):
    result = [i for i in input().split(" ")]
    p = result[0]
    if p in answered:
        continue
    s = result[1]
    if s == "WA":
        wa_count += 1
    else:
        ac_count += 1
        answered.add(p)
        if len(answered) == N:
            break
 
print(ac_count, wa_count)

Submission status: Wrong Answer

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

count=[[i+1,0,0,1] for i in range(n)]
ans=0
pen=0

for i in l:
  for j in count:
    if i[0]==j[0]:
      if j[3]==1:
        if i[1]=='WA':
          pen+=1
        else:
          ans+=1
          j[3]*=0

print(ans,pen)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最大公約数 
def gcd(a, b):
  if a < b:
      a, b = b, a
  while a % b != 0:
      a, b = b, a % b
  return b

# 最小公倍数
def lcm(a, b):
  y = a*b / gcd(a, b)
  return int(y)

n, m = MAP()


L = []
for i in range(m):
  l = S_LIST()
  L.append(l)

num = 1
# wa
wa = 0
ac = 0

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


for i in range(m):
  p = int(L[i][0])-1
  ans = L[i][1]
  if ac[p] == 0:
    if ans == "WA":
      wa[p] = wa[p] + 1
    if ans == "AC":
      ac[p] = ac[p] = 1
print(sum(ac), sum(wa))


# for p in range(1, n+1):
#   if L[i][0] == str(p):
#     for i in range(m):
#       if L[i][1] == "WA":
#         wa += 1

#     for i in range(m):
#       if L[i][1] == "AC":
#         ac += 1
#   print(wa)
#   print(ac)

Submission status: Wrong Answer

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

hako = [False for i in range(N)]
pena = 0
AC = 0

for i in range(M):
    if ps[i][1] =='AC' and hako[ps[i][0]-1]==False:
        AC+=1
        hako[ps[i][0]-1] = True
    elif ps[i][1] =='WA' and hako[ps[i][0]-1] == False:
        pena+=1
        
print(AC,pena)

Submission status: Wrong Answer

Solution code:
n, m = input().split()
a = [False] * int(n)
AC = 0
WA = 0
for i in range(int(m)):
  p, s = input().split()
  if(s == "AC" and a[int(p) - 1] == False):
    a[int(p) - 1] = True
    AC += 1
  if(s == "WA" and a[int(p) - 1] == False):
    WA += 1

print(AC, WA)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cleared = []
ac_counter = 0
wa_counter = 0
for i in range(m):
    p, s = input().split()
    p = int(p)
    if not p in cleared:
        if s == 'AC':
            ac_counter += 1
            cleared.append(p)
        else:
            wa_counter += 1
print('{} {}'.format(ac_counter, wa_counter))

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, m = MAP()
    ac = defaultdict(int)
    wa = defaultdict(int)
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac[p] = 1
        else:
            if ac[p] == 0:
                wa[p] += 1

    #print(sum(ac.values()))
    # print(wa)
    print(sum(ac.values()), sum(wa.values()))


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M = list(map(lambda x: int(x), input().split()))
cleared = [False for i in range(N+1)]
ac = 0
wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  
  if cleared[p]:
    continue
  if s == "AC":
    cleared[p] = True
  elif s == "WA":
    wa = wa + 1

print("{} {}".format(sum(np.array(cleared) *1), wa))

Submission status: Wrong Answer

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

AC = [0]*(n+1)
AC_count=0
WA = [0]*(n+1)
WA_count=0

for i in range(m):
  p_number, p_status = input().split()
  p_number =int(p_number)
  if (p_status =='WA') & (AC[p_number]==0):
    WA[p_number]+=1
    WA_count+=1
  if (p_status =='AC') & (AC[p_number]==0):
    AC[p_number] +=1
    AC_count+=1

print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
nset=set()
acount=0
pcount=0
for i in range(m):
    s,p=map(str,input().split())
    if int(s) not in nset:
        if p=="WA":
            pcount+=1
        if p=="AC":
            nset.add(int(s))
            acount+=1
print(acount,pcount)

Submission status: Wrong Answer

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

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

for i in range(m):
    p, s = input().split()
    p = int(p)-1
    if not d[p] and s == 'AC':
        ac += 1
        d[p] = True
    else:
        if not d[p]:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split(" ")]
ac = [0 for _ in range(0, n)]
wa_count = [0 for _ in range(0, n)]

for i in range(0, m):
    pi, si = [x for x in input().split(" ")]
    pi = int(pi)
    if si == "WA" and not ac[pi-1]:
        wa_count[pi-1] += 1
    elif si == "AC":
        ac[pi-1] = 1

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

Submission status: Wrong Answer

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

ac_set = set()
wa_cnt = 0
for i in range(M):
    p, s = input().split()
    if s == 'WA' :
        if p not in ac_set:
            wa_cnt += 1
    else :
        ac_set.add(p)
        
print(len(ac_set),wa_cnt)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ac = 0
wa = 0
p = []
s = []
flag = 0
for i in range(m):
    P,S = map(str,input().split())
    p.append(int(P))
    s.append(S)
mita = set()
for i in range(m):
    if p[i] in mita:
        pass
    elif s[i] == "AC":
        ac += 1
        mita.add(p[i])
    else:
        wa += 1
print(ac,wa)

Submission status: Wrong Answer

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

sum_ok = 0
sum_miss = 0
former_ok = []
for i in range(m):
    if s[i] == 'AC' and p[i] not in former_ok:        
        sum_ok += 1
        former_ok.append(p[i])
    elif s[i] == 'WA':
        sum_miss += 1
    if sum_ok == n:
        break
print(sum_ok, sum_miss)