Buggy python submission (verdict: Runtime Error):


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
c_sum = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
    
for j in range(N):
    if ans[p[j]-1] == 1:
        c_sum += c_wa[p[j]-1]
        
            
print(sum(ans), c_sum)

Fixed submission:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
for k in range(N):
    if ans[k] == 1:
        pena += c_wa[k]
    

            
print(sum(ans), pena)

Buggy python submission (verdict: Runtime Error):


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
c_sum = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
    
for i in range(N):
    if ans[p[j]-1] == 1:
        c_sum += c_wa[p[j]-1]
        
            
print(sum(ans), c_sum)

Fixed submission:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
for k in range(N):
    if ans[k] == 1:
        pena += c_wa[k]
    

            
print(sum(ans), pena)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().strip().split(" "))


p = []
s = []
ans = [0]*N
c_wa = 0

for i in range(M):
    temp1, temp2 = input().strip(" ").split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        print("WA", j, s[p[j]-1])
        if ans[p[j]-1] == 0:
            c_wa += 1
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 1:
            continue
        elif ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
            
print(sum(ans), c_wa)

Fixed submission:


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


p = []
s = []
ans = [0]*N
c_wa = [0]*N
pena = 0

for i in range(M):
    temp1, temp2 = input().strip().split(" ")
    p.append(int(temp1))
    s.append(str(temp2))
  

for j in range(M):
    
    if s[j] == "WA":
        if ans[p[j]-1] == 0:
            c_wa[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
                
            
    elif s[j] == "AC":
        if ans[p[j]-1] == 0:
            ans[p[j]-1] += 1
        elif ans[p[j]-1] == 1:
            pass
        
for k in range(N):
    if ans[k] == 1:
        pena += c_wa[k]
    

            
print(sum(ans), pena)