Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

accurate = []
correct = 0
wrong = [0] * n
penalty = 0

for i in range(m):
    p,s = input().split()
    num = int(p) - 1 
    if s == 'AC' and num not in accurate:
        accurate.append(num)
        correct += 1
        penalty += wrong[num]
    elif s == 'WA' and num not in accurate:
        wrong[num] += 1 
    else:
        continue

print('{} {}'.format(correct,penalty))

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

ac_list = []
correct = 0
wrong = [0] * n
penalty = 0

for i in range(m):
    p,s = input().split()
    if s == 'AC' and p not in ac_list:
        ac_list.append(p)
        correct += 1
        penalty += wrong[int(p)-1]
    elif s == 'WA' and p not in ac_list:
        wrong[int(p)-1] += 1 
    else:
        continue

print('{} {}'.format(correct,penalty))

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,m = map(int, input().split())

    ac_list = []
    correct = 0
    wrong = [0] * n
    penalty = 0

    for i in range(m):
        p,s = input().split()
        if s == 'AC' and p not in ac_list:
            ac_list.append(p)
            correct += 1
            penalty += wrong[int(p)-1]
        elif s == 'WA' and p not in ac_list:
            wrong[int(p)-1] += 1 
        else:
            continue
    
    print('{} {}'.format(correct,penalty))


if __name__ == '__main__':
    main()

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    n,m = map(int, input().split())

    ac_list = []
    correct = 0
    wrong = [0] * n
    penalty = 0

    for i in range(m):
        p,s = input().split()
        if s == 'AC' and p not in ac_list:
            ac_list.append(p)
            correct += 1
        elif s == 'WA' and p not in ac_list:
            wrong[int(p)-1] += 1 
        else:
            continue
    
    for i,k in enumerate(ac_list):
        penalty += wrong[int(k)-1]

    print('{} {}'.format(correct,penalty))


if __name__ == '__main__':
    main()

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,m = map(int, input().split())
    s = [list(input().split()) for i in range(m)]

    ac_list = []
    correct = 0
    wrong = [0] * n
    penalty = 0

    for i,k in enumerate(s):
        if k[1] == 'AC' and k[0] not in ac_list:
            ac_list.append(k[0])
            correct += 1
        elif k[1] == 'WA' and k[0] not in ac_list:
            wrong[int(k[0])-1] += 1 
        else:
            continue
    
    for i,k in enumerate(ac_list):
        penalty += wrong[int(k)-1]

    print('{} {}'.format(correct,penalty))


if __name__ == '__main__':
    main()

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)

Buggy python submission (verdict: Time Limit Exceeded):
def make_ac_list(list):
    ac_list = []
    co_list = []
    for i,k in enumerate(list):
        if k[1] == 'AC' and k[0] not in co_list:
            ac_list.append([int(k[0]),i])
            co_list.append(k[0])
    return ac_list

def count_penalty(array,list):
    penalty = 0
    for i,k in enumerate(list):
        for j in range(k[1]):
            if array[j] == [str(k[0]),'WA']:
                penalty += 1

    return penalty 


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

    ac_list = make_ac_list(s)
    correct = len(ac_list)
    penalty = count_penalty(s,ac_list)

    print('{} {}'.format(correct,penalty))


if __name__ == '__main__':
    main()

Fixed submission:
n, m = map(int, input().split())
ac = 0
wa = 0
 
ac_tf = [0] * n
wa_num = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "AC":
        if ac_tf[p] == 0:
            ac += 1
            wa += wa_num[p]
            ac_tf[p] = 1
    else:
        wa_num[p] += 1
            
print(ac, wa)