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

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

correct2=[]
data=[0]*n


for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in correct2:
        continue
    else:
        if i[1]=='WA':
            data[int(i[0])-1]+=1
        else:
            correct2.append(i[0])

print(len(correct),sum(data))

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

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

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

correct2=[]
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in correct2:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            correct2.append(i[0])

print(len(correct),sum_wa)

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

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

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

correct2=[]
data={}

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in correct2:
        continue
    else:
        if i[0] in data.keys():
            if i[1]=='WA': 
                data[i[0]]+=1
            else:
                correct2.append(i[0])
        else:
            if i[1]=='WA':
                data[i[0]]=1
            else:
                data[i[0]]=0
                correct2.append(i[0])
                
print(len(correct),sum([data[i] for i in correct]))

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

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

if m==0:
    print(0,0)
    import sys
    sys.exit()

correct=[]
data={}

for i in [list(input().split()) for _ in range(m)]:
    if i[0] in correct:
        continue
    else:
        if i[0] in data.keys():
            if i[1]=='WA': 
                data[i[0]]+=1
            else:
                correct.append(i[0])
        else:
            if i[1]=='WA':
                data[i[0]]=1
            else:
                data[i[0]]=0
                correct.append(i[0])
                
print(len(correct),sum([data[i] for i in correct]))

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
#p=[list(input().split()) for _ in range(m)]

correct=[]
data={}

"""
for j in range(m):
    if p[j][0] in correct:
        continue
    if p[j][0] in data.keys():
        if p[j][1]=='WA': 
            data[p[j][0]]+=1
        else:
            correct.append(p[j][0])
    else:
        if p[j][1]=='WA':
            data[p[j][0]]=1
        else:
            correct.append(p[j][0])
"""

for i in [list(input().split()) for _ in range(m)]:
    if i[0] in correct:
        continue
    else:
        if i[0] in data.keys():
            if i[1]=='WA': 
                data[i[0]]+=1
            else:
                correct.append(i[0])
        else:
            if i[1]=='WA':
                data[i[0]]=1
            else:
                correct.append(i[0])


#print(correct,data)
#print(len(correct),sum(data.values()))

print(len(correct),sum([data[i] for i in correct if i in data.keys()]))

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

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

correct=[]
data={}

for j in range(m):
    if p[j][0] in correct:
        continue
    if p[j][0] in data.keys():
        if p[j][1]=='WA': 
            data[p[j][0]]+=1
        else:
            correct.append(p[j][0])
    else:
        if p[j][1]=='WA':
            data[p[j][0]]=1
        else:
            correct.append(p[j][0])

#print(correct,data)
#print(len(correct),sum(data.values()))
sum_wa=0
for i in correct:
    if i in data.keys():
        sum_wa+=data[i]
#print(sum_wa)
print(len(correct),sum_wa)

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[list(input().split()) for _ in range(m)]

correct=[]
data={}

for j in range(m):
    if p[j][0] in correct:
        continue
    if p[j][0] in data.keys():
        if p[j][1]=='WA': 
            data[p[j][0]]+=1
        else:
            correct.append(p[j][0])
    else:
        if p[j][1]=='WA':
            data[p[j][0]]=1
        else:
            correct.append(p[j][0])

#print(correct,data)
#print(len(correct),sum(data.values()))
sum_wa=0
for i in correct:
    sum_wa+=data[i]
#print(sum_wa)
print(len(correct),sum_wa)

Fixed submission:
n,m=map(int,input().split())

if m==0:
    print(0,0)
    import sys
    sys.exit()

p=[list(input().split()) for _ in range(m)]
correct=set([p[i][0] for i in range(m) if p[i][1]=='AC'])

s=set()
sum_wa=0

for i in [p[j] for j in range(m) if p[j][0] in correct]:
    if i[0] in s:
        continue
    else:
        if i[1]=='WA':
            sum_wa+=1
        else:
            s.add(i[0])

print(len(correct),sum_wa)