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:
# -*- coding: utf-8 -*-
import sys
 
def main():
  input = sys.stdin.readlines()
  
  n, m = input.pop(0).split()

  #print(n, m, input)

  tmp = [False] * (int(n))
  c = 0
  p = 0
  for i in range(int(m)):
    test, result = input[i].split()
    t = int(test) - 1
    if result == "WA":
      if tmp[t] == False:
        p += 1
    elif result == "AC":
      if tmp[t] == False:
        c += 1
        tmp[t] = True

  print(c, p)

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

cs = list()
cnt_c, cnt_w = 0, 0
for p, s in ans:
  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:
n,m = list(map(int, input().split()))
ac = {}
wa = {}
wrong = 0
for i in range(m):
  p,s  = list(map(str, input().split()))
  if s == "AC":
    if p not in ac:
      ac[p] = 1
    if p in wa:
      wrong += wa[p]
  elif s == "WA":
    if p not in ac:
      if p not in wa:
        wa[p] = 1
      else:
        wa[p] += 1
print("{} {}".format(len(ac),wrong))

Submission status: Wrong Answer

Solution code:
n, m = input().split(" ")
n, m = int(n), int(m)
p_s = []
for i in range(m):
    inp = input().split(" ")
    inp[0] = int(inp[0])
    p_s.append(list(inp))
p_s.sort(key=lambda x: x[0])
print(p_s)
end_problem = -1
ans = 0
fail = 0
if m == 0:
    pass
else:
    for p, s in p_s:
        if p != end_problem:
            if s == "AC":
                ans += 1
                end_problem = p
            elif s == "WA":
                fail += 1
        else:
            pass
print(ans, fail)

Submission status: Wrong Answer

Solution code:
N,  M = map(int, input().split())
ans = {'AC': 0, 'WA':0}; lock_num = []
for _ in range(M):
    p, S = input().split()
    if p not in lock_num:
        ans[S] += 1
        if S == 'AC':
            lock_num.append(p)

print(ans['AC'], ans['WA'])

Submission status: Wrong Answer

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

ans_n = 0
penalty_n = 0

if m == 0:
  print(ans_n, penalty_n)
else:
  i = 0
  for row in src:
    if i != row[0]:
      ans_f = 0
      i = row[0]
      if row[1] == "AC":
        ans_n += 1
        ans_f = 1
      else:
        if ans_f != 1:
          penalty_n += 1
        else:
          continue
    else:
      if ans_f == 0:
        if row[1] == "AC":
          ans_n += 1
          ans_f = 1
        else:
          if ans_f != 1:
            penalty_n += 1
          else:
            continue
      else:
        continue

print(ans_n, penalty_n)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


n,m = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    else:
        if question_list[i] not in ac_list:
            if j == "WA":
                mistake += 1
            else:
                correct += 1
                ac_list.append(question_list[i])
    if len(ac_list) == n:
        break
            
        
print(correct,mistake)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# INPUT
head = list(map(int, input().split()))

n = head[0]
m = head[1]

submit = [input() for i in range(m)]

ac = 0
wa = 0
finished = []

for i in range(m):
    if len(finished) == n:
        break

    s = submit[i].split()

    if s[0] not in finished:
        if s[1] == "WA":
                wa = wa + 1

        if s[1] == "AC":
                finished.append(s[0])
                ac = ac + 1

print("{0} {1}".format(ac,wa))

Submission status: Wrong Answer

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

a=0
b=0
x=0
y=0
p=[]
S=[]
k=[]


if M==0:
  a=0
  b=0

if M!=0:
  for i in range(M):
    k=input().split()
    
    if x==k[0] and y==1:
      x=k[0]
    elif x==k[0] and y==0:
      if k[1]=="AC":
        a=a+1
        y=1
      else:
        b=b+1
    else:
      x=k[0]
      y=0
      if k[1]=="AC":
        a=a+1
        y=1
      else:
        b=b+1
      
print(a,b)

Submission status: Wrong Answer

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

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

AC = 0
P = 0

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

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

print(AC, P)

Submission status: Wrong Answer

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

np, cl = "", False
ac, wa = 0, 0
for i in range(M):
  p, s = input().split()
  # 初めての問題
  if np != p:
    cl = False
    if s == "WA":
      wa += 1
    elif s == "AC":
      ac += 1
      cl = True
    np = p
  # 継続問題
  else:
    if cl == True:
      continue
    else:
      if s == "WA":
        wa += 1
      elif s == "AC":
        ac += 1
        cl = True
    np = p
print(ac, wa)

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] == 'WA':
            cntw += 1
        else:
            cnta += 1
            aclst[int(p[i][0])] = 1

print(cntw,cnta)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split( ))
wa = [0] * (n + 1)
ac = [0] * (n + 1)
for i in range(m):
    no_s, res = map(str, input().split( ))
    no = int(no_s)
    if ac[no] == 0 and res == "AC":
        ac[no] = 1
    elif ac[no] == 0 and res == "WA":
        wa[no] += 1
for i in range(1, n):
    if ac[i] == 0:
        wa[i] == 0
acsum = 0
wasum = 0
for i in ac:
    acsum += i
for i in wa:
    wasum += i
print(str(acsum) + " " + str(wasum))

Submission status: Wrong Answer

Solution code:
N,M=input().split()
s=[input().split() for i in range(int(M))]
s=[flatten for inner in s for flatten in inner]
s=list(set(s))
AC=s.count('AC')
WA=s.count('WA')
print(str(AC)+' '+str(WA))

Submission status: Wrong Answer

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

idxw = {}
ac = 0
wa = 0

for i in range(int(M)):
  p, s = input().split(" ")
  if not (p in idxw):
    idxw[p] = []
  idxw[p].append(s)

  
#print(idxw)
for i in idxw:
  a = 'AC' in idxw[i]
  if a == True:
    ac +=1
    tmpwa = 0
    for j in idxw[i]:
      if j == 'AC':
        wa += tmpwa
      else:
        tmpwa += 1

#print(ac)
#print(wa)


print('{} {}'.format(ac, wa))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
sum_a = 0
tmp = []
test_cnt = []
false_cnt = 0
for index in range(M):
    A = input().split()
    if int(A[0]) not in test_cnt:
        test_cnt.append(int(A[0]))

    if A[0] not in tmp:
        if A[1] == 'WA':
            false_cnt += 1
        elif A[1] == 'AC':
            tmp.append(A[0])

print(len(test_cnt))
print(false_cnt)

Submission status: Wrong Answer

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

pen = temp_pen = 0
pen_dic={}
ac=set()

for _ in range(m):
  temp=input().split()
  if set(temp[0]) & set(ac):
    continue
  else:
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      pass
    if temp[1] == "AC":
      ac.add((temp[0]))
      pen += t
    else:
      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    input = stdin.readline
    N, M = map(int, input().split())
    SP = [tuple(input().split()) for i in range(M)]
    wa_num_temp = {}
    ac_num_temp = {}
    for sp in SP:
        if sp[0] in list(ac_num_temp.keys()):
            continue
        if sp[0] not in list(wa_num_temp.keys()):
            wa_num_temp[sp[0]] = 0
        if sp[1] == "WA":
            wa_num_temp[sp[0]] += 1
        elif sp[1] == "AC":
            ac_num_temp[sp[0]] = 1

    print(sum(ac_num_temp.values()), sum(wa_num_temp.values()))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
p=[0]*m
s=[0]*m
wal=[0]*(10**5+100)
acl=[0]*(10**5+100)
for i in range(m):
    p[i],s[i]=map(str, input().split())

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

Submission status: Wrong Answer

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

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

#print(N, M, p, S)
ac = 0
wa = 0

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

print(ac, wa)

Submission status: Wrong Answer

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

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

answers = {}
wrongs = {}

for a in l:
    if a[1] == "AC":
        answers[a[0]] = a[1]
    elif a[1] == "WA":
        if not a[0] in wrongs:
            wrongs[a[0]] = 1
        elif a[0] in wrongs:
            wrongs[a[0]] = wrongs[a[0]] + 1

# 集計
wc = 0
for k, v in wrongs.items():
    if k in answers.keys():
        wc += 1
result = [len(answers.keys()), wc]

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

Submission status: Wrong Answer

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

answerd = [0] * 100100
WA_count = 0
AC_count = 0

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

    if s == 'WA' and answerd[p] == 0:
        WA_count += 1

    if s == 'AC' and answerd[p] == 0:
        AC_count += 1
        answerd[p] = 1

print(AC_count, WA_count)

Submission status: Wrong Answer

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

score=[]
for i in range(M):
  pS = list(map(str, input().split()))
  score.append(pS)

AC = 0
WA = 0
  
for i in range(1,N+1):
  for j in range(M):
    if score[j][0]==str(i):
      if score[j][1]=='WA':
        WA+=1
      elif score[j][1]=='AC':
        AC+=1
        break
      
print(AC,WA)

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(sorted(listnum))])
newlistAC = [[] for i in range(len(newnumlist))]
for j in range(M):
    if int(ps[j][0]) == newnumlist[0][0]:
        newlistAC[0].append(ps[j][1])
#print(newnumlist,newlistAC)


if len(newnumlist) > 1:
    for i in range(1,len(newnumlist)):  
        for j in range(M):
            if int(ps[j][0]) == newnumlist[i][0]:
                newlistAC[i].append(ps[j][1])


countAC=0
counterror = 0
for i in range(len(newlistAC)):
    for j in range(len(newlistAC[i])):
        if newlistAC[i][j] == 'WA':
            counterror += 1
        else:
            countAC += 1
            break
    
print(countAC, counterror)

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(" ")]
score_dict = {}
 
for i in range(m):
    p, s = input().split(" ")
    if p not in score_dict:
        score_dict[p] = []
    
    score_dict[p].append(s)
 
ac_count = 0
wa_count = 0
 
for i in score_dict.values():

    if "AC" in i:
        ac_count += 1
        wa_count += len(i[:i.index("AC")])
    else:
        wa_count += len(i)
 
print("{0} {1}".format(ac_count, wa_count))

Submission status: Wrong Answer

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


print(A,W)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)

z = 0
seitou,sippai = 0,0
kuria = []
for i in range(0,len(judgment)):
    if number[i] not in kuria and judgment[i] == 'AC':
        seitou += 1
        kuria.append(number[i])
    elif number[i] not in kuria and judgment[i] == 'WA':
        sippai += 1
print(seitou,sippai)

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] == 'WA':
            cntw += 1
        else:
            cnta += 1
            aclst[int(p[i][0])] = 1

print(cnta, cntw)

Submission status: Wrong Answer

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

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

account = 0
wacount = 0
frag = 0

for j in range(n):
    frag = 0
    for k in range(m):
        if p[k] == j+1 and s[k] == "WA" and frag == 0:
            wacount += 1
        elif p[k] == j+1 and s[k] == "AC" and frag == 0:
            account += 1
            frag = 1

print("{} {}".format(account, wacount))

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
AC = 0
WA = 0
a = {}
for i in range(M):
  l = input().split()
  a.setdefault(l[0], [])
  a[l[0]].append(l[1])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans_list = [False] * 100000

now = 0
false_count = 0
ans_false = 0
ans = 0

for i in range(M):
    p, s = input().split()
    if ans_list[int(p) - 1]:
        continue
    if now != int(p) - 1:
        false_count = 0
    if s == "WA":
        now = int(p) - 1
        false_count += 1
    else:
        ans += 1
        ans_false = ans_false +  false_count
        ans_list[int(p) - 1] = True
 
print(ans, ans_false)

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)

lpu = list(set(lp))
lac = [0] * len(lpu)
lwa = [0] * len(lpu)

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

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

Submission status: Wrong Answer

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

wa = 0
ac = []
for i in range(M):
  p,S = map(str, input().split())
  if not len(ac) == N:  
    if not (p in ac):
      if S == "AC":
        ac.append(p)
      else:
        wa += 1

print(len(ac), wa)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
 
def main():
    NM = [int(i) for i in input().split(" ")]
    if NM[1] == 0:
        ans = "0 0"
    else:
        ans_ac = 0
        ans_wa = 0
        p = ""

        probs = []

        for i in range(NM[1]):
            ps = input().split(" ")
            #print(ps)

            if p != ps[0]:
                #print("A")
                p = ps[0]
                ac_flg = 0
                res = ps[1]
                if res == "AC\n":
                    if p in probs:
                        pass
                    else:
                        ans_ac += 1
                        ac_flg = 1
                        probs.append(p)
                else:
                    if p in probs:
                        pass
                    else:
                        ans_wa += 1
            else:
                #print("B")
                if ac_flg == 0:
                    res = ps[1]
                    if res == "AC\n":
                        if p in probs:
                            pass
                        else:
                            ans_ac += 1
                            ac_flg = 1
                            probs.append(p)
                    else:
                        if p in probs:
                            pass
                        else:
                            ans_wa += 1
                else:
                    pass
        ans = str(ans_ac) + " " + str(ans_wa)
    print(ans)
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ckn = set()
swa = 0
ac = 0

for _ in range(m):
  pm, c = input().split()
  
  if not pm in ckn:
    if c == 'WA':
      swa += 1

    else:
      ckn.add(pm)
      ac += 1

print(ac, swa)

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
print(s)
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 = map(int,input().split(" "))
question_list = []
res_list = []
ac_list = []
for i in range(m):
    a,b = input().split(" ")
    a = int(a)
    question_list.append(a)
    res_list.append(b)
correct = 0
mistake = 0




for i,j in enumerate(res_list):
    if i == 0:
        if j == "WA":
            mistake += 1
        else:
            correct += 1
            ac_list.append(question_list[i])
            
    else:
        #今やっている問題がまだ正解していない
        if question_list[i] not in ac_list:
            if j == "WA":
                mistake += 1
            else:
                correct += 1
                ac_list.append(question_list[i])
    if len(ac_list) == n:
        break
            
        
print(correct,mistake)

Submission status: Wrong Answer

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

A = [[0] * 2 for k in range(M)]
AC = [0] * M
WA = 0

for i in range(M):
    A[i][0], A[i][1] = input().split()

A.reverse()

for j in range(M):
    if A[j][1] == 'AC' and (A[j][0] in AC) is False:
        AC[j] = A[j][0]
    elif A[j][1] == 'WA' and (A[j][0] in AC) is True:
        WA += 1

print(len(AC) - AC.count(0), WA)

Submission status: Wrong Answer

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

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

answers = {}
wrongs = {}

for a in l:
    if a[1] == "AC":
        answers[a[0]] = a[1]
    elif a[1] == "WA":
        if not a[0] in answers and not a[0] in wrongs:
            wrongs[a[0]] = 1
        elif not a[0] in answers and a[0] in wrongs:
            wrongs[a[0]] = wrongs[a[0]] + 1

# 集計
wc = 0
for k, v in wrongs.items():
    if k in answers.keys():
        wc += 1
result = [len(answers.keys()), wc]

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

Submission status: Wrong Answer

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


print(N,M)

MEM = []
MEM.append(-1)
MEM.append("DUMMY")

wrong = 0
correct = 0
count = 0

for i in range(M):

  IN = input().split()
  P = int(IN[0])
  S = IN[1]

  if MEM[0] != P:
    correct = 0
    RES = []
    RES.append(S)
    
  else:
    RES.append(S)


  if S == "AC":
    correct += 1
    if correct > 1:
      pass
    else:
      count += 1
    
  if correct == 0:
    wrong += 1


  MEM = []
  MEM.append(P)
  MEM.append(S)
  
print(count,wrong)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    for i in range(scan,M):
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1

        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        else:
            break
        
print(all_AC, all_failure)

Submission status: Wrong Answer

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

for i in range(n):
  if ac[i] != 0:
    wa[i] = 0

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

Submission status: Wrong Answer

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

a=0
b=0
x=0
y=0
p=[]
S=[]
k=[]


if M==0:
  a=0
  b=0

if M!=0:
  for i in range(M):
    k=input().split()
    
    if x==k[0] and y==1:
      x=k[0]
    elif x==k[0] and y==0:
      if k[1]=="AC":
        a=a+1
        y=1
      else:
        b=b+1
    else:
      x=k[0]
      y=0
      if k[1]=="AC":
        a=a+1
      else:
        b=b+1
      
print(a,b)

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' and Liste[i] == max(Question):
                pena += 1
                print('%d %d' % (correct,pena))
                sys.exit(0)
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC':
                pena += 1
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'WA':
                pena += 1
#高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
print('%d %d' % (correct,pena))

Submission status: Wrong Answer

Solution code:
import sys
n,m = map(int,input().split())
d = []
a = 0
w = 0
x = 0

if m == 0:
    print(0,0)
    sys.exit()
for i in range(m):
    p,s = input().split()
    if (p,"AC") not in d:
        d.append((p,s))
        
        if s == "AC":
            a +=1
        elif s == "WA":
            w += 1
            del d[-1]
    else:
        if x > int(p):
            del d[:-1]
            x = int(p)
print(a,w)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(' '))
problem = [False] * n
ok=0
pen=0
i=0

while i < m:
    p, result = input().split(' ')
    p = int(p) - 1
    if problem[p]:
        pass
    else:
        if result == 'WA':
            pen += 1
        else:
            ok += 1
            problem[p] = True
    i+=1
print('{} {}'.format(ok, pen))

Submission status: Wrong Answer

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

ans = 0
pen = 0

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

for i in range(len(A)):
    if A[i][1]=='AC':
        ans += 1
        if i+1<=len(A)-1 and A[i+1] == (''.format(i), 'WA'):
          A.remove(A[i+1])
    if A[i][1] == 'WA':
        pen += 1

print(ans, pen)

Submission status: Wrong Answer

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

cor = pen = temp_pen = 0
temp_p = "0"
pen_dic={}
ac=set()

for _ in range(m):
  temp=input().split()
  if set(temp[0]) & set(ac):
    continue
  if temp[1] == "AC":
    ac.add((temp[0]))
    t = 0
    try:
      t = pen_dic[temp[0]]
    except:
      pass

    pen += t
  else:
    if not set(temp[0]) & set(ac):
      t = 0
      try:
        t = pen_dic[temp[0]]
      except:
        pass
      pen_dic.update({temp[0]:t + 1})
print(len(set(ac)), pen)

Submission status: Wrong Answer

Solution code:
a,s=input().split()
a=int(a) 
s=int(s)
A=[]
B=[]
ac=0
wa=0
for i in range(s):
  d,f=input().split()
  if f=="AC" and d not in B:
    ac+=1
    B.append(d)
  elif f=="WA" and d not in B:
    A.append(d)
wa+=len(A)
r=set(A) ^ set(B)
for i in r:
  wa-=B.count(i)
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
p = [0]*m
s = [0]*m
c = [0]*(m + 1)
c[-1] = -11
j = 1
for i in range(m):
    p[i],s[i] = map(str,input().split())
    if i == 0:
        c[i] = str(p[i])
    elif c[j - 1] != p[i]:
        c[j] = str(p[i])
        j += 1

ac = 0
wa = 0
j = 0
for i in range(m):

    if p[i] == c[j] and s[i] == "AC":
        ac += 1
        j += 1
        if c[j] == 0 or c[j] == -11:
            break
    elif s[i] == "WA" :
        wa += 1
        
print("{} {}".format(ac,wa))

Submission status: Wrong Answer

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

for i in range(count+1):
    if s[i][1]=="AC":
        if s[i][0] in dame:
            c1+=1
        else:
            dame.append(s[i][0])
            aans+=1
    else:
        wans+=1
print(aans,wans)

Submission status: Wrong Answer

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

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

print(cor,resMis)

#TLEが出ているか確認（numList = [] * Mが原因）

Submission status: Wrong Answer

Solution code:
#C - Welcome to AtCoder
N,M = list(map(int, input().split()))
p = []
S = []
for k in range(M):
    p_input,S_input = input().split()
    p.append(p_input)
    S.append(S_input)
p = list(map(int, p))

j = 0
sum_ac,sum_wa = 0,0
for i in range(N):
    try:
        flg = 0
        while p[j] == i + 1:
            if S[j] == 'WA':
                print('WA')
                j = j + 1
                sum_wa = sum_wa + 1
            elif S[j] == 'AC' and flg == 0:
                print('AC')
                flg = flg + 1
                j = j + 1
                sum_ac = sum_ac + 1
            else:
                j = j + 1
    except IndexError:
        pass

print(sum_ac,sum_wa)

Submission status: Wrong Answer

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

ac = 0
wa = 0


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

print(ac, wa)

Submission status: Wrong Answer

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

WA_count, AC_count = 0, 0
P_set = list(set(P))
for i in range(len(P_set)):
  Pi_index = [j for j, x in enumerate(P) if x == P_set[i]]
  for k in Pi_index :
    if S[k] == 'WA' :
      WA_count += 1
    else :
      AC_count += 1
      break
      
print(AC_count, WA_count)

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin
    input = stdin.readline
    N, M = map(int, input().split())
    SP = [tuple(input().split()) for i in range(M)]
    wa_num_temp = {}
    ac_num_temp = {}
    for sp in SP:
        if sp[0] in ac_num_temp.keys():
            continue
        if sp[0] not in wa_num_temp:
            wa_num_temp[sp[0]] = 0
        if sp[1] == "WA" and sp[0] not in ac_num_temp.keys():
            wa_num_temp[sp[0]] += 1
        elif sp[1] == "AC" and sp[0] not in ac_num_temp.keys():
            ac_num_temp[sp[0]] = 1

    print(sum(ac_num_temp.values()), sum(wa_num_temp.values()))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

wa_num = 0
ac_q = []
for i in range(m):
    if score_list[i][1] == "AC" and score_list[i][0] not in ac_q:
        ac_q.append(score_list[i][0])
    elif score_list[i][1] == "WA" and score_list[i][0] not in ac_q:
        wa_num = wa_num + 1
    
ac_num = len(ac_q)

print(ac_num,wa_num)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split(" "))
nac = 0
npe = 0
cp = 0
is_ac = {}
for i in range(m):
  p_s, s = input().split(" ")
  p = int(p_s)
  cis_ac = False
  if p in is_ac:
    cis_ac = is_ac[p]
  if cis_ac:
    continue
  if s == "AC":
    nac += 1
    is_ac[p]=True
  else:
    npe += 1
print(str(nac)+" "+str(npe))