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):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))
PS = [sys.stdin.buffer.readline().decode().rstrip().split() for _ in range(M)]

ac = np.zeros(N + 1, dtype=int)
wa = np.zeros(N + 1, dtype=int)

for p, s in PS:
    p = int(p)
    if s == 'AC':
        ac[p] = 1
    if s == 'WA':
        if ac[p]:
            continue
        wa[p] += 1
print(ac.sum() , wa.sum())


import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))
PS = [sys.stdin.buffer.readline().decode().rstrip().split() for _ in range(M)]

ac = np.zeros(N + 1, dtype=int)
wa = np.zeros(N + 1, dtype=int)

for p, s in PS:
    p = int(p)
    if s == 'AC':
        ac[p] = 1
    if s == 'WA':
        if ac[p]:
            continue
        wa[p] += 1
print(ac.sum(), wa[ac > 0].sum())


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):
lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

c = 0
p = 0
curr_no = -1
for line in lines[1:]:
    curr = line.split()
    if(curr_no != curr[0]):
        curr_no = curr[0]
        curr_flag = True
    if(curr_flag):
        if(curr[1] == "AC"):
            c += 1
            curr_flag = False
        else:
            p += 1

print(str(c) + " " + str(p))


lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

c = 0
p = 0
curr_no = -1
for line in lines[1:]:
    curr = line.split()
    if(curr_no != curr[0]):
        curr_no = curr[0]
        curr_flag = True
    if(curr_flag):
        if(curr[1] == "AC"):
            c += 1
            curr_flag = False
        else:
            p += 1

print(c, p)


from collections import defaultdict

params = input().split()
n = int(params[0])
m = int(params[1])

penaltyCount = dict()
penaltyCount = defaultdict(lambda: 0, penaltyCount)

correct = 0
penalty = 0

for i in range(m):
    submission = input.split()
    p = int(submission[0]) - 1
    status = submission[1]

    if penaltyCount[p] == -1:
        continue
    if status == "WA":
        penaltyCount[p] += 1
    else:
        penalty += penaltyCount[p]
        penaltyCount[p] = -1
        correct += 1

print(str(correct) + " " + str(penalty))



from collections import defaultdict

lines = []
while True:
    line = input()
    if line:
        lines.append(line)
    else:
        break

correct = 0
penalty = 0
d = dict()
d = defaultdict(lambda: 0, d)

for line in lines[1:]:
    n = line.split()[0]
    m = line.split()[1]

    if d[n] == -1:
        continue
    if m == "WA":
        d[n] += 1
    else:
        penalty += d[n]
        d[n] = -1
        correct += 1

print(str(correct) + " " + str(penalty))



from collections import defaultdict

params = input().split()
n = int(params[0])
m = int(params[1])

penaltyCount = dict()
penaltyCount = defaultdict(lambda: 0, penaltyCount)

correct = 0
penalty = 0

for i in range(m):
    submission = input().split()
    p = int(submission[0]) - 1
    status = submission[1]

    if penaltyCount[p] == -1:
        continue
    if status == "WA":
        penaltyCount[p] += 1
    else:
        penalty += penaltyCount[p]
        penaltyCount[p] = -1
        correct += 1

print(str(correct) + " " + str(penalty))



Verdicts: 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())
question = 0
ans = 0

co = 0
pe = 0
temp =0
for i in range(m):
    p,s = input().split()
    if temp == 0:
        check = int(p)
        temp +=1

    print("check,p,s",check,p,s)
    if check == int(p) and s == "WA":
        pe += 1
    elif check == int(p) and s =="AC":
        co += 1
        check += 1

print(co,pe)



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

co = 0
pe = 0

ans_check = [0]*n
wa_check = [0]*n
temp = 0

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


print(co,pe)



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())
la = []
lw = []
lwa = []
for i in range(n):
  la.append(0)
  lw.append(0)
  lwa.append(0)
for _ in range(m):
  q,a = input().split()
  if a == "WC" and la[int(q)-1] != 1:
    lw[int(q)-1] += 1
  elif a == "AC" and la[int(q)-1] != 1:
    la[int(q)-1] = 1
    lwa[int(q)-1] = lw[int(q)-1]
    
print(sum(la), sum(lwa))

n,m = map(int, input().split())
a = []
for _ in range(n):
  a.append(0)
w = a.copy()
x = a.copy()
for _ in range(m):
  q,r = input().split()
  q = int(q)-1
  if r == "WA" and a[q] != 1:
    w[q] += 1
  elif r == "AC" and a[q] != 1:
    x[q] = w[q]
    a[q] = 1
print(sum(a), sum(x))

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


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

for i in range(m):
    
    p, s = list(input().split())
    p = int(p) - 1

    
    if ac[p] != 1:
        wa[p] = 1

    
    if s == "AC":
        ac[p] = 1

    print(ac, wa)

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


n, m = map(int, input().split())
listAC = [0] * n
listWAAC = [0] * n
listWA = [0] * n
for i in range(m):
    p, s = map(str, input().split())
    p = int(p) - 1
    if listAC[p] == 1:
        continue
    if s == 'AC':
        listAC[p] += 1
        listWAAC[p] += listWA[p]
        continue
    listWA[p] += 1

print(sum(listAC), sum(listWAAC))


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

nAC = 0
nWA = 0
result_dic = {}

for i in range(M):
    pi, si = input().split()
    
    if pi not in result_dic.keys():
#         result_dic[pi] = si
        if si == "AC":
            result_dic[pi] = [si,0]
            nAC += 1
        else:
            result_dic[pi] = [si,1]
    else:
        pi_res = result_dic[pi][0]
        if pi_res == "AC":
            pass
        elif pi_res == "WA":
            if si == "AC":
                nWA += result_dic[pi][1]
                nAC += 1
                result_dic[pi] = [si,0]
            elif si == "WA":
                result_dic[pi][1] += 1
    print(result_dic)

print(nAC,nWA)

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

nAC = 0
nWA = 0
result_dic = {}

for i in range(M):
    pi, si = input().split()
    
    if pi not in result_dic.keys():
#         result_dic[pi] = si
        if si == "AC":
            result_dic[pi] = [pi,0]
            nAC += 1
        else:
            result_dic[pi] = [pi,1]
    else:
        pi_res = result_dic[pi][0]
        if pi_res == "AC":
            pass
        elif pi_res == "WA":
            if si == "AC":
                nWA += result_dic[pi][1]
                nAC += 1
                result_dic[pi] = si
            elif si == "WA":
                result_dic[pi][1] += 1

print(nAC,nWA)

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

nAC = 0
nWA = 0
result_dic = {}

for i in range(M):
    pi, si = input().split()
    
    if pi not in result_dic.keys():
#         result_dic[pi] = si
        if si == "AC":
            result_dic[pi] = [si,0]
            nAC += 1
        else:
            result_dic[pi] = [si,1]
    else:
        pi_res = result_dic[pi][0]
        if pi_res == "AC":
            pass
        elif pi_res == "WA":
            if si == "AC":
                nWA += result_dic[pi][1]
                nAC += 1
                result_dic[pi] = [si,0]
            elif si == "WA":
                result_dic[pi][1] += 1
#     print(result_dic)

print(nAC,nWA)

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())
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
w = 0
for i in range(n):
    if ac[i] ==1:
        w+=wa[i]
print(sum(ac),w)



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
w = 0
for i in range(n+1):
    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):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
tmp = 0
flag = False
for j in range(N):
    for k in ans[j]:
        if k == "WA":
            tmp += 1
        else:
            ac += 1
            pe += tmp
            break
print(ac,pe)

from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
ans = [[] for i in range(N)]
for i in range(M):
    p,s = [(x) for x in stdin.readline().rstrip().split()]
    ans[int(p)-1].append(s)

ac = 0
pe = 0
tmp = 0
flag = False
for j in range(N):
    tmp = 0
    for k in ans[j]:
        if k == "WA":
            tmp += 1
        else:
            ac += 1
            pe += tmp
            tmp = 0
            break
print(ac,pe)

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

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

for i in range( m ):
  p = input().split()
  prob_no =int( p[ 0 ])
  if p[ 1 ] == "WA":
    wa[ prob_no - 1 ] += 1
  else:
    ac[ prob_no - 1 ] = True

wa_cnt = 0
for i in range( n ):
  if ac[ i ]:
    wa_cnt += wa[ i ]
ac_cnt = sum( ac )

print( ac_cnt, wa_cnt )

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

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

for i in range( m ):
  p = input().split()
  prob_no =int( p[ 0 ])
  if p[ 1 ] == "WA":
    if not ac[ prob_no - 1 ]:
      wa[ prob_no - 1 ] += 1
  else:
    ac[ prob_no - 1 ] = True

wa_cnt = 0
for i in range( n ):
  if ac[ i ]:
    wa_cnt += wa[ i ]
ac_cnt = sum( ac )

print( ac_cnt, wa_cnt )

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):
def resolve():
    n,m = map(int,input().split())
    ac_list = [1]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and ac_list[int(p)-1]==1:
            wa += 1
        elif s == 'AC' and ac_list[int(p)-1]==1:
            ac += 1
            ac_list[int(p)-1] = 0
    print(f'{ac} {wa}')
resolve():

def resolve():
    n,m = map(int,input().split())
    ac_list = [0]*n
    wa_count = [0]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and (ac_list[int(p)-1]==0):
            wa_count[int(p)-1] += 1
        elif s == 'AC' and (ac_list[int(p)-1]==0):
            ac += 1
            ac_list[int(p)-1] = 1
    for (i,j) in zip(wa_count,ac_list):
        if j: wa+=i
    print(f'{ac} {wa}')
resolve()

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 numpy as np
hoge = input().split()
N = int(hoge[0])
M = int(hoge[1])

if M != 0:
  A = []
  ACnum = []
  ACkazu = []
  for i in range(M):
    hoge = input().split()
    if hoge[1] == "AC" and hoge[0] not in ACkazu:
      ACnum.append(i)
      ACkazu.append(hoge[0])
      A.append(hoge)
    elif hoge[0] not in ACkazu:
      A.append(hoge)
  pena = 0
  _remove = []
  for i in ACnum:
    i = int(i)
    AC_num = A[i][0]
    for j in range(0,i):
      if A[j][0] == A[i][0]:
        pena += 1
        _remove.append(j)
    _remove.append(i)
  
  for i in reversed(_remove):
    A.pop(i)
  pena += len(A)
  print(len(ACnum), end="")
  print(" ", end="")
  print(pena, end="")
else:
  print(0, end="")
  print(" ", end="")
  print(0, end="")

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

WA = [0] * 105000
AC = [False] * 105000

WAnum = 0
ACnum = 0

for i in range(M):
    hoge = input().split()
    if AC[int(hoge[0])]:
      continue
    if hoge[1] == "AC":
      AC[int(hoge[0])] = True;
      ACnum += 1
      WAnum += WA[int(hoge[0])]
    elif hoge[1] == "WA":
      WA[int(hoge[0])] += 1
      
print(ACnum, WAnum)

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):
#C - Welcome to AtCoder
N,M = map(int,input().split())
S_P_list = []
for _ in range(M):
    p,s = input().split()
    S_P_list.append((int(p),s))
S_P_list = sorted(S_P_list,key = lambda x:x[0],reverse = False)    
print(S_P_list)
AC_list = list(set([i[0] for i in S_P_list if i[1] == 'AC']))
print(AC_list)
WA = 0
AC = 0
for i in range(M):
    if (S_P_list[i][0] in AC_list):
        if S_P_list[i][1] == 'AC':
            AC += 1
            AC_list.remove(S_P_list[i][0])
        else:
            WA += 1
print(AC,WA)

#C - Welcome to AtCoder
N,M = map(int,input().split())
S_P_list = []
for _ in range(M):
    p,s = input().split()
    S_P_list.append((int(p),s))

S_P_list = sorted(S_P_list,key = lambda x:x[0],reverse = False)    

AC_list = list(set([i[0] for i in S_P_list if i[1] == 'AC']))
WA = 0
AC = 0
for i in range(M):
    if (S_P_list[i][0] in AC_list):
        if S_P_list[i][1] == 'AC':
            AC += 1
            AC_list.remove(S_P_list[i][0])
        else:
            WA += 1
print(AC,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(' '))
ac_set = set()
wa_cnt_ls = [0] * N
wa_cnt = 0
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not s in ac_set:
        if s == 'AC':
            wa_cnt += wa_cnt_ls[idx]
            ac_set.add(s)
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

N, M = map(int, input().split(' '))
ac_list = []
wa_cnt, wa_cnt_ls = 0, [0] * N
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not p in ac_list:
        if p == 'AC':
            ac_list.append(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_list), wa_cnt)

N, M = map(int, input().split(' '))
ac_set = set()
wa_cnt, wa_cnt_ls = 0, [ 0 for i in range(N) ]
for i in range(M):
    p, s = input().split(' ')
    idx = int(p) - 1
    if not idx in ac_set:
        if s == 'AC':
            ac_set.add(idx)
            wa_cnt += wa_cnt_ls[idx]
        else:
            wa_cnt_ls[idx] += 1
print(len(ac_set), wa_cnt)

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())
a = 0
w = 0
lis = [[] for i in range(N)]
for i in range(M):
  p,s = map(int,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)



import numpy as np
N,M = map(int,input().split())
a = 0
w = 0
lis = np.zeros(N + 1)
for i in range(M):
  p,s = map(str,input().split())
  if lis[p] == 0 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p] != 0 and s == "AC":
    continue
  elif lis[p] == 0 and s == "WA":
    w += 1
  elif lis[p] != 0 and s == "WA":
    continue
    
print(a,w)



import numpy as np
N,M = map(int,input().split())
a = 0
w = 0
lis = np.zeros(N + 1)
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  if lis[p + 1] == 0 and s == "AC":
    a += 1
    lis[p] = 1
  elif lis[p + 1] > 0 and s == "AC":
    continue
  elif lis[p + 1] == 0 and s == "WA":
    w += 1
  elif lis[p + 1] > 0 and s == "WA":
    continue
    
print(a,w)



N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for _ in range(N)]
for i in range(M):
  p,s = map(int,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)



N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for _ in range(N)]
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)



Verdicts: 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):
import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for _ in range(n)]
wa_list = [0 for _ in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        wa_list[p - 1] += 1
    cnt += 1
for i in range(n):
    if wa_list[i] == 1 and ac_list[i] == 1:
        wa_cnt += wa_list[i]
print(sum(ac_list), wa_cnt)



import math
import fractions

n, m = map(int, input().split())
ac_list = [0 for _ in range(n)]
wa_list = [0 for _ in range(n)]
wa_cnt = 0
cnt = 1
while cnt <= m:
    p, s = input().split()
    p = int(p)
    if s == "AC":
        ac_list[p - 1] = 1
    else:
        if ac_list[p - 1] == 0:
            wa_list[p - 1] += 1
    cnt += 1
for i in range(n):
    if wa_list[i] >= 1 and ac_list[i] == 1:
        wa_cnt += wa_list[i]
print(sum(ac_list), wa_cnt)



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):
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    pS = defaultdict(list)
    for i in range(M):
        p, S = input().split()
        pS[p].append(S)

    ac = 0
    wa = 0
    for pp in pS:
        tmp = pS[pp]
        for t in tmp:
            wa_tmp = 0
            if t == 'WA':
                wa_tmp += 1
            else:
                ac += 1
                wa += wa_tmp
                break
    print(ac, wa)


if __name__ == "__main__":
    main()


from collections import defaultdict


def main():
    N, M = map(int, input().split())
    pS = defaultdict(list)
    for i in range(M):
        p, S = input().split()
        pS[p].append(S)

    ac = 0
    wa = 0
    for pp in pS:
        tmp = pS[pp]
        wa_tmp = 0
        for t in tmp:
            if t == 'WA':
                wa_tmp += 1
            else:
                ac += 1
                wa += wa_tmp
                break
    print(ac, 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):
a,b = map(int, input().split())
List = [input().split() for i in range(b)]
Wnum = 0
Cnum = 0
aclist = []
for i in range(len(List)):
  print(i)
  if List[i][1] == 'WA':
    if [List[i][0], 'AC']  in aclist:
      break
    else:
      Wnum += 1
#      print("WA", Wnum)
  else:
    if List[i] in aclist:
      break
    else:
      aclist.append(List[i])
      Cnum += 1
#      print(aclist)

print(Cnum, Wnum)



a,b = map(int,input().split())
AC = [0]*(a+1)
WA = [0]*(a+1)
ac = 0
wa = 0
wat = 0

for i in range(b):
  x,y = map(str,input().split())
  if y == "WA":
    WA[int(x)] += 1
  elif AC[int(x)] == 0 and y == "AC":
    wa += WA[int(x)]
    ac += 1
    AC[int(x)] = 1

print(ac,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())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        if b=="WA":
            d[a]=["WA",1]
        else:
            c+=1
            d[a]=["AC",1]
    else:
        if b=="WA":
            if d[a][0]=="AC":
                continue
            else:
                d[a][1]+=1
        else:
            print(d[a][0])
            if d[a][0]=="AC":
                continue
            c+=1
            #print(d[a][1])
            d[a][0]="AC"
            p+=d[a][1]
#print(d)
print(c,p)


n,m=map(int,input().split())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        if b=="WA":
            d[a]=["WA",1]
        else:
            c+=1
            d[a]=["AC",1]
    else:
        if b=="WA":
            if d[a][0]=="AC":
                continue
            else:
                d[a][1]+=1
        else:
            #print(d[a][0])
            if d[a][0]=="AC":
                continue
            c+=1
            #print(d[a][1])
            d[a][0]="AC"
            p+=d[a][1]
#print(d)
print(c,p)


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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1
            elif result == "AC":
                AC +=1
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

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

sP = {}
WA =0
AC =0
for _ in range(M):
    data = input()
    number, result = data.split()
    if data not in sP:
        sP[data] =1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass
    else:
        sP[data] += 1
        if number + " AC" not in sP:
            if result == "WA":
                WA += 1

            elif result == "AC":
                AC += 1
        else:
            pass


print(AC, WA)

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

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if ACc[p - 1] == 0:
            ACc[p - 1] += 1
    else:
        if ACc[p - 1] != 1:
            WAc[p - 1] += 1
for j in range(n):
    if ACc[j] == 0:
        WAc[j] = 0

print(sum(ACc), sum(WAc))

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())
P = [True] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  p = int(p)
  if s == 'AC':
    P[p-1] = False
  else:
    if P[p-1]:
      wa += 1
  
print(P.count(1), wa)

N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'AC':
    wa += P[index]
    P[index] = -1
  elif :
    if P[index] != -1
      P[index] += 1
  
print(P.count(-1), wa)

N, M = map(int, input().split())
P = [0] * N

wa = 0
for _ in range(M):
  p, s = input().split()
  index = int(p)-1
  if s == 'WA' and P[index] != -1:
      P[index] += 1
  elif P[index] > -1:
    wa += P[index]
    P[index] = -1
  
print(P.count(-1), wa)

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())
ac = [0]*N
wa = 0

for i in range(M):
    P, S = map(str, input().split())
    P = int(P)-1
    if ac[P] != 1 and S == "AC":
        wa += abs(ac[P])
        ac[P] = 1
    elif ac[P] != 1 and S == "WA":
        ac[P] -= 1
    print(ac.count(1), wa)
    print(ac)
    print(wa)


N, M = map(int, input().split())
ac = [0]*N
wa = 0

for i in range(M):
    P, S = map(str, input().split())
    P = int(P)-1
    if ac[P] != 1 and S == "AC":
        wa += abs(ac[P])
        ac[P] = 1
    elif ac[P] != 1 and S == "WA":
        ac[P] -= 1

print(ac.count(1), 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):
import numpy as np

N,M=map(int,input().split())
ac=np.array([0]*N)
wa=np.array([0]*N)

for i in range(M):
    a,b=input().split()
    A=int(a)
    if ac[A-1]==0 and b=="WA":
        wa[A-1]+=1
    else :
        ac[A-1]=1

cal=sum(ac)
ans=sum(ac*wa)

import numpy as np

N,M=map(int,input().split())
ac=np.array([0]*N)
wa=np.array([0]*N)

for i in range(M):
    a,b=input().split()
    A=int(a)
    if ac[A-1]==0 and b=="WA":
        wa[A-1]+=1
    else :
        ac[A-1]=1

cal=sum(ac)
ans=sum(ac*wa)
print(cal, ans)


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

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

for _ in range(N):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        if not ac[p]:
            wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[i]:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")


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

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

for _ in range(N):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[i]:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")


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

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

for i in range(N):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[p]==True:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")


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

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

for i in range(N):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        wa[p]+=1

a=0
b=0

for i in range(N):
    if ac[i]==True:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")


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

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

for i in range(m):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        if not ac[p]:
            wa[p]+=1

a=0
b=0

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

print(a,b,sep=" ")


Verdicts: 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())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum([p*c for p, c in zip(penalty, correct)]))))



N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(0, 0)

N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] != 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum(penalty))

N, M = map(int, input().split())
ps = [input().split() for _ in range(M)]

correct = [0] * N
penalty = [0] * N
for p, s in ps:
    p = int(p)
    if correct[p-1] == 1:
        continue
    if s == 'AC':
        correct[p-1] = 1
    else:
        penalty[p-1] += 1
print(sum(correct), sum([p*c for p, c in zip(penalty, correct)]))

Verdicts: 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())
p=[list(input().split()) for _ in range(m)]
a=[0]*(n+1)
w=[0]*(n+1)
for i in range(m):
    if a[int(p[i][0])]==0 and p[i][1]=='AC':
        a[int(p[i][0])]+=1
    if a[int(p[i][0])]==0 and p[i][1]=='WA':
        w[int(p[i][0])]+=1
a=np.array(a)
w=np.array(w)
aw=a*w
print(sum(a),sum(aw))

import numpy as np
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]
a=[0]*(n+1)
w=[0]*(n+1)
for i in range(m):
    if a[int(p[i][0])]==0 and p[i][1]=='AC':
        a[int(p[i][0])]+=1
    if a[int(p[i][0])]==0 and p[i][1]=='WA':
        w[int(p[i][0])]+=1
a=np.array(a)
w=np.array(w)
aw=a*w
print(sum(a),sum(aw))

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())
p,S = list(map(int,input().split()))
ac = 0
wa = 0
for j in range(n):
  for i in range(m):
    if S[i] == "AC":
      ac += 1
      i += 1
      j += 1
    else:
      wa = 0
      i += 1

n,m = map(int,input().split())
S = list(map(str,input().split()))
ac = 0
wa = 0
i = 0
j = 0
while j < n:
  while i < m:
    if S[i] == "AC":
      ac += 1
      i += 1
      j += 1
    else:
      wa += 1
      i += 1
print(ac)
print(wa)

n,m = map(int,input().split())
S = list(map(str,input().split()))
ac = 0
wa = 0
i = 0
j = 0
for j in range(n):
  for i in range(m):
    if S[i] == "AC":
      ac += 1
      i += 1
      j += 1
    else:
      wa += 1
      i += 1
print(ac)
print(wa)


n,m = map(int,input().split())
S = list(map(int,input().split()))
ac = 0
wa = 0
i = 0
j = 0
for j in range(n):
  for i in range(m):
    if S[i] == "AC":
      ac += 1
      i += 1
      j += 1
    else:
      wa += 1
      i += 1
print(ac)
print(wa)

N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = [0]*N
WA_list = [0]*N

for i in range(M):
  p,s = map(str,input().split())
  p = int(p-1)
  if s == "AC" and AC_list[p] == 0:
    AC += 1
    AC_list[p] = 1
    penalty += WA_list[p]
  elif s == "WA":
    WA_list[p] += 1
  if AC == N:
    break
print(AC,penalty)

n,m = map(int,input().split())
S = list(map(int,input().split()))
ac = 0
wa = 0
for j in range(n):
  for i in range(m):
    if S[i] == "AC":
      ac += 1
      i += 1
      j += 1
    else:
      wa += 1
      i += 1
print(ac)
print(wa)

N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = [0]*N
WA_list = [0]*N

for i in range(M):
  p,s = map(str,input().split())
  p = int(p)-1
  if s == "AC" and AC_list[p] == 0:
    AC += 1
    AC_list[p] = 1
    penalty += WA_list[p]
  elif s == "WA":
    WA_list[p] += 1
  if AC == N:
    break
print(AC,penalty)

Verdicts: Runtime Error

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())
cor = set()
pens = {}
for i in range(m):
  p,s = input().split()
  if s=="AC":
    cor.add(p)
  else:
    if not p in cor:
      if p in pens:
        pens[p] += 1
      else:
        pens[p] = 1
pen = 0
for x in cor:
  if x in pens:  
    pen += pens(x)
print(str(len(cor))+" "+str(pen))

n,m = map(int,input().split())
cor = set()
pens = {}
for i in range(m):
  p,s = input().split()
  if s=="AC":
    cor.add(p)
  else:
    if not p in cor:
      if p in pens:
        pens[p] += 1
      else:
        pens[p] = 1
pen = 0
for x in cor:
  if x in pens:  
    pen += pens[x]
print(str(len(cor))+" "+str(pen))

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())
table = {}
ac = 0
pena_arr = [0 for _ in range(m + 1)]
for _ in range(n):
    a, b = input().split()
    a = int(a)
    if a not in table and b == "AC":
        ac += 1
        table[a] = True
    elif a not in table and b == "WA":
        pena_arr[a] += 1
pena = 0
for i in range(1, m + 1):
    if pena_arr[i] > 0 and i in table:
        pena += pena_arr[i]
print(ac, pena)


n, m = map(int, input().split())
account, wacount = 0, 0
acdic = [0] * (n + 10)
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC" and acdic[p] <= 0:
        account += 1
        wacount += abs(acdic[p])
        acdic[p] = 1
    elif s == "WA" and acdic[p] <= 0:
        acdic[p] -= 1
print(account, wacount)

Verdicts: Runtime Error

Accepted