ZhenlongDai/ACPR huggingface dataset:
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, M = map(int, input().split())
    ans = [False for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
        else:
            if ans[i - 1] == False:
                wa += 1

    print(ac, wa)
    return 0
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())
    ans = [False for _ in range(N)]
    wa_list = [0 for _ in range(N)]

    ac = 0
    wa = 0

    for _ in range(M):
        i, result = input().split()
        i = int(i)
        if result == "AC":
            if ans[i-1] == False:
                ac += 1
                ans[i - 1] = True
                wa += wa_list[i-1]
        else:
            if ans[i - 1] == False:
                wa_list[i - 1] += 1
    if sum(ans) == 0:
        wa = 0

    print(ac, wa)
    return 0
if __name__ == '__main__':
    main()

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

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

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

for i in range(N):
    if AC[i]==0:
        WA[i]=0
    
print(sum(AC),sum(WA))

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

ac = [False]*n
c_ac = 0
c_wa = 0
c_wa_tmp = 0
for _ in range(m):
    pi,si = input().split()
    pi = int(pi) - 1
    
    if ac[pi] == False:
        if si == 'WA':
            c_wa_tmp += 1
        elif si == 'AC':
            c_ac += 1
            c_wa += c_wa_tmp
            c_wa_tmp = 0
            ac[pi] = True

print(c_ac, c_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())

ac = [False]*n
c_ac = 0
c_wa = 0
wa = [0]*n
for _ in range(m):
    pi,si = input().split()
    pi = int(pi) - 1
    
    if ac[pi] == False:
        if si == 'WA':
            wa[pi] += 1
        elif si == 'AC':
            c_ac += 1
            c_wa += wa[pi]
            ac[pi] = True

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



N,M=map(int, input().split())
ifacL=[0]*N
psL=[]
AC=0
WA=0
for _ in range(M):
  psL.append(list(map(str, input().split())))

for i in range(M):
  if ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="WA":
    WA+=1
  elif ifacL[int(psL[i][0])-1]==0 and psL[i][1]=="AC":
    AC+=1
    ifacL[int(psL[i][0])-1]=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())
ifACL=[0]*N
cWAL=[0]*N
psL=[]
AC=0
WA=0
p=0
s=0
for _ in range(M):
  p,s=map(str, input().split())
  p=int(p)
  if ifACL[p-1]==0 and s=="WA":
    cWAL[p-1]+=1
  elif ifACL[p-1]==0 and s=="AC":
    AC+=1
    WA+=cWAL[p-1]
    ifACL[p-1]=1

print(AC,WA)

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


def main():
     n, m = map(int, input().split())
     ac_list = [0 for i in range(n)]
     wa_list = [0 for i in range(n)]

     for i in range(m):
          p, s = input().split()
          p = int(p) - 1
          if ac_list[p] == 0:
               if s == 'AC':
                    ac_list[p] = 1
               else:
                    wa_list[p] += 1
     
     print('{} {}'.format(sum(ac_list), sum(wa_list)))

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())
     ac_list = [False for i in range(n)]
     wa_list = [0 for i in range(n)]
     ac_ans = wa_ans = 0

     for i in range(m):
          p, s = input().split()
          p = int(p) - 1
          if not ac_list[p]:
               if s == 'AC':
                    ac_list[p] = True
                    ac_ans += 1
                    wa_ans += wa_list[p]
               else:
                    wa_list[p] += 1
     
     print('{} {}'.format(ac_ans, wa_ans))

if __name__ == "__main__":
    main()

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

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

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

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

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 = map(int,input().split())

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

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

print(sum(ac),sum([wa[x] for x in range(n) if ac[x]==1]))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
is_ac = [False]*n
ac = 0
wa = 0
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s=='AC' and (not is_ac[p]):
        ac += 1
        is_ac[p] = True
    if s=='WA' and (not is_ac[p]):
        wa += 1
print(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):
n, m = map(int, input().split())
is_ac = [False]*n
ac = 0
was = [0]*n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s=='AC' and (not is_ac[p]):
        ac += 1
        is_ac[p] = True
    if s=='WA' and (not is_ac[p]):
        was[p] += 1
wa = 0
for i in range(n):
    if is_ac[i]:
        wa += was[i]
print(ac, wa)

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

ac_list = []
wa_dict = {}
num_wa = 0

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC':
        ac_list.append(p)
        if p in wa_dict.keys():
            num_wa += wa_dict[p]
    elif p not in ac_list:
        if p not in wa_dict.keys():
            wa_dict[p] = 1
        else:
            wa_dict[p] += 1
            
num_ac = len(ac_list)
        
print(num_ac, num_wa)

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

Expected output:
1 0

Actual output:
3 0


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

ac_list = []
wa_list = [0 for i in range(n)]
num_wa = 0
num_ac = 0

for ps in ps_list:
    p = int(ps[0])
    s = ps[1]
    
    if s == 'AC' and wa_list[p-1] != -1:
        ac_list.append(p)
        num_wa += wa_list[p-1]
        num_ac += 1
        wa_list[p-1] = -1
    elif wa_list[p-1] != -1:
        wa_list[p-1] += 1
        
print(num_ac, num_wa)

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

ACList = []
WAcnt = 0
for i in range(M):
    s = input().split()
    if s[1] == 'AC' and s[0] not in ACList:
        ACList.append(s[0])
    elif s[1] == 'WA' and s[0] not in ACList:
        WAcnt += 1

print("{} {}".format(len(ACList), WAcnt))

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 = [int(i) for i in input().split()]

ACSet = set([])
WAList = []
WAcnt = 0

for i in range(M):
    s = input().split()
    
    if len(ACSet) != N:
        if s[1] == 'AC':
            ACSet.add(s[0])
        
        elif s[1] == 'WA' and s[0] not in ACSet:
            WAList.append(s[0])


for i in range(len(WAList)):
    if WAList[i] in ACSet:
        WAcnt += 1

print("{} {}".format(len(ACSet), WAcnt))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n,m = map(int,input().split())
ac, wa=[], []
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac): wa.append(p)
penalty = len(wa)
clear = len(set(ac))
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())
l=[]
prevID = ""
accepted = False
penalties = 0
total = 0
for i in range(m):
  x = input().split()
  ID = x[0]
  stat = x[1]
  if ID != prevID:
    accepted = False
  if ID == prevID and accepted:
    continue
  if stat == "AC":
    total += 1
    accepted = True
  else:
    penalties += 1
  prevID = ID

print(total, 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):
n, m = map(int, input().split())
won = set()
d = {}
penalties = 0
for i in range(m):
  x = input().split()
  ID = x[0]
  stat = x[1]
  if ID in won:
    continue
  if stat == "WA":
    if (d.get(ID, None)):
      d[ID] += 1
    else:
      d[ID] = 1
  else:
    won.add(ID)

for item in won:
    penalties += d.get(item,0)
print(len(won), penalties)

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

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

for _ in range(m):
    p, s = input().split()
    if (not ac[int(p)]) and s == 'WA':
        wa[int(p)] += 1
    elif s == 'AC':
        ac[int(p)] = 1
sw = 0
for i in range(n+1):
    sw += ac[i] * wa[i]
print(sum(ac), sw)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

d = []
ac = wa = 0
for _ in range(M):
    p, S = input().split()
    p = int(p)
    if p not in d:
        if S == 'AC':
            d.append(p)
            ac += 1
        elif S == '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())

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

Problem: p02802
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N,M = map(int,input().split())
P = [0]*M
S = [0]*M
for i in range(M):
    P[i],S[i] = map(str,input().split())
    
AC = [0]*N
ACcount = 0
WAcount = 0
for i in range(M):
    if AC[int(P[i])-1]==0:
        if S[i] == 'WA':
            WAcount += 1
        if S[i] == 'AC':
            ACcount += 1
            AC[int(P[i])-1] = 1 
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 2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
P = [0]*M
S = [0]*M
for i in range(M):
    P[i],S[i] = map(str,input().split())
    
AC = [0]*N
WA = [0]*N
ACcount = 0
WAcount = 0
for i in range(M):
    if AC[int(P[i])-1]==0:
        if S[i] == 'WA':
            WA[int(P[i])-1] += 1
        if S[i] == 'AC':
            ACcount += 1
            AC[int(P[i])-1] = 1 
for i in range(N):
    if AC[i] == 1:
        WAcount += WA[i]
print(ACcount,WAcount)

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

ac_counter = 0
wa_counter = 0

ac_flag = [ 0 for i in range(N)]

for i in range(M):
  P_num, outcome = map(str, input().split())
  if ac_flag[int(P_num)-1] == 0:
    if outcome == "WA":
      wa_counter += 1
    else:
      ac_counter += 1
      ac_flag[int(P_num)-1] = 1
  else:
    pass

print(ac_counter, wa_counter) 

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

wa_counter = [ 0 for i in range(N)]
ac_flag = [ 0 for i in range(N)]
penalty_sum = 0

for i in range(M):
  P, outcome = map(str, input().split())
  P = int(P) -1
  if ac_flag[P] == 0 and outcome == "AC":
    ac_flag[P] = 1
    penalty_sum += wa_counter[P]
  elif ac_flag[P] == 0 and outcome == "WA":
    wa_counter[P] += 1
  else:
    pass

print(sum(ac_flag), penalty_sum)
Problem: p02802
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n ,m = map(int,input().split())
ok = [False] * n
wa_cnt = 0
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        ok[int(p)-1] = True
    elif not(ok[int(p)-1]):
        wa_cnt += 1
print(sum(ok),wa_cnt)


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())
ok = [False] * n
wa = [0] * n
for i in range(m):
    p,s = input().split()
    if s == 'AC':
        ok[int(p)-1] = True
    elif not(ok[int(p)-1]):
        wa[int(p)-1] += 1
wa_sum = sum([wa[i] * ok[i] for i in range(n)])
print(sum(ok),wa_sum)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, M = map(int, input().split())
judge = [0]*10**5
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    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):
import math
N, M = map(int, input().split())
judge = [0]*N
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    wa += judge[int(p)-1]
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    judge[int(p)-1] += 1
print(ac,wa)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
H = list(map(int, input().split()))
N = H[0]
M = H[1]
C = [0]*N
A = 0
W = 0
for i in range(M):
    X = input().split()
    if (C[int(X[0])-1]==0):
        if (X[1]=="AC"):
            C[int(X[0])-1]=1
            A += 1
        else:
            W += 1
print(str(A)+" "+str(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):
H = list(map(int, input().split()))
N = H[0]
M = H[1]
C = [0]*N
A = 0
W = [0]*N
w = 0
for i in range(M):
    X = input().split()
    if (C[int(X[0])-1]==0):
        if (X[1]=="AC"):
            C[int(X[0])-1]=1
            A += 1
        else:
            W[int(X[0])-1]+= 1

for i in range(N):
    if(C[i]==1):
        w+=W[i]
print(str(A)+" "+str(w))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
ac = 0
wa = 0
ac_list = [0]*n

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

for _ in range(m):
    p,s=input().split()
    p = int(p) - 1
    if ac_list[p] == 'AC': continue
    ac_list[p] = s
    if s == 'AC':
        ac += 1
        wa += wa_list[p]
    else:
        wa_list[p] += 1
print(ac,wa)
Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int,input().split())
pS = [tuple(input().split()) for _ in range(m)]
pena = 0
correct = 0
flag = [False] * n
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena += 1
        else:
            correct += 1
            flag[p-1] = True
print(correct, pena)


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 = [input().split() for _ in range(m)]
correct = 0
flag = [False] * n
pena = [0] * n
sum = 0
for p, s in pS:
    p = int(p)
    if flag[p-1] == True:
        continue
    else:
        if s == "WA":
            pena[p-1] += 1
        elif s == "AC":
            sum += pena[p-1]
            correct += 1
            flag[p-1] = True
print(correct, sum)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=[int(s) for s in input().split()]
ACls=[0 for _ in range(N)]
ans=[0,0]
for i in range(M):
  a,b=input().split()
  a=int(a)-1
  if b=='AC':
    if ACls[a]==0:
      ACls[a]=1
      ans[0]+=1
  else:
    if ACls[a]==0:
      ans[1]+=1
print(*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=[int(s) for s in input().split()]
WAls=[0 for _ in range(N)]
ACls=[0 for _ in range(N)]
wa=0
for i in range(M):
  a,b=input().split()
  a=int(a)-1
  if b=='AC':
    if ACls[a]==0:
      wa+=WAls[a]
      ACls[a]=1
  else:
    if ACls[a]==0:
      WAls[a]+=1
ans=[sum(ACls),wa]
print(*ans)

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = list(map(int,input().split()))
ans = 0
pen = 0

check = {}

for i in range(M):
    if len(check) == N:
        break
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 0
        else:
            ans = 1
    else:
        if S == 'WA':
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] == -1

print(ans,pen)

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

Expected output:
2 1


Actual output:
1 0


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

check = {}

for i in range(M):
    p,S = input().split()
    p = int(p)
    if p not in check:
        if S == 'WA':
            check[p] = 1
        else:
            ans += 1
            check[p] = -1
    else:
        if S == 'WA' and check[p] != -1:
            check[p] += 1
        elif S == 'AC' and check[p] != -1:
            pen += check[p]
            ans += 1
            check[p] = -1

print(ans,pen)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
ac, wa=[], {}
for i in range(m):
  p,s = map(str, input().split())
  if s=='AC': ac.append(p)
  elif (s=='WA') and (p not in ac):
    if p not in wa.keys(): wa[p]=1
    else: wa[p]+=1
penalty = sum(wa.values())
clear = len(ac)
print('%d %d'%(clear,penalty))

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

Expected output:
1 0

Actual output:
3 0


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.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
L = []
cnt = 0
for _ in range(m):
    p, s = input().split()
    if p in L:
        continue
    else:
        if s == 'AC':
            L.append(p)
        else:
            cnt += 1
print(len(L), cnt)


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())
d = {}
cnt_ac = 0
cnt_wa = 0
for _ in range(m):
    p, s = input().split()
    if p not in d:
        d[p] = [s]
    else:
        d[p].append(s)
for i in d:
    if 'AC' in d[i]:
        cnt_ac += 1
        cnt_wa += d[i].index('AC')
print(cnt_ac, cnt_wa)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
pS = []
pS_dict = {i:[] for i in range(10**5)}
shutugen = set()
for i in range(M):
    tmp = input().split()
    if tmp[1] == "AC":
        pS_dict[int(tmp[0])].append(1)
    else:
        pS_dict[int(tmp[0])].append(0)
    shutugen.add(int(tmp[0]))
    
seitou = 0
penaru = 0
for i in shutugen:
    set_i = pS_dict[i]
    for s in set_i:
        if s == 0:
            penaru += 1
        else:
            seitou += 1
            break
print(seitou, penaru) 

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 = []
pS_dict = {i:[] for i in range(10**5)}
shutugen = set()
for i in range(M):
    tmp = input().split()
    if tmp[1] == "AC":
        pS_dict[int(tmp[0])].append(1)
    else:
        pS_dict[int(tmp[0])].append(0)
    shutugen.add(int(tmp[0]))
    
seitou = 0
penaru = 0
for i in shutugen:
    seitou_i = 0
    penaru_i = 0
    set_i = pS_dict[i]
    for s in set_i:
        if s == 0:
            penaru_i += 1
        else:
            seitou_i += 1
            break
    if seitou_i == 0:
        continue
    else:
        seitou += seitou_i
        penaru += penaru_i
print(seitou, penaru)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA' and S[p] == 0:
        P[p] += 1
    elif s == 'AC' and S[p] == 0:
        S[p] = 1

print(sum(S), sum(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())
P = [0 for _ in range(N+1)]
S = [0 for _ in range(N+1)]

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA' and S[p] == 0:
        P[p] += 1
    elif s == 'AC' and S[p] == 0:
        S[p] = 1

for i in range(N+1):
    if S[i] == 0 and P[i] > 0:
      P[i] = 0
        
print(sum(S), sum(P))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
p = []
S = []
AC_cnt = 0
WA_cnt = 0
for i in range(M):
    tmp_p, tmp_S = input().split()
    tmp_p = int(tmp_p)
    p.append(tmp_p)
    S.append(tmp_S)
p_cnt = [0 for i in range(N)]
for i in range(M):
    if p_cnt[p[i]-1]==1:
        continue
    if S[i]=="AC":
        AC_cnt+=1
        p_cnt[p[i]-1]=1
    elif S[i]=="WA":
        WA_cnt+=1
print(AC_cnt,WA_cnt)

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 = []
S = []
AC_cnt = [0 for i in range(N)]
WA_cnt = [0 for i in range(N)]
for i in range(M):
    tmp_p, tmp_S = input().split()
    tmp_p = int(tmp_p)
    p.append(tmp_p)
    S.append(tmp_S)
p_cnt = [0 for i in range(N)]
for i in range(M):
    if p_cnt[p[i]-1]==1:
        continue
    if S[i]=="AC":
        AC_cnt[p[i]-1]+=1
        p_cnt[p[i]-1]=1
    elif S[i]=="WA":
        WA_cnt[p[i]-1]+=1

ac_cnt = sum(AC_cnt)
wa_cnt = 0
for i in range(N):
    if AC_cnt[i]==1:
        wa_cnt+=WA_cnt[i]
print(ac_cnt,wa_cnt)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int, input().split())
AC = [0] * n
WA = [0] * n

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

    if s == 'AC':
        AC[p] = 1
    elif AC[p] != 1:
        WA[p] += 1

print(sum(AC),sum(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())
AC = [0] * (n+1)
WA = [0] * (n+1)

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

    if s == 'AC':
        AC[p] = 1
    elif s == 'WA'and AC[p] != 1:
        WA[p] += 1

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

print(sum(AC),sum(WA))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

stop_set=set()

WA_count=0
AC_count=0
for i in range(M):
    if not lst[i][0] in stop_set:
        if lst[i][1]=='AC':
            AC_count+=1
            stop_set.add(lst[i][0])
        else:
            WA_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())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

stop_set=set()

WA_count=0
AC_count=0
from collections import defaultdict
WA_dict = defaultdict(lambda: 0)

for el in lst:
    if not el[0] in stop_set:
        if el[1]=='AC':
            AC_count+=1
            stop_set.add(el[0])
        else:
            WA_dict[el[0]] +=1


new_set=set(WA_dict.keys())&stop_set

WA_count=sum([WA_dict[i] for i in new_set])
print(AC_count, WA_count)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if qp[ta] == 0 :
        if tb == 'WA':
            dp[ta]+=1
        else :
            qp[ta]=1
print(sum(qp),sum(dp))

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

a,b = map(int,input().split())
dp = [0]*(100010)
qp = [0]*(100010)
for i in range(b):
    ta,tb = map(str,input().split())
    ta = int(ta)
    if qp[ta] == 0 :
        if tb == 'WA':
            dp[ta]+=1
        else :
            qp[ta]=1
ANS = 0
for i, j in zip(dp,qp):
    ANS += i*j
print(sum(qp),ANS)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
p_s = [input().split() for _ in range(m)]
problem = [0]*n
pena = 0
for i in range(m):
    if p_s[i][1] == 'WA':
        if problem[int(p_s[i][0])-1] == 0:
            pena += 1
    elif p_s[i][1] == 'AC':
        problem[int(p_s[i][0])-1] = 1

print(sum(problem), pena)

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_s = [input().split() for _ in range(m)]
problem = [0]*n
pena = [0]*n
penalty = 0
for i in range(m):
    if p_s[i][1] == 'WA':
        if problem[int(p_s[i][0])-1] == 0:
            pena[int(p_s[i][0])-1] += 1
    elif p_s[i][1] == 'AC':
        problem[int(p_s[i][0])-1] = 1
        penalty += pena[int(p_s[i][0])-1]
        pena[int(p_s[i][0])-1] = 0
print(sum(problem), penalty)
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int,input().split())
li = []
for _ in range(M):
  p, S = input().split()
  li.append([int(p), S])

c = []
wa = [0] * N

for i in range(M):
  j = li[i][0] - 1
  if not j in c and li[i][1] == "WA":
    wa[j] += 1
    continue
  if not j in c and li[i][1] == "AC":
    c.append(j)

print(len(c), 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 = map(int,input().split())
li = []
for _ in range(M):
  p, S = input().split()
  li.append([int(p), S])

ac = [0] * N
wa = [0] * N
c1 = 0
c2 = 0

for i in range(M):
  j = li[i][0] - 1
  if li[i][1] == "WA":
    wa[j] += 1
  if ac[j] == 0 and li[i][1] == "AC":
    ac[j] = 1
    c1 += 1
    c2 += wa[j]

print(c1, c2)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]
judges = [str(arr[j][1]) for j in range(m)]
results = [False]*n
cnt_ac = 0
cnt_wa = 0
total_wa = 0
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
            cnt_ac += 1
            cnt_wa += total_wa
            total_wa = 0
        else:
            total_wa += 1
print("{} {}".format(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())
arr = [input().split() for i in range(m)]
q = [int(arr[j][0]) for j in range(m)]

judges = [str(arr[h][1]) for h in range(m)]
results = [False]*n
wa_cnt = [0]*n
total_wa = 0
for k in range(m):
    if results[q[k]-1] == False:
        if judges[k] == "AC":
            results[q[k]-1] = True
            total_wa += wa_cnt[q[k]-1]
        else:
            wa_cnt[q[k]-1] += 1
    else:
        continue
print("{} {}".format(results.count(True), total_wa))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
AC_Set = set()
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        break
    else:
        if result == "AC":
            AC_Set.add(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_Set),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())
AC_Set = set()
WA_Dict = {}
WA_SUM = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        continue
    else:
        if result == "AC":
            AC_Set.add(num)
            WA_SUM += WA_Dict.get(num,0)
        else:
            WA_Dict[num] = WA_Dict.get(num,0) + 1

print("{} {}".format(len(AC_Set),WA_SUM))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())
table= [0]*N
pen = 0
score = 0
for i in range(M):
  p,S = input().split()
  p = int(p)-1
  if table[p] == 1:
    continue
  elif S == "WA":
    pen += 1
  else:
    score += 1
    table[p] = 1
print(score,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())
AC = [0]*N
WA = [0]*N
score = 0
pen = 0
for i in range(M):
  p,S = input().split()
  p = int(p)-1
  if AC[p] == 1:
    continue
  elif S == "WA":
    WA[p] += 1
  elif S == "AC":
    AC[p] = 1
    score += 1
    pen += WA[p]
print(score,pen)

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

WA=[]
AC=[]
for i in range(N):
    WA.append(0)
    AC.append(0)

for i in range(M):
    if P[i][1]=="WA" and  AC[int(P[i][0])-1]==0:
        WA[int(P[i][0])-1]+=1
    elif P[i][1]=="AC":
        WA[int(P[i][0])-1]=0
        AC[int(P[i][0])-1]=1

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


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

Expected output:
2 2


Actual output:
2 0


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

WA=[]
AC=[]
for i in range(N):
    WA.append(0)
    AC.append(0)

for i in range(M):
    if P[i][1]=="WA" and  AC[int(P[i][0])-1]==0:
        WA[int(P[i][0])-1]+=1
    elif P[i][1]=="AC":
        AC[int(P[i][0])-1]=1
for i in range(N):
    if AC[i]==0:
        WA[i]=0

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

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
a = [False]*n
b = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        a[p-1] = True
    if s == 'WA' and a[p-1] == False:
        b[p-1] += 1
print(a.count(True),sum(b))

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())
a = [False]*n
b = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        a[p-1] = True
    if s == 'WA' and a[p-1] == False:
        b[p-1] += 1
correct = a.count(True)
penalty = 0
for i in range(len(a)):
    if a[i] == True:
        penalty += b[i]
print(correct, penalty)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if not p in d:
            d[p] = ''
        if d[p] != 'WA':
            scores[0 if s == 'AC' else 1] += 1
            d[p] = s
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])


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

Expected output:
2 0


Actual output:
3 0


Fixed submission (verdict: Accepted):
def solve(n, m, PS):
    d = {}
    scores = [0, 0]
    for p, s in PS:
        if p not in d:
            d[p] = {'wa': 0, 'ac': 0}
        if d[p]['ac'] > 0:
            continue
        if s == 'AC':
            d[p]['ac'] = 1
            scores[0] += 1
            scores[1] += d[p]['wa']
        if s == 'WA':
            d[p]['wa'] += 1
    return scores

_n, _m = map(int, input().split())
_PS = [input().split() for _ in range(_m)]
_scores = solve(_n, _m, _PS)
print(_scores[0], _scores[1])

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nm = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [i for i in input().split()]
  val = dic.setdefault(tmp[0],'NEW')
  
  if (val == 'NEW') or (val == 'WA'):	
    if tmp[1] == 'WA':
      pe += 1
      dic[tmp[0]] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      dic[tmp[0]] = 'AC'

print(co, pe)


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 = [int(i) for i in input().split()]
dic = {}

co = 0
pe = 0

for i in range(0,nm[1]):
  tmp = [j for j in input().split()]
  val = dic.setdefault(tmp[0],['NEW', 0])
  
  if (val[0] == 'NEW') or (val[0] == 'WA'):	
    if tmp[1] == 'WA':
      dic[tmp[0]][1] += 1
      dic[tmp[0]][0] = 'WA'
    elif tmp[1] == 'AC':
      co += 1
      pe += dic[tmp[0]][1]
      dic[tmp[0]][0] = 'AC'

print(co, pe)

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int, input().split())
a=[0]*(10**5+1)
w=[0]*(10**5+1)

for _ in range(M):
  p,s=input().split()
  p=int(p)
  if s=='AC':
    a[p]=1
  else:
    if a[p]==0:
      w[p]+=1

print(sum(a), sum(w))

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]*(N+1)
w=[0]*(N+1)

for _ in range(M):
  p,s=input().split()
  p=int(p)
  if s=='AC':
    a[p]=1
  else:
    if a[p]==0:
      w[p]+=1

a2=0
w2=0
for n in range(N+1):
  if a[n]==1:
    a2+=a[n]
    w2+=w[n]
      
print(a2, w2)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
num_ac = num_wa = 0
acs = [0]*n
for X in inputs[1:]:
    p, s = X.split()
    p = (int(p)-1)
    if acs[p] == 0:
        if s == 'AC':
            num_ac += 1
            acs[p] = 1
        else:
            num_wa += 1
        
print(*[num_ac, num_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):
import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
acs = [0]*n
was = [0]*n
for X in inputs[1:]:
    p, s = X.split()
    p = (int(p)-1)
    if acs[p] == 0:
        if s == 'AC':
            acs[p] = 1
        else:
            was[p] += 1

print(*[sum(acs), sum(w for a, w in zip(acs, was) if a)])

Problem: p02802
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
pen=0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x]:
    wa[x]=1
print(sum(l),sum(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):
from sys import stdin as s
n,m=map(int,s.readline().split())
l=[0]*n
wa=[0]*n
cor,pen=0,0
for i in range(m):
  x,y=s.readline().split()
  x=int(x)-1
  if y=="AC":
    l[x]=1
  elif not l[x]:
    wa[x]+=1
for i in range(n):
  if l[i]:
    cor+=1
    pen+=wa[i]
print(cor,pen)

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

no = 0
correct = 0
penalty = 0

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

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

print(correct, penalty)

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

Expected output:
2 1


Actual output:
1 1


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

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

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

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

print(correct, penalty)
Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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

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

ans=[sum(acs),sum(wa)]
print(*ans)

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

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

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

obj = {}
ii = 0
jj = 0

for i in range(M):
    p = [x for x in input().split()]
    key = p[0]
    res = p[1]
    if key not in obj:
        obj[key] = {'AC': 0, 'WA': 0}
    if res == 'WA' and obj[key]['AC'] > 0:
        obj[key]['WA'] = obj[key]['WA'] + 1
    if res == 'AC':
        obj[key]['AC'] = 1

for k in obj:
    ii = ii + obj[k]['AC']
    jj = jj + obj[k]['WA']


print(ii, jj)

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

Expected output:
2 2

Actual output:
2 1


Fixed submission (verdict: Accepted):
N, M = [int(x) for x in input().split()]

obj = {}
ii = 0
jj = 0

for i in range(M):
    p = [x for x in input().split()]
    key = p[0]
    res = p[1]
    if key not in obj:
        obj[key] = {'AC': 0, 'WA': 0}
    if res == 'WA' and obj[key]['AC'] == 0:
        obj[key]['WA'] = obj[key]['WA'] + 1
    if res == 'AC':
        obj[key]['AC'] = 1

for k in obj:
    ii = ii + obj[k]['AC']
    if obj[k]['AC'] > 0:
        jj = jj + obj[k]['WA']


print(ii, jj)

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = (int(i) for i in input().split())
p = []
ac = 0
wa = 0
for i in range(m):
  a,b = (input().split())
  a = int(a)
  p.append([a,b])
x = [0]*n
for i in range(m):
  tmp = p[i][0] - 1
  if p[i][1] == "AC":
    x[tmp] = 1
  elif p[i][1] == "WA":
    if x[tmp] == 0:
      wa += 1
for i in range(n):
  if x[i] == 1:
    ac += 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 = (int(i) for i in input().split())
p = []
ac = 0
wa = 0
for i in range(m):
  a,b = (input().split())
  a = int(a)
  p.append([a,b])
x = [0]*n
w = [0]*n
for i in range(m):
  tmp = p[i][0] - 1
  if p[i][1] == "AC":
    x[tmp] = 1
  elif p[i][1] == "WA":
    if x[tmp] == 0:
      w[tmp] += 1
for i in range(n):
  if x[i] == 1:
    ac += 1
    wa += w[i]
print(ac,wa)
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
WA = 0
AC = [0 for i in range(n)] 

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

print(AC.count(1), 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())
PN = 0
AC_list = [0 for i in range(n)] 
WA_list = [0 for i in range(n)] 

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

    if s == "AC" and AC_list[p-1] == 0:
        PN += WA_list[p-1]
        AC_list[p-1] = 1
    
    else:
        WA_list[p-1] += 1


print(AC_list.count(1), PN)

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

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n,m=map(int, input().split())
ac=set()
ac_cnt=0
wa_cnt=0
for i in range(m):
    p,s=nm()
    if s=='AC':
        if int(p) in ac:
            continue
        else:
            ac.add(int(p))
            ac_cnt+=1
    elif s=='WA':
        if int(p) in ac:
            continue
        else:
            wa_cnt+=1
print(ac_cnt,wa_cnt)



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

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
from collections import defaultdict
n,m=map(int, input().split())
ac=set()
ac_cnt=0
wa_cnt=0
d_ac=defaultdict(int)
d_wa=defaultdict(int)
for i in range(m):
    p,s=nm()
    if s=='AC':
        if int(p) in ac:
            continue
        ac.add(int(p))
        ac_cnt+=1
    elif s=='WA':
        if int(p) in ac:
            continue
        d_wa[p]+=1

for a in ac:
    wa_cnt+=d_wa[str(a)]

print(ac_cnt,wa_cnt)

Problem: p02802
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result and result[p] == 'AC':
        continue
    if s == 'WA':
        wa += 1
        result[p] = s
    elif s == 'AC': 
        ac += 1
        result[p] = s
    
print(str(ac) + ' ' + str(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 = [int(s) for s in input().split(' ')]
ac = 0
wa = 0
result = dict()
fail = dict()
for m in range(M):
    p, s = input().split(' ')
    if p in result and result[p] == 'AC':
        continue
    if s == 'WA':
        fail[p] = fail.get(p, 0) + 1
        result[p] = s
    elif s == 'AC': 
        ac += 1
        wa += fail.get(p, 0) 
        result[p] = s
    
print(str(ac) + ' ' + str(wa))
Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

dones = set()
wa = buff = 0
for _ in range(M):
    p, S = input().split()
    if p not in dones:
        if S == 'AC':
            dones.add(p)
            wa += buff
            buff = 0
        else:
            buff += 1
print(len(dones), 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())

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

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

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

penalties = [0] * N
corrects = [0] * N

for p, s in ps:
    if s == 'AC' and corrects[int(p) - 1] == 0:
        corrects[int(p) - 1] = 1
    elif s == 'WA' and corrects[int(p) - 1] == 0:
        penalties[int(p) - 1] += 1

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

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

penalties = [0] * N
corrects = [0] * N

for p, s in ps:
    if s == 'AC' and corrects[int(p) - 1] == 0:
        corrects[int(p) - 1] = 1
    elif s == 'WA' and corrects[int(p) - 1] == 0:
        penalties[int(p) - 1] += 1

for i in range(N):
    penalties[i] = penalties[i] * corrects[i]
print(sum(corrects), sum(penalties))

Problem: p02802
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = dict()
t, f = 0, 0
n, m = map(int, input().split(" "))
for _ in range(m):
  p, s = input().split(" ")
  if not p in l:
    l[p] = None
  if s == "WA":
    if l[p] != True:
      f += 1
  elif s == "AC":
    if l[p] != True:
      l[p] = True
      t += 1  

print(t, 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):
l = dict()
t, f = 0, 0
n, m = map(int, input().split(" "))
for _ in range(m):
  p, s = input().split(" ")
  if not p in l:
    l[p] = [None, 0]
  if s == "WA":
    if l[p][0] != True:
      l[p][1] += 1
  elif s == "AC":
    if l[p][0] != True:
      l[p][0] = True
      t += 1

for _, v in l.items():
  if v[0]:
    f += v[1]
print(t, f)