Problem:


Score : 300 points

Problem Statement

Takahashi participated in a contest on AtCoder.

The contest had N problems.

Takahashi made M submissions during the contest.

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

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

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

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

Constraints

N, M, and p_i are integers.

1 \leq N \leq 10^5

0 \leq M \leq 10^5

1 \leq p_i \leq N

S_i is AC or WA.

Input

Input is given from Standard Input in the following format:

N M
p_1 S_1
:
p_M S_M

Output

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

Sample Input 1

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

Sample Output 1

2 2

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

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

Thus, he has two correct answers and two penalties.

Sample Input 2

100000 3
7777 AC
7777 AC
7777 AC

Sample Output 2

1 0

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

Sample Input 3

6 0

Sample Output 3

0 0



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


Sample output:
2 2

Submission status: Wrong Answer

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

p = [0] * M
S = [''] * M


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

dp = [[0] * 2 for i in range(N)]  # x問目の、score, 正答までのwrong_ans
#dp = [[0] * 2 for i in range(100005)]  # x問目の、score, penalty

for i in range(M):
    num = p[i] - 1
    # 未得点のときだけ影響
    if(dp[num][0] == 0):
         if(S[i] == 'WA'):
             dp[num][1] += 1
             continue

         elif(S[i] == 'AC'):
             dp[num][0] += 1

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)

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]=input().split()
    p[i]=int(p[i])
sum_ok,sum_miss=0,0
former_ok=[0]*n
for p_,s_ in zip(p,s):
    if p_ not in former_ok:
      if s_=='AC':
        former_ok[sum_ok]=p_
        sum_ok+=1
        if sum_ok==n:break
      else:sum_miss+=1
print(sum_ok, sum_miss)

Submission status: Wrong Answer

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

n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
    if(l[i][0] in ac) == False:
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in ac) == False:
      wa += 1
      
print(len(ac),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':
        wrong[p[k] - 1] += 1
    elif S[k] == 'AC' and 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=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,m):
    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())
cnt1=0
cnt2=0
flag=[-1]*(n+1)
for _ in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if flag[p]==1:
    continue
  else:
    if s=='AC':
      cnt1+=1
      flag[p]=1
    else:
      cnt2+=1
print(cnt1,cnt2)

Submission status: Wrong Answer

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

ac = 0
wa = 0
check = [False for i in range(n)]
for i in range(m):
  p, s = map(str, input().split())
  if not check[int(p)-1]:
    if s == 'AC':
      check[int(p)-1] = True
      ac+=1
    if s == 'WA':
      wa+=1
      
print(ac, end="")
print(" ", end="")
print(wa)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N, M = list(map(int, input().split()))
    
    inputs = [input().split() for i in range(M)]
    has_been_solved = set()

    penalty = {}
    correct = 0

    for i in inputs:
        
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            correct += 1
            has_been_solved.add(num)
        else:
            if num not in penalty:
                penalty[num] = 1
            else:
                penalty[num] += 1
    print(correct, sum([penalty[p] for p in  penalty.keys()]))         
        

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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

print(a, b)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans1 = 0
ans2 = 0
preans2 = 0
t = []
pret = []
for i in range(m):
  pret = list(map(str, input().split()))
  t.append(pret)
for i in range(m):
  if t[i][1] == "WA":
    preans2 += 1
  else:
    if i > 0:
      if t[i-1] != t[i]:
        ans1 += 1
        ans2 += preans2
        preans2 = 0
    else:
      ans1 += 1
    
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
k = []
t,f = 0,0
for _ in range(m):
  a,b = map(str,input().split())
  if a in k:
    pass
  elif b == "AC":
    k.append(a)
    t = t + 1
  else:
    f = f + 1
print(t,f)

Submission status: Wrong Answer

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

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

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac=0
wa=0
problem=[]
ac_problem=[]
for i in range(m):
    ps=list(map(str,input().split()))
    ps[0]=int(ps[0])
    problem.append(ps)
    if ps[1]=='AC':
        ac_problem.append(ps[0])
set(ac_problem)
for i in range(m):
    if ac_problem.count(problem[i][0])>0:
        if problem[i][1]=='AC':
            ac+=1
            t=problem[i][0]
            ac_problem[ac_problem.index(t)]=0
        elif problem[i][1]=='WA':
            wa+=1
            
print(ac,wa)

Submission status: Wrong Answer

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

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

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

print(a, b)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
cnt1=0
cnt2=0
flag=[-1]*(n+1)
for _ in range(m):
  p,s=map(str,input().split())
  p=int(p)
  if s=='AC':
    if flag[p]==1:
      continue
    else:
      cnt1+=1
      flag[p]=1
  if s=='WA':
    if flag[p]==1:
      continue
    else:
      cnt2+=1
print(cnt1,cnt2)

Submission status: Wrong Answer

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

N, M = map(int, input().split())
a = [input().split() for _ in range(M)]
p = [int(x[0]) for x in a]
s = [x[1] for x in a]
del a

sl = []
ans = 0
pen = 0
for i in range(M):
    if p[i] in sl:
        continue

    if s[i] == 'WA':
        pen += 1
    else:
        ans += 1
        sl.append(p[i])

print(ans, pen)

Submission status: Wrong Answer

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

pn_num=0
WA_list=[0]*N
AC_list=[0]*N

for _ in range(M):
    pi,Si=input().split()
    pi=int(pi)
        
    if Si=='AC':
        pn_num+=WA_list[pi-1]
        AC_list[pi-1]=1
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
s = [0] * M
wcount = 0
acount = 0
k=0
for i in range(M):
    p[i], s[i] = map(str, input().split())
while k <M:
    if s[k]=="WA":
        wcount+=1
        print("a")
    elif s[k]=="AC":
        acount+=1
        print("b")
        while True:
            if k+1==M:
                break
            elif p[k]==p[k+1]:
                k+=1
            else:
                break
    k+=1
print(acount,wcount)

Submission status: Wrong Answer

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

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,sum_wa_with_ac = 0,0,0
for i in range(N):
    try:
        flg = 0
        sum_wa = 0
        while p[j] == i + 1:
            if S[j] == 'WA' and flg == 0:
                j = j + 1
                sum_wa = sum_wa + 1
            elif S[j] == 'AC' and flg == 0:
                flg = flg + 1
                j = j + 1
                sum_ac = sum_ac + 1
                sum_wa_with_ac = sum_wa_with_ac + sum_wa
            else:
                j = j + 1
    except IndexError:
        pass

print(sum_ac,sum_wa_with_ac)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
a = OrderedDict()

for i in range(m):
  p, s = input().split()
  if a.get(p) == None:
    a[p] = list()
  a[p].append(s)
  
ac = 0
wa = 0
for k in a.keys():
  try:
    wa += a[k].index('AC')
    ac += 1
    continue
  except:
    wa += len(a[k])
    pass
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import numpy as np
DEB = False
N,M = map(int, input().split())
res = np.zeros((N+1,2), dtype=np.int16)

for i in range(M):
    p, s = input().split()
    p = int(p)
    if res[p][0] == 0:
        if s == 'AC':
            res[p][0] += 1
        elif s == 'WA':
            res[p][1] += 1
    
if DEB:
    for r in res:
        print(r)

print("%d %d"%(res[1:,0].sum(), res[1:,1].sum()))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
li = []
for m in range(M):
  x,y = input().split()
  li.append([int(x), y])

sets = set()

ac = 0
wa = 0

for i in li:
  if i[1] == 'AC':
    if i[0] not in sets:
      sets.add(i[0])
      ac += 1

  else:
    if i[0] not in sets:
      wa += 1

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
 
ac = 0
wa = 0
ans = {}
 
for i in range(m):
  a, b = input().split()
  
  if a in ans.keys():
    if ans[a] == 'AC':
      continue
    elif b == 'AC':
      ac += 1
      ans[a] = b
 
    elif b == 'WA':
      wa += 1
  
 
  else:
    if b == 'AC':
      ac += 1
    elif b == 'WA':
      wa += 1
  
    ans[a] = b
print(ac, wa)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
wa={i:0 for i in range(1,a+1)}
ac={i:0 for i in range(1,a+1)}
g=0
print(wa)
if b==0:
    print("0 0")
    g=1
for i in range(b):
    c,d=input().split()
    print(wa)
    if d=="WA" and ac[int(c)]==0:
        wa[int(c)]+=1
        print(wa)
    else:
        print(wa)
        ac[int(c)]=1
        print(wa)
f=0
h=0
if g==0:
    for i in range(1,a+1):
        if ac[i]==1:
            f+=1
            h+=wa[i]
    print(str(f)+" "+str(h))

Submission status: Wrong Answer

Solution code:

N,M= map(int,input().split())
L = [list(map(str,input().split())) for i in range(M)]
AC =0
WA =0
WC = 0
list =  [[] for i in range(N)]

for id,res in L:
    list[int(id)-1].append(res)

for j in list:
    for i in j:
        if i =='AC':
            AC += 1
            WA += WC
            WC = 0
            break
        else:
            WC += 1

print(str(AC)+ ' '+str(WA))

Submission status: Wrong Answer

Solution code:

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

#print(N,M)

num=[]
answer=[]
correct=[]
for k in range(M):
    n,a=input().split()
    num.append(int(n))
    answer.append(a)
#print(num)
#print(answer)
    
preNum=0
preCorrect = False
correctCount=0
wrongCount = 0
temp_wrongCount = 0
for i in range(M):
    if i > 0 and num[i] != num[i-1]:
        preCorrect = False
        temp_wrongCount = 0

    if preCorrect == False and answer[i] == "AC":
        correctCount = correctCount + 1
        preCorrect = True
        wrongCount = wrongCount + temp_wrongCount
    if preCorrect == False and answer[i] == "WA":
        temp_wrongCount = temp_wrongCount + 1

print(correctCount, wrongCount)

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,sum_wa_with_ac = 0,0,0
for i in range(N):
    try:
        flg = 0
        sum_wa = 0
        while p[j] == i + 1:
            if S[j] == 'WA' and flg == 0:
                j = j + 1
                sum_wa = sum_wa + 1
            elif S[j] == 'AC' and flg == 0:
                flg = flg + 1
                j = j + 1
                sum_ac = sum_ac + 1
                sum_wa_with_ac = sum_wa_with_ac + sum_wa
            elif flg >= 0:
                j = j + 1
            else:
                pass
    except IndexError:
        pass

print(sum_ac,sum_wa_with_ac)

Submission status: Wrong Answer

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

P = list()
for m in range(M):
    n, rst = input().split()
    n = int(n)
    P.append( (n, rst) )


ck = [False for _ in range(N+1)]

ret_cor, ret_pen = 0, 0

for n, rst in P:
    if rst == 'AC':
        if not ck[n]:
            ck[n] = True
            ret_cor += 1

    else: # rst == 'WA'
        if not ck[n]:
            ret_pen += 1

print(ret_cor, ret_pen)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n,m=map(int,input().split())
wa=0
ac=0
cnt=0
ig=0
l=[(input().split()) for _ in range(m)]
l=sorted(l, key=itemgetter(0))
 
for t in l:
  c,r=t[0],t[1]
  if c == ig:
    continue
  
  if r == 'WA':
    cnt+=1
  elif r == 'AC':
    ac+=1
    wa+=cnt
    cnt=0
    ig=c
    
print(ac,wa)

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 = []
R = []
for i in range(N):
    Q.append(0)
    R.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':
        R[a[i] - 1] = R[a[i] - 1] + 1

for i in range(N):
    if Q[i] == 0:
        P = 0
    else: P = P + R[i]

print(AC, P)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=[list(input().split()) for _ in range(m)]
 
ac=[]
wa=0
for i in range(m):
  if l[i][1]=="AC":
      ac.append(l[i][0])
  elif l[i][1]=="WA":
    if (l[i][0] in set(ac)) == False:
      wa += 1
    
print(len(set(ac)),wa)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
p = [0] * M
s = [0] * M
wcount = 0
acount = 0
k=0
for i in range(M):
    p[i], s[i] = map(str, input().split())
while k <M-1:
    if s[k]=="WA":
        wcount+=1
    elif s[k]=="AC":
        acount+=1
        while True:
            if k+1==M:
                break
            elif p[k]==p[k+1]:
                k+=1
            else:
                break
    k+=1
print(acount,wcount)

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
string_list = [input() for i in range(s[1])]
AC_count = 0
WA_count = 0
AC_list = []

for ele in string_list:
    l = ele.split()
    if l[0] in AC_list:
        pass
    elif l[1] == "AC":
        # if not l[0] in AC_list:
        AC_list.append(l[0])
        AC_count = AC_count+1
    elif l[1] == "WA":
        # if not l[0] in AC_list:
        WA_count = WA_count+1

print(str(AC_count)+" "+str(WA_count))

Submission status: Wrong Answer

Solution code:
import sys

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

n_l = [0] * int(n)
w_l = [0] * int(n)

a = 0
w = 0
for i_s in i:
    p, c = i_s.split()
    p = int(p) - 1
    if n_l[p] == 1:
        continue

    if c == "AC":
        n_l[p] = 1
    else:
        w_l[p] += 1

for n, w in zip(n_l, w_l):
    if n == 1:
        a += 1
        w += w

print("{} {}".format(a, w))

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    has_been_solved = set()

    penalty = 0
    correct = 0
    for i in sys.stdin:
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            has_been_solved.add(num)
        else:
            penalty += 1
    correct = len(has_been_solved)
    
    print(correct, penalty)            
        

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ac = 0
wa = 0
check = [0 for i in range(n)]
for i in range(m):
  p, s = map(str, input().split())
  if check[int(p)-1] == 0:
    if s == 'AC':
      check[int(p)-1] = 1
      ac+=1
    else:
      wa+=1
print(ac, end="")
print(" ", end="")
print(wa)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
ac = 0
wa = 0
sub = []
for i in range(0, nm[1]):
    seen = set()
    seen_add = seen.add
    sub.append([i for i in input().split() if i not in sub])
for i in range(0, len(sub)):
    if sub[i][1] == "AC":
        ac += 1
    elif sub[i][1] == "WA":
        wa += 1
    else:
        continue

print(ac, end=" ")
print(wa)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
List=[list(input().split()) for i in range(M)]
AC = set([])
WA = []
accnt = 0
wacnt = 0

for i in range(M):
  num = List[i][0]
  res = List[i][1]
  
  if num in AC:
    wacnt = wacnt + WA.count(num)
  else:
    if res == "AC":
      accnt = accnt + 1
      AC.add(num)
    if res == "WA":
      WA.append(num)
  
ans = [int(accnt),int(wacnt)]
print(*ans)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    has_been_solved = set()

    penalty = 0
    correct = 0
    for i in inputs:
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            has_been_solved.add(num)
        else:
            penalty += 1
    correct = len(has_been_solved)
    
    print(correct, penalty)            
        

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
s = sys.stdin.readlines()
clear = []
a = 0
b = 0
c = 0
N, M = map(int, s[0].split())
for e in s[1:M + 1]:
  p, S = e.split()
  if p not in clear:
    if S == 'AC':
        clear.append(p)
        a += 1
        c = b
    else:
        b += 1

print('{} {}'.format(a, c))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ac_list=[0 for i in range(n+1)]
ac=0
wa=0
for i in range(m):
    p,s=list(input().split(" "))
    if ac_list[int(p)]==0 and s=="AC":
        ac+=1
        ac_list[int(p)]=1
    elif ac_list[int(p)]==0 and s=="WA":
        wa+=1

print(ac,wa)

Submission status: Wrong Answer

Solution code:
import sys
s = sys.stdin.readlines()
clear = []
a = 0
b = 0
c = 0
N, M = map(int, s[0].split())
for e in s[1:M + 1]:
  p, S = e.split()
  if p not in clear:
    if S == 'AC':
        clear.append(p)
        a += 1
    else:
        b += 1

print('{} {}'.format(a, c))

Submission status: Wrong Answer

Solution code:
F_str = input().split()
F = [int(f) for f in F_str]
N = F[0]
M = F[1]

WA_list = [0 for _ in range(N)]
AC_list = []

for i in range(M):
    S_str = input().split()
    S = [str(s) for s in S_str]
    if(S[1] == "AC"):
        AC_list.append(S[0])
    elif(not(S[0] in AC_list)):
        WA_list[int(S[0])-1] += 1

AC_set = list(set(AC_list))

print(str(len(AC_set)) + " " + str(sum(WA_list)))

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


print(cnta, cntw)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
lis = [None] * N
ac = 0
wa = 0
for i in range(M):
    a,b = map(str,input().split())
    a = int(a)
    if b == 'AC' and lis[a-1] == None:
        lis[a-1] = 'AC'
        ac += 1
    elif b == 'AC' and lis[a-1] == 'AC':
        continue
    elif b == 'WA' and lis[a-1] == 'AC':
        continue
    else:
        wa += 1
print(ac,wa)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if m == 0 :
  print('0 0')
  exit()
t = [0]*n
ansWA,ansAC = 0,0
for i in range(m):
  tmpN,tmpW = input().split()
  if t[int(tmpN)-1] == 0:
    if tmpW == 'WA':
      ansWA += 1
    else:
      ansAC += 1
      t[int(tmpN)-1] = 1
print(ansAC,ansWA)

Submission status: Wrong Answer

Solution code:
init = input().split(" ")
n = int(init[0])
m = int(init[1])

if m == 0:
  print("0 0")
  exit()

result = {}
for i in range(m):
  score = input().split(" ")
  p = int(score[0])
  s = score[1]
  if p not in result:
    if s == "AC":
      result[p] = {"flag": 1, "miss": 0}
    else:
      result[p] = {"flag": 0, "miss": 1}
  else:
    if s == "AC":
      result[p]["flag"] = 1
    elif s == "WA" and result[p]["flag"] == 0:
      result[p]["miss"] += 1

ans = [0, 0]
for v in result.values():
  if v["flag"] == 1:
    ans[0] += 1
  ans[1] += v["miss"]
print(" ".join([str(i) for i in ans]))

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

print(cnta, cntw)

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
dic = {}
wa = 0
ac = 0
for i in range(M):
  p,S = map(str, input().split())
  if S == "WA":
    if p in dic.keys() and dic[p] != 0:
      dic[p] = dic[p] + 1
    else:
      dic[p] = 1
  else:
    if p in dic.keys():
      if dic[p] != 0:
        ac += 1 
        wa += dic[p]
    else:
      ac += 1
    dic[p] = 0
      

print(ac, wa)

Submission status: Wrong Answer

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

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

print(sum(AC), sum(WA))

Submission status: Wrong Answer

Solution code:
P=[]
S=[]

N,M = map(int, input().split(' '))
for i in range(M):
    p,s=map(str,input().split(' '))
    P+=p
    S+=[s]    
P=[int(p) for p in P]

Q=[]
for i in range(N):
    Q+=[[]]

for i in range(M):
    for j in  range(N):
        if P[i] == j+1 :
            Q[j]+=[S[i]]
            
        
A=0
B=0

for  i in range(N):
    for j in range(len(Q[i])):
        if Q[i][j]==[]:
            break
        elif Q[i][j]=='WA':
            B +=1
        elif Q[i][j]=='AC':
            A +=1
            break
            
print(A,B)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
a = OrderedDict()

for i in range(m):
  p, s = input().split()
  if a.get(p) == None:
    a[p] = list()
  a[p].append(s)
  
ac = 0
wa = 0
for k, _ in a.items():
  try:
    wa += a[k].index('AC')
    ac += 1
  except:
    wa += len(a[k])
    pass
print(ac, wa)

Submission status: Wrong Answer

Solution code:
import sys

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

n_l = [0] * int(n)
w_l = [0] * int(n)

a = 0
w = 0
for i_s in i:
    p, c = i_s.split()
    p = int(p) - 1
    if n_l[p] == 1:
        continue

    if c == "AC":
        n_l[p] = 1
    elif n_l[p] == 0:
        w_l[p] += 1

for n, w in zip(n_l, w_l):
    if n == 1:
        a += 1
        w += w

print("{} {}".format(a, w))

Submission status: Wrong Answer

Solution code:
s=[]
lis=[]
N,M=map(int, input().split())
wacount=0
account=0
count=0
zero=0
flag=1
cur=0
changeflag=1
#s=[list(input()) for i in range(2)] 
#for range(M):
#print(N,M)

for i in range(M):
     lis=input().split()
     #print(lis)
     lis[0]=int(lis[0])
     lis.append(i)
     #print(lis)
     s.append(lis)

s2=sorted(s,key=lambda x:x[0])
sorted(s2,key=lambda x:x[2])
j=1
for i in range(len(s2)):
    if s2[i][0]>j:
        j=s2[i][0]
        flag=1
        count=0
    if (s2[i][0]==j)and(flag==1):
        if s2[i][1]=="WA":
            count=count+1
        elif s2[i][1]=="AC":
            account=account+1
            wacount=wacount+count
            flag=0
            count=0
                
print(wacount,account)

Submission status: Wrong Answer

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

        if s=='WA':
            W+=1

        else:
            AC[p]=1
            A+=1

for i in range(N+1):
    if AC[i]==1:
        W+=WA[i]
print(A,W)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
ac = 0
wa = 0
sub = []
for i in range(0, nm[1]):
    seen = set()
    seen_add = seen.add
    sub.append([i for i in input().split() if not (i in seen or seen_add(i))])
for i in range(0, len(sub)):
    if sub[i][1] == "AC":
        ac += 1
    elif sub[i][1] == "WA":
        wa += 1
    else:
        continue

print(ac, end=" ")
print(wa)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
a=[]
count_ac = 0
count_wa = 0
for i in range(M):
    P,S=input().split()
    if P in a:
        continue
    if S == 'AC':
        a.append(P)
        count_ac += 1
    else:
        count_wa += 1
print(count_ac,count_wa)

Submission status: Wrong Answer

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

p = [0] * M
S = [''] * M


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

dp = [[0] * 2 for i in range(N)]  # x問目の、score, penalty
#dp = [[0] * 2 for i in range(100005)]  # x問目の、score, penalty

for i in range(M):
    num = p[i] - 1
    # 得点済
    if(dp[num][0] > 0):
        continue

    if(S[i] == 'AC'):
        dp[num][0] += 1
        continue

    elif(S[i] == 'WA'):
        dp[num][1] += 1

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
tasks = []
for i in range(M):
  a, b = map(str,input().split())
  tasks.append([int(a),b])
AC = 0
WA = 0

try:
  for i in range(len(tasks)):
    num = tasks[i][0]
    if tasks[i][1]=="AC":
      AC += 1
      for j in range(i+1,len(tasks)):
        if tasks[j][0]==tasks[i][0]: del tasks[j]
    else: 
      for j in range(i+1,len(tasks)):
        if tasks[j]==[i,"AC"]: WA += 1
except IndexError: pass
print(AC, WA)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int,input().split())
a = OrderedDict()

for i in range(m):
  p, s = input().split()
  if a.get(p) == None:
    a[p] = list()
  a[p].append(s)
  
sum = 0
for k, _ in a.items():
  try:
    sum += a[k].index('AC')
  except:
    pass
print(sum)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
ac = 0
wa = 0
sub = []
for i in range(0, nm[1]):
    seen = set()
    seen_add = seen.add
    sub.append([i for i in input().split() if not (i in seen or seen_add(i))])
sub = list(set(map(tuple, sub)))
for i in range(0, len(sub)):
    if sub[i][1] == "AC":
        ac += 1
    elif sub[i][1] == "WA":
        wa += 1
    else:
        continue

print(ac, end=" ")
print(wa)

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
if AC == 0:
    P = 0

print(AC, P)

Submission status: Wrong Answer

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

quiz_dict = {}
wa_dict = {}
 
for i in range(M):
  tmp = input().split()
  
  quiz = tmp[0]
  res = tmp[1]
  
  if quiz not in quiz_dict:
    quiz_dict[quiz] = 0
  
  if quiz not in wa_dict: 
    wa_dict[quiz] = 0
  
  if res == "AC":
    quiz_dict[quiz] = 1
  if res == "WA":
    if quiz_dict[quiz] == 0:
      wa_dict[quiz] += 1


tmp_list = [k for k, v in quiz_dict.items() if v > 0] 

print(tmp_list)

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

a = len(filter_dict(lambda k,v: v==1, quiz_dict))
tmp = filter_dict(lambda k,v: k in tmp_list, quiz_dict)
wa_n = sum(tmp.values())

print(a, wa_n)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    has_been_solved = set()

    penalty = 0
    correct = 0
    for i in inputs:
        num = int(i[0])
        if num not in has_been_solved and i[1] == 'AC':
            has_been_solved.add(num)
        elif num not in has_been_solved and i[1] != 'AC':
            penalty += 1
    correct = len(has_been_solved)
    
    print(correct, penalty)            
        

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
if ac == 0:
  swa = 0
  
print(ac, swa)