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:
import numpy as np
N, M = map(int, input().split())
P = [input().split() for _ in range(M)]
X = np.zeros(N, np.int)
ac = 0
wa = 0
for pi in P:
    i = int(pi[0])
    s = pi[1]
    if X[i-1] == 0:
        if s == 'WA':
            wa += 1
        else:
            ac += 1
            X[i-1] = 1

print(ac, wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
lis = [list(input().split()) for _ in range(M)]
AC = [[0] * 2 for i in range(10**5)]
for i in range(M):
    if lis[i][1] == "AC":
        AC[int(lis[i][0])-1][1] = 1
    elif AC[int(lis[i][0])-1][1] == 0:
        AC[int(lis[i][0])-1][0] += 1
a = 0
w = 0
for i in range(10**5):
    if AC[i][1] == 1:
        a += 1
    w += AC[i][0]
print(a, w)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
pi = []
Si = []
for i in range(M):
    p, S = map(str, input().split())
    pi.append(p)
    Si.append(S)
score = 0
penalty = 0
now_num = 1
AC_problem = [True] * N
WA_problem = [True] * N
for i in range(M):
    if Si[i] == 'AC' and AC_problem[int(pi[i]) - 1]:
        score += 1
        AC_problem[int(pi[i]) - 1] = False
        WA_problem[int(pi[i]) - 1] = False
    elif WA_problem[int(pi[i]) - 1]:
        penalty += 1
print(str(score) + ' ' + str(penalty))

Submission status: Wrong Answer

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

seitou = 0
pena = 0

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

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
AC_C = []
WA_C = []
Num = s[0][0]
AC_count = 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

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

print(AC,WA)

Submission status: Wrong Answer

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

#an1=0
an2=0
li=[]

if m==0:
    print(len(li),an2)
    exit()

for _ in range(m):
    p,s=map(str,input().split())
    
    if p in li:
        continue
    
    if s=="AC":
        li.append(p)
    else:
        an2+=1

print(len(li),an2)

Submission status: Wrong Answer

Solution code:
import numpy as np

N_M = input()
N = int(N_M.split(" ")[0])
M = int(N_M.split(" ")[1])

input_list = []
for i in range(M):
	input_list.append(tuple(input().split(" ")))

AC_list = np.zeros(N, dtype=bool)
WA_list = np.zeros(N, dtype=int)

for data in input_list:

	if data[1] == 'AC':
		AC_list[int(data[0]) - 1] = True
		WA_list[int(data[0]) - 1] = -1 * WA_list[int(data[0]) - 1]

	if data[1] == 'WA':
		if not AC_list[int(data[0]) - 1]:
			WA_list[int(data[0]) - 1] += 1

print(np.count_nonzero(AC_list), np.sum((WA_list < 0) * WA_list) * -1)

Submission status: Wrong Answer

Solution code:
N,M = input().split()
N = int(N)
M = int(M)
pSList = []
plist = []
Slist = []
for i in range(0,M):
    pSList.append(input())
    x = pSList[i].split()
    plist.append(x[0])
    Slist.append(x[1])

pintlist = [int(s) for s in plist]

account = 0
wacount = 0

if M != 0:
    n = int(plist[0])
    for i in range(0,M):
        temp = int(plist[i])

        if n == temp:
            if Slist[i] == "WA":
                wacount += 1
            elif Slist[i] == "AC":
                account += 1
                n += 1
        elif n != temp:
            pass
    print(str(account) + " " + str(wacount))
elif M == 0:
    print(str(0) + " " + str(0))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
AC_flag = [False]*N
WA_count = [0]*N
for m in range(M):
    P,S = map(str,input().split())
    p = int(P)
    if AC_flag[p-1] == False and S == "AC":
        AC_flag[p-1] = True
    if AC_flag[p-1] == False and S == "WA":
        WA_count[p-1] += 1
print(*[sum(AC_flag),sum(WA_count)])

Submission status: Wrong Answer

Solution code:
def main():
    n,m=map(int,input().split())
    p =[[] for i in range(n)]
    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())
l = list([input().split() for i in range(m)])
acount = 0
wcount = 0
a = 0
b = 0
for i,j in l:
    if a!=int(i) and j=='AC':
        acount += 1
        a = int(i)
    elif b!=int(i) and j=='WA':
        wcount += 1
        b = int(i)
print('{} {}'.format(acount,wcount))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans = 0
wa = 0
li = [[i] for i in range(n)]
wa_list = [0] * n
for i in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if "AC" not in li[p-1]:
    li[p-1].append(s)
    wa_list[p-1] += 1
    if s == "AC":
      ans += 1
      wa += wa_list[p-1]

print(ans,wa)

Submission status: Wrong Answer

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

idxw = {}
idxa = {}

for i in range(int(M)):
  p, s = input().split(" ")
  if not ('{}{}'.format(p,s) in idxw):
    if s == 'WA':
      idxw['{}{}'.format(p, s)] = True
  if not ('{}{}'.format(p,s) in idxa):
    if s == 'AC':
      idxa['{}{}'.format(p, s)] = True
      
#print(idxw)
#print(idxa)

print('{} {}'.format(len(idxa), len(idxw)))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
string_list=[input() for i in range(M)]
checkAC=np.zeros((N,2),np.float32)
for i in string_list:
    Ni,Si = i.split()
    Ni = int(Ni)-1
    if checkAC[Ni,0]==0:
        if Si=='AC':
            checkAC[Ni,0]=1
        else:
            checkAC[Ni,1]=checkAC[Ni,1]+1
strlist = checkAC.sum(axis=0)
print(str(int(strlist[0]))+' '+str(int(strlist[1])))

Submission status: Wrong Answer

Solution code:
import numpy as np
def LI():
  return [int(s) for s in input().split()]

correct_answers = []
warning_count = 0
import numpy
N,M = LI()

correct_answers = np.zeros(N,dtype = 'int')

for i in range(M):
  p_num, answer = [s for s in input().split()]
  p_num = int(p_num)
  include_answers = True if correct_answers[p_num-1] == 1 else False
  
  if answer == 'AC' and not include_answers:
    correct_answers[p_num-1] = 1
  elif answer == 'WA' and not include_answers:
    warning_count+=1
    
print(sum(correct_answers),warning_count)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = [list(input().split())for i in range(M)]
ans = 0
pen = 0
k = 0
t = 0
r = []
for i in range(len(A)):
  if A[i][1] == 'AC':
    r.append(A[i][0])
R = list(set(r))
ans = len(R)
while k < ans:
  if A[t][1] == 'AC':
    k += 1
  elif A[t][1] == 'WA':
    pen += 1
  t+=1
print(ans,pen)

Submission status: Wrong Answer

Solution code:
#注意　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"
    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:
#coding:utf-8
n, m = map(int, input().split())
ac = 0
wa = 0
quest = 0
result = 'WA'
clear = []


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

    quest = p

print(ac, wa)

Submission status: Wrong Answer

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

def qa(s):
    qa_dict = {}
    WAs=0
    ACs=0
    for qa in s:
        qa_dict[qa[0]] = 0
    for qa in s:
        if qa_dict[qa[0]] <= 0:
            if qa[1] == 'WA':
                qa_dict[qa[0]] -= 1
            elif qa[1] == 'AC':
                qa_dict[qa[0]] *= -1
    for v in qa_dict.values():
        if v > 0:
            WAs += v
            ACs += 1
    return ACs, WAs

if m == 0:
    ac, wa = 0, 0
else:
    ac, wa = qa(s)
print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

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

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

print(sum(Bool),count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
ac = {}
wa = 0
manager = {}
for i in range(m):
  p,s  = list(map(str, input().split()))
  if s == "AC":
    if p not in ac:
      ac[p] = 1
  elif s == "WA":
    if p not in ac:
      wa += 1
print("{} {}".format(len(ac),wa))

Submission status: Wrong Answer

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

ACList = []
WAcnt = 0

for i in range(M):
    s = input().split()
    # N問と決まっているので、N問分のACが出た時点で判定不要となる
    if len(ACList) != N:
        if s[1] == 'AC' and s[0] not in ACList:
            ACList.append(s[0])
        elif s[1] == 'WA' and s[0] not in ACList:
            WAcnt += 1

print("{} {}".format(len(ACList), WAcnt))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N,M = list(map(int, input().split()))
data = [input().split() for i in range(M)] if M>0 else[]

CA = []
PN = 0

for d in data:
    if d[0] not in CA:
        if d[1]=='AC':
            CA.append(d[0])
        else:
            PN += 1

print("{} {}".format(len(CA),PN))

Submission status: Wrong Answer

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

rlt = {}
for i in range(m):
    ipt = input().split()

    if rlt.get((int(ipt[0]), ipt[1])) is None:
        rlt[(int(ipt[0]), ipt[1])] = 1
    elif (int(ipt[0]), "AC") not in rlt:
            rlt[(int(ipt[0]), ipt[1])] += 1

cp = dict(rlt)
for k, v in cp.items():
    if k[1] == "WA" and (k[0], "AC") not in cp:
        del rlt[(k[0], "WA")]


collect = 0
false = 0
for k, v in rlt.items():
    if k[1] == "AC":
        collect += 1
    else:
        false += 1
print(collect, false)

Submission status: Wrong Answer

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

c_l = [0 for i in range(N)]
a = 0
w = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if c_l[p-1] == 0:
    if s == "AC":
      a += 1
      c_l[p-1] = 1
    else:
      w += 1
print("{} {}".format(a,w))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

pp = list(set(p))

ac = 0#正解数を数える
wa = 0#ペナルティ数を数える
for j in pp:
	ind = [i for i, x in enumerate(p) if x == j]#該当する問題の位置を返す(リスト内包表記)
	for k in ind:
		cou = 0#waを数える
		if s[k] == 'WA':
			cou += 1
		else:
			ac += 1
			break
		if cou != len(ind):
			wa += cou

print(str(ac)+' '+str(wa))

Submission status: Wrong Answer

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = []
wrong = []
for j in range(N):
    right.append(0)
    wrong.append(0)
for k in range(M):
    if S[k] == 'WA' and right[p[k] - 1] == 0:
        wrong[p[k] - 1] += 1
    elif S[k] == 'AC':
        if right[p[k] - 1] == 0:
            right[p[k] - 1] += 1
print(str(sum(right)) + ' ' + str(sum(wrong)))

Submission status: Wrong Answer

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

cs = list()
cnt_c, cnt_w = 0, 0
for i in range(m):
  p, s = input().split()
  if p in cs:
    continue
  if s == 'AC':
    cnt_c += 1
    cs.append(p)
  else:
    cnt_w += 1

print(cnt_c, cnt_w)

Submission status: Wrong Answer

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

wa = 0

if m == 0:
    print(0, 0)
    sys.exit()
    
numlist = []
for i in range(m):
    if p[i][0] not in numlist:
        numlist.append(p[i][0])
        
ac = numlist

for i in range(m):
    result = p[i][1]
    num =  p[i][0]
    x = 0
    
    if result == "WA":
        wa += 1
        x += 1
        try:
            last = p[i+1][1]
        except:
            wa = wa - x
    
    if result == "AC":
        continue

    
print(len(ac),wa)

Submission status: Wrong Answer

Solution code:

def main():
    N, M = map(int, input().split())
    ps = [(input().split()) for _ in range(M)]
    
    wa_count = 0
    ac_count = 0
    ac_p = 0
    for p, s in ps:
        if int(p) == ac_p:
            continue
        elif s == "WA":
            wa_count += 1
        elif s == "AC":
            ac_count += 1
            ac_p = int(p)
    print(ac_count, wa_count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac = []
wa = {}

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

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

Submission status: Wrong Answer

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

not_AC_ls=[i for i in range(1,N+1)]

ac_num=0
pn_num=0

for _ in range(M):
    
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        if pi in not_AC_ls:
            ac_num+=1
            not_AC_ls.remove(pi)
    if Si=='WA':
        if pi in not_AC_ls:
            pn_num+=1

print(ac_num,pn_num)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, M = map(int, input().split())
#problems = [[] for i in range(N)]

c = p = 0
prev_ac_num = None
prev_wa_num = None

wa_count = 0

for i in range(M):
    num, state = map(str, input().split())

    if state == 'WA':
        wa_count += 1

    # penaltyのカウント
    if state == 'AC' and prev_ac_num != num:
        p += wa_count
        wa_count = 0

    # acceptのカウント
    if state == 'AC' and prev_ac_num != num:
        c += 1

    if state == 'AC':
        prev_ac_num = num
        wa_count = 0

    if state == 'WA':
        prev_wa_num = num

print(c, p)

Submission status: Wrong Answer

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

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

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

ac_count_list = [0]*n
wa_count_list = [0]*n
wa_count = 0

for i in range(m):
    q = int(ps[i][0])
    if ps[i][1] == "AC":
        ac_count_list[q-1] = 1
        wa_count += wa_count_list[q-1]
    else:
        if ac_count_list[q-1]==0:
            wa_count_list[q-1] += 1

print(sum(ac_count_list),wa_count)

Submission status: Wrong Answer

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

N = Input[0]
M = Input[1]

Ar = []

for i in range(M):
  Input = list(map(str,input().split()))
  Ar.append([])
  Ar[i].append(int(Input[0]))
  Ar[i].append(Input[1])

ac = 0
pn = 0

ac_ar=[]
pn_ar=[]

chk  = 1

for i in range(M):
  if (Ar[i][1]=="AC") and not(Ar[i][0] in ac_ar):
    ac_ar.append(Ar[i][0])
    chk+=1
    
  elif (chk<=Ar[i][0])and(Ar[i][1]=="WA"):
    pn_ar.append(Ar[i][0])

ac = len(ac_ar)
pn = len(pn_ar)

print(ac,pn)

Submission status: Wrong Answer

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

wa = 0
ac = 0
ac_list = []
for p, s in S:
    if p not in ac_list:
        if s == "WA":
                wa += 1
        else:
                ac += 1
                ac_list.append(p)
print(ac, wa)

Submission status: Wrong Answer

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

count_wa = [0]*n
flag_ac = [False]*n
for i in l:
    if not flag_ac[int(i[0])-1]:
        if i[1] == "AC":
            flag_ac[int(i[0])-1] = True 
        elif i[1] == "WA":
            count_wa[int(i[0])-1] += 1

for i in range(n):
    if not flag_ac[i]:
        count_wa[i-1] = 0

print(sum(flag_ac), sum(count_wa))

Submission status: Wrong Answer

Solution code:

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

ac = 0
wa = 0

ac_list = []

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

    if int(p) in ac_list:
        continue
    else:
        if  S == 'AC':
            ac += 1
            ac_list.append(int(p)) 
        else:
            wa += 1

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
k = []
ac_count = 0
miss_count = 0
for i in range(M):
    s = input().split()
    if s[1] == "AC":
        if s[0] not in k:
            k.append(s[0])
            ac_count += 1
    else:
        if s[0] not in k:
            miss_count += 1
print(ac_count,miss_count)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
t=[0]*(N+1)
e=[0]*(N+1)
for i in range(M):
  p,s=input().split()
  if t[int(p)]==0 and s=="WA":
    e[int(p)]+=1
  if t[int(p)]==0 and s=="AC":
    t[int(p)]=1
print(sum(t),sum(e))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
list_point = ["NN"] * (N + 1)
list_wa = [0] * (N + 1)
for x in range(M):
    point,state = input().split()
    point = int(point)
    if(list_point[point]!='AC' and state == 'AC'):
        list_point[point]=state
    elif(list_point[point]!='AC' and state == 'WA'):
        list_wa[point] += 1
#print(list_point)
#print(list_wa)
print(list_point.count('AC'),sum(list_wa))
#print(' ',sum(list_wa))

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections


NM = str(raw_input()).split()
N = int(NM[0])
M = int(NM[1])
A = []
B= []
C = [0]*100100
D = [0]*100100

poi1 = 100100
poi2 = 100100

owa = [0]* 100100

for i in xrange(M):
  temp = str(raw_input()).split()
  A.append(int(temp[0]))
  B.append(temp[1])

for i in xrange(M):
  if(B[i] == "AC"):
    C[A[i]] += 1
    owa[A[i]] = 1
  elif(owa[A[i]]==0):
    D[A[i]] += 1

c = collections.Counter(C)
d = collections.Counter(D)

poi1 -= c[0]
poi2 -= d[0]


print (str(poi1)+ " " + str(poi2));

Submission status: Wrong Answer

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


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

collect_list = []
wa_count = 0

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

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


li = []

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

wa = 0

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

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

print(ac, wa)

Submission status: Wrong Answer

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

wa = 0
ac = 0
ac_list = []
for p, s in S:
    if p not in ac_list:
        print(s)
        if s == "WA":
                wa += 1
        else:
                ac += 1
                ac_list.append(p)
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

class problem():
  def __init__(self, n, s):
    self.num = n
    self.result = s


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

for i in sys.stdin:
  pm, c = i.split()
  if not(int(pm) in ckn):
    if c == 'WA':
      swa += 1
      if flag == 0:
        fac += 1
    elif c == 'AC':
      ckn.append(int(pm))
      ac += 1
      if flag == 0:
        flag += 1

if ac == 0:
  fac = -1
  
print(ac, swa)

Submission status: Wrong Answer

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

lis = []

for _ in range(M):
    i, j = input().split()
    i = int(i)
    lis.append((i, j))


cnt_AC = []
cntsAC = 0

inc = [i for i in range(1, N + 1)]
zeros = [0 for _ in range(N)]

flags = dict(zip(inc, zeros))
flags_forWA = dict(zip(inc, zeros))

cntsWA = 0

for k, v in lis:
    if k not in cnt_AC:
        if v == "AC":
            cnt_AC.append(k)
            cntsAC += 1
            flags[k] = 1
        else:
            cnt_AC.append(k)
    else:
        if v == "AC" and flags[k] == 0:
            cntsAC += 1
            flags[k] = 1


for k, v in lis:
    if flags[k] == 1 and v == "WA" and flags_forWA[k] == 0:
        cntsWA += 1
        flags_forWA[k] = 1

print(cntsAC, cntsWA, sep=" ")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().rstrip().split())
AC = 0
WA = 0
data = {}
for _ in range(M):
    tmp = input().rstrip().split()
    p, S =  int(tmp[0]), tmp[1]
    if p not in data.keys():
        if S == 'AC':
            data[p] = {'AC': True, 'WA': 0}
            AC += 1
        elif S == 'WA':
            data[p] = {'AC': False, 'WA': 1}
    else:
        if S == 'AC':
            if data[p]['AC'] is True:
                continue
            elif data[p]['AC'] is False:
                data[p]['AC'] = True
                WA += data[p]['WA']
                AC += 1
        elif S == 'WA':
            if data[p]['AC'] is True:
                continue
            elif data[p]['WA'] is False:
                data[p]['WA'] += 1
print('{} {}'.format(AC, WA))

Submission status: Wrong Answer

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

ans = []
if M > 0:
  for _ in range(M):
    ans.append(input().split())
else:
  print(0," ",0)
  exit()

ac = 0
wa = 0
l = ['', '']
ac_l = []

for i in range(M):
  if ans[i][0] in ac_l: # 対象の問題でACを出している場合
    continue # ACでもWAでもカウントしない
  if l[0] != ans[i][0]: # 異なる問題の場合
    l = ans[i]
    if l[1] == 'AC':
      ac += 1
      ac_l.append(l[0]) # 一度ACを出した問題番号を保持
    else:
      wa += 1
  else: # 同じ問題の場合
    if l[1] == 'AC': # すでにACを出している場合
      continue # ACでもWAでもカウントしない
    else:
      l = ans[i]
      if l[1] == 'AC':
        ac += 1
        ac_l.append(l[0]) # 一度ACを出した問題番号を保持
      else:
        wa += 1

print(ac, " ", wa)

Submission status: Wrong Answer

Solution code:
nm = input().split()
wa = 0
ac = 0
db = [0]*int(nm[0])
for i in range(int(nm[1])):
 tmp = input().split()
 if db[int(tmp[0])-1] == 0:
  if tmp[1] == "AC":
   db[int(tmp[0])-1]=1
   ac+=1
  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):
    p, s = input().split()
    P += [int(p)]
    S += [s]

CA = 0
PN = 0
d = {key:True for key in P}
for i in range(len(P)):
    if d[P[i]]:
        if S[i] == "WA":
            PN += 1
        elif S[i] == "AC":
            CA += 1
            d[P[i]] = False

print(CA, PN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def inputIntList():
  return [int(s) for s in input().split()]


def inputInt():
  return int(input())


def main():
  N, M = inputIntList()

  ac = 0
  wa = 0
  problem = ['' for _ in range(N)]
  for _ in range(M):
    i, s = input().split()
    i = int(i)-1
    if problem[i] == 'AC':
      continue
    else:
      problem[i] = s

    if problem[i] == 'WA':
      wa += 1
    else:
      ac += 1

  print(ac, wa)


if __name__ == "__main__":
  main()

Submission status: Wrong Answer

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

submit = []
results = [0] * n

for i in range(m):
  q, r = input().split()
  q = int(q)
  if type(results[q-1]) is int:
    results[q-1]=[r]
  else:
    results[q-1].append(r)

ok = 0
penalty = 0
for result in results:
  if type(result) == int:
    pass
  else:
    for r in result:
      if r == 'AC':
        ok = ok + 1
        break
      else:
        penalty = penalty + 1
      
print(ok, penalty)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
P = []
S = []

def f(s):
  lst = s.split()
  return int(lst[0]),lst[1]



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

correct = 0
penalty = 0
q = []

for i, j in enumerate(S):
  if 'AC' in j:
    if P[i] not in q:
      q.append(P[i])
      correct += 1
    else:
      continue
  if 'WA' in j:
    if P[i] not in q:
      penalty += 1
    else:
      continue

print(correct, penalty)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n, m = list(map(int, input().split()))
p = np.zeros(m, dtype=np.int64)
s = np.zeros(m, dtype=np.bool)
for i in range(m):
    _p, _s = input().split()
    p[i] = int(_p) - 1
    s[i] = _s[0] == 'A'
isAc = np.zeros(n, dtype=np.bool)
waCount = np.zeros(n, dtype=np.int64)
for i in range(m):
    question = p[i]
    isAc[question] = isAc[question] or s[i]
    if (not isAc[question]) and (not s[i]):
        waCount[question] += 1
acCount = np.count_nonzero(isAc)
waSum = np.sum(waCount)
print('{} {}'.format(acCount, waSum))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m=map(int,input().split())
p=[]
s=[]
ac=0
wa=0
aclist=[]
for i in range(m):
	x,y=input().split()
	p.append(int(x))
	s.append(y)
	if y=='AC' and int(x) in aclist:
		pass
	elif y=='AC' and int(x) not in aclist:
		aclist.append(int(x))
		ac+=1
	elif y=='WA' and int(x) not in aclist:
		wa+=1
	else:
		pass
print(ac,wa)

Submission status: Wrong Answer

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

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

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

print(str(ac) + " " + str(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 k not in da.keys():
        if v=="WA":
            if k in dw.keys():
                dw[k]+=1
            else:
                dw[k]=1
        else:
            da[k]=1
print(sum(da.values()),sum(dw.values()))