TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m = map(int, input().split()) 

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=0

for i in range(n):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))

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

pena=[0]*(n+1)
seitou=[0]*(n+1)

for i in range(m):
    p,s = map(str,input().split()) 
    p=int(p)
    if s=="WA" and seitou[p]==0:
        pena[p]+=1
    if s=="AC":
        seitou[p]=1

pena_kazu=0

for i in range(1,n+1):
    if seitou[i]==1:
        pena_kazu+=pena[i]

seitou_kazu=sum(seitou)

print(str(seitou_kazu)+" "+str(pena_kazu))

Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):

check = {}
error = {}

ans_ac = 0
ans_wa = 0

for i in range(m):
    p,s = map(str, input().split())
    p = int(p)
    if p in check:
        pass
    else:
        if s == "WA":
            if p in error:
                error[p] += 1
            else:
                error[p] = 1
        else:
            if p in check:
                check[p] += 1
            else:
                check[p] = 1
            if p in error:
                ans_wa += error[p]
            ans_ac += 1
print(str(ans_ac) + " " + str(ans_wa) )

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

check = {}
error = {}

ans_ac = 0
ans_wa = 0

for i in range(m):
    p,s = map(str, input().split())
    p = int(p)
    if p in check:
        pass
    else:
        if s == "WA":
            if p in error:
                error[p] += 1
            else:
                error[p] = 1
        else:
            if p in check:
                check[p] += 1
            else:
                check[p] = 1
            if p in error:
                ans_wa += error[p]
            ans_ac += 1
print(str(ans_ac) + " " + str(ans_wa) )

Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    lis=[0]*(n+1)
    wa=0
    for _ in range(m):
        P,s=input().split()
        p=int(P)
        if lis[p]==0:
            if s=='WA': wa+=1
            else: lis[p]+=1
    print(sum(lis))
    print(wa)


if __name__ == "__main__":
    main()

import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    lis=[0]*(n+1)
    ww=[0]*(n+1)
    wa=0
    for _ in range(m):
        P,s=input().split()
        p=int(P)
        if lis[p]==0:
            if s=='WA': ww[p]+=1
            else:
                lis[p]+=1
                wa+=ww[p]
    print(sum(lis),wa)


if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0]]*n
for _ in range(k):
    a, b = rl().split()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
print(li)
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)






import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    b = b.rstrip()
    a = int(a) - 1
    if b == 'WA':
        li[a][0] += 1
    elif li[a][1] == 0:
        li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    wa += i
    if v == 1:
        ac += 1
print(ac, wa)






import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [['WA'] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    a = int(a)
    a -= 1
    if li[a][-1] == 'WA':
        li[a].append(b)
print(li)
ac = 0
wa = 0
for i in li:
    for v in i:
        if v == 'AC':
            ac += 1
        elif v == 'WA':
            wa += 1
print(ac, wa-len(li))

import sys
import math
import itertools
import numpy

rl = sys.stdin.readline

n, k= map(int, rl().split())
li = [[0, 0] for _ in range(n)]
for _ in range(k):
    a, b = rl().split()
    b = b.rstrip()
    a = int(a) - 1
    if li[a][1] == 0:
        if b == 'WA':
            li[a][0] += 1
        else:
            li[a][1] = 1
ac = 0
wa = 0
for lis in li:
    i, v = lis
    if v == 1:
        ac += 1
        wa += i
print(ac, wa)






Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N,M = map(int,input().split())
L = []
for i in range(M):
    L.append(list(map(str,input().split())))
L.sort()
count_AC = 0
count_WA = 0
temp = 0
flag = 'WA'
p = 0

for i in range(M):
    if L[i][0] != p:
        p = L[i][0]
        temp = 0
        flag = 'WA'
        if L[i][1] == 'WA':
            temp += 1
        if L[i][1] == 'AC':
            count_AC += 1
    elif L[i][0] == p:
        if L[i][1] == 'WA':
            temp += 1
        if L[i][1] == 'AC':
            if flag == 'WA':
                count_AC += 1
                count_WA += temp
                flag = 'AC'
            if flag == 'AC':
                pass

print('{} {}'.format(count_AC, count_WA))

N,M = map(int,input().split())
L = []
for i in range(M):
    L.append(list(map(str,input().split())))
from operator import itemgetter
L.sort(key=itemgetter(0))
count_AC = 0
count_WA = 0
temp = 0
p = 0
#print(L)

for i in range(M):
    #print(L[i])
    if L[i][0] != p:
        p = L[i][0]
        temp = 0
        flag = 'WA'
        if L[i][1] == 'WA':
            temp += 1
        else:
            count_AC += 1
            flag = 'AC'
    else:
        if L[i][1] == 'WA':
            temp += 1
        else:
            if flag == 'WA':
                count_AC += 1
                count_WA += temp
                flag = 'AC'
            else:
                pass
            
    #print(temp, count_AC, count_WA)

print('{} {}'.format(count_AC, count_WA))

Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):

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

submit = []
for _ in range(M):
  temp = [x for x in input().split()]
  submit.append(temp)

ac = [0]*(N + 1)
wa = [0]*(N + 1)
  
for i in range(M):
  result = submit[i][1]
  question = int(submit[i][0])
  
  if result == 'AC' and ac[question] == 0:
    ac[question] = 1
  elif result == 'WA' and ac[question] == 0:
    wa[question] += 1

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

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


N, M = map(int, input().split())
 
submit = []
for _ in range(M):
  temp = [x for x in input().split()]
  submit.append(temp)
 
ac = [0]*(N + 1)
wa = [0]*(N + 1)
  
for i in range(M):
  result = submit[i][1]
  question = int(submit[i][0])
  
  if result == 'AC' and ac[question] == 0:
    ac[question] = 1
  elif result == 'WA' and ac[question] == 0:
    wa[question] += 1
 
for i in range(N + 1):
  if ac[i] != 1:
    wa[i] = 0
 
print(sum(ac), sum(wa))
  

Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n, m = map(int, input().split())
lst = [input().split() for i in range(m)]

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

for i in range(m):
    p_i = int(lst[i][0])
    if lst[i][1] == 'AC':
        ac[p_i-1] = 1
    else:
        if ac[p_i-1] == 0:
            wa[p_i-1] += 1

print(ac)
print(wa)

num_ac = sum(ac)
pnlt = sum(wa)

print(num_ac, pnlt)


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

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

for i in range(m):
    p_i = int(lst[i][0])
    s_i = lst[i][1]
    if s_i == 'AC':
        ac[p_i-1] = True
    else:
        if ac[p_i-1] is False:
            wa[p_i-1] += 1

num_ac = 0
pnlt = 0
for i in range(n):
    if ac[i]:
        num_ac += 1
        pnlt += wa[i]
print(num_ac, pnlt)


Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = 0

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA":
        t += 1

print(sum(q),t)


import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1

for [p,s] in ps:
    if q[p] == 0 and t[p] != 0:
        t[p] == 0


print(sum(q),sum(t))


import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1


"""
for [u,r] in ps:
    u = int(u) -1
    if q[u] == 0 and t[u] != 0:
        t[u] == 0
"""

w = 0
for i, uc in enumerate(q):
    if uc == 1:
        w += t[i]
    


print(sum(q),w)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
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-1)
        
    if Si=='AC':
        pn_num+=WA_list[pi-1]
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

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]
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

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

pn_num=0
AC_list=[0]*N

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

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]
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

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

pn_num=0
AC_list=[0]*N

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

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':
        if AC_list[pi-1]==0:
            pn_num+=WA_list[pi-1]
            AC_list[pi-1]=1
    
    else:
        WA_list[pi-1]+=1
    
print(sum(AC_list),pn_num)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n, m = map(int, input().split())
l = [list(input().split()) for i in range(m)]
cnt = 0
ans = [0]*n
num = 0
for i in range(0, m):
  num = int(l[i][0])
  if l[i][1] == 'AC':
    ans[num] = 1
  elif ans[num] != 1:    
    cnt += 1
print(sum(ans), cnt)

n, m = map(int, input().split())
Penalty = [0]*(n+1)
AC = [False]*(n+1)
correct = 0
penalty = 0
for i in range(m):
  ans = input().split()
  problem = int(ans[0])
  result = ans[1]
  if AC[problem] == False:
    if result == 'AC':
      AC[problem] = True
      correct += 1
      penalty += Penalty[problem]
    else:
      Penalty[problem] += 1
print(correct, penalty)

Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N, M, *PS = open(0).read().split()
N, M = [int(_) for _ in [N, M]]
cor = [0] * (N + 1)
pen = [0] * (N + 1)
for p, s in PS:
    p = int(p)
    if cor[p] == 1:
        continue
    if s == 'AC':
        cor[p] = 1
    else:
        pen[p] += 1
ans = [0, 0]
for i in range(1, N + 1):
    if cor[p] == 0:
        continue
    ans[0] += 1
    ans[1] += pen[ @ ]
print(*ans)


N, M, *PS = open(0).read().split()
N, M = [int(_) for _ in [N, M]]
cor = [0] * (N + 1)
pen = [0] * (N + 1)
for p, s in zip(PS[::2], PS[1::2]):
    p = int(p)
    if cor[p] == 1:
        continue
    if s == 'AC':
        cor[p] = 1
    else:
        pen[p] += 1
ans = [0, 0]
for i in range(1, N + 1):
    if cor[i] == 0:
        continue
    ans[0] += 1
    ans[1] += pen[i]
print(*ans)


Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m=map(int,input().split())
ac=[0 for _ in range(n)]
wt=[0 for _ in range(n)]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(p)
        pen += wt[int(p)]
    else:
        if p in ac:
            pass
        else:
            wt[int(p)] += 1
            
t_ac=set(ac))
print(len(t_ac),pen)







n,m=map(int,input().split())
ac=[]
wt=[0 for _ in range(n)]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(p)
        pen += wt[p]
    else:
        if p in ac:
            pass
        else:
            wt[p] += 1
            
t_ac=set(ac)
print(len(t_ac),pen)

n,m=map(int,input().split())
ac=[]
wt=[]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(p)
        pen += wt[p]
    else:
        if p in ac:
            pass
        else:
            wt[p] += 1
            
t_ac=set(ac)
print(len(t_ac),pen)


n,m=map(int,input().split())
ac=[False]*(n+1)
wa=[0]*(n+1)
pena=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if s == "AC":
        ac[p] = True
    else:
        if False:
            wa[p] += 1
        else:
            continue
for i in ac:
    if i == True:
        pena += wa[index(i)]

n,m=map(int,input().split())
ac=[0 for _ in range(n)]
wt=[0 for _ in range(n)]
pen=0
for i in range(m):
    p,s=input().split()
    if s=="AC":
        ac.append(int(p))
        pen += wt[int(p)]
    else:
        if int(p) in ac:
            pass
        else:
            wt[int(p)] += 1
            
t_ac=set(ac))
print(len(t_ac),pen)







n,m=map(int,input().split())
AC=[0 for _ in range(n)]
WA=[0 for _ in range(n)]
pen=0
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        if AC[p-1]==0:
            AC[p-1]=1
            pen += WA[p-1]
        else:
            pass
    else:
        if AC[p-1]==0:
            WA[p-1] +=1
        else:
            pass
print(AC.count(1),pen)
            

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in lis:
    if i[0] not in d:
        if i[1] == 'AC':
            ac += 1
            d[i[0]] = 'AC'
        else:
            d[i[0]] = 1
    else:
        if i[1] == 'AC':
            if d[i[0]] != 'AC':
                ac += 1
                wa += d[i[0]]
                d[i[0]] = 'AC'
        else:
            d[i[0]] += 1
print(ac, wa)

n, m = map(int, input().split())
lis = [list(input().split()) for _ in range(m)]
d = {}
ac, wa = 0, 0
for i in lis:
    if i[0] not in d:
        if i[1] == 'AC':
            ac += 1
            d[i[0]] = 'AC'
        else:
            d[i[0]] = 1
    else:
        if i[1] == 'AC':
            if d[i[0]] != 'AC':
                ac += 1
                wa += d[i[0]]
                d[i[0]] = 'AC'
        else:
            if d[i[0]] != 'AC':
                d[i[0]] += 1
print(ac, wa)

Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")



N,M = pin()
p=[0 for i in range(0,M)]
S=[0 for i in range(0,M)]
for i in range(0,M):
    p[i],S[i] =pin(str)

#print(p,S)

AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]

for i in range(0,N):
    for j in range(0,M):
    
        
        if int(p[j])-1==i:
            if (S[j]) == 'WA':
                Penalties[int(p[j])-1] += 1
            else:
                AC[int(p[j])-1] = 1
                break
            print(AC,Penalties)
print(AC,Penalties)
acnum=0
pennum=0
for i in range(0,N):
    acnum += AC[i]
    if AC[i]==1:
        pennum += Penalties[i]

print(acnum,pennum)

# coding: utf-8
# Your code here!

def pin(type=int):
    return eval("map(type,input().split())")



N,M = pin()
p=[0 for i in range(0,M)]
S=[0 for i in range(0,M)]
for i in range(0,M):
    p[i],S[i] =pin(str)

#print(p,S)

AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]


for j in range(0,M):
    
    if (S[j]) == 'WA':
        Penalties[int(p[j])-1] += 1
    else:
        AC[int(p[j])-1] = 1
        continue

acnum=0
pennum=0
for i in range(0,N):
    acnum += AC[i]
    if AC[i]==1:
        pennum += Penalties[i]

print(acnum,pennum)

# coding: utf-8
# Your code here!

def pin(type=int):
    return map(type,input().split())




N,M = pin() 
p=[0 for j in range(0,M)]
S=[0 for j in range(0,M)]
for j in range(0,M):
    p[j],S[j] =pin(str) 
    
# O(3M)...?
#print(p)
#print(p,S)

AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]







for j in range (0,M):
    if S[j] == "AC":
        if AC[int(p[j])-1]==1:
            continue
        else:
            AC[int(p[j])-1]=1
    else:#wa or something
        if AC[int(p[j])-1]==1:
            continue
        else:
            Penalties[int(p[j])-1]+=1
  # print(AC,Penalties)

for i in range(0,N):
    if AC[i] == 0:
        Penalties[i]=0
#print("///////")    
#print(AC,Penalties)    




print(AC.count(1),sum(Penalties))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
W_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        W_num[int(PS[j][0]-1)]=1 
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1]=1
s = sum(A_num)
for k in range(N):
    if A_num[k] == 0:
        W_num[k]=0
w = sum(W_num)
print(s,w)

N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
w=0
print(PS)
for j in range(M):
    print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        w+=1
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1] =1
s = sum(A_num)
print(s,w)

N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
W_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        W_num[int(PS[j][0])-1]+=1 
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1]=1
s = sum(A_num)
for k in range(N):
    if A_num[k] == 0:
        W_num[k]=0
w = sum(W_num)
print(s,w)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N,M = map(int,input().split())
PS = [list(input().split()) for i in range(M)]
PS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]
AC = [0]*N
WA = [0]*N

for i in range(M):
    print(PS[i][0])
    if AC[PS[i][0]] == 0:
        if PS[i][1] == "AC":
            AC[PS[i][0]] = 1
        else:
            WA[PS[i][0]] += 1
        # print(AC,WA)
w = 0
for i in range(N):
    if AC[i] == 1:
        w += WA[i]
print(sum(AC),w)


N,M = map(int,input().split())
PS = [list(input().split()) for i in range(M)]
PS = [[int(PS[i][0])-1,PS[i][1]] for i in range(M)]
AC = [0]*N
WA = [0]*N

for i in range(M):
    # print(PS[i][0])
    if AC[PS[i][0]] == 0:
        if PS[i][1] == "AC":
            AC[PS[i][0]] = 1
        else:
            WA[PS[i][0]] += 1
        # print(AC,WA)
w = 0
for i in range(N):
    if AC[i] == 1:
        w += WA[i]
print(sum(AC),w)

Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
ac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]
print(0, 0)

N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
ac = [L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]]

import numpy as np
N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = np.array([L[j] for j in range(M) if [L[j][0], 'AC'] not in L[:j]])
print(np.count_nonzero(AC == 'AC', axis = 1), np.count_nonzero(AC == 'WA', axis = 1))

N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)

Verdicts: Wrong Answer

Wrong Answer

Time Limit Exceeded

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
up = [input().split() for i in range(m)]

wa,ac = 0,0
if m==0:
    print(0,0)
else:
    k = [[] for i in range(2)]
    f=0
    temp=up[0]
    for t in up:
        if not temp[0]==t[0]:
            f+=1
        k[f].append(t)
        temp=t
    temp = False
    for qrs in k:
        for qr in qrs:
            if qr[1] == "WA":
                wa+=1
            elif qr[1] == "AC" and not temp:
                ac+=1
                break
    print(ac,wa)


n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    if d[p][1]:
      pass
    else:
      if s=="WA":
          d[p][0]+=1
      elif s=="AC":
          d[p][1]=True
          ac+=1
          wa+=d[p][0]
  else:
    if s=="WA":
      d[p]=[1,False]
      wa+=1
    elif s=="AC":
      d[p]=[0,True]
      ac+=1
print(ac,wa)

n,m = map(int,input().split())
ac,wa = 0,0
d = {}
for i in range(m):
  p,s = input().split()
  if p in d:
    if d[p][1]:
      pass
    else:
      if s=="WA":
          d[p][0]+=1
      elif s=="AC":
          d[p][1]=True
          ac+=1
          wa+=d[p][0]
  else:
    if s=="WA":
      d[p]=[1,False]
    elif s=="AC":
      d[p]=[0,True]
      ac+=1
print(ac,wa)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt=defaultdict(lambda :0)
temp=0
for x,y in zip(p,s):
    if y=='AC':
        cnt[x]=1
        pena+=temp

    elif cnt[x]!=1 and y=='WA':
        temp+=1

print(sum(cnt.values()),pena)

from collections import defaultdict
n,m=map(int,input().split())
p,s=[],[]
for i in range(m):
    P,S=input().split()
    p.append(int(P))
    s.append(S)

pena=0
cnt_ac=defaultdict(lambda :0)
cnt_wa=defaultdict(lambda :0)
for x,y in zip(p,s):
    if cnt_ac[x]==0:
        if y=='AC':
            cnt_ac[x]=1
            pena+=cnt_wa[x]

        elif y=='WA':
            cnt_wa[x]+=1

print(sum(cnt_ac.values()),pena)


Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N, M = map(int, input().split())
Counted = [0 for _ in range(N)]
num1 = 0
num2 = 0
subnum2 = [0 for l in range(N)]
for j in range(M):
  p, S = input().split()
  p_ = int(p)
  if S == "AC" and Counted[p_] == 0:
    num1 += 1
    num2 += subnum2[p_ - 1]
    Counted[p_] = 1
  elif S == "WA" and Counted[p_] == 0:
    subnum2[p_ - 1] += 1
print("{} {}".format(num1, num2))

N, M = map(int, input().split())
Counted = [0 for _ in range(N)]
num1 = 0
num2 = 0
subnum2 = [0 for l in range(N)]
for j in range(M):
  p, S = input().split()
  p_ = int(p)
  if S == "AC" and Counted[p_ -1] == 0:
    num1 += 1
    num2 += subnum2[p_ - 1]
    Counted[p_ -1] = 1
  elif S == "WA" and Counted[p_-1] == 0:
    subnum2[p_ - 1] += 1
print("{} {}".format(num1, num2))


Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=map(input().split())
    if S=="WA" and already.count(P)==0:
        wa=wa+1
    if S=="AC" and already.count(P)==0:
        ac=ac+1
        already.append(P)
    else:
        pass
print(wa,ac)


 
    


    

    




N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            p.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if p.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(ac,wa)

        





N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M+1):
    P,S=map(input().split())
    if S=="WA" and already.count(P)==0:
        wa=wa+1
    if S=="AC" and already.count(P)==0:
        ac=ac+1
        already.append(P)
    else:
        pass
print(wa,ac)


 
    


    

    




N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            p.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if p.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(wa,ac)

        





N,M=map(int,input().split())
ac=0
wa=0
mydict={}
w=[]
p=[]
for i in range(M):
    P,S=input().split()
    if S=="WA":
        if w.count(P)==0:
            mydict[P]=1
            w.append(P) 
        else:
            mydict[P]=mydict[P]+1
    else:
        if w.count(P)==0:
            ac=ac+1
            p.append(P)
            if w.count(P)!=0:
                wa=wa+mydict[P]
        else:
            pass
print(ac,wa)

        





N,M=map(int,input().split())
ac=0
wa=0
a=[0]*N
w=[0]*N
for i in range(M):
    P,S=input().split()
    if S=="WA":
        w[int(P)-1]+=1
    else:
        if a[int(P)-1]==0:
            a[int(P)-1]+=1
            ac=ac+1
            wa+=w[int(P)-1]
        else:
            pass
print(ac,wa)

        





Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):


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

AC = []
WC = []
ansAC
ansRC

for i in range(0, M):
    AC[i] = False
    WA[i] = 0

for m in range(0, M):
    p, s = input().split()
    
    if s == "AC" and int(p) <= N:
        AC[p] = True
        ansAC +=1
        ansWC += WA[p]
    
    elif s == "WA" and (p not in ans):
        WA[p] +=1
    else:
        continue

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

import sys
from collections import defaultdict

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

wa = defaultdict(lambda: 0)
already = set()
for line in sys.stdin:
    p, s = line.strip().split()
    p = int(p)
    
    if p in already:
        continue
    
    if s == 'AC':
        ac += 1
        already.add(p)
    
    else:
        wa[p] += 1

print(ac, sum(wa[i] for i in already))


Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = [0] * nm[0]
wa = [0] * nm[0]

for i in range(nm[1]):
    if hist[i][1] == "AC":
        if ac[hist[i][0]-1] != 1:
            ac[hist[i][0]-1] = 1
    elif hist[i][1] == "WA":
        if ac[hist[i][0]-1] != 1:
            wa[hist[i][0]-1] = wa[hist[i][0]-1] + 1

for i in range(nm[0]):
    wa[i] = wa[i] * (1-ac[i])

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

hist = []
nm = list(map(int, input().split()))
for i in range(nm[1]):
    a,b=input().split()
    hist.append((int(a), b))

ac = [0] * nm[0]
wa = [0] * nm[0]

for i in range(nm[1]):
    if hist[i][1] == "AC":
        if ac[hist[i][0]-1] != 1:
            ac[hist[i][0]-1] = 1
    elif hist[i][1] == "WA":
        if ac[hist[i][0]-1] != 1:
            wa[hist[i][0]-1] = wa[hist[i][0]-1] + 1


for i in range(nm[0]):
    wa[i] = wa[i] * ac[i]

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

Verdicts: Wrong Answer

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m = list(map(int,input().split()))
counter = 0
data = []

for i in range(n):
  data.append(input().split())
num = [int(s) for s in range(1,n+1)]
checkd = []
tmp = 0
wa = 0
for i in range(n):
  if data[i][1] == "WA":
    tmp += 1
  elif data[i][1] == "AC" and data[i][0] not in checkd:
    counter += 1
    checkd.append(data[i][0])
    wa += tmp
    tmp = 0
print(counter,wa)

  
  



n,m = list(map(int,input().split()))
counter = 0
data = []
tmp = {}

wa = 0

for _ in range(m):
  a,b = input().split() 
  if b == "WA": 
    if int(a) not in tmp:
      tmp[int(a)] = 0
    if tmp[int(a)] != -1:
      tmp[int(a)] += 1
  if int(a) not in tmp: 
    tmp[int(a)] = 0
  if (( b == "AC") and (tmp[int(a)] != -1)):
    counter += 1
    #checkd.append(int(a))
    wa += tmp[int(a)] 
    tmp[int(a)] = -1 


"""
for i in range(m):
  if data[i][1] == "WA":
    if int(data[i][0]) not in tmp:
      tmp[int(data[i][0])] = 0
    tmp[int(data[i][0])] += 1  
  elif ((data[i][1]) == "AC") and (int(data[i][0]) not in checkd):
    counter += 1
    checkd.append(int(data[i][0]))
    if int(data[i][0] ) not in tmp:
      tmp[int(data[i][0])] = 0  
    wa += tmp[int(data[i][0])]
"""    
print(counter,wa)

  
  



Verdicts: Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  p=[list(map(str,input().split())) for i in range(m)]
  q=[]
  s=[0]*n
  t=0
  for i in range(len(p)):
    if p[i][1]=='AC' and  not p[i][0] in q:
      q.append(p[i][0])
      t+=s
      
    elif p[i][1]=="WA":
      if not p[i][0] in q:
        s[i]+=1
  
  
  
  
  print(len(q),t)
  

n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  p=[list(map(str,input().split())) for i in range(m)]
  q=[]
  s=[0]*n
  t=0
  for i in range(len(p)):
    if p[i][1]=='AC' and  not p[i][0] in q:
      q.append(p[i][0])
      t+=s
      
    elif p[i][1]=="WA":
      if not p[i][0] in q:
        s[i]+=1
  
  
  
  
  print(len(q),len(s))
  

n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  p=[list(map(str,input().split())) for i in range(m)]
  q=[]
  s=[0]*n
  t=0
  for i in range(len(p)):
    if p[i][1]=='AC' and  not p[i][0] in q:
      q.append(p[i][0])
      t+=s[i]
      
    elif p[i][1]=="WA":
      if not p[i][0] in q:
        s[i]+=1
  
  
  
  
  print(len(q),t)
  

n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  q=[0]*(n+1)
  s=[0]*(n+1)
  t=0
  for i in range(m):
    p,u=map(str,input().split())
    p=int(p)
    if q[p]==1:
      continue
    
    elif u=='AC':
      q[p]=1
      
      t+=s[p]
      
      
    elif u=="WA":
      if q[p]==0:
        s[p]+=1
        
  
  
  
  
  print(sum(q),t)
  

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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 `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m = map(int, input().split())

ac = [0]*(n+1)
wa = [0]*(n+1)


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

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))


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

ac = [0]*(n)
wa = [0]*(n)


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

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))

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

ac = [0]*(n+1)
wa = [0]*(n+1)


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

for i in range(n+1):
	if ac[i]==0:
		wa[i]=0
        
print(sum(ac),sum(wa))


Verdicts: Runtime Error

Runtime Error

Accepted