Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * n
walis = [0] * n
ac = 1s


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = True
        

    if aclis[p[i]] == 0:
        walis[p[i]] += 1
ans1 = aclis.count('True')

for i in range(n):
    if aclis[i] == True:
        ans2 += walis[i]

print(ans1, ans2)

Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * n
walis = [0] * n



for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = True
        ac += 1

    if aclis[p[i]] == 0:
        walis[p[i]] += 1
ans1 = aclis.count('True')

for i in range(n):
    if aclis[i] == True:
        ans2 += walis[i]

print(ans1, ans2)

Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m == 0:
    print(0, 0)
else:
    p = [0] * m
    s = [0] * m
    for i in range(m):
        p[i], s[i] = map(str, input().split())
    for i in range(m):
        p[i] = int(p[i])
    p.append(int(ie9))

    probcnt = p[0]
    ACval = False
    ACcnt = 0
    wa = 0
    pena = 0
    for i in range(m):
        if probcnt == p[i]:
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                    if p[i] !=p[i+1]:
                        wa = 0
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa
                    wa = 0

        else:
            ACval = False
            probcnt = p[i]
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                    if p[i] !=p[i+1]:
                        wa = 0
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa


    print(ACcnt, pena)

Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m == 0:
    print(0, 0)
else:
    p = [0] * m
    s = [0] * m
    for i in range(m):
        p[i], s[i] = map(str, input().split())
    for i in range(m):
        p[i] = int(p[i])

    probcnt = p[0]
    ACval = False
    ACcnt = 0
    wa = 0
    pena = 0
    for i in range(m):
        if probcnt == p[i]:
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa
        wa = 0
        else:
            ACval = False
            probcnt = p[i]
            if ACval == False:
                if s[i] == 'WA':
                    wa += 1
                else:
                    ACval = True
                    ACcnt += 1
                    pena += wa
        wa = 0

    print(ACcnt, pena)


Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

probcnt = p[0]
ACval = False
ACcnt = 0
wa = 0
for i in range(m):
    if probcnt == p[i]:
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1
    else:
        ACval = False
        probcnt = p[i]
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1

print(ACcnt, wa)

Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

probcnt = 1
ACval = False
ACcnt
wa = 0
for i in range(m):
    if probcnt == p[i]:
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1
    else:
        ACval = False
        probcnt += 1
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1

print(ACcnt, wa)

Fixed submission:
n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)