Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ac = [False] * N
wa_cnt = [0] * N
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p_i = int(p) - 1
    if s == 'WA':
        if not ac[p_i]:
            wa_cnt[p_i] += 1
    else:
        if not ac[p_i]:
            ac[p_i] = True
            ac_cnt += 1

wa_cnt_sum = 0
for i in range(N):
    if ac_cnt[i]:
        wa_cnt_sum += wa_cnt[i]

print(ac_cnt,wa_cnt_sum)


Fixed submission:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

wa = 0
for i in range(N + 1):
    if is_AC[i]:
        wa += WA_cnt[i]
print(ac, wa)
'''
うまくいかなかったパターン
1 4
1 WA
1 WA
1 WA
1 WA
'''

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (10 ** 5) + 1
WA_cnt = [0] * (10 ** 5) + 1
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))



Fixed submission:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

wa = 0
for i in range(N + 1):
    if is_AC[i]:
        wa += WA_cnt[i]
print(ac, wa)
'''
うまくいかなかったパターン
1 4
1 WA
1 WA
1 WA
1 WA
'''

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ac = 0
is_AC = [False] * M
WA_cnt = [0] * M
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))



Fixed submission:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

wa = 0
for i in range(N + 1):
    if is_AC[i]:
        wa += WA_cnt[i]
print(ac, wa)
'''
うまくいかなかったパターン
1 4
1 WA
1 WA
1 WA
1 WA
'''

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
wa_dict = {}
is_AC = []
ac_cnt = 0
for i in range(N):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC.count(p) == 0:
            if wa_dict.get(p) is None:
                wa_dict[p] = 1
            else:
                wa_dict[p] += 1
        else:
            continue
    else:
        if is_AC.count(p) == 0:
            ac_cnt += 1
            is_AC.append(p)

print(ac_cnt, sum(wa_dict.values()))


Fixed submission:
N, M = map(int, input().split())
ac = 0
is_AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

wa = 0
for i in range(N + 1):
    if is_AC[i]:
        wa += WA_cnt[i]
print(ac, wa)
'''
うまくいかなかったパターン
1 4
1 WA
1 WA
1 WA
1 WA
'''