Buggy python submission (verdict: Runtime Error):


N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while M <= scan:
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

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

Buggy python submission (verdict: Runtime Error):
all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while M < scan:
        #print(j,i,int(A[scan][0]), A[scan][1])
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1
        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        elif int(A[scan][0]) < j:
            scan += 1
        else:
            break
        
print(all_AC, all_failure)

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

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
#A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while scan <= M:
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1

        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        else:
            break
        
print(all_AC, all_failure)

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

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = [list(map(str,input().split())) for _ in range(M)]
A = sorted(A, key=lambda x: x[0])

all_failure = 0
all_AC = 0
scan = 0
for j in range(N):
    while scan <= M:
        if int(A[scan][0]) == j+1 and A[scan][1] == "WA":
            all_failure += 1
            scan+=1

        elif int(A[scan][0]) == j+1 and A[scan][1] ==  "AC":
            all_AC+=1
            scan+=1
            break
        else:
            break
        
print(all_AC, all_failure)

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