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):
def main():
    n,m=map(int,input().split())
    f =[0]*n
    p=[]
    s=[]
    for i in range(m):
        pp,ss=input().split()
        ppp=int(pp)-1
        p.append(ppp)
        s.append(ss)


    cntA = 0
    cntW = 0

    for i in range(m):
        ptmp=p[i]
        stmp=s[i]
        cnt=0
        if f[ptmp] == 0:
            if stmp == 'WA':
                cnt += 1
            elif stmp == 'AC':
                cntA +=1
                cntW += cnt
                f[ptmp] =1

    print(str(cntA) + ' ' + str(cntW))
    # print(cntA)
    # print(cntW)
if __name__=='__main__':
    main()


def main():
    n,m=map(int,input().split())
    p =[[] for i in range(n)]
    for i in range(m):
        pp,ss=input().split()
        ppp=int(pp)
        p[ppp-1].append(ss)


    cntA = 0
    cntW = 0
    for i,a in enumerate(p):
        flg = 0
        cnt=0
        for j,s in enumerate(a):
            if  s == 'WA':
                cnt += 1
            elif s == 'AC':
                cntA += 1
                cntW+=cnt
                break
    print(str(cntA) + ' ' + str(cntW))
    # print(cntA)
    # print(cntW)
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):
n, m = list(map(int, input().split()))
results = []
if m:
    results = [input().split() for _ in range(m)]
ac = []
k_wa = 0
cnt_ac = 0
cnt_wa = 0
for res in results:
    if res[1] == "AC":
        if not res[0] in ac:
            cnt_ac += 1
            ac.append(res[0])
            cnt_wa += k_wa
    else:
        k_wa += 1
print(cnt_ac, cnt_wa)

N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N
wa=0
for i in range(M):
  p,s=input().split()
  p=int(p)-1
  if AC[p]==0 and s=="AC":
  	AC[p]=1
  	wa+=WA[p]
  WA[p]+=1
print(sum(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())
prb = [0 for x in range(N)]
ac_cnt = 0
wa_cnt = 0
for x in range(M):
    p, s = input().split()
    print(p, s)
    if prb[int(p) - 1] == 0 and s == "WA":
        wa_cnt += 1
    elif prb[int(p) - 1] == 0 and s == "AC":
        ac_cnt += 1
        prb[int(p) - 1] = 1
print(ac_cnt, wa_cnt)

N, M = map(int, input().split())
A = [[] for _ in range(N)]
ac_cnt, wa_cnt = 0, 0
for _ in range(M):
    p, s = input().split()
    if s == "AC":
        A[int(p) - 1].append(1)
    else:
        A[int(p) - 1].append(0)

for x in A:
    if x.count(1) >= 1:
        ac_cnt += 1
        wa_cnt += len(x[0:x.index(1)])
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):
r = int(input())
g = int(input())

print(int(g * 2 - r))

# history :: {int : (int, bool)}
n, m = [int(x) for x in input().split()]
history = { i+1 : [0, False] for i in range(n)}

for _ in range(m):
  pi, result = input().split()
  translated_pi = int(pi)
  if result == 'WA' and not history[translated_pi][1]:
    history[translated_pi][0] += 1
  else:
    history[translated_pi][1] = True

ac_count = 0
penalty_count = 0
for result in history.values():
  if result[1]:
    ac_count += 1
    penalty_count += result[0]

print("{} {}".format(ac_count, penalty_count))

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):
num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]

for i in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    print(d_ac, d_wa)
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

print(sum(d_ac),sum(d_wa))

num, all_ans = [int(i) for i in input().split(" ")]
d_wa = [0 for _ in range(num)]
d_ac = [0 for _ in range(num)]
ans = 0

for _ in range(all_ans):
    ans_num, ac_wa = [i for i in input().split(" ")]
    if d_ac[int(ans_num) - 1] == 1: continue
    if ac_wa == "AC": 
        d_ac[int(ans_num) - 1] = 1
        continue
    if ac_wa == "WA":
        d_wa[int(ans_num) - 1] += 1
        continue

for num, i in enumerate(d_ac):
    if i:
       ans += d_wa[num]

print(sum(d_ac),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())

List = []
ans = [0  for i in range(N+1)]
WA = [0  for i in range(N+1)]

for i in range(M):
  p,S = map,input().split()
  
  if ans[p] != 0:
    if S == "AC":
      ans[p] = 1
    else:
      WA[p] += 1
      
A = sum(ans)
W = sum(WA)

print(A,W)

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

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


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

List = []
ans = [0  for i in range(N+1)]
WA = [0  for i in range(N+1)]

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ans[p] == 0:
    if S == "AC":
      ans[p] = 1
    else:
      WA[p] += 1
      
A = sum(ans)

W= 0

for i in range(N+1):
  W += ans[i] * WA[i]

print(A,W)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N, M = map(int, input().split())

acs = set()
was = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in acs:
        if S == 'AC':
            acs.add(p)
            wa = was
            was = 0
        else:
            was += 1
print(len(acs), wa)

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

ac = [0] * N
wa = [0] * N
buff = [0] * N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if ac[p] == 0:
        if S == 'AC':
            ac[p] = 1
            wa[p] = buff[p]
        else:
            buff[p] += 1
print(sum(ac), sum(wa))


Verdicts: Runtime Error

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,input().split())
PS = (input().split() for _ in range(M))

ac = [False] * N
wa_cnt = [0] * N
penal = 0
for P,S in PS:
    p = int(P)-1
    if ac[p]:
        pass
    elif S == b'WA':
        wa_cnt[p] += 1
    else:
        ac[p] = True
        penal += wa_cnt[p]

ac = sum(ac)
print(ac, penal)

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,input().split())
PS = (input().split() for _ in range(N))

ac = [False] * N
wa_cnt = [0] * N
penal = 0
for P,S in PS:
    p = int(P)-1
    if ac[p]:
        pass
    elif S == b'WA':
        wa_cnt[p] += 1
    else:
        ac[p] = True
        penal += wa_cnt[p]

ac = sum(ac)
print(ac, penal)

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,input().split())
PS = (input().split() for _ in range(M))

ac = [False] * N
wa_cnt = [0] * N
penal = 0
for P,S in PS:
    p = int(P)-1
    if ac[p]:
        pass
    elif S == 'WA':
        wa_cnt[p] += 1
    else:
        ac[p] = True
        penal += wa_cnt[p]

ac = sum(ac)
print(ac, penal)

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())
acf,waf=[0]*n,[0]*n
ac,wa=0,0
for i in range(m):
    x,y=input().split()
    x=int(x)
    if y=='AC':
        if acf[x]==0:
            ac+=1
            wa+=waf[x-1]
            acf[x-1]+=1
    else:
        waf[x-1]+=1
print(ac,wa)


n,m=map(int,input().split())
acf,waf=[0]*n,[0]*n
ac,wa=0,0
for i in range(m):
    x,y=input().split()
    x=int(x)
    if y=='AC':
        if acf[x-1]==0:
            ac+=1
            wa+=waf[x-1]
            acf[x-1]+=1
    else:
        waf[x-1]+=1
print(ac,wa)


Verdicts: Runtime Error

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N ,M = map(int, input().split())
ps = [list(input().split()) for i in range(M)]

ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

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

print(str(sum(ac)) + " " + str(sum(wa)))


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

ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

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

print(str(sum(ac)) + " " + str(sum(wa)))


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

ac = [0 for i in range(N)]
wa = [0 for i in range(N)]

for i in range(M):
    s = int(ps[i][0])-1
    if ps[i][1] == "WA" and ac[s] == 0:
        wa[s] += 1

    if ps[i][1] == "AC" and ac[s] == 0:
        ac[s] = 1

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

print(str(sum(ac)) + " " + str(sum(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=[0]*N
wa=[0]*N

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

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

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

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
            
wacnt=0
for i in range(N):
	if ac[i]>=1:
      wacnt+=wa[i]
		
print(sum(ac), wacnt)

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

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
            
wacnt=0
for i in range(N):
	if ac[i]>=1:
		wacnt+=wa[i]
		
print(sum(ac), wacnt)

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


c = 0
a = 0

t = [0]*(n+1)

temp = []


for i in range(m):
    s = input().split()
    x = s[0]
    y = s[1]
    if y == 'AC' x not in temp:
        a += 1
        c += t[int(x)]
        temp += [x]
    elif y == 'WA':
        t[int(x)] += 1

print(a, c)


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

a = [0] * (n+1)
b = [0] * (n+1)

c = 0

for i in [0]*(m):

    s = input().split()

    if a[int(s[0])] == 0:
        if s[1] == "AC":
            a[int(s[0])] = 1
            c += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(a), 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())
q = [0 for i in range(n)]
alist = []
ac = 0
pe = 0
be = be
for i in range(m):
    a,b=input().split()
    alist.append((int(a), b))
for i in range(m):
    if q[alist[i][0]-1] == 0:
        if alist[i][1] == 'AC':
            ac += 1
            be = be + pe
            q[alist[i][0]-1] = 1
        else:
            pe += 1
    else:
        continue
print(ac,be)

n, m = map(int,input().split())
q = [0 for i in range(n)]
alist = []
ac = 0
pe = [0 for i in range(n)]
be = 0
for i in range(m):
    a,b=input().split()
    alist.append((int(a), b))
for i in range(m):
    if q[alist[i][0]-1] == 0:
        if alist[i][1] == 'AC':
            ac += 1
            be = be + pe[alist[i][0]-1]
            q[alist[i][0]-1] = 1
        else:
            pe[alist[i][0]-1] +=  1
    else:
        continue
print(ac,be)

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())
j=[0]*n 
c=[0]*n 
print(j)
print(c)
pe=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
    pe+=c[p]
  elif s[0]=="W":c[p]+=1
print(ac,pe)

n,m=map(int,input().split())
j=[0]*n 
c=[0]*n 
pe=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
    pe+=c[p]
  elif s[0]=="W":c[p]+=1
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())
p = []
S = []
for _ in range(M):
    a, b = input().split()
    p.append(int(a))
    S.append(b)

ans = [[] for i in range(N)]
WA, AC = 0, 0
for p, S in zip(p, S):
    if ans[p - 1].count("AC") != 0:
        pass
    else:
        ans[p - 1].append(S)
        if S == "WA":
            WA += 1
        if S == "AC"
            AC += 1

print(AC, WA)

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

ans = [0] * N
AC = 0
WA = 0

for P in Q:
    p = int(P[0])
    S = P[1]
    if ans[p - 1] == "END":
        continue
    if S == "WA":
        ans[p - 1] += 1
    if S == "AC":
        WA += ans[p - 1]
        AC += 1
        ans[p - 1] = "END"


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

for _ in range(M):
  p_str, s = map(str, input().split())
  p = int(p_str)
  if p in ac:
    continue
  if s == 'AC':
    ac.append(p)
    p.sort
  if s == 'WA':
    wa += 1

print(len(ac), wa)


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

for _ in range(M):
  p_str, s = map(str, input().split())
  p = int(p_str)
  if ac[p-1] == 1:
    continue
  if s == 'AC':
    ac[p-1] = 1
  if s == 'WA':
    wa[p-1] += 1

result = [x * y for (x, y) in zip(ac, wa)]
AC = sum(ac)
WA = sum(result)

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):
def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        if r[i][1] == "WA":
            if ac[int(r[i][0])] != 0:
                wa[int(r[i][0])] += 1
        elif r[i][1] == "AC":
            ac[int(r[i][0])] = 1
    acsum = sum(ac)
    wasum = sum(wa)
    return "{0} {1}".format(acsum, wasum)

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

def main(n,m,r):
    ac = [0]*n
    wa = [0]*n
    for i in range(len(r)):
        seq = int(r[i][0])
        judge = r[i][1]
        if ac[seq-1] == 1:
            continue
        if judge == "WA":
            wa[seq-1] += 1
        else:
            ac[seq-1] = 1
    for i in range(len(ac)):
        if ac[i] == 0:
            wa[i] = 0
    return "{0} {1}".format(sum(ac), sum(wa))

n,m = map(int, input().split())
r = list(input().split() for _ in range(m))
print(main(n,m,r))

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

AC = [False] * (N+1)
WA_cnt = [0] * (N+1)
ans = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        WA_cnt[p] += 1
        
    elif s == "AC":
        ans += 1
        pena += WA_cnt[p]
        AC[p] = True

print(ans, pena, sep=' ')

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

AC = [False] * (N+1)
ans = 0
tmp_pena = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        tmp_pena += 1
    elif s == "AC":
        ans += 1
        pena = tmp_pena
        AC[p] = True

print(ans, pena, sep=' ')

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

AC = [False] * (N+1)
ans = 0
tmp_pena = 0
pena = 0

print(PS)

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        tmp_pena += 1
        
    elif s == "AC":
        ans += 1
        pena += tmp_pena
        AC[p] = True

print(ans, pena, sep=' ')

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

AC = [False] * (N+1)
WA_cnt = [0] * (N+1)
ans = 0
pena = 0

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        WA_cnt[p] += 1
        
    elif s == "AC":
        ans += 1
        pena += WA_cnt[p]
        AC[p] = True

print(ans, pena, sep=' ')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n, m = map(int, input().split())
p, s = [], []
pslist = []
for i in range(m):
  row = list(input().split( ))
  pslist.append(row)
aclist = [0] * n
walist = [0] * n
for j, k in pslist:
  j = int(j)
  if k == 'AC':
    if aclist[j - 1] == 0:
      aclist[j - 1] = 1
  if k == 'WA':
    if aclist[j - 1] == 0:
      walist[j - 1] += 1

n, m = map(int, input().split())
p, s = [], []
pslist = []
for i in range(m):
  row = list(input().split( ))
  pslist.append(row)
aclist = [0] * n
walist = [0] * n
for j, k in pslist:
  j = int(j)
  if k == 'AC':
    if aclist[j - 1] == 0:
      aclist[j - 1] = 1
  if k == 'WA':
    if aclist[j - 1] == 0:
      walist[j - 1] += 1
wacountlist = [x * y for (x, y) in zip(aclist, walist)]
print(sum(aclist), sum(wacountlist))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
n,m=list(map(int,input().split()))
ac,wa=0,0
aclis=[0]*n
walis=[0]*n

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

n,m=list(map(int,input().split()))
ac,wa=0,0
aclis=[0]*n
walis=[0]*n

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

Verdicts: Runtime Error

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
d = [0]*10**5

a = set()
w = 0

for t in open(0):
    p, s = t.split
    p = int(p)
    if "AC" == s and p not in a:
        w += d[p]
        a.add(p)
    if "WA" == s:
        d[p] += 1

print(len(a), w)

d = [0]*10**5

a = set()
w = 0

for t in open(0):
    p, s = t.split()
    p = int(p)
    if "AC" == s and p not in a:
        w += d[p]
        a.add(p)
    if "WA" == s:
        d[p] += 1

print(len(a), w)

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

n,m=map(int,input().split())
w,l=0,[0]*n
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if s=='AC':
        w+=l[p]*(l[p]>=0)
        l[p]=-1
    else:
        l[p]+=(l[p]>=0)
print(l.count(-1),w)

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 = []
for i in range(0,M):
    a, b = input().split()
    a = int(a)
    p_S.append([a,b])
s, t = 0, 0
res = []
for i in range(0,N):
    res.append([i,0])
for i in range(0,M):
    if p_S[i][1] == "WA":
        res[p_S[i][0]][1] = res[p_S[i][0]][1]+1
    elif res[p_S[i][0]][1] >= 0:
        s, t = s+1, t+res[p_S[i][0]][1]
        res[p_S[i][0]][1] = -1
print(s, t)

N, M = map(int, input().split())
p, S = [0]*M, [0]*M
for i in range(0,M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])
s, t = 0, 0
res = []
for i in range(0,N):
    res.append([i,0])
for i in range(0,M):
    if S[i] == "WA":
        res[p[i]-1][1] = res[p[i]-1][1]+1
    elif res[p[i]-1][0] != -1:
        s, t = s+1, t+res[p[i]-1][1]
        res[p[i]-1][0] = -1
print(s, t)

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 collection import defaultdict
N, M = map(int, input().split())

aced = [False]*N
D = defaultdict(int)
ac = 0
pena = 0
for _ in range(M):
    id, judge = input().split()
    id = int(id)-1
    if judge == "WA":
        D[id] += 1
    else:
        if not aced[id]:
            aced[id] = True
            ac += 1
            pena += D[id]
print(ac, pena)


from collections import defaultdict
N, M = map(int, input().split())

aced = [False]*N
D = defaultdict(int)
ac = 0
pena = 0
for _ in range(M):
    id, judge = input().split()
    id = int(id)-1
    if judge == "WA":
        D[id] += 1
    else:
        if not aced[id]:
            aced[id] = True
            ac += 1
            pena += D[id]
print(ac, pena)


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

a,b=map(int,input().split())

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
print(ac)
#print(wa)
print(acans,waans)


a,b=map(int,input().split())

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
#print(ac)
#print(wa)
print(acans,waans)

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 = input().split()
  p = int(p)-1

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print('%d %d' % (sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0])))

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

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

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

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print(sum(ac), sum(wa[k] for k in [i for i,j in enumerete(ac) if j != 0]))

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

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

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

  if s == 'WA' and ac[int(p)-1] == 0:
    wa[int(p)-1] += 1
  elif s == 'AC' and ac[int(p)-1] == 0:
    ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

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

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

    if s == 'WA' and ac[int(p)-1] == 0:
        wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
        ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

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

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

  if s == 'WA' and ac[p] == 0:
    wa[p] += 1
  elif s == 'AC' and ac[p] == 0:
    ac[p] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

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

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

    if s == 'WA' and ac[int(p)-1] == 0:
            wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i,j in enumerete(ac) if j != 0]])))

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

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

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

    if s == 'WA' and ac[int(p)-1] == 0:
            wa[int(p)-1] += 1
    elif s == 'AC' and ac[int(p)-1] == 0:
            ac[int(p)-1] += 1

print('%d %d' % (sum(ac), sum([wa[k] for k in [i for i, j in enumerate(ac) if j != 0]])))

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):
nm=list(map(int,input().split()))
ps=[]
for i in range(nm[1]):
    ps.append(list(input().split()))
    ps[-1][0]=int(ps[-1][0])
ac=[0]*nm[0]
wa=0
for i in range(nm[1]):
    if ps[i][1]=="AC":
        if ac[ps[i][0]]==0:
            ac[ps[i][0]]=1
        else:
            pass
    else:
        if ac[ps[i][0]]==0:
            wa+=1
        else:
            pass
print(sum(ac),wa)


nm=list(map(int,input().split()))
ps=[]
for i in range(nm[1]):
    ps.append(list(input().split()))
    ps[-1][0]=int(ps[-1][0])
ac=[0]*nm[0]
wa=[0]*nm[0]
for i in range(nm[1]):
    if ps[i][1]=="AC":
        if ac[ps[i][0]-1]==0:
            ac[ps[i][0]-1]=1
        else:
            pass
    else:
        if ac[ps[i][0]-1]==0:
            wa[ps[i][0]-1]+=1
        else:
            pass
ans=0
for i in range(nm[0]):
    if ac[i]==1:
        ans+=wa[i]
print(sum(ac),ans)


Verdicts: Runtime Error

Accepted
Problem: Takahashi participated in a contest on AtCoder.  The contest had N problems.  Takahashi made M submissions during the contest.  The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`).  The number of Takahashi's correct answers is the number of problems on which he received an `AC` once or more.  The number of Takahashi's penalties is the sum of the following count for the problems on which he received an `AC` once or more: the number of `WA`s received before receiving an `AC` for the first time on that problem.  Find the numbers of Takahashi's correct answers and penalties.

Submission attempts (in order):
N, M=map(int,input().split())
 
ans=[0]*N
pena=[0]*N
AC=[0]*N
 
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        pena[p-1]+=1
        print(pena)
    else:
        if AC[p-1]==0:
            ans[p-1]+=pena[p-1]
        AC[p-1]=1
        print(AC)
 
print(AC.count(1),sum(ans))

N, M=map(int,input().split())
 
ans=[0]*N
pena=[0]*N
AC=[0]*N
 
for i in range(M):
    p,s=input().split()
    p=int(p)
    if s=="WA":
        pena[p-1]+=1
        #print(pena)
    else:
        if AC[p-1]==0:
            ans[p-1]+=pena[p-1]
        AC[p-1]=1
        #print(AC)
 
print(AC.count(1),sum(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 = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p] == 0):
    WA[p-1] += 1
print(sum(AC), sum(WA))

N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(M):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p] = 1
  elif(AC[p] == 0):
    WA[p] += 1
print(sum(AC), sum(WA))

N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))

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):
ls_ac = [0] * n
ls_ng = [0] * n
ac = 0
ng = 0


for i in range(m):
    p = int(ls[i][0])
    if ls[i][1] == "AC":
        if ls_ac[p - 1] == 0:
            ac += 1
            ng += ls_ng[p - 1]
            ls_ac[p - 1] = 1
    elif ls[i][1] == "WA":
        if ls_ac[p - 1] == 0:
            ls_ng[p - 1] += 1

print(ac, ng)

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

ls_ac = [0] * n
ls_ng = [0] * n
ac = 0
ng = 0


for i in range(m):
    p = int(ls[i][0])
    if ls[i][1] == "AC":
        if ls_ac[p - 1] == 0:
            ac += 1
            ng += ls_ng[p - 1]
            ls_ac[p - 1] = 1
    elif ls[i][1] == "WA":
        if ls_ac[p - 1] == 0:
            ls_ng[p - 1] += 1

print(ac, ng)

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=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[A[M]-1]!=-1 and S[j]=="WA":
        pen+=1
    elif task[A[M]-1]!=-1 and S[j]=="AC":
        ans+=1
        task[A[M]]=-1
        break
print(ans,pen)

N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[A[M]]!=-1 and S[j]=="WA":
        pen+=1
    elif task[A[M]]!=-1 and S[j]=="AC":
        ans+=1
        task[A[M]]=-1
        break
print(ans,pen)

N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[P[j]-1]!=-1 and S[j]=="WA":
        pen+=1
    elif task[P[j]-1]!=-1 and S[j]=="AC":
        ans+=1
        task[P[j]-1]=-1
        break
print(ans,pen)

N,M=map(int,input().split())
P,S=[],[]
ans,pen=0,0
task=[0]*N
for _ in range(M):
    A,B=map(str,input().split())
    P.append(int(A))
    S.append(B)

for j in range(M):
    if task[P[j]-1]!=-1 and S[j]=="WA":
        task[P[j]-1]+=1
    elif task[P[j]-1]!=-1 and S[j]=="AC":
        ans+=1
        pen+=task[P[j]-1]
        task[P[j]-1]=-1
print(ans,pen)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted