Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
in1.sort() = [c for c in input()]
in2.sort(reversed=1) = [c for c in input()]
print("Yes" if in1<in2 else "No")

Fixed submission:
a,b=input(), input()
aa=[A for A in a]
aa.sort()
bb=[B for B in b]
bb.sort(reverse=1)
print("No" if aa>=bb else "Yes")

Buggy python submission (verdict: Runtime Error):
print("Yes" if [c for c in input()].sort()<[c for c in input()].sort(reversed=1) else "No")

Fixed submission:
a,b=input(), input()
aa=[A for A in a]
aa.sort()
bb=[B for B in b]
bb.sort(reverse=1)
print("No" if aa>=bb else "Yes")

Buggy python submission (verdict: Runtime Error):
print("Yes" if [c for c in input()].sort()<[c for c in input()].sort(reversed=1) else "No"


Fixed submission:
a,b=input(), input()
aa=[A for A in a]
aa.sort()
bb=[B for B in b]
bb.sort(reverse=1)
print("No" if aa>=bb else "Yes")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

num_array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print("{}".format(num_array[k-1]))


Fixed submission:
# coding: utf-8

num_array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print("{}".format(num_array[k-1]))

Buggy python submission (verdict: Runtime Error):
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if (c-a-b>0) and 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')



Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, \
2, 5, 4, 1, 4, 1, 51]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))

Buggy python submission (verdict: Runtime Error):
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')




Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, \
2, 5, 4, 1, 4, 1, 51]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))

Buggy python submission (verdict: Runtime Error):
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')




Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, \
2, 5, 4, 1, 4, 1, 51]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))

Buggy python submission (verdict: Runtime Error):
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')



Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, \
2, 5, 4, 1, 4, 1, 51]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))
Buggy python submission (verdict: Runtime Error):
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)(c-a-b):
    print('Yes')
else:
    print('No')



Fixed submission:
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if (c-a-b>0) and 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())

a = input().split()

sum_a_rev = 0

for i in range(n):
    sum_a_rev = sum_a_rev + 1/int(a[i])

res = 1/sum_a_rev

print("{}".format(res))



Fixed submission:
a = int(input())

s = input()

if a >= 3200:
    print("{}".format(s))
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
n = int(input())

sum_a_rev = 0

for i in range(n):
    val = int(input())
    sum_a_rev = sum_a_rev + 1/val

res = 1/sum_a_rev

print("{}".format(res))



Fixed submission:
n = int(input())

a = input().split()

sum_a_rev = 0

for i in range(n):
    sum_a_rev = sum_a_rev + 1/int(a[i])

res = 1/sum_a_rev

print("{}".format(res))

Buggy python submission (verdict: Runtime Error):
n = int(input())

sum_a_rev = 0

for i in range(n):
    val = int(input())
    sum_a_rev = sum_a_rev + 1/val

res = 1/sum_a_rev

print("{}".format(res))



Fixed submission:
n = int(input())

a = input().split()

sum_a_rev = 0

for i in range(n):
    sum_a_rev = sum_a_rev + 1/int(a[i])

res = 1/sum_a_rev

print("{}".format(res))
Buggy python submission (verdict: Runtime Error):
n = int(input())

input_patterns = []

patterns = {}

def init_key():
    ini_key = []
    for i in range(26):
        ini_key.append(0)
    return ini_key

for i in range(n):
    val = input()
    input_patterns.append(val)

#input_patterns = ['acornistnt', 'peanutbomb', 'constraint']
count = 0
for inp in input_patterns:
#    key = init_key()
    #for j in range(len(inp)):
        # make [0, 0, 1, 0, 2, 3, ...]
        #       a  b  c  d  e  f  
    #    for k in range(26):
    #        if inp[j] == chr(ord('a') + k):
    #            key[k] = key[k] + 1
    
    key = sorted(inp)
    skey = ''

    for k in range(len(key)):
        skey = skey + key[k]

    if skey in patterns:
        patterns[skey] = patterns[skey] + 1
    else:
        patterns[skey] = 1

    if patterns[skey] > 1:
        count = count + patterns[skey] - 1
    
result = 0

#for skey in patterns:
#    if patterns[skey] > 1:
#        for i in range(1, int(patterns[skey])):
#            result = result + i

print('{}'.format(count))


Fixed submission:
a, b = map(int, input().split())

print('{}'.format(max(a+b, a-b, a*b)))
Buggy python submission (verdict: Runtime Error):
import math
from decimal import Decimal

a, b, c = map(int, input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if (a.sqrt + b.sqrt < c.sqrt):
    print("Yes")
else:
    print("No")



Fixed submission:
import math
from decimal import Decimal

a, b, c = map(int, input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
if (a.sqrt() + b.sqrt() < c.sqrt()):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
in_data = [list(map(int,input().split())) for i in range(3)]
print(ls)
print(in_data[0])
print(in_data[1])
print(in_data[2])
print("--------")

N = in_data[0][0]

earn_ttl = 0

for i in range(N):
    #print(i)
    value = in_data[1][i]
    cost = in_data[2][i]
    earn = value - cost
    if (earn > 0):
        earn_ttl = earn_ttl + earn
        
print(earn_ttl)

Fixed submission:
in_data = [list(map(int,input().split())) for i in range(3)]

N = in_data[0][0]

earn_ttl = 0

for i in range(N):
    value = in_data[1][i]
    cost = in_data[2][i]
    earn = value - cost
    if (earn > 0):
        earn_ttl = earn_ttl + earn
        
print(earn_ttl)
Buggy python submission (verdict: Runtime Error):
import math
import decimal
decimal.getcontext().prec = 6
a, b, c = map(int, input().split())
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
d = decimal.Decimal(math.sqrt(a*b))
if a + 2 * d +b - c < 1e-20:
    print("Yes")
else:
    print("No")

Fixed submission:
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
import math
h, w = map(int,input().split())
if h % 2 ==1 and w % 2 == 1:
    print((h*w+1)/2)
else:
# print(math.ceil(h*w/2))
print(h*w/2)

Fixed submission:
import math
h, w = map(float, input().split())
if h == 1 or w == 1:
    print(1)
else:
    print(math.ceil(h*w/2))
Buggy python submission (verdict: Runtime Error):
import math
import decimal
decimal.getcontext().prec = 6
a, b, c = map(int, input().split())
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
if a + 2 * math.sqrt(a*b) + b - c < 1e-20:
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())

d = c - a - b
if d**2 > 4*a*b and d > 0:
# if a + 2 * d +b - c < 1e-20:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import math
a, b, c = map(int, input().split())
if math.fsum(a**(1/2) + b**(1/2)) < math.fsum(c**(1/2)):
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())

d = c - a - b
if d**2 > 4*a*b and d > 0:
# if a + 2 * d +b - c < 1e-20:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import math
a, b, c = map(int, input().split())
if ((c-a-b)/2).as_integer_ratio() > (math.sqrt(a*b)).as_interger_ratio():
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())

d = c - a - b
if d**2 > 4*a*b and d > 0:
# if a + 2 * d +b - c < 1e-20:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    D = list(set(S))
    count = []*len(D)
    for i in range(len(D)):
        count[i] = S.count(D[i])
    maxi = max(count)
    for i in range(len(D)):
        if(count[i]==maxi):
            print(D[i])
main()

Fixed submission:
def main():
    a = set(map(int,input().split()))
    if (len(a)==2):
        print("Yes")
    else:
        print("No")
main()
Buggy python submission (verdict: Time Limit Exceeded):
n , k = map(int, input().split())
p = list(map(int, input().split()))
size = max(p)
sheet = [0]*size
for i in range(size):
    if (i == 0):
        sheet[i]=1
    else:
        sheet[i] = (sheet[i-1]*i + (i+1))/(i+1)
ans = 0
for i in range(n-k+1):
    total = 0
    for j in range(k):
        total += sheet[p[i+j]-1]
    if (total > ans):
        ans = total
print (ans)

Fixed submission:
def main():
    n , k = map(int, input().split())
    p = list(map(int, input().split()))
    size = max(p)
    sheet = [0]*size
    for i in range(size):
        if (i == 0):
            sheet[i]=1
        else:
            sheet[i] = (sheet[i-1]*i + (i+1))/(i+1)
    ans = 0
    total = 0
    for i in range(n-k+1):
        if (i == 0):
            for j in range(k):
                total += sheet[p[i+j]-1]
            if (total > ans):
                ans = total
        else:
            total -= sheet[p[i-1]-1]
            total += sheet[p[i+k-1]-1]
            if (total > ans):
                ans = total
    print (ans)
main()
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b%2==0):
  ans = "Even"
else:
  ans = "Odd"
printf(ans)

Fixed submission:
a, b = map(int, input().split())
ans = "Odd"
if(a*b%2==0):
	ans = "Even"
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    r = [input() for i in range(n)]
    r.sort()
    counter = 0
    tmp = 0
    for i in range(n):
        if (r[i] > tmp):
            tmp = r[i]
            counter += 1
    print(counter)
main()

Fixed submission:
def main():
    n = int(input())
    r = [int(input()) for i in range(n)]
    r.sort()
    counter = 0
    tmp = 0
    for i in range(n):
        if (r[i] > tmp):
            tmp = r[i]
            counter += 1
    print(counter)
main()
Buggy python submission (verdict: Runtime Error):
a, b, c = int(input())
print(a+b+c)

Fixed submission:
data = input()
ans = int(data[0])+int(data[1])+int(data[2])
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = a+b+c
print(ans)

Fixed submission:
data = input()
ans = int(data[0])+int(data[1])+int(data[2])
print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, c= map(int, input().split())
print(a+b+c)

Fixed submission:
data = input()
ans = int(data[0])+int(data[1])+int(data[2])
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
ls = []
count = [0]*9
for i in range(3):
    ls.extend(input().split(' '))
for i in range(int(input())):
    s = input()
    if s in ls:
        i = ls.index(s)
        count[i]="1"
flag = 0
for i in range(3):
    if count[i] == count[i+3] == count[i+6]=="1":
        flag = 1
        break
if flag == 0:
	for i in range(0,8,3):
    	if count[i] == count[i+1] == count[i+2] == "1":
       		flag = 1
        	break
if count[0]==count[4]==count[8]=="1":
    flag = 1
if count[2] == count[4] == count[6] == "1":
    flag = 1
if flag == 1:
    print("Yes")
elif flag == 0:
    print("No")

Fixed submission:
# coding: utf-8
# Your code here!
ls = []
count = [0]*9
for i in range(3):
    ls.extend(input().split(' '))
for i in range(int(input())):
    s = input()
    if s in ls:
        i = ls.index(s)
        count[i]="1"
flag = 0
for i in range(3):
    if count[i] == count[i+3] == count[i+6]=="1":
        flag = 1
        break
for i in range(0,8,3):
    if count[i] == count[i+1] == count[i+2] == "1":
        flag = 1
        break
if count[0]==count[4]==count[8]=="1":
    flag = 1
if count[2] == count[4] == count[6] == "1":
    flag = 1
if flag == 1:
    print("Yes")
elif flag == 0:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,r=map(int(input().split(' ')))
if n<10:
  print(100*(10-n)+r)
else:
  print(r)

Fixed submission:
n,r=map(int,input().split(' '))
if n<10:
  print(100*(10-n)+r)
else:
  print(r)

Buggy python submission (verdict: Runtime Error):
n,r=map(int(input().split(' ')))
if n<10:
  print(100*(10-n))
else:
  print(r)

Fixed submission:
n,r=map(int,input().split(' '))
if n<10:
  print(100*(10-n)+r)
else:
  print(r)
Buggy python submission (verdict: Runtime Error):
n,sin=map(int,input().split(' '))
while n>=sin:
    ls.append(n%sin)
    n=n//sin
ls.append(n)
print(len(ls))

Fixed submission:
n,sin=map(int,input().split(' '))
ls=[]
while n>=sin:
    ls.append(n%sin)
    n=n//sin
ls.append(n)

print(len(ls))
Buggy python submission (verdict: Runtime Error):
n=int(input())
ls=input().split(' ')
mp=[]
for i in range(min(ls),max(ls)+1):
    hp=0
    for j in range(n):
        hp+=(i-int(ls[j]))**2
    mp.append(hp)
print(min(mp))

Fixed submission:
n=int(input())
ls=input().split(' ')
mp=[]
for i in range(100):
    hp=0
    for j in range(n):
        hp+=(i-int(ls[j]))**2
    mp.append(hp)
print(min(mp))
Buggy python submission (verdict: Runtime Error):
Input_list = list(input())

print(Input_list[int(input())-1])

Fixed submission:
Input_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(Input_list[int(input())-1])
Buggy python submission (verdict: Time Limit Exceeded):
answer = []


def point_check(num):
    for i in A_dic.keys():
        A_dic[i] -= 1
    A_dic[num] += 1


N, K, Q = map(int, input().split())
A_dic = {i: K for i in range(1, N + 1)}

for j in range(Q):
    answer.append(int(input()))

for l in answer:
    point_check(l)
# print(A_dic)

for k in A_dic.values():
    if k <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
answer = []


def point_check(num):
    for i in A_dic.keys():
        A_dic[i] -= num


N, K, Q = map(int, input().split())
A_dic = {i: K for i in range(1, N + 1)}

for j in range(Q):
    answer.append(int(input()))

point_check(Q)

for l in answer:
    A_dic[l] += 1

for k in A_dic.values():
    if k <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
cnt=0
 
if w%2==0:
  print((w//2)*h)
elif w%2!=0 and w!=1:
  if h%2==0:
    print(w*(h//2))
  else:
    print(w*((h-1)//2)+(w+1)//2)
elif w==1:
  print(1)

Fixed submission:
li=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())

print(li[k-1])
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
 
if w%2==0:
  if h==1:
    print(1)
  elif:
    print((w//2)*h)
elif w==1:
  print(1)
elif w%2!=0:
  if h%2==0:
    print(w*(h//2))
  else:
    print(w*((h-1)//2)+(w+1)//2)


Fixed submission:
h,w=map(int,input().split())
 
if w%2==0:
  if h==1:
    print(1)
  else:
    print((w//2)*h)
elif w==1:
  print(1)
elif w%2!=0:
  if h%2==0:
    print(w*(h//2))
  else:
    print(w*((h-1)//2)+(w+1)//2)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
  print(0)
  
else:
  for i in range(k):
    h.remove(h[i])
  print(sum(h))

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
  print(0)
  
else:
  del h[0:k]
  print(sum(h))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int,input().split()))
cnt=0

for i in range(n):
  if all([p[i]<=p[j] for j in range(i)]):
    cnt+=1
    
print(cnt)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
min=p[0]

for i in range(n):
  if p[i]<=min:
    cnt+=1
    min=p[i]
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

array = (list(map(int, input().split())))

product_array = []

for i in range(n):
    for j in range(n - (i + 1)):
        product_array.append(array[i] * array[i + j + 1])

product_array.sort()

print(product_array[k - 1])



Fixed submission:
array = list(map(int, input().split()))

if (array[0] == array[1]) & (array[1] == array[2]) & (array[2] == array[0]):
    print('No')

elif (array[0] != array[1]) & (array[1] != array[2]) & (array[2] != array[0]):
    print('No')

else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
h, w = input().split()
n = int(h) * int(w)
a = n//2
if h==1 or w==1:
  print(1)
  
elif n%2==1:
  print(a+1)
  
else:
  print(a)


Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
k -= 1
print(l[k])
Buggy python submission (verdict: Runtime Error):
l = input()
h, w = l.split(" ")
n = h * w
a = n/2
if n%2==0:
  print(a)
  

else:
  print(a+0.5)

Fixed submission:
h, w = input().split()
n = int(h) * int(w)
a = n//2
if int(h)==1 or int(w)==1:
  print(1)
  
elif n%2==1:
  print(a+1)
  
else:
  print(a)

Buggy python submission (verdict: Runtime Error):
h, w = int(input().split(" "))
n = h * w
a = n/2
if n%2==0:
  print(a)
  
else:
  print(a+0.5)

Fixed submission:
h, w = input().split()
n = int(h) * int(w)
a = n//2
if int(h)==1 or int(w)==1:
  print(1)
  
elif n%2==1:
  print(a+1)
  
else:
  print(a)

Buggy python submission (verdict: Runtime Error):
h, w = int(input().split())
n = h * w
a = n/2
if n%2==0:
  print(a)
  
else:
  print(a+0.5)

Fixed submission:
h, w = input().split()
n = int(h) * int(w)
a = n//2
if int(h)==1 or int(w)==1:
  print(1)
  
elif n%2==1:
  print(a+1)
  
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
alpha = N * A
if B <= alpha:
  print(B)
  
elif B > alpha:
  prihnt(alpha)

Fixed submission:
N,A,B = map(int,input().split())
alpha = N*A
if B <= alpha:
  print(B)
  
else:
  print(alpha)
Buggy python submission (verdict: Runtime Error):
import math
 
h,w = list(map(int, input().split()))
 
 
 
if h%2==1 and w%2==1:
 
    a = (h//2) * w
    b = math.ceil(w/2)

 
    print(a+b)
else:
 
    print(h*w//2)

Fixed submission:
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(lst[k-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(0, a+1):
    for j in range(0, b+1):
        for k in range(0, c+1):
            if i*500 + j*100 + k*50 == x:
                count += 1

print(count)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())

X = X - A

while X >= B:
    X = X - B

print(X)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())

if (A+B) > (C+D):
    print('Left')
elif (A+B) == (C+D:
    print('Balanced')
else:
    print('Right')

Fixed submission:
A,B,C,D = map(int, input().split())

if (A+B) > (C+D):
    print('Left')
elif (A+B) == (C+D):
    print('Balanced')
else:
    print('Right')
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

p_list=[]
latest=""
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p != latest:
            if p not in p_list:
                ans+=1
                plt+=cnt[int(p)]
                p_list.insert(0,p)
                latest=p
        
print(str(ans) + " " + str(plt))



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

p_list=[0]*(n+1)
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p_list[int(p)] == 0:
                ans+=1
                plt+=cnt[int(p)]
                p_list[int(p)] += 1
        
print(str(ans) + " " + str(plt))

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

p_list=[]
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p not in p_list:
            ans+=1
            plt+=cnt[int(p)]
            p_list.insert(0,p)
        
print(str(ans) + " " + str(plt))



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

p_list=[0]*(n+1)
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p_list[int(p)] == 0:
                ans+=1
                plt+=cnt[int(p)]
                p_list[int(p)] += 1
        
print(str(ans) + " " + str(plt))

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

p_list=[]
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if p not in p_list:
        if s == "WA":
            cnt[int(p)] += 1;
        if s == "AC":
            ans+=1
            plt+=cnt[int(p)]
            p_list.append(p)
        
print(str(ans) + " " + str(plt))



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

p_list=[0]*(n+1)
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p_list[int(p)] == 0:
                ans+=1
                plt+=cnt[int(p)]
                p_list[int(p)] += 1
        
print(str(ans) + " " + str(plt))

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

p_list=[]
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p not in p_list:
            ans+=1
            plt+=cnt[int(p)]
            p_list.append(p)
        
print(str(ans) + " " + str(plt))



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

p_list=[0]*(n+1)
cnt=[0]*(n+1)
ans=0
plt=0
for i in range(m):
    p,s=map(str,input().split())
    if s == "WA":
        cnt[int(p)] += 1;
    if s == "AC":
        if p_list[int(p)] == 0:
                ans+=1
                plt+=cnt[int(p)]
                p_list[int(p)] += 1
        
print(str(ans) + " " + str(plt))