Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
for j in [j for j in al if j[0] in al_a]:
  if j[1] == 'AC':
    al_a.remove(j[0])
  else:
    r2 += 1
    
print(r1 ,r2)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
for j in al:
  if j[0] in al_a:
    if j[1] == 'AC':
      al_a.remove(j[0])
    else:
      r2 += 1
    
print(r1 ,r2)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
for j in al:
  if j[0] in al_a:
    if j[1] == 'AC':
    	al_a.remove(j[0])
  	else:
    	r2 += 1
    
print(r1 ,r2)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
for j in al:
  if j[0] in al_a and j[1] == 'AC':
    al_a.remove(j[0])
  elif j[1] == 'WA' and j[0] in al_a:
    r2 += 1
    
print(r1 ,r2)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = [i[0] for i in al if i[1] == 'AC']
al_a = list(set(al_a))
r1 = len(al_a)
r2 = 0
for j in al:
  if j[1] == 'AC':
    al_a.remove(j[0])
  elif j[0] in al_a:
    r2 += 1
    
print(r1 ,r2)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(input().split())
al_a = []
for a in al:
  if a[1] == 'AC':
    al_a.append(a[0])
r1 = len(set(al_a))
r2 = 0
for j in al:
  if j[1] == 'AC':
    al_a = [i for i in al_a if i != j[0]]
  elif j[0] in al_a:
    r2 += 1
    
print(int(r1) ,int(r2))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(tuple(input().split()))
al_a = []
for a in al:
  if a[1] == 'AC':
    al_a.append(a)
r1 = len(set(al_a))
al_a2 = [i[0] for i in al_a]
r2 = 0
for j in al:
  if j[1] == 'AC':
    al_a2 = [i for i in al_a2 if i != j[0]]
  elif j[1] == 'WA' and j[0] in al_a2:
    r2 += 1
  
  
print(int(r1) ,int(r2))

Fixed submission:
def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()