Problem p02802 (python)

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

Buggy submission (verdict: Runtime Error):
import sys

def main():
    N, M = list(map(int, input().split()))
    
    inputs = [input().split() for i in range(M)]
    has_been_solved = set()

    penalty = {}
    correct = 0

    for i in inputs:
        
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            correct += 1
            has_been_solved.add(num)
        else:
            if num not in penalty:
                penalty[num] = 1
            else:
                penalty[num] += 1
    print(correct, sum([penalty[p] for p in has_been_solved]))         
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
    N, M = list(map(int, input().split()))
    
    inputs = [input().split() for i in range(M)]
    has_been_solved = set()

    penalty = {}
    correct = 0

    for i in inputs:
        
        num = int(i[0])
        if num in has_been_solved:
            continue

        if i[1] == 'AC':
            correct += 1
            has_been_solved.add(num)
        else:
            if num not in penalty:
                penalty[num] = 1
            else:
                penalty[num] += 1
    print(correct, sum([penalty[p] for p in  already]))         
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    inputs = inputs.split()
    inputs = [[inputs[i], inputs[i + 1]] for i in range(0, len(inputs), 2)]
    print(inputs)
    has_been_solved = set()

    penalty = 0
    correct = 0
    for i in inputs:
        num = int(i[0])
        if num not in has_been_solved and i[1] == 'AC':
            has_been_solved.add(num)
        elif num not in has_been_solved and i[1] != 'AC':
            penalty += 1
    correct = len(has_been_solved)
    
    print(correct, penalty)            
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    # N, M = list(map(int, input().split()))
    # inputs = [input().split() for i in range(M)]
    with open('./abc151/test.txt', 'r') as f:
        inputs = f.read()
        f.close()
    inputs = inputs.split()
    inputs = [[inputs[i], inputs[i + 1]] for i in range(0, len(inputs), 2)]
    print(inputs)
    has_been_solved = set()

    penalty = 0
    correct = 0
    for i in inputs:
        num = int(i[0])
        if num not in has_been_solved and i[1] == 'AC':
            has_been_solved.add(num)
        elif num not in has_been_solved and i[1] != 'AC':
            penalty += 1
    correct = len(has_been_solved)
    
    print(correct, penalty)            
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = list(map(int, input().split()))
    inputs = [input().split() for i in range(M)]
    
    # dic = {}
    has_been_solved = set()
    pen = 0
    cor = 0
    for i in inputs:
        if i[0] in has_been_solved:
            continue

        if i[1] == 'AC':
            cor += 1
            has_been_solved.add(i[0])
        else:
            pen += 1

    print(f'{cor} {pen}')
    



if __name__ == "__main__":
    main()