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())
p = []
S = []
for i in range(M):
    pp, SS = map(str, input().split())
    p.append(pp)
    S.append(SS)

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

AC = 0
P = 0

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

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

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

print(AC, P)

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

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

AC = 0
P = 0

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

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

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

print(AC, P)

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

n, m = map(int, input().split())
ps = []
for _ in range(m):
    ps.append(input().split())

sub_st = defaultdict(list)
for p, s in ps:
    sub_st[p].append(s)

solved = 0
error = 0
for k, v in sub_st.items():
    temp_error = 0
    for history in v:
        if 'AC' in v:
            error += temp_error
            solved += 1
            break
        temp_error += 1

print(solved, error)


from collections import defaultdict

n, m = map(int, input().split())
ps = []
for _ in range(n):
  ps.append(map(int, input().split()))

sub_st = defaultdict(list)
for p, s in ps:
  sub_st[p].append(s)

solved = 0
error = 0
for k, v in sub_st.items():
  temp_error = 0
  for history in v:
    temp_error += 1
    if 'AC' in v:
      error += temp_error
      solved += 1
      break

priny(solved, error)
    

N, M = map(int, input().split())
did_ac = [False] * N
pn_cnt = [0] * N
for _ in range(M):
    p, s = input().split()
    p = int(p) - 1
    if did_ac[p]:
        continue
    s = s == 'AC'
    if s:
        did_ac[p] = True
    else:
        pn_cnt[p] += 1
print(sum(did_ac), sum(pn_cnt[i] for i in range(N) if did_ac[i]))


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 = list(map(int,input().split()))
ac = 0
wa = 0
y = [0] * n
z = [0] * n

for _ in range(m):
  p,s = input().split()
  p = int(p)
  if not y[p] and s == 'WA':
    z[p] += 1
  elif not y[p] and s == 'AC':
    ac += 1
    y[p] += 1

for i in range(m):
  if y[i]:
    wa += z[i]

print(ac,wa)

n,m = list(map(int,input().split()))
ac = 0
wa = 0
y = {i:0 for i in range(1,n+1)}
z = {i:0 for i in range(1,n+1)}

for _ in range(m):
  p,s = input().split()
  p = int(p)
  if not y[p] and s == 'WA':
    z[p] += 1
  elif not y[p] and s == 'AC':
    ac += 1
    y[p] += 1

for i in range(1,n+1):
  if y[i]:
    wa += z[i]

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):
n, m = map(int, input().split())
p = [list(input().split()) for _ in range(m)]

ac = 0
wa = 0
prob = 0

for i in range(m):
    if p[i][0] != prob:
        if p[i][1] == "WA":
            wa += 1
        elif p[i][1] == "AC":
            ac += 1
            prob = p[i][0]
            
print(ac, wa

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

ac = 0
wa = 0
prob = 0

for i in range(m):
    if int(p[i][0]) != prob:
        if p[i][1] == "WA":
            wa += 1
        elif p[i][1] == "AC":
            ac += 1
            prob = p[i][0]
            
print(ac, wa)

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

ac_tf = [0] * n
wa_num = [0] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 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):
N, M = map(int, input().split())
L = []
for i in range(M):
  L += [input().split()]

cnt_WA = 0
cnt_AC = 0
j0 = 0
for j, k in L:
  if (cnt_AC == N) or (j0 == j):
    break
  if k == 'WA':
    cnt_WA += 1
  if k == 'AC':
    cnt_AC += 1
  j0 = j
print(cnt_AC, cnt_WA)

from collections import defaultdict
N, M = map(int, input().split())
L = []
for i in range(M):
  L += [input().split()]

WA = defaultdict(lambda: 0)
cnt_AC = 0
alr = set()
for j, k in L:
  j = int(j)
  if j in alr:
    continue
  if k == 'AC':
    cnt_AC += 1
    alr.add(int(j))
  else:
    WA[j] += 1

print(cnt_AC, sum(WA[l] for l in alr))

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())
a=[(0,0) for _ in range(n+1)]
x=[]
for i in range(m):
    x.append(list(input().split()))
    x[i][0]=int(x[i][0])
for i in range(m):
    if x[i][1]=="AC":
        a[x[i][0]][1]=1
    else:
        if a[x[i][0]][1]==1:
            continue
        else:
            a[x[i][0]][0]+=1
c=0
d=0
for i in range(n+1):
    c+=a[i][1]
    if a[i][1]:
        d+=a[i][0]
print(c,d)

n,m=map(int,input().split())
a=[[0,0] for _ in range(n+1)]
x=[]
for i in range(m):
    x.append(list(input().split()))
    x[i][0]=int(x[i][0])
for i in range(m):
    if x[i][1]=="AC":
        a[x[i][0]][1]=1
    else:
        if a[x[i][0]][1]==1:
            continue
        else:
            a[x[i][0]][0]+=1
c=0
d=0
for i in range(n+1):
    c+=a[i][1]
    if a[i][1]:
        d+=a[i][0]
print(c,d)

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 = input().split()
l = [0]*int(N) #flg
m = [0]*int(N) #counter
c =0

for i in range(int(M)+1):
    p,s = input().split()
    if s =="AC":
        if l[int(p)-1]==1:
            pass
        else:
            l[int(p)-1] = 1
            c += m[int(p)-1]
    elif s == "WA":
        m[int(p)-1] += 1



print(l.count(1),c)





N,M = input().split()
l = [0]*int(N) #flg
m = [0]*int(N) #counter
c =0

for i in range(int(M)):
    p,s = input().split()
    if s =="AC":
        if l[int(p)-1]==1:
            pass
        else:
            l[int(p)-1] = 1
            c += m[int(p)-1]
    elif s == "WA":
        m[int(p)-1] += 1



print(l.count(1),c)






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())
cnt=0
acc=0
ac=[0]*n
for i in range(m):
	p,s= map(str,input().split())
	if ac[int(p)]==0:
		if s=='AC':
			acc+=1
			ac[int(p)]=1
		else:
			cnt+=1
print(acc,cnt)

n,m= map(int,input().split())
cnt=0
acc=0
ac=[0]*n
for i in range(m):
	p,s= map(str,input().split())
	if ac[int(p)]==0:
		if s=='AC':
			acc+=1
			ac[int(p)]=1
		else:
			cnt+=1
print(acc,cnt)

n,m=map(int,input().split())
cnt=0
acc=0
ac={}
for i in range(m):
	p,s= map(str,input().split())
	if ac[p]==0:
		if s=='AC':
			acc+=1
			ac[p]=1
		else:
			cnt+=1
print(acc,cnt)

import sys
input = sys.stdin.readline

def main():
    n,m=map(int,input().split())
    w=[0]*(n+1)
    a=[0]*(n+1)
    for i in range(m):
        p,s=map(str,input().split())
        p=int(p)
        if a[p]==0:
            if s=='WA':
                w[p]+=1
            else:
                a[p]=1
    wa=0
    for i in range(1,n+1):
        wa=wa+a[i]*w[i]
    print(sum(a),wa)

if __name__ == '__main__':
    main()

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):
def main():
    N, M= map(int, input().split())
    
    acList = [False] * N
    waList = [0] * N
    waCount = 0

    for _ in range(M):
        p, s = map(str, input().split())
        p = int(p) - 1
        if atList[p]:
            continue
        if s == "WA":
            waList[p] += 1
            continue
        waCount += waList[p]
        acList[p] = True

    print(sum(acList), waCount)

if __name__ == "__main__":
    main()

def main():
    N, M= map(int, input().split())
    
    acList = [False] * N
    waList = [0] * N
    waCount = 0

    for _ in range(M):
        p, s = map(str, input().split())
        p = int(p) - 1
        if acList[p]:
            continue
        if s == "WA":
            waList[p] += 1
            continue
        waCount += waList[p]
        acList[p] = True

    print(sum(acList), waCount)

if __name__ == "__main__":
    main()

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())
quest = []
if m == 0:
    pass
else:
    for i in range(m):
        a,b=input().split()
        quest.append([int(a), b])
wa = 0
ac = 0
ans = [0]*n
for j in range(m):
    if quest[j][1] == "AC":
      if  ans[int(quest[j][0]-1)] != 1:
        ac += 1
        ans[int(quest[j][0]-1)] = 1
    else:
        if ans[int(quest[j][0]-1)] == 1:
            pass
        else:
            wa+=1

n,m=map(int,input().split())
j=[0]*n
c=[0]*n
wa=0
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s[0]=="A" and j[p]==0:
        j[p]=1
        ac+=1
        wa+=c[p]
    elif s[0]=="W":c[p]+=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())

no = 0
correct = 0
penalty = 0

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

    if p > no:
        if s == "WA":
            penalty += 1
        elif s == "AC":
            correct += 1
            no = p + 1 

print(correct, penalty)

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

solved = set()
correct = 0
penalty = 0
penalty_memo = [0] * (n+1)

for _ in range(m):
    p,s = input().split()
    p = int(p)

    if p not in solved:
        if s == "WA":
            penalty_memo[p] += 1
        else:
            correct += 1
            penalty += penalty_memo[p]
            solved.add(p)

print(correct, penalty)

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

a = 0
p = 0
m = 0
for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "AC" and m != P:
    a += 1
    m = P
  if S == "AC" and m == P:
    continue
  else:
    p += 1

print(a,p)

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

if M == 0:
  print(0,0)
  exit()
  
a = [0]*(N + 1)
p = [0]*(N + 1)
wa = [0]*(N + 1)

for i in range(M):
  P, S = input().split()
  P = int(P)
  if S == "WA":
    wa[P] += 1
  elif a[P] == 0:
    a[P] += 1
    p[P] = wa[P]

print(sum(a),sum(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):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0]*N
    num_penalty = 0
    for i in range(M):
        pi = p[i]
        si = S[i]
        if wa_flag[pi-1] == 0 and si == "WA":
            num_penalty += 1
        if si == "AC":
            wa_flag = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0] * N
    num_penalty = 0
    for i in range(M):
        if S[i] == "WA":
            if wa_flag[p[i]-1] != -1:
                wa_flag[p[i]-1] += 1
        else:
            if wa_flag[p[i]-1] != -1:
                num_penalty += wa_flag[p[i]-1]
                wa_flag[p[i]-1] = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, M = map(int, input().split())
    p = [None] * M
    S = [None] * M
    for i in range(M):
        pi, si = input().split()
        p[i] = int(pi)
        S[i] = str(si)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


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]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(n) if ac[i]==1))      

n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(m) if ac[i]==1))    

n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(n+1) if ac[i]==1))  

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())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1
for i in range(M):
    if acs[i]==0:
        wa[i]=0
ans=[sum(acs),sum(wa)]


N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1
for i in range(N):
    if acs[i]==0:
        wa[i]=0
ans=[sum(acs),sum(wa)]


N,M=map(int,input().split())
acs=[0 for i in range(N)]
wa=[0 for i in range(N)]

for  i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=='AC':
        acs[p-1]=1
    elif S=='WA' and acs[p-1]==0: 
        wa[p-1]+=1
for i in range(N):
    if acs[i]==0:
        wa[i]=0
ans=[sum(acs),sum(wa)]
print(*ans)

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())
a=[0]*n
w=[0]*n
ac=0
wa=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=="AC":
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)

n,m = map(int,input().split())
a=[0]*n
w=[0]*n
ac=0
wc=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=="AC":
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)

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
WA = 0
lis = [0] * N
for i in range(M):
  a,b = map(input().split())
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)


N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = map(input().split())
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC'
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)

N,M = map(int,input().split())
AC = 0
WA = 0
lis = [0] * N
for i in range(M):
  a,b = input().split()
  if lis[int(a)-1] < 0:
    pass
  elif b == 'AC':
    WA += lis[int(a)-1]
    AC += 1
    lis[int(a)-1] = -1
  else:
    lis[int(a)-1] += 1
print(AC, WA)


Verdicts: 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_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if flag == 1 and no!= a:
        flag=0
    else:
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a
    else:
        continue

print(ac_cnt,wa_cnt)

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

ac_cnt=0
wa_cnt=0
flag=0
no=-1

for i in range(m):
    a,b=input().split()
    if flag == 1 and no!= a:
        flag=0
    else:
        if flag == 0 and b == "WA":
            wa_cnt += 1
        elif flag == 0 and b == "AC":
            ac_cnt += 1
            flag += 1
            no=a

print(ac_cnt,wa_cnt)

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

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1

print(ac_cnt)
c=0
d=0

for i in range(n):
    if ac_cnt[a]:
        c += 1
        d += wa_cnt[i]

print(c,d)

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

ac_cnt=[False]*n
wa_cnt=[0]*n

p=int(p-1)

for _ in range(m):
    a,b=input().split()
    if b == "AC":
        ac_cnt[a] == True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
a=0
b=0

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

print(a,b)

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

l = [list(input().split()) for _ in range(m)]
wa_cnt = 0
ac_cnt=0
flag=0

for i in range(m):
    if i == 0 or l[i-1][0]==l[i][0]:
        if l[i][1]=="WA" and flag==0:
            wa_cnt += 1
        else:
            ac_cnt += 1
            flag = 1
    else:
        flag=0
        if l[i][1]=="WA" and flag==0:
            wa_cnt += 1
        else:
            ac_cnt += 1
            flag = 1

print(ac_cnt,wa_cnt)

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

ac_cnt=[False]*n
wa_cnt=[0]*n

for _ in range(m):
    a,b=input().split()
    a=int(a)-1
    if b == "AC":
        ac_cnt[a] = True
    else:
        if ac_cnt[a] == False:
            wa_cnt[a] += 1
c=0
d=0

for i in range(n):
    if ac_cnt[i]:
        c += 1
        d += wa_cnt[i]

print(c,d)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

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):
import numpy as np

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

numAC = [0]*N
numWA = [0]*N
flgAC = [0]*N

#print(num)

for ii in range(M):
  pi,Si = input().split()
  pi = int(pi)
  
  if flgAC[pi] == 0:
    if Si == "AC":
      numAC[pi] = 1
      flgAC[pi] = 1
    elif Si == "WA":
      numWA[pi] += 1

print(np.sum(numAC),np.sum(numWA))

import numpy as np

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

#numAC = [0]*N
numWA = [0]*N
flgAC = [0]*N

#print(num)

for ii in range(M):
  pi,Si = input().split()
  pi = int(pi) - 1 
  
  if flgAC[pi] == 0:
    if Si == "AC":
      #numAC[pi] = 1
      flgAC[pi] = 1
    elif Si == "WA":
      numWA[pi] += 1

countWA = 0
for ii in range(N):
  if flgAC == 1:
    countWA += numWA[ii]
print(np.sum(flgAC),countWA)


import numpy as np

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

#numAC = [0]*N
numWA = [0]*N
flgAC = [0]*N

#print(num)

for ii in range(M):
  pi,Si = input().split()
  pi = int(pi) - 1 
  
  if flgAC[pi] == 0:
    if Si == "AC":
      #numAC[pi] = 1
      flgAC[pi] = 1
    elif Si == "WA":
      numWA[pi] += 1

countWA = 0
for ii in range(N):
  if flgAC[ii] == 1:
    countWA += numWA[ii]
print(np.sum(flgAC),countWA)


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):
s = input().rstrip().split()
N,M = int(s[0]),int(s[1])

a=[]
for i in range(M):
  a.append(input().rstrip().split())

pen =0
AClist =[]
ACflag= [0]*N
#print(a,len(a))

for i in range(len(a)):
  if a[i][1] == "AC" and ACflag[int(a[i][0])] == 0:
    AClist.append(a[i])
    ACflag[int(a[i][0])] = 1
  if a[i][1] == "WA" and ACflag[int(a[i][0])] == 0:
    pen += 1

print(len(AClist),pen)

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

lac = [0]*(N+1)
lpcnt = [0]*(N+1)

for i in range(M):
  s = input().split()
  n = int(s[0])
  if s[1] == "AC":
    lac[n] =1
    continue
  if s[1] == "WA" and lac[n] == 0:
    lpcnt[n] += 1

cnt = 0
for i in range(N+1):
  if lac[i] == 1:
    cnt += lpcnt[i]
  
print(sum(lac), end=" ")
print(cnt)

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):
x = int(input())

ans = 0

def prime(x):
    y = x//2+1
    cnt = 0
    for i in range(2,y+1):
        if x%i==0:
            cnt += 1
            
    if cnt == 0:
        return x
    else:
        return 0
        
while ans == 0:
    ans = prime(x)
    x += 1
    
if x == 2:
    print(2)
else:
    print(ans)

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

pro = [0]*n

ac = set([])

ans = 0

pen = 0

for _ in range(m):
    l = input().split()
    s = l[1]
    p = int(l[0])    
    if s == "AC":
        if p not in ac:
            ans += 1
            pen += pro[p-1]
            ac.add(p)
            
    else:
        if p not in ac:
            pro[p-1] += 1
            
print(ans,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())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
                    ac.append(int(p))
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for k,v in A.items():
    if k in ac:
        count += 1
        total += v

N, M = map(int, input().split())
A = {}
ac = []
for i in range(M):
    p, s = map(str, input().split())
    if int(p) not in ac:
        if int(p) not in A.keys(): 
            if int(p) >0 and int(p) <=N :
                if s == "WA":
                    A[int(p)] =1
                elif s =="AC":
                    A[int(p)] =0
        elif int(p) in A.keys():
            if s == "WA":
                    A[int(p)] +=1
            elif s =="AC":
                    A[int(p)] +=0
                    ac.append(int(p))
        
total=0
count = 0
for k,v in A.items():
    if k in ac:
        count += 1
        total += i
print(count, total)

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):
    p, s = map(str, input().split())
    if AC[int(p)-1] == 0 and s =="WA":
        WA[int(p)-1] += 1
    else:
        AC[int(p)-1] = 1
        

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

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=[0]*m
s=[0]*m
for i in range(m):
    pi,si=input().split()
    p[i]=int(pi)
    s[i]=si
judge=[0]*(n+1)
ac=0
wa=0
for i in range(m):
    if judge[p[i]]==-1:
        continue
    if judge[p[i]]==0:
        if s[i]=='WA':
            judge[p[i]]+=1
        else:
            wa+=judge[p[i]]
            judge[p[i]]=-1
            ac+=1
print(ac,wa)

n,m=map(int,input().split())
p=[0]*m
s=[0]*m
for i in range(m):
    pi,si=input().split()
    p[i]=int(pi)
    s[i]=si
judge=[0]*(n+1)
ac=0
wa=0
for i in range(m):
    if judge[p[i]]==-1:
        continue
    if judge[p[i]]!=-1:
        if s[i]=='WA':
            judge[p[i]]+=1
        else:
            wa+=judge[p[i]]
            judge[p[i]]=-1
            ac+=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):
from operator import itemgetter


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

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

l = []
for i in range(m):
    p, s = map(str, input().split())
    l.append([int(p), s])
l.sort(key = itemgetter(0))

numAC = 0
numWA = 0
countWA = 0
AC = False
last = l[0][0]

for i in range(m):
    if last == l[i][0]:
        if AC:
            continue
        elif l[i][1] == "AC":
            numAC += 1
            numWA += countWA
            AC = True
        else:
            countWA += 1
    else:
        last = l[i][0]
        AC = False
        if l[i][1] == "AC":
            numAC += 1
            AC = True
        else:
            countWA = 1

from operator import itemgetter


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

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

l = []
for i in range(m):
    p, s = map(str, input().split())
    l.append([int(p), s])
l.sort(key = itemgetter(0))

numAC = 0
numWA = 0
countWA = 0
AC = False
last = l[0][0]

for i in range(m):
    if last == l[i][0]:
        if AC:
            continue
        elif l[i][1] == "AC":
            numAC += 1
            numWA += countWA
            AC = True
        else:
            countWA += 1
    else:
        last = l[i][0]
        AC = False
        if l[i][1] == "AC":
            numAC += 1
            AC = True
        else:
            countWA = 1

print(numAC, numWA)

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())
ans_num_lis = [0 for i in range(N)]
pre_ans_lis = [0 for i in range(N)]
ans_lis = [0 for i in range(N)]
for i in range(M):
  problem, result = input().split()
  problem_num = int(problem)
  if result == "WA":
    pre_ans_lis[problem_num] += 1
  if result == "AC" and not ans_num_lis[problem_num]:
    ans_num_lis[problem_num] = 1
    ans_lis[problem_num] = pre_ans_lis[problem_num]

print(sum(ans_num_lis), sum(ans_lis))

N, M = map(int, input().split())
ans_num_lis = [0 for i in range(N)]
pre_ans_lis = [0 for i in range(N)]
ans_lis = [0 for i in range(N)]
for i in range(M):
  problem, result = input().split()
  problem_num = int(problem)
  if result == "WA":
    pre_ans_lis[problem_num-1] += 1
  if result == "AC" and not ans_num_lis[problem_num-1]:
    ans_num_lis[problem_num-1] = 1
    ans_lis[problem_num-1] = pre_ans_lis[problem_num-1]

print(sum(ans_num_lis), sum(ans_lis))

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=[0]*M
S=['']*M
for i in range(M):
	p[i],S[i]=input().split()
P=[int(s) for s in p]
a=0
b=0
c=0
d=0
for j,k in zip(P,S):
	if d!=j:
		c=0
	if k=='AC':
		if c!=j:
			a+=1
			c+=j
		else:
			continue
	else:
		if c!=j:
			b+=1
	d=j
print(a)
print(b)

N,M=map(int, input().split())
p=[0]*M
S=['']*M
for i in range(M):
	p[i],S[i]=input().split()
P=[int(s) for s in p]
a=0
b=0
c=0
d=0
for j,k in zip(P,S):
	if d!=j:
		c=0
	else:
		c=c
	if k=='AC':
		if c!=j:
			a+=1
			c+=j
		else:
			continue
	else:
		if c!=j:
			b+=1
	d=j
print(a)
print(b)

n,m = map(int,input().split())
WA = [0]*n
AC  = [0]*n
wa = 0
for i in range(m):
    x = input().split()
    x[0] = int(x[0])
    if x[1] == 'WA' and AC[x[0]-1] == 0:
        WA[x[0]-1] += 1
    elif x[1] == 'AC' and AC[x[0]-1] == 0:
        AC[x[0]-1] += 1
        wa += WA[x[0]-1]
print(sum(AC),wa)  

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())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
    i = int(a)
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)

n,m=map(int,input().split())
wa=0
ac=0
flag=0
for _ in range(m):
	a, b = input().split()
	if flag == 0:
		if b == "WA":
			wa+=1
		else:
			ac+=1
			flag=1
print(ac,wa)

n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	if check[int(a)]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[int(a)]=1
print(ac,wa)

n,m=map(int,input().split())
wa=0
ac=0
check=0
for _ in range(m):
    a, b = input().split()
    if int(a) == check:
      if b =="WA":
          wa+=1
      else:
          ac+=1
          check=int(a)
print(ac,wa)

n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	i = int(a)
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)

n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	if check[int(a)]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[int(a)]=1
print(ac,wa)

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

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

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):
# coding: utf-8

n,m = map(int,input().split())
ac = wa = wa_another = 0
p_list = []

for i in range(m):
    P,s = map(str,input().split())
    p = int(P)

    if s == "WA":
        if not p in p_list:
            wa_another += 1
        else:
            wa += 1

    
    if (s == "AC") and (not p in p_list):
        ac += 1
        wa += wa_another
        wa_another = 0
        p_list.append(p)

print(ac,wa)

# coding: utf-8

import sys
input = sys.stdin.readline

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

ac_set = set()
penalty = 0
wa_count = [0] * (n+1)

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

    if s == "AC":
        if not p in ac_set:
            penalty += wa_count[p]
            ac_set.add(p)
    elif s == "WA":
        wa_count[p] += 1


print(len(ac_set), penalty)

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())
A = [list(map(str, input().split())) for _ in range(m)]

ans = 0
pen = 0

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

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

print(ans, pen)

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

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

for _ in range(m):
    p, s = map(str, input().split())
    p = int(p)

    if ac[p-1]:
        continue
    else:
        if s == 'AC':
            ac[p-1] = 1
        else:
            wa[p-1] += 1

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

print(AC, WA)

Verdicts: Wrong Answer

Accepted