ZhenlongDai/ACPR huggingface dataset:
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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]-1]==0:
            ac[ps[i][0]-1]=1
        else:
            pass
    else:
        if ac[ps[i][0]-1]==0:
            wa+=1
        else:
            pass
print(sum(ac),wa)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
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)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
if M==0:
    print(0,0)
    exit()
    
ACCNT=[0]*N
Asum=0
Wsum=0

for i in range(M):
    PI,SI=input().split()
    for ii in range(N):
        if int(PI)==ii+1:
            if SI=="WA" and ACCNT[ii]!=1:
                Wsum=Wsum+1
            elif SI=="AC":
                ACCNT[ii]=1
                Asum=Asum+1

print(Asum,Wsum)

Failing test case input:
100000 3
6234 AC
7777 AC
7777 AC

Expected output:
2 0


Actual output:
3 0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
    
if M==0 :
    print(0,0)
    exit()

ACCNT=[False]*N
Asum=0
WACNT=[0]*N

for i in range(M):
    PI,SI=input().split()
    iii=int(PI)-1
    if ACCNT[iii]==False:
        if SI=="WA" :
            WACNT[iii]=WACNT[iii]+1
        elif SI=="AC" :
            ACCNT[iii]=True
            Asum=Asum+1

Wsum=0
for i in range(N):
    if ACCNT[i]==True:
        Wsum=Wsum+WACNT[i]

print(Asum,Wsum)

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
ans = [0]*n
pen = [0]*n
for i in range(m):
  inp = input().split()
  if inp[1] == "AC":
    ans[int(inp[0])-1] = 1
  else:
    if ans[int(inp[0])-1] == 0:
    	pen[int(inp[0])-1] += 1
        
print("{0} {1}".format(ans.count(1),sum(pen)))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
ans = [0]*n
tmp = [0]*n
pen = [0]*n
for i in range(m):
  inp = input().split()
  if inp[1] == "AC":
    ans[int(inp[0])-1] = 1
    pen[int(inp[0])-1] = tmp[int(inp[0])-1]
  elif inp[1] == "WA":
    if ans[int(inp[0])-1] == 0:
      tmp[int(inp[0])-1] += 1
        
print("{0} {1}".format(sum(ans),sum(pen)))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M= [int(i) for i in input().split()]
tmp=[]
scr=[0]*2
rec=[0]*N
r=0
ts=0
for i in range(M):
        tmp = ([x for x in input().split()])
        q=int(tmp[0])
        if q!=r: ts=0
        if rec[q-1] == 1:
                continue
        else:
                if tmp[1] == 'AC':
                        rec[q-1]=1
                        scr[0]+=1
                        scr[1]+=ts
                        ts=0
                elif tmp[1]=='WA':
                        ts+=1
        r=q

Failing test case input:
-3 -3

Expected output:
0 0


Actual output:

Fixed submission (verdict: Accepted):
N,M= [int(i) for i in input().split()]
tmp=[]
scr=[0]*2
rec=[0]*N
eec=[0]*N

ts=0
for i in range(M):
        tmp = ([x for x in input().split()])
        q=int(tmp[0])

        if rec[q-1] == 1:
                continue
        else:
                if tmp[1] == 'AC':
                        rec[q-1]=1
                        scr[0]+=1
                        scr[1]+=eec[q-1]
                elif tmp[1]=='WA':
                        eec[q-1]+=1
        
        
print(scr[0],scr[1])

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
ac = [0 for _ in range(n)]
pen = [0 for _ in range(n)]

for _ in range(m):
  p, s = input().split()
  p = int(p) - 1
  if s == 'WA':
    if ac[p] == 0:
      pen[p] += 1
  else:
    ac[p] = 1
print(str(sum(ac)) + ' ' + str(sum(pen)))
  

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ac = [0 for _ in range(n)]
pen = [0 for _ in range(n)]

for _ in range(m):
  p, s = input().split()
  p = int(p) - 1
  if s == 'WA':
    if ac[p] == 0:
      pen[p] += 1
  else:
    ac[p] = 1

for p in range(n):
  if ac[p] == 0:
    pen[p] = 0
print(str(sum(ac)) + ' ' + str(sum(pen)))
Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter
N, M = list(map(int, input().split()))
results = []
for _ in range(M):
    p, s = input().split()
    results.append((int(p), s))

wa_counter = Counter()
is_active = [True for _ in range(N)]
correct = 0
for p, s in results:
    p -= 1
    if s == 'WA':
        if is_active[p]:
            wa_counter[p] += 1
        else:
            pass
    elif s == 'AC':
        if is_active[p]:
            correct += 1
            is_active[p] = False
        else:
            pass

incorrect = sum(wa_counter.values())
print(correct, incorrect)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import Counter
N, M = list(map(int, input().split()))
results = []
for _ in range(M):
    p, s = input().split()
    results.append((int(p), s))

wa_counter = Counter() 
is_active = [True for _ in range(N)] 
for p, s in results:
    p -= 1
    if s == 'WA':
        if is_active[p]:
            wa_counter[p] += 1
        else:
            pass
    elif s == 'AC':
        if is_active[p]:
            is_active[p] = False
        else:
            pass

correct = 0 
incorrect = 0 
for i in range(N):
    if is_active[i] is False: 
        correct += 1
        incorrect += wa_counter[i]
print(correct, incorrect)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    

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

    submits = []
    for _ in range(m):
        p, s = input().split(' ')
        submits.append((int(p), s))

    submits_iter = iter(submits)
    submit = next(submits_iter, None)
    done = set()
    passed = 0
    penalties = 0
    while submit:
        p, s = submit
        if p not in done:
            if s == 'AC':
                passed += 1
                done.add(p)
            else:
                penalties += 1
        submit = next(submits_iter, None)
    print('%s %s' % (passed, penalties))


main()


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict


def main():
    

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

    submits = []
    for _ in range(m):
        p, s = input().split(' ')
        submits.append((int(p), s))

    submits_iter = iter(submits)
    submit = next(submits_iter, None)
    done = set()
    passed = 0
    penalties = 0
    penalty_stock = defaultdict(int)
    while submit:
        p, s = submit
        if p not in done:
            if s == 'AC':
                passed += 1
                done.add(p)
                penalties += penalty_stock[p]
            else:
                penalty_stock[p] += 1
        submit = next(submits_iter, None)
    print('%s %s' % (passed, penalties))


main()
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
q,sub=map(int,input().split())
ac=[0 for i in range(q)]
sum_wa=[0 for i in range(q)]
waans=0
for i in range(sub):
    m,n=input().split()
    m=int(m)
    if n=='WA':
        if sum_wa[m-1]==0:
            waans+=1
    elif n=='AC' and ac[m-1]==0:
        ac[m-1]+=1
        sum_wa[m-1]+=1
print(sum(ac) ,waans)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
q,sub=map(int,input().split())
ac=[0 for i in range(q)]
sum_wa=[0 for i in range(q)]
waans=0
for i in range(sub):
    m,n=input().split()
    m=int(m)
    if n=='WA':
        if ac[m-1]==0:
            sum_wa[m-1]+=1
    elif n=='AC' and ac[m-1]==0:
        ac[m-1]+=1
        waans+=sum_wa[m-1]
print(sum(ac) ,waans)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = [int(i) for i in input().split()]
wrong_count = [0 for i in range(n)]
correct_count = [0 for i in range(n)]
for i in range(m):
    p, s = input().split()
    if s == 'AC':
        correct_count[int(p)-1] = 1
    elif correct_count[int(p)-1] == 0:
        wrong_count[int(p)-1] += 1
print(sum(correct_count), sum(wrong_count))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = [int(i) for i in input().split()]
wrong_count = [0 for i in range(n)]
correct_count = [0 for i in range(n)]
for i in range(m):
    p, s = input().split()
    if s == 'AC':
        correct_count[int(p)-1] = 1
    elif correct_count[int(p)-1] == 0:
        wrong_count[int(p)-1] += 1
penalty_count = sum([wrong_count[i] for i in range(n) if correct_count[i] == 1])
print(sum(correct_count), penalty_count)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, m = list(map(int, input().split()))
    ac_list = [0] * n
    wa_list = [0] * n
    for _ in range(m):
        tmp = input().split()
        contest_num = int(tmp[0]) - 1
        if ac_list[contest_num]:
            continue
        ret = tmp[1]
        if ret == "AC":
            ac_list[contest_num] = 1
        else:
            wa_list[contest_num] = 1

    print(sum(ac_list), sum(wa_list))


if __name__ == '__main__':
    main()


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
def main():
    n, m = list(map(int, input().split()))
    ac_list = [0] * n
    wa_list = [0] * n
    for _ in range(m):
        tmp = input().split()
        contest_num = int(tmp[0]) - 1
        if ac_list[contest_num]:
            continue
        ret = tmp[1]
        if ret == "AC":
            ac_list[contest_num] = 1
        else:
            wa_list[contest_num] += 1

    penalty = [wa_list[i] if ac_list[i] else 0 for i in range(n)]

    print(sum(ac_list), sum(penalty))


if __name__ == '__main__':
    main()
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ps = [[] for _ in range(N)]
for _ in range(M):
    p, s = input().split()
    ps[int(p)-1].append(s)

WAc = 0
ACc = 0
for i in range(N):
    for j in range(len(ps[i])):
        if ps[i][j] == "WA": 
            WAc += 1
        else:
            ACc += 1
            break
print(ACc, WAc)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ps = [[] for _ in range(N)]
for _ in range(M):
    p, s = input().split()
    ps[int(p)-1].append(s)

WAc = 0
ACc = 0
temp = 0
for i in range(N):
    for j in range(len(ps[i])):
        if ps[i][j] == "WA": 
            temp += 1
        else:
            ACc += 1
            WAc += temp
            temp = 0
            break
    else:
        temp = 0
print(ACc, WAc)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())
f=[0]*(N+1)
ans_a=[0]*(N+1)
ans_w=0
for i in range(M):
    p,s = map(str, input().split())
    if s=='WA' and ans_a[int(p)]==0:
        f[int(p)]+=1
    else:
        if ans_a[int(p)]==0:
            ans_a[int(p)]+=1
            ans_w+=f[int(p)]
print(sum(ans_a),sum(f))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
f=[0]*(N+1)
ans_a=[0]*(N+1)
ans_w=0
for i in range(M):
    p,s = map(str, input().split())
    if s=='WA' and ans_a[int(p)]==0:
        f[int(p)]+=1
    else:
        if ans_a[int(p)]==0:
            ans_a[int(p)]+=1
            ans_w+=f[int(p)]
print(sum(ans_a),ans_w)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
pis=[]
wa,ac={},{}
for i in range(M):
    p  = input().split()
    pis += [(int(p[0]),p[1])]
for p in pis:
    wa[p[0]]=0
    ac[p[0]]=0
if __name__ == '__main__':
   for p in pis:
      if ac[p[0]]<1:
         if p[1]=='WA':
              wa[p[0]]+=1
         elif p[1]=='AC':
              ac[p[0]]=1
   a=sum(ac.values())
   w=sum(wa.values())
   print('{} {}'.format(a,min(a,w)))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
pis=[]
wa,ac={},{}
for i in range(M):
    p  = input().split()
    pis += [(int(p[0]),p[1])]
for p in pis:
    wa[p[0]]=0
    ac[p[0]]=0
if __name__ == '__main__':
   for p in pis:
      if ac[p[0]]<1:
         if p[1]=='WA':
              wa[p[0]]+=1
         elif p[1]=='AC':
              ac[p[0]]=1
   for p in pis:
      if ac[p[0]]<1:
        wa[p[0]]=0
   a=sum(ac.values())
   w=sum(wa.values())
   print('{} {}'.format(a,w))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(map(int,input().split()))
ans=[list(map(str,input().split())) for i in range(s[1])]
que=[0 for i in range(s[0]+1)]
a=0
b=0
for i in range(s[1]):
  if que[int(ans[i][0])]==0:
    if ans[i][1]=='WA':
      a+=1
    else:
      b+=1
      que[int(ans[i][0])]=1
print(*[b,a])

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
s=list(map(int,input().split()))
ans=[list(map(str,input().split())) for i in range(s[1])]
ac=[0]*s[0]
wa=[0]*s[0]
a=0
b=0
c=0
for i in range(s[1]):
  c=int(ans[i][0])-1
  if ac[c]==0:
    if ans[i][1]=='WA':
      wa[c]+=1
    else:
      a+=1
      b+=wa[c]
      ac[c]=1
print(a,b)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
k = []
ac_count = 0
miss_count = 0
for i in range(M):
    s = input().split()
    if s[1] == "AC":
        if s[0] not in k:
            k.append(s[0])
            ac_count += 1
    else:
        if s[0] not in k:
            miss_count += 1
print(ac_count,miss_count)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
k = {}
for i in range(M):
  p,s = input().split()
  if p not in k:
    k[p] = [s]
  else:
    k[p].append(s)
ac = 0
wa = 0
for l in k:
  now = 0
  for m in k[l]:
    if m == "WA":
      now += 1
    elif m == "AC":
      ac += 1
      wa += now
      break
print(ac,wa)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
li = []
for i in range(M):
    li.append(input().split())

br = ''
r = ['WA']*(N+1)
o = []
c = 0
ac_c = 0
p_c =0

for ps in li:
    if ps[1] == 'WA':
        c+=1
    else: 
        index = int(ps[0])
        if r[index] == 'WA':
            r[index] = 'AC'
            p_c += c
            ac_c+=1
        else:
            pass
        c=0

print(ac_c, p_c)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
li = []
for i in range(M):
    li.append(input().split())


r = ['WA']*(N+1)
wa_li = [0]*(N+1)
o = []
c = 0
ac_c = 0

for ps in li:
    index = int(ps[0])
    if ps[1] == 'WA':
        if r[index] == 'WA':
            wa_li[index]+=1

    else: 
        if r[index] == 'WA':
            r[index] = 'AC'
            ac_c += 1
        else:
            pass

p_c =0
for i,v in enumerate(r):
    if v == 'AC':
        p_c+=wa_li[i]

print(ac_c, p_c)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
ac=[0]*N
pn=0
for i in range(M):
  p,s=input().split()
  p=int(p)
  if ac[p-1]==0:
    if s=="AC":
      ac[p-1]=1
    else:
      pn+=1

print(sum(ac),pn)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
ac=[0]*N
pn=[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
    else:
      pn[p-1]+=1

pna=0
for i in range(N):
  if ac[i]==1:
    pna+=pn[i]
print(sum(ac),pna)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

AC = [False for _ in range(N)]
WA = [0 for _ in range(N)]

for _ in range(M):
    p,s = input().split()
    p = int(p)-1
    if AC[p]:
        continue
    if s=='AC':
        AC[p] = True
    else:
        WA[p] += 1

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

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):


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

AC = [False for _ in range(N)]
WA = [0 for _ in range(N)]
total_WA = 0

for _ in range(M):
    p,s = input().split()
    p = int(p)-1
    if AC[p]:
        continue
    if s=='AC':
        AC[p] = True
        total_WA += WA[p]
    else:
        WA[p] += 1

print(sum(AC), total_WA)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
lst=[list(input().split()) for _ in range(m)]
print(lst)
pena_lst=[0]*n
acn_lst=[0]*n

for p,s in lst:
    p=int(p)-1
    if acn_lst[p]==1:
        continue
    if s =="AC":
        acn_lst[p]=1
    else: pena_lst[p]+=1
pena=0
acn=0
for i in range(n):
    acn+=acn_lst[i]
    if acn_lst[i]==1:
        pena+=pena_lst[i]
print(pena,acn)

Failing test case input:
0 -3

Expected output:
0 0


Actual output:
[]
0 0


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
lst=[list(input().split()) for _ in range(m)]
pena_lst=[0]*n
acn_lst=[0]*n

for p,s in lst:
    p=int(p)-1
    if acn_lst[p]==1:
        continue
    if s =="AC":
        acn_lst[p]=1
    else: pena_lst[p]+=1
pena=0
acn=0
for i in range(n):
    acn+=acn_lst[i]
    if acn_lst[i]==1:
        pena+=pena_lst[i]
print(acn,pena)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

penalty = 0
a = [[False, 0] for i in range(N)]
count = 0

for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if a[p][0] == False:
        if S == 'WA':
            a[p][1] += 1
        else:
            a[p][0] = True
            count += 1
    else:
        pass

print(count, sum([a[i][1] for i in range(N)]))

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

penalty = 0
a = [[False, 0] for i in range(N)]
count = 0

for i in range(M):
    p, S = input().split()
    p = int(p) - 1
    if a[p][0] == False:
        if S == 'WA':
            a[p][1] += 1
        else:
            a[p][0] = True
            count += 1
    else:
        pass

print(count, sum([a[i][1] for i in range(N) if a[i][0] is True]))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
d = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q, s = input().split()
    d.setdefault(q, '')
    if d[q] == 'AC':
        continue
    d[q] = s
    if s == 'WA':
        wa_count += 1
    else:
        ac_count += 1
print(ac_count, wa_count)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
question = {}
wa = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q, s = input().split()
    question.setdefault(q, '')
    wa.setdefault(q, 0)
    if s == 'AC':
        if question[q] == 'AC':
            continue
        else:
            question[q] = 'AC'
            ac_count += 1
            wa_count += wa[q]
    else:
        wa[q] += 1
print(ac_count, wa_count)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
p=[]
s=[]
ac=["WA"]*n
for i in range(m):
	pp,ss=input().split()
	p.append(int(pp))
	s.append(ss)
pena=0
for i in range(m):
	if s[i]=="AC":
		ac[p[i]-1]="AC"
	else:
		if ac[p[i]-1]=="WA":
			pena+=1

print(ac.count("AC"),pena)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
p=[]
s=[]
ac=["WA"]*n
wa=[0]*n
for i in range(m):
	pp,ss=input().split()
	p.append(int(pp))
	s.append(ss)
for i in range(m):
	if s[i]=="AC":
		ac[p[i]-1]="AC"
	else:
		if ac[p[i]-1]=="WA":
			wa[p[i]-1]+=1
for i in range(n):
	if ac[i]=="WA":
		wa[i]=0
print(ac.count("AC"),sum(wa))
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    a = [input().split() for _ in range(M)]
    ac_count = [0] * (N + 1)
    wa_count = defaultdict(lambda:0)
    ac, wa = 0, 0

    for q_no, ans in a:
        if ac_count[int(q_no)] == 0:
            if ans == "AC":
                ac_count[0] = 1
                ac += 1
                wa += wa_count.get(q_no, 0)
            else:
                wa_count[q_no] += 1
    
    print(ac, wa)

if __name__ == '__main__':
    main()

Failing test case input:
100000 3
7777 AC
7777 AC
7777 AC

Expected output:
1 0

Actual output:
3 0


Fixed submission (verdict: Accepted):
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    a = [input().split() for _ in range(M)]
    ac_count = [0] * (N + 1)
    wa_count = defaultdict(lambda:0)
    ac, wa = 0, 0

    for q_no, ans in a:
        q_no = int(q_no)
        if ac_count[q_no] == 0:
            if ans == "AC":
                ac_count[q_no] = 1
                ac += 1
                wa += wa_count.get(q_no, 0)
            else:
                wa_count[q_no] += 1
    
    print(ac, wa)

if __name__ == '__main__':
    main()

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	ac=0
	pe=0
	ch=[]
	for i in range(M):
		a=list(map(str,input().split()))
		if a[0] in ch:
			continue
		elif a[1]=="AC":
			ch.append(a[0])
			ac+=1
		else:
			pe+=1
	print(ac,pe)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M=map(int,input().split())
if M==0:
	print("0 0")
else:
	ac=0
	pe=0
	ch=[0]*N
	Ch=[0]*N
	for i in range(M):
		a, b=input().split()
		a=int(a)-1
		if ch[a]==1:
			continue
		elif b=="WA":
			Ch[a]+=1
		else:
			ch[a]=1
			ac+=1
			pe+=Ch[a]
	print(ac,pe)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
dic={}
ans=0
pen=0
for i in range(m):
    p,s=input().split()
    if p not in dic.keys():
        dic[p]={}
    if s=='AC':
        dic[p][s]=1
    if 'AC' not in dic[p].keys():
        if 'WA' not in dic[p].keys():
            dic[p][s]=0
        dic[p][s]+=1

for key in dic.keys():
    if 'AC' in dic[key].keys():
        ans+=1
    if 'WA' in dic[key].keys():
        pen+=dic[key]['WA']

print(str(ans)+' '+str(pen))


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
dic={}
ans=0
pen=0
for i in range(m):
    p,s=input().split()
    if p not in dic.keys():
        dic[p]={}
    if s=='AC':
        dic[p][s]=1
    if 'AC' not in dic[p].keys():
        if 'WA' not in dic[p].keys():
            dic[p][s]=0
        dic[p][s]+=1

for key in dic.keys():
    if 'AC' in dic[key].keys():
        ans+=1
        if 'WA' in dic[key].keys():
            pen+=dic[key]['WA']

print(str(ans)+' '+str(pen))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, m = map(int, input().split())
    ac_status = defaultdict(bool)
    wa_count = defaultdict(int)
    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac_status[p] = True
        else:
            if ac_status[p] == False:
                wa_count[p] += 1
    ac = len([v for v in ac_status.values() if v])
    wa = sum([v for v in wa_count.values()])
    
    
    print(ac, wa)


input = lambda: stdin.readline().rstrip()
main()

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, m = map(int, input().split())
    ac_status = defaultdict(int)
    wa_count = defaultdict(int)
    for _ in range(m):
        p, s = input().split()
        p = int(p)
        if s == "AC":
            ac_status[p] = 1
        else:
            if ac_status[p] != 1:
                wa_count[p] += 1
    ac = len([v for v in ac_status.values() if v == 1])
    wa = sum([v for k,v in wa_count.items() if ac_status[k] == 1])
    
    
    print(ac, wa)


input = lambda: stdin.readline().rstrip()
main()

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())
correct = [0]*N
penalty = [0]*N
ans_c,ans_p = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s=="AC":
        if correct[p-1]==0:
            ans_c += 1
        correct[p-1]+=1
    if s=="WA":
        if correct[p-1]==0:
            ans_p += 1

print(ans_c,ans_p)

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
correct = [0]*N
penalty = [0]*N
ans_c,ans_p = 0,0
for i in range(M):
    p,s = input().split()
    p = int(p)
    if s=="AC":
        if correct[p-1]==0:
            correct[p-1]+=1
    if s=="WA":
        if correct[p-1]==0:
            penalty[p-1]+=1

ans_penalty = 0
for i in range(N):
    if correct[i]>=1:
        ans_penalty+=penalty[i]
print(sum(correct),ans_penalty)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
ANS=[[0]*2 for _ in range(n+1)]
for _ in  range(m):
  i,s=input().split()
  if ANS[int(i)][0]==0:
    if s=='AC':
      ANS[int(i)][0]+=1
    else:
      ANS[int(i)][1]+=1
print(sum([row[0] for row in ANS]),sum([row[1] for row in ANS]))

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
A=0
W=0
ANS=[[0]*2 for _ in range(n+1)]
for _ in  range(m):
  i,s=input().split()
  if ANS[int(i)][0]==0:
    if s=='AC':
      ANS[int(i)][0]+=1
    else:
      ANS[int(i)][1]+=1
wa=0
for i in ANS:
  if i[0]==1:
    wa+=i[1]
print(sum([row[0] for row in ANS]),wa)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())

points    = [0] * n
penalties = [0] * n

for i in range(m):
  q, ans = input().split()
  
  if(points[int(q) - 1] == 0):
    
    if(ans == 'AC'):
      points[int(q) - 1] = 1
    
    else:
      penalties[int(q) - 1] = penalties[int(q) - 1] + 1

print(sum(points), sum(penalties))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())

points    = [0] * n
penalty   = [0] * n
penalties = 0

for i in range(m):
  q, ans = input().split()
  q = int(q) - 1
  
  if(points[q] == 0):
    
    if(ans == 'AC'):
      points[q] = 1
      penalties += penalty[q]
    
    else:
      penalty[q] += 1

print('{} {}'.format(sum(points), penalties))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split(' '))
wa_count = [0] * N
ac = [False] * N
rest_ac_num = N

WA = 'WA'

for i in range(M):
    
    
    
    
    

    _p, S = input().split(' ')
    p = int(_p) - 1

    if ac[p]:
        continue

    if S == WA:
        wa_count[p] += 1
    else:
        ac[p] = True
        rest_ac_num -= 1

    if rest_ac_num == 0:
        break

wa_total = 0
for c in wa_count:
    wa_total += c

print(N - rest_ac_num, wa_total)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split(' '))
wa_count = [0] * N
ac = [False] * N
ac_count = 0

WA = 'WA'
AC = 'AC'
for i in range(M):
    
    
    
    
    

    _p, S = input().split(' ')
    p = int(_p) - 1

    if ac[p]:
        continue

    if S == WA:
        wa_count[p] += 1
    elif S == AC:
        ac[p] = True
        ac_count += 1

    
    

wa_total = 0
for i, c in enumerate(wa_count):
    if ac[i]:
        wa_total += c

print(ac_count, wa_total)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
penalty = 0
ac_list = [False]*N
for i in range(M):
    p, S = input().split()
    if S == 'WA' and ac_list[int(p)-1]==False:
        penalty += 1
    else:
        ac_list[int(p)-1]=True
ACs = [a for a in ac_list if a]
print(len(ACs), penalty)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
penalty = 0
AC = [0]*N
WA = [0]*N
for i in range(M):
    p, S = input().split()
    if S == 'AC':
        AC[int(p)-1]=1
    else:
        if AC[int(p)-1]==0:
            WA[int(p)-1] += 1
penalty = [a*b for a, b in zip(AC, WA)]
print(sum(AC), sum(penalty))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict

def solve():
    N, M = map(int, input().split())
    d = defaultdict(int)
    e = defaultdict(int)
    for _ in range(M):
        a, b = input().split()
        a = int(a)
        if b == 'AC':
            e[a] = 1 
        elif b == 'WA' and e[a] == 0:
            d[a] += 1 

    ac = sum(e.values())

    wa = 0
    for k, v in e.items():
        wa += d[k]
    ans = [ac, wa]
    print(*ans)




solve()

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict

def solve():
    N, M = map(int, input().split())
    d = defaultdict(int)
    e = set()
    for _ in range(M):
        a, b = input().split()
        a = int(a)
        if b == 'AC':
            e.add(a)
        if b == 'WA' and a not in e:
            d[a] += 1
    s = 0
    for a in e:
        s += d[a]
    ans = [len(e), s]
    print(*ans)




solve()

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split(' '))
score = 0
penalty = 0
problems = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in problems:
        continue
    
    if result == "WA":
        penalty +=1
    else:
        score +=1
        problems.add(num)

print(score,penalty)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split(' '))
score = 0
penalty = 0
penalties = {}
acs = set()
for _ in range(m):
    num,result = input().split(' ')
    if num in acs:
        continue
    
    if result == "WA":
        if num in penalties:
            penalties[num] +=1
        else:
            penalties[num] =1
    else:
        score +=1
        if num in penalties:
            penalty += penalties[num]
        acs.add(num)

print(score,penalty)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N , M = [int(n) for n in input().split(' ')]


list_AC = []
count_WA = {}

for i in range(M):
    p , S = input().split(' ')
    
    if (p in list_AC):
        
        continue 
    else:
        if S == 'AC':
            list_AC.append(p)
        else:
            if p in count_WA:
                count_WA[p] += 1
            else:
                count_WA[p] = 1
        
for i in list_AC:
    if i in count_WA:
        print(count_WA[i])
    else:
        print(0)


Failing test case input:
0 -5

Expected output:
0 0


Actual output:

Fixed submission (verdict: Accepted):

N , M = [int(n) for n in input().split(' ')]

list_AC = [0] * N
list_WAcount = [0] * N
sumAC = 0
sumWA = 0

for i in range(M):
    sp , S = input().split(' ')
    p = int(sp)
    
    if (list_AC[p-1] != 0):
        
        continue 
    else:
        
        if S == 'AC':
            sumAC += 1
            list_AC[p-1] = 1
            sumWA += list_WAcount[p-1]
        else:
            list_WAcount[p-1] += 1

print("{} {}".format(sumAC,sumWA))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
prev_p = 0
aced = False
cnt_ac = 0
cnt_wa = 0
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if prev_p != p:
        prev_p = p
        aced = False
    if aced:
        continue
    else:
        if s == "AC":
            cnt_ac += 1
            aced = True
        else:
            cnt_wa += 1
print(cnt_ac,cnt_wa)



Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
cnt_ac = 0
cnt_wa = 0

aced_state = [False for i in range(N+1)]
wa_state = [0 for i in range(N+1)]

for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if aced_state[p] == True:
        continue
    else:
        if s == "AC":
            cnt_ac += 1
            cnt_wa += wa_state[p]
            aced_state[p] = True
        else:
            wa_state[p] += 1

print(cnt_ac,cnt_wa)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())

state = {}
wa = 0
ac = 0
for i in range(m):
  no, result = input().split()
  if result == 'AC':
    if not state.get(no):
      ac += 1
    state[no] = True
  elif result == 'WA':
    if not state.get(no):
      wa += 1

print(str(ac) + ' ' + str(wa))
  

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())

state = {}
wa_count = {}
wa = 0
ac = 0
for i in range(m):
  no, result = input().split()
  if result == 'AC':
    if not state.get(no):
      ac += 1
      wa += wa_count.get(no, 0)
    state[no] = True
  elif result == 'WA':
    if not state.get(no):
      if no in wa_count.keys():
        wa_count[no] += 1
      else:
        wa_count[no] = 1

print(str(ac) + ' ' + str(wa))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
keep=[]
lis=[]
ac=0
wa=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
for j in range(M):
    if not keep[j][0] in lis and keep[j][1]=="AC":
        ac+=1
        lis.append(keep[j][0])
for j in range(M):
    if keep[j][0] in lis and keep[j][1]=="WA":
        wa+=1
    
print(ac,wa)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
keep=[]
lis=[]
ac=[0]*N
wa=[0]*N
WA=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
    
for j in range(M):
    if keep[j][1]=="AC":
        ac[int(keep[j][0])-1]=1
    elif ac[int(keep[j][0])-1]==0:
        wa[int(keep[j][0])-1]+=1
AC=sum(ac)
for k in range(N):
    WA+=ac[k]*wa[k]
    
print(AC,WA)
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [False] * (N + 1)
    for p, S in pS:
        p = int(p)
        if ac[p]:
            continue
        if S == 'AC':
            ac[p] = True
            continue
        score[p] += 1
    print(sum(ac), sum(score))


if __name__ == '__main__':
    main()


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):

def main():
    N, M = map(int, input().split())
    pS = [list(input().split()) for _ in range(M)]

    score = [0] * (N + 1)
    ac = [False] * (N + 1)
    for p, S in pS:
        res = int(p)
        if S == 'AC':
            ac[res] = True
        if ac[res]:
            continue
        score[res] += 1
    penalty = 0
    for i in range(N + 1):
        if ac[i]:
            penalty += score[i]
    print(sum(ac), penalty)
    
    


if __name__ == '__main__':
    main()

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
P = [0] * N

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

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
P = [0] * N

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

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
ps = [input().split() for i in range(M)]

acs = set()
ac = pena = 0
for p,s in ps:
    if p in acs: continue
    if s=='AC':
        acs.add(p)
        ac += 1
    else:
        pena += 1
print(ac, pena)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
ps = [input().split() for i in range(M)]
from collections import defaultdict
acs = set()
penas = defaultdict(lambda: 0)
for p,s in ps:
    if p in acs: continue
    if s=='AC':
        acs.add(p)
    else:
        penas[p] += 1

pena = 0
for p in acs:
    pena += penas[p]
print(len(acs), pena)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())

inputs = [ input().split() for _ in range(m) ]

collectNum = 0
penaltyNum = 0


status = [False] * (n+1)

for inp in inputs:
    questNum = int(inp[0])
    result = inp[1]

    if status[questNum] == False:
        if result == 'AC':
            collectNum += 1
            status[questNum] = True
        elif result == 'WA':
            penaltyNum += 1

print("{} {}".format(collectNum, penaltyNum))



Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())

inputs = [ input().split() for _ in range(m) ]

collectNum = 0
penaltyNum = 0



waCounts = [0] * (n+1)

for inp in inputs:
    questNum = int(inp[0])
    result = inp[1]

    if waCounts[questNum] != -1:
        if result == 'AC':
            collectNum += 1
            penaltyNum += waCounts[questNum]
            waCounts[questNum] = -1
        elif result == 'WA':
            waCounts[questNum] += 1

print("{} {}".format(collectNum, penaltyNum))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
prob = [0]*N
WA = 0
for _ in range(M):
    p,S = input().split()
    p = int(p)
    if S == "AC":
        prob[p-1] = 1
    elif prob[p-1] == 0:
        WA += 1
print(sum(prob),WA)


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


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

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
ac = [False for _ in range(n+1)]
wa = [0 for _ in range(n+1)]

acCount = 0
waCount = 0

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

for i in range(n+1):
    if(ac[i] == True):
        acCount += 1
        waCount += wa[p]

print(acCount, waCount)



Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 0


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ac = [False for _ in range(n+1)]
wa = [0 for _ in range(n+1)]

acCount = 0
waCount = 0

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

for i in range(n+1):
    if(ac[i] == True):
        acCount += 1
        waCount += wa[i]

print(acCount, waCount)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

PS = []
qn = 1
ok, ng = (0, 0)
for _ in range(M):
    pp, S = input().split()
    p = int(pp)
    if qn <= p:
        if S == 'AC':
            qn = p + 1
            ok += 1
        else:
            ng += 1

print('{} {}'.format(ok, ng))

Failing test case input:
100000 3
12676 AC
7777 AC
7777 CA

Expected output:
2 0


Actual output:
1 0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

ok, ng = (0, 0)
oks = set()
ngdict = dict()
for _ in range(M):
    pp, S = input().split()
    p = int(pp)
    if p in oks:
        continue
    if S == 'AC':
        ok += 1
        ng += ngdict.get(pp, 0)
        oks.add(p)
    else:
        ngdict[pp] = ngdict.get(pp, 0) + 1

print('{} {}'.format(ok, ng))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
ac, wa=['F']*n,[0]*n
for i in range(m):
  p,s = map(str, input().split())
  p=int(p)
  if s=='AC': ac[p-1]='T'
  elif (s=='WA') and (ac[p-1]=='F'): wa[p-1]+=1
penalty = sum(wa)
clear = len([i for i in ac if i=='T'])
print('%d %d'%(clear,penalty))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
ac, wa=[False]*n,[0]*n
for i in range(m):
  p,s = input().split()
  p=int(p)
  if s=='AC': ac[p-1]=True
  elif (s=='WA') and (ac[p-1]==False): wa[p-1]+=1

penalty, clear=0,0
for i,tf in enumerate(ac):
  if tf:
    penalty += wa[i]
    clear += 1
print('%d %d'%(clear,penalty))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split(' '))

cleared = set()
penalties = 0

for _ in range(M):
    q, result = input().split(' ')
    if result == 'AC':
        cleared.add(q)
    elif q not in cleared:
        penalties += 1

print(len(cleared), penalties)


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
from collections import defaultdict

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

cleared = set()
penalties = defaultdict(int)

for _ in range(M):
    q, result = input().split(' ')
    if result == 'AC':
        cleared.add(q)
    elif q not in cleared:
        penalties[q] += 1

print(len(cleared), sum([penalties[q] for q in cleared]))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict


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

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


if __name__ == "__main__":
    main()


Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 0


Fixed submission (verdict: Accepted):
from collections import defaultdict


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

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


if __name__ == "__main__":
    main()

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
ACc = [0 for i in range(n)]
WAc = [0 for i in range(n)]

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

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

Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


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

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

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

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
R = lambda : input().split()

n, m = map(int, R())
a = [False] * n
b = [0] * n
for _ in range(m):
  p, s = R()
  p = int(p) - 1
  if s == 'AC':
    a[p] = True
  elif not a[p]:
    b[p] += 1
print(sum(a), sum(b))


Failing test case input:
4 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
R = lambda : input().split()

n, m = map(int, R())
a = [False] * n
b = [0] * n
for _ in range(m):
  p, s = R()
  p = int(p) - 1
  if s == 'AC':
    a[p] = True
  elif not a[p]:
    b[p] += 1
b =  [y for x, y in zip(a, b) if x]
print(len(b), sum(b))
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
count = [0]*N
ans = 0
ok = 1
for _ in range(M):
    p, s = input().split()
    if count[int(p)-1] >= 0 and s == "WA":
        count[int(p) - 1] += 1
    elif count[int(p)-1] >= 0 and s == "AC":
        ans += count[int(p)-1]
        count[int(p)-1] = -1
        ok += 1
print(ok, ans)

Failing test case input:
-36 -6

Expected output:
0 0


Actual output:
1 0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
count = [0]*N
ans = 0
ok = 0
for _ in range(M):
    p, s = input().split()
    if count[int(p)-1] >= 0 and s == "WA":
        count[int(p) - 1] += 1
    elif count[int(p)-1] >= 0 and s == "AC":
        ans += count[int(p)-1]
        count[int(p)-1] = -1
        ok += 1
print(ok, ans)

Problem: p02802
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, M = map(int, input().split())
pSs = [list(map(str, input().split())) for _ in range(M)]



ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

print(sum(ACs), sum(WAs))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
pSs = [list(map(str, input().split())) for _ in range(M)]



ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

num_WA = 0
for i, WA in enumerate(WAs):
    if ACs[i] == True:
        num_WA += WA

print(sum(ACs), num_WA)