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:
from sys import stdin
N, M = [int(i) for i in stdin.readline().rstrip().split()]
ans_list = []
for m in range(M):
    ans_list.append([i for i in stdin.readline().rstrip().split()])
ac = 0
wa = 0
result_dict = {}
for n in range(1, N + 1):
    result_dict[n] = False
for q, r in ans_list:
    q_now = int(q)
    if result_dict[q_now] == False:
        if r == "WA":
            wa += 1
        if r == "AC":
            ac += 1
            result_dict[q_now] = True
print(ac, wa)

Submission status: Wrong Answer

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

hoge = {}
count = 0
count2 = 0
for i in range(m):
    p, s = input().split()
    if p not in hoge:
        hoge[p] = 0
    if s == 'WA':
        if hoge[p] != -1:
            hoge[p] += 1
            count += 1
    elif s == 'AC':
        if hoge[p] != -1:
            hoge[p] = -1
            count2 += 1

print(count2,count)

Submission status: Wrong Answer

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

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

ans_status = [0] * N
penalty_count = 0
ans_count = 0

for i in range(M):
  if ans_status[P[i][0] - 1] != "AC":
    if P[i][1] == "AC":
      ans_status[P[i][0] - 1] = "AC"
      ans_count += 1
    else:
      penalty_count += 1

print(ans_count, penalty_count)

Submission status: Wrong Answer

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

ls_ac = [0] * n
ac = 0
ng = 0


for i in range(m):
    p = int(ls[i][0])
    if ls[i][1] == "AC":
        if ls_ac[p - 1] == 0:
            ac += 1
            ls_ac[p - 1] = 1
    elif ls[i][1] == "WA":
        if ls_ac[p - 1] == 0:
            ng += 1

print(ac, ng)

Submission status: Wrong Answer

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

c = 'AC'
w = 'WA'

cnt_c, cnt_w = 0, 0
cs = list()
for p, s in ans:
  if p in cs:
    continue
  if s == w:
    cnt_w += 1
  else:
    cnt_c += 1
    cs.append(p)

print(cnt_c, cnt_w)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
ac = set()
pena_cnt = 0
ac_cnt = 0
for p,s in ps:
  if (p not in ac) and (s == 'WA'):
    pena_cnt += 1
  if (p not in ac) and (s == 'AC'):
    ac.add(p)
    ac_cnt += 1
    
print(ac_cnt, pena_cnt)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = [0]*N
count_WA = 0
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if li_AC[p-1] == 0:
        if S == "AC":
            li_AC[p-1] = 1
            count_WA_total += count_WA
            count_WA = 0
        if S == "WA":
            count_WA += 1
print(counter(li_AC, 1), count_WA_total)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
question_list = []
score_list = []

for i in range(M):
  q,s = input().split()
  question_list.append(int(q))
  score_list.append(s)

maru_flag = [0] * N
pena_flag = [0] * N
for i in range(M):
  if score_list[i] == "AC":
    maru_flag[question_list[i] - 1] = 1

  if maru_flag[question_list[i] - 1] != 1 and score_list[i] == "WA":
    pena_flag[question_list[i] - 1] += 1

print(str(sum(maru_flag)) + " " + str(sum(pena_flag)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
count = 0
ans = []
penal = 0
p = [0]*m
x = [0]*m
for i in range(m):
    p[i], x[i] = map(str, input().split())
    if x[i] == "AC":
        ans.append(p[i])
        ans = list(set(ans))
    elif x[i] == "WA":
        for j in range(len(ans)):
            if ans[j] == p[i]:
                penal -= 1
        penal += 1

if penal < 0:
    penal = 0

print("{}".format(len(ans)) + " {}".format(penal))

Submission status: Wrong Answer

Solution code:
# N問出題
# M回提出

ans = []
pena = 0
N, M = map(int, input().split())
for _ in range(M):
    p, s = input().split()
    # 正解
    if s == "AC" and int(p) <= N:
        ans.append(p)
    # WAかつ未正解
    elif s == "WA" and (p not in ans):
        pena +=1
    else:
        continue

print(len(set(ans)), pena)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
AC = 0
WA = 0
pro = '0'
ACflag = False
thisWA = 0
for i in range(m):
    p,S = map(str, input().split())
    if p != pro:
        pro = p
        if ACflag == True:
            WA+=thisWA
        ACflag = False
        thisWA = 0
    if ACflag == False:
        if S == 'AC':
            AC+=1
            ACflag = True
        if S == 'WA':
            thisWA+=1
if ACflag == True:
    WA+=thisWA
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,M = map(int,input().split())
d1 = defaultdict(lambda:False)
d2 = defaultdict(lambda:False)
for i in range(M):
    p,s = input().split()
    if s == 'WA':
        if not d1[p]:
            d2[p] += 1
    else:
        if not d1[p]:           
            d1[p] = True
ans = [0,0]
for p in d1:
    if d1:
        ans[0] += 1
        ans[1] += d2[p]
print(*ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

ac = np.zeros(N, dtype = np.int64)
wa = np.zeros(N, dtype = np.int64)

for i in range(M):
    P, S = input().split()
    P = int(P) -1
    if S == "AC":
        ac[P] = 1
    if S == "WA":
        if ac[P] == 1:
            pass
        else:
            wa[P] += 1

print(np.sum(ac), np.sum(wa))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
n,m = [int(x) for x in stdin.readline().rstrip().split()]

li = [list(stdin.readline().rstrip().split()) for _ in range(m)]
lin = [0]*(n+1)
wor = [0]*(n+1)

for i in li:
    if lin[int(i[0])] == 0:
        if i[1] == "WA":
            wor[int(i[0])] += 1
        elif i[1] == "AC":
            lin[int(i[0])] = 1
print(sum(lin),sum(wor))

Submission status: Wrong Answer

Solution code:
N , M = map(lambda x: int(x),input().split())
isAC = []
score=0
penalty = 0
for i in range(M):
    p,r = input().split()
    #print(p,r)
    #p = int(p)
    if p in isAC:
        continue
    if r == "WA":
        penalty += 1
        #print(penalty)
    if r == "AC":
        isAC.append(p)
        score+=1
        #print(score)
    #print(isAC)
print(score,penalty)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

seitou=0
pena=0
p1="1"
cont=0
q=[0]*(n+1)
for i in range(m):
    
    p,s=input().split()
    p=int(p)
    if q[p]==0:
        if s=="WA":pena+=1
        if s=="AC":
            seitou+=1
            q[p]=1    

print(seitou,pena)

Submission status: Wrong Answer

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

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
        else:
            if ans[i - 1] == False:
                wa += 1

    print(ac, wa)
    return 0
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

clear=[]
ACcount=0
WAcount=0
for i in range(m):
  a,b=input().split()
  if a not in clear:
    if b=="WA":
      WAcount+=1
    else:
      ACcount+=1
      clear.append(a)
    
print(ACcount,WAcount)

Submission status: Wrong Answer

Solution code:
import math
n,m = map(int,input().split())
ps_ls = [list(input().split()) for i in range(m)]
ans_wa = 0
ans_ac = 0
strk_wa = 0
frag = 1
for i in range(m):
    ps_ls[i][0] = int(ps_ls[i][0])
ps_ls.sort(key=lambda x: x[0])

for i in range(m-1):
    if ps_ls[i][1] == "WA" and frag == 1:
        strk_wa += 1

    if ps_ls[i][1] == "AC":
        if frag == 1:
            ans_ac += 1
        frag = 0
        ans_wa += strk_wa
    if ps_ls[i][0] != ps_ls[i+1][0]:
        strk_wa = 0
        frag = 1

print(ans_ac,ans_wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
dw=dict()
da=dict()
for i in range(M):
    k,v=input().split()
    if v=="WA" and k not in da.keys():
        if k in dw.keys():
            dw[k]+=1
        else:
            dw[k]=1
    else:
        da[k]=1
print(sum(da.values()),sum(dw.values()))

Submission status: Wrong Answer

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

cor = pen = temp_pen = 0
temp_p = "0"
aclist=[]
for x in range(m):
  p, s = input().split()
  if p in aclist:
    continue
  if p != temp_p:
    temp_p = p
    temp_pen = 0

  if s == "AC":
    cor += 1
    pen += temp_pen
    temp_pen = 0
    aclist.append(p)
  else:
    temp_pen += 1
    
print(cor, pen)

Submission status: Wrong Answer

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

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

print (sum(aw),sum(pn))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
TF=[0]*n
p=[0]*n
for _ in range(m):
    i,s =map(str,input().split())
    i=int(i)-1
    if (s=="WA") and TF[i]==0:
        p[i]+=1
    if (s=="WA")and TF[i]==1:
        pass
    if s=="AC" and TF[i]==0:
        TF[i]=1
    if s=="WA" and TF[i]==1:
        pass
ac=sum(TF)
pe=sum(p)
print(ac,pe)

Submission status: Wrong Answer

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

dwa = {}
dac = {}

for i in range(m):
    p, s = input().split()
    if s == "AC":
        if int(p) not in dac:
            dac[int(p)] = 1
        # else:
        #     dac[int(p)] += 1
    else:
        if (int(p) not in dac) and (int(p) not in dwa):
            dwa[int(p)] = 1
        elif int(p) not in dac:
            dwa[int(p)] += 1


# print(dwa, dac)
ans1 = sum(dac.values())
ans2 = sum(dwa.values())

print(ans1, ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N, M = map(int, input().split())
ac, wa = 0, 0
l = {}
T = {}
idx, sta = -1, -1
for i in range(M):
    tmp = input().split()
    p = int(tmp[0])
    s = tmp[1]
    if p not in l.keys():
        l[p] = []
        T[p] = False
    if s == "AC" and not T[p]:
        ac += 1
        T[p] = True
    if s == "WA" and not T[p]:
        wa += 1
print(ac, wa)

Submission status: Wrong Answer

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

solve_problem = [0] * N 
ans = [0,0]

for i in range(0,M):
    ps = input().split(" ")
    if ps[1] == "AC":
        if solve_problem[ int(ps[0]) -1] == 0:
            solve_problem[int(ps[0])-1] = 1
            ans[0] += 1
    else:
        if solve_problem[ int(ps[0])-1] == 0:
            ans[1] += 1

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

Submission status: Wrong Answer

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

flag = [0 for i in range(n)]
count_ac = 0
count_wa = 0

for i in range(m):
    p, s = map(str, input().split(' '))
    p = int(p)
    if s == 'AC':
        if not flag[p-1]:
            count_ac += 1
            flag[p-1] = 1
    else: # WA
        if not flag[p-1]:
            count_wa += 1

print('{} {}'.format(count_ac, count_wa))

Submission status: Wrong Answer

Solution code:
import sys


def main():
    n, m = map(int, sys.stdin.readline().split(" "))
    mem = dict()
    ac_count = 0
    wrong_count = 0
    for _ in range(m):
        t, result = sys.stdin.readline().strip().split(" ")
        test_no = int(t)
        if test_no > n:
            continue
        if test_no in mem:
            if not mem[test_no]:
                if result == "WA":
                    wrong_count += 1
                else:
                    ac_count += 1
                    mem[test_no] = True
        else:
            mem[test_no] = result == "AC"
            if result == "WA":
                wrong_count += 1
            else:
                ac_count += 1
    print("%d %d" % (ac_count, wrong_count))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
AC = []
ans = []
for i in range(M):
    p, S = list(input().split())
    if S == "AC" and p not in AC:
        AC.append(p)
    elif p not in AC:
        ans.append(p)
print(len(AC), len(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ac = 0
wa = 0
problems = [[0,0] for _ in range(n)]
for i in l:
    if i[1] == 'WA' and problems[int(i[0])-1][0] == 0:
        problems[int(i[0])-1][1] += 1
    elif i[1] == 'AC' and problems[int(i[0])-1][0] == 0:
        problems[int(i[0])-1][0] += 1
    else:
        pass


for i in problems:
    ac += i[0]
    wa += i[1]
    
print(ac,wa)

Submission status: Wrong Answer

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

n, m = [int(i) for i in input().split()]

submits = [0] * m
for i in range(m):
    p, s = input().split()
    submits[i] = (int(p), s.strip())

answer = [0] * (n+1)
for i in range(n):
    answer[i+1] = {'AC':0, 'WA':0}

for submit in submits:
    p, s = submit[0], submit[1]
    if answer[p][s] == 0:
        answer[p][s] = 1
        continue
    if s == 'AC':
        continue
    if s == 'WA' and answer[p]['AC'] == 0:
        answer[p][s] += 1

ac_num = 0
wa_num = 0
for a in answer[1:]:
    ac_num += a['AC']
    wa_num += a['WA']
print(ac_num, wa_num)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC = {}
WA = {}
for i in range(M):
    prb ,ans = input().split()
    if ans == "AC":
        AC[prb] = 1
    else:
        if (prb in WA) == False and (prb in AC) ==  False:
            WA[prb] = 1
        else:
            if (prb in AC) ==  False:
                WA[prb] +=1
wa = 0
for i,v in WA.items():
    if prb in AC:
        wa += v
print("{} {}".format(len(AC),wa))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
ps = [list(input().split()) for i in range(M)]
wa = 0
ACdict = {}
for i in range(M):
    if ps[i][0] not in ACdict.keys():
        if ps[i][1] == "WA":
            wa += 1
        else: ACdict[ps[i][0]] = "AC"
print(len(ACdict), wa)

Submission status: Wrong Answer

Solution code:
import string
N,M=map(int,input().split())
A=list(range(N))
for i in range(N):
 A[i]=0
CL=0
PN=0
for i in range(M):
 P,s=input().split()
 p=int(P)
 if A[p-1]==0:
  if s=="WA":
   PN+=1
  else:
   CL+=1
   A[p-1]=1
print("{0} {1}".format(CL,PN))

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
accept = [0] * i[0]
miss = [0] * i[0]
# print(accept)
for j in range(i[1]):
    s = input().split()
    if(accept[int(s[0]) - 1] == 1):
        # print("already")
        print('',end='')
    elif(s[1] == 'AC'):
        accept[int(s[0]) - 1] = 1
    else:
        miss[int(s[0]) - 1] += 1

print(sum(accept), sum(miss))

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 A[i]=='WA' and D[P[i]-1]=='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:
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
a = []
for i in range(m):
    a.append([str(i) for i in input().split()])

ac = []
ans2 = 0
for i in range(m):
    if a[i][1] == "AC":
        ac.append(a[i][0])
    if a[i][1] == "WA" and not(a[i][0] in ac):
        ans2 += 1
ans1 = len(set(ac))

print(ans1,end = " ")
print(ans2)

Submission status: Wrong Answer

Solution code:
import itertools
n , m = list(map(int, input().split()))
p = []
s = []

cheak = [0]*n

for i in range(m):
    x,y = [j for j in input().split()]
    p.append(int(x))
    s.append(y)

ok = 0
out = 0

for i in range(m):
    if s[i]=="AC" and cheak[p[i]-1]==0:
        cheak[p[i]-1]=1
        ok += 1

#print(cheak)

for i in range(m):
    if cheak[p[i]-1]==1 and s[i]=="WA":
        out += 1
        cheak[p[i]-1]= -1

#print(cheak)      

print(str(ok)+" "+str(out))

Submission status: Wrong Answer

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

d1 = dict()
for p, s in ps:
    if s == "AC":
        d1[p] = d1.get(p, 1)



d = [-1] * n

ans = 0
for p, s in ps:
    p = int(p) - 1

    if s == "WA":
        d[p] = 0
    if s == "AC" and d[p] == 0:
        ans += 1
        d[p] == 1

print(len(d1), ans)

Submission status: Wrong Answer

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

memo = 0

acc = 0
mis = 0

for i in range(m):

    if s[i][0] != memo:
        if s[i][1] == "AC":
            acc += 1
            memo = s[1][0]
        elif s[i][1] == "WA":
            mis += 1

print(acc, mis)

Submission status: Wrong Answer

Solution code:
N,M = list(map(int,input().split()))
AC_list = []
WA_count = 0
AC_count = 0
for i in range(M):
    A = list(input().split())
    if A[1] == "AC":
        if A[0] in AC_list:
            pass
        else:
            AC_list.append(A[0])
            AC_count += 1
    else:
        if A[0] in AC_list:
            pass
        else:
            WA_count += 1
print(AC_count,WA_count)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = list()
s = list()
for i in range(m):
    a,b = input().split()
    p.append(int(a))
    s.append(b)
toi = set(p)
x = -1
ac = 0
pen = 0
check = False
for i in toi:
    for j in range(p.count(i)):
        x += 1
        if s[x] == "AC":
            if not check:
                check = True
                ac += 1
        else:
            if not check:
                pen += 1
    check = False
print(ac,pen)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
P=[0]*M
S=[0]*M
cor=[0]*N
ac,wa=0,0
for i in range(M):
    P[i],S[i]=input().split()
    P[i]=int(P[i])
    if(cor[P[i]-1]==0 and S[i]=="WA"):
        wa+=1
    elif(cor[P[i]-1]==0 and S[i]=="AC"):
        cor[P[i]-1]=1
        ac+=1
    else:
        pass
print("{0} {1}".format(ac,wa))

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 = len(finish_dic.values())
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 = [int(s) for s in input().split()]
AC_list = [0 for i in range(N)]
n_WA = 0 
for i in range(M):
  Ai = input().split()
  n_problem = int(Ai[0])-1
  if Ai[1] == "WA" and AC_list[n_problem] == 0:
    n_WA += 1
  elif AC_list[n_problem] == 0:
    AC_list[n_problem] = 1
print(sum(AC_list), n_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])

check = 0
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])
        if check == 1:
            check += 0
    elif s[i] == 'WA':
        sum_miss += 1
        check = 1
    elif (s[i] != 'AC' and check == 0) or (s[i] == 'WA' and check == 0):
        check = 1
    if sum_ok == n:
        break
print(sum_ok, sum_miss)

Submission status: Wrong Answer

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

answers = [0] * (n + 1)
penalties = [0] * (n + 1)

for num, r in scores:
    n = int(num)
    if r == 'AC':
        answers[n] = 1
    elif r == 'WA' and answers[n] == 0:
        penalties[n] += 1

print(sum(answers), sum(penalties))

Submission status: Wrong Answer

Solution code:
import numpy as np
n, m = map(int, input().split())
submit = [
    input().split() for i in range(m)
]
record = np.zeros(n+1)
penalty = 0
for i in range(m):
    p = int(submit[i][0])
    s = submit[i][1]
    if record[p]:
        continue
    else:
        if s == "AC":
            record[p] = 1
            continue
        elif s == "WA":
            penalty += 1
            continue

print(int(sum(record)), penalty)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n, m = map(int, input().split())
an = []

if(m != 0):
    for i in range(m):
        tp = list(map(str, input().split()))
        tp[0] = int(tp[0])
        an.append(tp)

    sorted(an, key=itemgetter(0))

    sc = 0
    er = 0

    flag = 0
    prob = an[0][0]
    for i in range(m):
        pr = an[i][0]
        ans = an[i][1]
        if (prob != pr):
            flag = 0
            prob = pr
        if(flag == 0 and ans == "AC"):
            sc += 1
            flag = 1
        elif (flag == 0 and ans == "WA"):
            er += 1

else:
    sc = 0
    er = 0

print("{} {}".format(sc, er))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
queans = []
wa = [0] * N
ac = [0] * N
for i in range(M):
  a,b=input().split()
  queans.append((int(a), b))
for i in range(M):
  Q = queans[i][0]
  A = queans[i][1]
  if(A == 'AC'):
    ac[Q-1] = 1 
  else:
    if(ac[Q-1] != 1):
      wa[Q-1] += 1
      
acsum = 0
wasum = 0
for j in range(N):
  acsum += ac[j]
  wasum += wa[j]

print(acsum, wasum)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ps = []
for i in range(M):
	P,S = map(str,input().split())
	ps.append((int(P),S))
#print(ps)
p_flag = [0]*N
ans_flag = [0]*N
cnt_ans = 0
cnt_p = 0
for i in range(M):
	if(p_flag[ps[i][0]-1] == 0 and ps[i][1] == "WA"):
		cnt_p+=1
	if(ans_flag[ps[i][0]-1] == 0 and ps[i][1] == "AC"):
		cnt_ans+=1
		ans_flag[ps[i][0]-1]+=1
		p_flag[ps[i][0]-1]+=1
print(cnt_ans,cnt_p)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a=0
b=0
c = []
for _ in range(m):
    pp,s = map(str,input().split())
    p = int(pp)
    if p not in c:
        if s == 'WA':
            b+=1
        else:
            c.append(p)
            a+=1
print(a,b)

Submission status: Wrong Answer

Solution code:
[n,m] = [int(x) for x in input().split()]
ok=[]
c_ok=0
c_ng=0
for i in range(m):
	[p,s]=[x for x in input().split()]
	if s=="AC" and (p in ok)==False:
		c_ok+=1
		ok.append((p))
	elif s=="WA" and (p in ok)==False:
		c_ng+=1

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

Submission status: Wrong Answer

Solution code:
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, m = na()
p = [0] * (n+1)
c = 0
penalty = 0
for _ in range(m):
    ps = stdin.readline().rstrip().split(" ")
    pi, si = int(ps[0]), ps[1]
    if p[pi]==0:
        if si == "AC":
            c += 1
            p[pi] = 1
        else:
            penalty+=1
print(c, penalty)

Submission status: Wrong Answer

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

ac_list = []

ac_count = 0
wa_count = 0

for p, s in ps_list:
    if s == 'AC':
        if p not in ac_list:
            ac_count += 1
            ac_list.append(p)
    elif s == 'WA':
        if p not in ac_list:
            wa_count += 1

print(' '.join([str(ac_count), str(wa_count)]))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ca = [0]*(n+10)
cw = [0]*(n+10)
for i in range(m):
    a,b = map(str,input().split())
    if b == "WA" and ca[int(a)]==0:
        cw[int(a)] += 1
    elif b == "AC":
        ca[int(a)] = 1
print(sum(ca),sum(cw))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ps=[list(input().split()) for _ in range(m)]
ps.sort(key=lambda x:x[0])
s_cnt=0
p_cnt=0
num=0
for p,s in ps:
  if num<int(p) and s=="WA":
    s_cnt+=1
  elif num<int(p) and s=="AC":
    num=int(p)
    p_cnt+=1
print("{} {}".format(p_cnt,s_cnt))

Submission status: Wrong Answer

Solution code:
import sys

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


def main():
    N, M = map(int, input().split())

    p_S = []
    for i in range(M):
        p_S.append(input().split())

     
    uniq_ps = get_unique_list(p_S)

    ac = 0
    wa = 0
    for arr in uniq_ps:
        if arr[1] == 'AC':
            ac += 1
        else:
            wa += 1

    print(ac, wa)

main()

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
a=[sys.stdin.readline().split() for i in range(m)]
wa = [0 for i in range(n)]
ac = [0 for i in range(n)]

for i in range(m):
    p=int(a[i][0])-1
    if a[i][1]=="WA" and ac[p]==0:
        wa[p]+=1
    else:
        ac[p] = 1


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

Submission status: Wrong Answer

Solution code:
N,M=map(int, input().split())
p=[0]*M
S=['']*M
for i in range(M):
    p[i],S[i]=input().split()
A=[0]*N
count=0
for i in range(M):
    tmp=int(p[i])-1
    if S[i]=='AC':
        A[tmp]=1
    if S[i]=='WA':
        if A[tmp]==0:
            count+=1
countA=0
for i in range(N):
    if A[i]==1:
        countA+=1
print(countA, count)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
d={}
for i in range(m):
  p,s=input().split()
  if p in d.keys():
    d[p].append(s)
  else:
    d[p]=[s,]
ac=0
wa=0
for k,v in d.items():
  for i in v:
    if i=="WA":
      wa=wa+1
    else:
      ac=ac+1
      break

print(ac,wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
LIST=[0]*(N+1)

C=0
P=0
for i in range(M):
    A=list(map(str,input().split()))
    if(A[1]=="WA"):
        if(LIST[int(A[0])]==0):
            P+=1
    else:
        if(LIST[int(A[0])]==0):
            C+=1
            LIST[int(A[0])]=1
print(C,P)

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()
    p = int(p)
    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:
N, M = list(map(int, input().split(' ')))
result_list = [input().split(' ') for i in range(M)]
AC_total = 0
WA_total = 0
ac_list = []
wa_dict = {}
for p, s in result_list:
    if p not in ac_list:
        if s == 'WA':
            if p in wa_dict:
                wa_dict[p] += 1
            else:
                wa_dict[p] = 1
        else:
            AC_total += 1
            ac_list.append(p)
for wa in list(wa_dict.values()):
    WA_total += wa
print('{} {}'.format(AC_total, WA_total))