Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

The i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).

The number of Takahashi's correct answers is the number of problems on which he received an AC once or more.

The number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.

Find the numbers of Takahashi's correct answers and penalties.

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

Print the number of Takahashi's correct answers and the number of Takahashi's penalties.

Sample Input 1

2 5
1 WA
1 AC
2 WA
2 AC
2 WA

Sample Output 1

2 2

In his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.

In his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

Note that it is pointless to get an AC more than once on the same problem.

Sample Input 3

6 0

Sample Output 3

0 0



Sample input:
2 5
1 WA
1 AC
2 WA
2 AC
2 WA


Sample output:
2 2

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
p, pc = 0, 0
c = [0] * n
for i in range(m):
    q, r = input().split(' ')
    Q = int(q) - 1
    pc = pc + 1 if r == 'WA' else pc
    if r == 'AC':
        c[Q] = 1
        p += pc
        pc = 0
print('{} {}'.format(sum(c), p))

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

ac = []
acn,wan = 0,0
for i in range(m):
  ans = input().split()
  if ans[0] not in ac:
    if ans[1] == 'AC' :
      ac += [ans[0]]
      acn += 1
    else :
      wan += 1
print(acn,wan)

Submission status: Wrong Answer

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

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]
  
  if quiz not in quiz_dict:
    quiz_dict[quiz] = 0
  
  if quiz not in wa_dict: 
    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()) 

def filter_dict(f, d):
  return {k:v for k,v in d.items() if f(k,v)}

a = len(filter_dict(lambda k,v: v==1, quiz_dict))

print(a, wa_n)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=[input().split() for i in range(m)]
for i in range(m):
    a[i][0]=int(a[i][0])
#print(a)
miss=[0]*n
ans=[]
total=0
for i in range(m):
    if a[i][1]=="AC":
        ans.append(a[i][0])
        total+=miss[a[i][0]-1]
    if a[i][1]=="WA":
        miss[a[i][0]-1]+=1
cnt=len(set(ans))
#print(cnt)
print(cnt,total)

Submission status: Wrong Answer

Solution code:
import sys
N,M = map(int,input().split())
if M == 0:
	print('0 0')
	sys.exit()


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

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

cor_count = 0
pen_count = 0
AC_list = []

for i in range(M):
	if not p[i] in AC_list:
		if s[i] == 'AC':
			AC_list.append(p[i])
		else:
			pen_count += 1

#print(AC_list)
cor_count = len(set(AC_list))
if M != 0:
	print(cor_count,pen_count)

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
    elif S == 'WA':
        if correct[p] == 0:
            penalty[p] += 1

if M == 0:
    print(0, 0)
else:
    print(sum(correct.values()), sum(penalty.values()))

Submission status: Wrong Answer

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

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

for i in range(M):
    p,s = [i for i in input().split(" ")]
    if result[int(p)-1] == 0:
        if s == 'AC':
            result[int(p)-1] = 1
            ac += 1
        else:
            wa += 1

print(ac,wa,sep=' ')

Submission status: Wrong Answer

Solution code:
mondaisu,kaitosu=map(int, input().split())
kuroji=[0]*mondaisu
akaji=[0]*mondaisu
for i in range(kaitosu):
    a,kekka = input().strip().split()
    a=int(a)
    if kuroji[a-1]==1:
        pass
    elif kuroji[a-1]==0:
        if kekka=="WA":
            akaji[a-1]+=1
        else:
            kuroji[a-1]=1
kurojisum=sum(kuroji)
akajisum=sum(akaji)
print(kurojisum,akajisum)

Submission status: Wrong Answer

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

wa = 0
ac_number = []
for i in range(M):
  if not pS[i][0] in ac_number:
    if pS[i][1] == "AC":
      ac_number.append(pS[i][0])
    else:
      wa += 1

print(len(ac_number), wa)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
results = []
if m:
    results = [input().split() for _ in range(m)]
ac = []
k_wa = 0
cnt_ac = 0
cnt_wa = 0
for res in results:
    if res[1] == "AC":
        if not res[0] in ac:
            cnt_ac += 1
            ac.append(res[0])
            cnt_wa += k_wa
            k_wa = 0
    else:
        k_wa += 1
print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ss = [list(input().split()) for i in range(m)]
s = [[0]*2 for i in range(m)]

for i in range(m):

    s[i][0] = int(ss[i][0])
    if ss[i][1] == "AC":
        s[i][1] = 1
    else:
        s[i][1] = 2

s = sorted(s, key=lambda x: x[0])
memo = 0
acc = 0
mis = 0

for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == 1:
            acc += 1
            memo = s[i][0]
        elif s[i][1] == 2:
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

Solution code:
N, M = [int(num) for num in input().split()]
pro = {}
c = []
f_sum = 0
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        if p not in c:
            c.append(p)
    else:
        if p in c:
            continue
        else:
            f_sum += 1
print("{} {}".format(len(c), f_sum))

Submission status: Wrong Answer

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

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

pS = [list(input().split()) for _ in range(M)]
ACed = [0] * (N+1)
pena_memo = [0] * (N+1)
n_pena = [0] * (N+1)

if N == 1:
    if pS[0][1] == "AC":
        print(1,0)
    else:
        print(0,0)
    exit()

for i in range(M):
    if ACed[int(pS[i][0])] == 0:
        if pS[i][1] == "AC":
            ACed[int(pS[i][0])] = 1
            n_pena[int(pS[i][0])] = pena_memo[int(pS[i][0])]
        else:
            pena_memo[int(pS[i][0])] += 1

print(sum(ACed), sum(n_pena))

Submission status: Wrong Answer

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

cp=0
cc=0
ca=[]
for i in range(m):
    if s[i]=='WA':
        cp+=1
    elif s[i]=='AC':
        cc+=1
        for j in range(i+1,m):
            if p[i]==p[j]:
                s[j]='AR'

print('{} {}'.format(cc,cp))

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()
    if  p in done:
        continue
    else:
        if s=="WA":
            WA+=1
        else:
            done.append(p)
            AC+=1
print(AC,WA)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**5+1)
acl=[0]*(10**5+1)

for i in range(m):
    p[i],s[i]=map(str, input().split())

for i in range(m):
    if s[i]=="AC" and acl[int(p[i])]==0:
        acl[int(p[i])]=1
    if s[i]=="WA" and wal[int(p[i])]==0:
        wal[int(p[i])]=1
print(sum(acl),sum(wal))

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
N,M = map(int, input().split())
s = list(input().split() for i in range(M))

if M == 0:
    print(0,0)
    exit()
else:
    pass

AC = 0
WA = 0
Num = s[0][0]
AC_count = 0
WA_n = 0


for i in range(M):
    tmp_N = Num
    if tmp_N == s[i][0]:
        pass
    else:
        tmp_N = s[i][0]
        Num = tmp_N
        AC_count = 0
        WA_n = 0

    if s[i][1] == 'AC':
        AC_count += 1
        if AC_count == 1:
            AC += 1
            WA_n = 0
        else:
            pass
    else:
        if AC_count == 0:
            WA_n += 1
        else:
            WA += WA_n

print(AC,WA)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

inp = list(map(int,input().split()))

mondai = inp[0]
teisyutu = inp[1]
frag = []
seikai =[]
for i in range(mondai):
    frag.append(0)
    seikai.append(0)
for i in range(teisyutu):
    info = list(input().split())
    info[0]=int(info[0])
    
    if info[1]=="WA":
        if seikai[info[0]-1]==0:
            frag[info[0]-1]+=1
    else:
        seikai[info[0]-1]=1
print("{} {}".format(sum(seikai),sum(frag)))

Submission status: Wrong Answer

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

wa_answer=0
ac_list=[]
problem_num=1
tmp=0
for i in range(M):
    P, S = map(str, input().split())
    if not problem_num==int(P):
        tmp=0
        problem_num=int(P)
    if S=="WA":
        if int(problem_num) not in ac_list:
            tmp+=1
    if S=="AC":
        if int(problem_num) not in ac_list:
            wa_answer=wa_answer+tmp
            ac_list.append(int(problem_num))
    # print(tmp)
    # print(ac_answer)
    # print(wa_answer)
    # print(ac_list)

print(str(len(ac_list))+" "+str(wa_answer))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ac_set = set()
ac = 0
wa = 0

for _ in range(m):
  p, s = input().split()
  
  if s == 'AC':
    ac_set.add(p)
  elif (p not in ac_set):
    wa += 1
    
print(len(ac_set), wa)

Submission status: Wrong Answer

Solution code:
Intstr = input()

InList = Intstr.split(" ")
N_Num = int(InList[0])
M_Num = int(InList[1])

Num_List = [[0 for i in range(2)]for j in range(M_Num)]

WA = 0
AC = 0
flag = 0
Tru = 0
B = "-1"

for i in range(M_Num):
  Instr = input().split(" ")
  Num_List[i][0] = Instr[0]
  Num_List[i][1] = Instr[1]

for i in range(len(Num_List)):
  if B == Num_List[i][0]:
    flag = 1
  else:
    flag = 0
    Tru = 0
  if Num_List[i][1] == "WA" and flag == 0:
    WA += 1
  elif Num_List[i][1] == "AC" and Tru == 0:
    AC += 1
    Tru = 1
    flag = 1
  B = Num_List[i][0]
print("%d %d"%(AC,WA))

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
results = []
if m:
    results = [input().split() for _ in range(m)]
ac = []
k_wa = 0
cnt_ac = 0
cnt_wa = 0
for res in results:
    if res[1] == "AC":
        if not res[0] in ac:
            cnt_ac += 1
            ac.append(res[0])
            cnt_wa += k_wa
    else:
        k_wa += 1
print(cnt_ac, cnt_wa)

Submission status: Wrong Answer

Solution code:
import sys
N,M = map(int,input().split())
if M == 0:
    print('%d %d' % (0,0))
    sys.exit(0)
Liste = dict()
Question = [0] * M
ACorWE = [0] * M
Z = 0
correct = 0
pena = 0
for i in range(M):
    Question[i], ACorWE[i]= map(str, input().split())
Question = [int(element) for element in Question]
for _ in range(max((max(Question)+1),len(ACorWE))): #range(max(Question)+1) before
    Liste[_] = [0] 
#Liste[4].append(0) 
#print(Liste)
#print(Question) #[1, 1, 2, 2, 2]
#print(ACorWE) #['WA', 'AC', 'WA', 'AC', 'WA']
for i in range(M): ###for i in range(M) before 
    Liste[Question[i]].append(ACorWE[i])
    #print(Liste)
    Liste[i].remove(0)
#print(Liste)
#{0: [], 1: ['WA', 'AC'], 2: ['WA', 'AC', 'WA'], 3: [], 4: []}

for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    if 'AC' in Liste[i] and Z == 0:
        correct += 1
        Z = 1
    Z = 0
for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    for j in range(len(Liste[i])):
        if j <= len(Liste[i]) -2:
            if Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC':
                pena += 1
#高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
print('%d %d' % (correct,pena))

Submission status: Wrong Answer

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

points    = 0
penalties = 0

# 答えのリストの作成
input_lists = []
question_numbers = []
for i in range(m):
  qn, ans = input().split()
  input_list = [int(qn), ans]
  question_numbers.append(int(qn))
  input_lists.append(input_list)

# 問題番号の重複排除
question_numbers = list(set(question_numbers))

# カウント
for qn in question_numbers:
  for input_list in input_lists:
    if(qn == input_list[0] and input_list[1] == 'WA'):
      penalties = penalties + 1
    if(qn == input_list[0] and input_list[1] == 'AC'):
      points = points + 1
      break

print(points, penalties)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
R = []
for i,[p, s] in enumerate(A[::-1]):
    if  s== 'AC':
        A = A[0:-i]
        break
Accepted = dict(filter(lambda p: p[1]=='AC', A))
Rejected =dict(filter(lambda p: p[1]=='WA', A))
print(len(Accepted), len(Rejected))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
arr = [input().split() for i in range(M)]
s = [[0,0] for i in range(N)]
p = 0
a = 0
for i, j in arr:
    if j == 'AC':
        s[int(i)-1][0] = 1
    elif j == 'WA':
        if s[int(i)-1][0] == 1: # if done
            pass
        else:
            s[int(i)-1][1] += 1
print(s)
for i, j in s:
    if i == 1:
        p += j
        a += 1
print(a, p)

Submission status: Wrong Answer

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

check_list = [0]*(n+1)
wa = 0
ac = 0
if m == 0:
    pass
else:
    for i in range(m):
        p, s = input().split()
        p = int(p)
        if check_list[p] == 1:
            continue
        if check_list[p] == 0 and s == 'AC':
            check_list[p] = 1
            ac += 1
        #elif check_list[p] == 0 and s == 'WA':                                          
        else:
            wa += 1
print(ac, wa)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
li = [list(map(str, input().split())) for i in range(m)]
wa_i = ac_i = 0
ac_set = list()
for j, k in li:
  jk = str(j)+'AC'
  if(jk not in ac_set):
    if k == 'WA':
      wa_i += 1
    else:
      ac_i += 1
      ac_set.append(jk)

print(ac_i, wa_i)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ac_count = 0
penalty_count = 0
ac_number_list = set()

for i in range(M):
    temp_str_number, temp_result = map(str, input().split())
    temp_number = int(temp_str_number)
    if temp_number not in ac_number_list :
        if temp_result == 'AC' :
            ac_count += 1
            ac_number_list.add(temp_number)
        else :
            penalty_count += 1    

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

Submission status: Wrong Answer

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

correct = [0] * n
penalty = 0
for i in range(m):
    tgt = p[i] - 1
    if correct[tgt] == 1:
        continue
    if s[i] == 'AC':
        correct[tgt] += 1
    elif s[i] == 'WA':
        penalty += 1

print('{0} {1}'.format(sum(correct), penalty))

Submission status: Wrong Answer

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

    print(ansa,lis.count("WA"))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
P = []
s = []
sekai = 0
wrong = 0

for i in range(M):
  p,S = map(str,input().split())
  P.append(int(p))
  s.append(S)

print(P,s)
#problem = list(range(1,N+1))
problem = []

for j, ans in zip(P,s):
  if (j not in problem) and (ans == "AC"):
    problem.append(j)
    sekai += 1
  elif (j not in problem) and (ans == "WA"):
    wrong += 1
print(sekai, wrong)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [list(map(str, input().split())) for _ in range(M)]
aclst = [0] * (N + 1)
cntw = 0
cnta = 0

for i in range(M):
    if aclst[int(p[i][0])] == 0:
        if p[i][1] == 'AC':
            cnta += 1
            aclst[int(p[i][0])] = 1
        else:
            cntw += 1
    if cnta == N:
        break
print(cnta, cntw)

Submission status: Wrong Answer

Solution code:
#19,20はWAだが処理速度が心配なので提出
#注意　ACを出さないとWAは加算されない
#注意　同じ問題のACは加算されない
#注意　途中で問題を変えている可能性あり

#総問題数n 提出回数m受け取り
n,m=(int(x) for x in input().split())

#回答済リスト(ださい)
ans_list = []
ans = 0
wa = 0
w_wa =0

i=1
while (i<=m):
    #問題番号p　結果sを受け取り
    p,s=input().split()
    kaitousumi = "F"
    if p in ans_list:
        kaitousumi = "T"
#    for j in range(len(ans_list)):
#        print(p,s,ans_list)
#        if p == ans_list[j]:
#            kaitousumi = "T"
    if kaitousumi == "F":
        if s == "WA":
            w_wa += 1
        else:
            ans_list.append(p)
            ans +=1
            wa += w_wa
            w_wa = 0
    i+=1
print(ans,wa)

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)
print(answers,end=" ")
print(penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac_cnt = {}
wa_cnt = {}
for n in range(N):
  ac_cnt[str(n + 1) + "AC"] = '0'
  wa_cnt[str(n + 1) + "WA"] = '0'
for i, ps in enumerate(PS):
  p_s = ps[0] + ps[1]
  if ac_cnt.get(p_s) and ac_cnt[p_s] == '0':
    ac_cnt[p_s] = int(ac_cnt[p_s]) + 1
  if wa_cnt.get(p_s) and ac_cnt[p_s.replace('WA', 'AC')] == '0':
    wa_cnt[p_s] = int(wa_cnt[p_s]) + 1
ac_s = 0
for s in ac_cnt.values():
  if s == '0':
    ac_s += int(s)
  else:
    ac_s += s
wa_s = 0
for s in wa_cnt.values():
  if s == '0':
    wa_s += int(s)
  else:
    wa_s += s
print(str(ac_s) + " " + str(wa_s))

Submission status: Wrong Answer

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

Num = []
St = []
for i in range(m):
    p, s = input().split()
    Num.append(int(p))
    St.append(s)
#print(Num[0])
#print(St)
maru=0
pena=0
flg=0
for i in range(m-1):
    if Num[i]==Num[i+1]:
        if (St[i]=='WA') & (St[i+1]=='AC'):
            maru+=1
            pena+=1
        elif St[i+1]=='AC':
            if flg==0:
                maru+=1
                flg=1
print(maru,pena)

Submission status: Wrong Answer

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

AC_num = 0
WA_num = 0
AC_map = []
#data = [[N+1]*3 for i in range(M)]
data = []
for i in range(1, M+1):
    p,S = map(str, input().split())
    s = 0
    if S == 'AC':
        s = 1
    data.append([int(i),int(p),int(s)])


sorted_data = sorted(data, key=lambda x:(x[1], x[0]))

before = 0
is_ac = False
ac_num = 0
wa_num = 0
for val in sorted_data:
    if before == val[1]:
        if is_ac:
            continue
        else:
            if val[2] == 1:
                ac_num += 1
                is_ac = True
            else:
                wa_num += 1
    else:
        is_ac = False
        before = val[1]
        if val[2] == 1:
            ac_num += 1
            is_ac = True
        else:
            wa_num += 1

print(str(ac_num)+' '+str(wa_num))

Submission status: Wrong Answer

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

lac = [0] * n
lwa = [0] * n

for i in range(n):
    if lac[i] == 0:
        for j in range(m):
            if lp[j] == i+1 and ls[j] == 'WA':
                lwa[i] += 1
            if lp[j] == i+1 and ls[j] == 'AC':
                lac[i] = 1
                break
    else:
        break

print(sum(lac), sum(lwa))

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
ac,wa=0,0
if m==0:
    print(ac,wa)
else:
    problem=0
    result='AC'
    for i in range(m):
        pa,s=map(str, input().split())
        p=int(pa)
        if p!=problem and s=='AC':
            problem=p
            result=s
            ac+=1
        elif p!=problem and s=='WA':
            problem=p
            result=s
            wa+=1
        elif p==problem and s=='AC' and s!=result:
            result=s
            ac+=1
        elif p==problem and s=='WA' and result!='AC':
            result=s
            wa+=1
        else:
            continue
    print(ac,wa)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
d = dict()
score = 0
penalty = 0
for i in range(m):
	p, stat = input().split()
	p = int(p)
	# if p not in d:
	# 	d[p] = list()
	if p not in d:
		d[p] = 0
	if stat == "AC" and d[p] == 0:
		d[p] = 1
		score += 1
	elif stat == "WA" and d[p] != 1:
		d[p] = 0
		penalty += 1
	elif d[p] == 1:
		pass



# for problem in d.keys():
# 	for solution in d[problem]:
# 		if solution:
# 			score += 1
# 			break
# 		else:
# 			penalty += 1
print("{0} {1}".format(score, penalty))

Submission status: Wrong Answer

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

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
  
  if quiz not in wa_dict: 
    wa_dict[quiz] = 0
  
  if res == "AC":
    quiz_dict[quiz] = 1
  if res == "WA":
    wa_dict[quiz] += 1
wa_n = sum(wa_dict.values()) 

def filter_dict(f, d):
  return {k:v for k,v in d.items() if f(k,v)}

a = len(filter_dict(lambda k,v: v==1, quiz_dict))

print(a, wa_n)

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 = list(map(int, input().split()))

P = []
S = []

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

exs = list(set(P))

WAC_all = []
ACC_all = []
EX = []

for ex in exs:
    WAC = 0
    ACC = 0
    WAC_small = []
    ACC_small = []
    for i in range(M):
        if P[i] == ex:
            if S[i] == 'WA':
                WAC += 1
            else:
                WAC = 0
                ACC = 1
            EX.append(ex)
            WAC_small.append(WAC)
            ACC_small.append(ACC)
    WAC_all.append(WAC_small)
    ACC_all.append(ACC_small)

res_ac = 0
res_wa = 0

for i in range(len(ACC_all)):
    for j, ac in enumerate(ACC_all[i]):
        if ac == 0:
            res_wa += WAC_all[i][j]
        else:
            res_ac += 1
            break

print(res_ac, res_wa)

Submission status: Wrong Answer

Solution code:
def solve(N, M, A):
    if M == 0:
        return 0, 0
    A = [[int(x[0]), x[1]] for x in A]
    Unsolve = {}
    Solved = []
    a = 0
    w = 0
    ac = 0
    wa = 0
    check = 0
    num = A[0][0]
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                w += 1
                Unsolve[A[i][0]] = w
            elif A[i][1] == 'AC':
                Solved.append(A[i][0])
                Unsolve.setdefault(A[i][0], 0)
                wa += Unsolve[A[i][0]]
                w = 0
                ac += 1


    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
N, M = map(int, input().split())
L = []
for _ in range(M) :
  L.append(list(map(str, input().split())))
#print(L)

A = [[0 for _ in range(2)] for _ in range(N+1)]
ACsum = 0
WAsum = 0
for i in range(M) :
  if L[i][1] == "WA" :
    A[int(L[i][0])][0] += 1
  else :
    A[int(L[i][0])][1] = 1

for j in range(N) :
  if A[j][1] == 1 :
    ACsum += 1
    WAsum += A[j][0]
  
print(str(ACsum) + " " + str(WAsum))

Submission status: Wrong Answer

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

    print(ansa,lis.count("WA"))
print(lis)

Submission status: Wrong Answer

Solution code:
n , m = map(int,input().split())
p = []
s = []
for i in range(m):
    a, b = input().split()
    p.append(int(a))
    s.append(0 if b=='WA' else 1)

ac = 0
pena = 0
sub =[]
for i in set(p):
    si = [j for j , x in enumerate(p) if x == i]

    for j in si:
        if s[j] == 0:
            pena +=1 
        elif s[j] == 1:
            ac +=1
            break
print(ac,pena)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m==0:
    print(0,0)
    exit()
p=[]
s=[]
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":
        ac+=1
        t[p[i]-1]+=1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
P = 0
N,M = map(int,input().strip().split())
if M == 0:
    print("{0} {1}".format(0,P))
    sys.exit()
ans_list = [list(input().strip().split()) for _ in range(M)]
result = [False] * N
for ans in ans_list:
    if result[int(ans[0])-1] != True:
        if ans[1] == "WA":
            P += 1
        elif ans[1] == "AC":
            result[int(ans[0])-1] = True
print("{0} {1}".format(result.count(True),P))

Submission status: Wrong Answer

Solution code:
import copy

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

L=[list() for i in range(N)]
print(L)

for j in range(M):
    p,s=map(str,input().split())
    p=int(p)
    L[p-1].append(copy.deepcopy(s))

right=0
wrong=0

for k in range(N):
    for l in range(len(L[k])):
        if L[k][l]=='WA':
            wrong+=1
        else:
            right+=1
            break

print(right,wrong)

Submission status: Wrong Answer

Solution code:
# C - Welcome to AtCoder
N,M = map(int, input().split())
s = list(input().split() for i in range(M))

if M == 0:
    print(0,0)
    exit()
else:
    pass

AC = 0
WA = 0
Num = s[0][0]
AC_count = 0
WA_n = 0


for i in range(M):
    tmp_N = Num
    if tmp_N == s[i][0]:
        pass
    else:
        tmp_N = s[i][0]
        Num = tmp_N
        AC_count = 0
        WA_n = 0

    if s[i][1] == 'AC':
        AC_count += 1
        if AC_count == 1:
            AC += 1
        else:
            pass
    else:
        if AC_count == 0:
            WA_n += 1
        else:
            WA += WA_n

print(AC,WA)

Submission status: Wrong Answer

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


print(A,WA)

Submission status: Wrong Answer

Solution code:
N,M=input().split()
answer=0
penalty=0
PS=[]
check=[]
for _ in range(int(M)):
    PS.append(input().split())
for i in PS:
    if ((str(i[0])+'AC') in check)==False:
        if i[1]=="WA":
            penalty+=1
        elif i[1]=="AC":
            answer+=1
            check.append(str(i[0])+"AC")
print(str(answer)+" "+str(penalty))

Submission status: Wrong Answer

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

ac = 0
wa = 0

for i in range(n):
    for j in range(m):
        if int(p_s[j][0])-1 == i:
            if p_s[j][1] == 'WA':
                wa += 1
            else:
                ac += 1
                break

print(ac,wa)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    c = {"AC": {}, "WA": {}}
    
    for m in range(M):
        p, S = input().split()
        p = int(p)
        
        if p not in c[S].keys():
            c[S][p] = 1
        else:
            if p not in c["AC"].keys():
                c[S][p] += 1

    ac = 0
    wa = 0
    for p in c["AC"].keys():
        ac += 1
        if p in c["WA"].keys():
            wa += c["WA"][p]
    
    print(ac, wa)
        
    
if __name__ == "__main__":
    main()