Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n =int(raw_input())
L =map(int,raw_input().split())
m =int(raw_input())
S =map(int,raw_input().split())

sum =0

for i in S:
    if i in L:
        sum +=1
print sum

Fixed submission:
raw_input()
s =set(raw_input().split())
raw_input()
print len(s &set(raw_input().split()))
Buggy python submission (verdict: Runtime Error):
for i in range(9):
	for j in range(9):
		print str(i+1)+"x"+str(j+1)+"="+str(i*j)

Fixed submission:
for i in range(1,10):
	for j in range(1,10):
		print str(i)+'x'+str(j)+'='+str(i*j)
Buggy python submission (verdict: Runtime Error):
a=input()
for i in range(2):
	x=input()
	y=input()
	print x+y

Fixed submission:
a=input()
for i in range(a):
	x=input()
	y=input()
	if len(str(x+y))>80:
		print "overflow"
	else:
		print x+y

Buggy python submission (verdict: Runtime Error):
a=input()
for i in range(2):
	x=input()
	y=input()
	if len(x+y)>80:
		print "overflow"
	else:
		print x+y

Fixed submission:
a=input()
for i in range(a):
	x=input()
	y=input()
	if len(str(x+y))>80:
		print "overflow"
	else:
		print x+y
Buggy python submission (verdict: Runtime Error):
a = []
while True:
    s = int(input())
    if s != 0:
        a.append(s)
    else:
        print(a.pop())

Fixed submission:
a = []
while True:
    try:
        s = int(input())
    except:
        break

    if s != 0:
        a.append(s)
    else:
        print(a.pop())
Buggy python submission (verdict: Runtime Error):
s=list(map(int, input().split()))
s.sort()
s.reverse()

for i in s:
    print(i, end="")
    if i != s[-1]:
        print(" ", end="")

print()

Fixed submission:
l = list(map(int, input().split()))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl))

Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split))
l.sort()
l.reverse()
print(" ".join(map(str, l)))

Fixed submission:
l = list(map(int, input().split()))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl))

Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl))

Fixed submission:
l = list(map(int, input().split()))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl))

Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split))

Fixed submission:
l = list(map(int, input().split()))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl))
Buggy python submission (verdict: Runtime Error):
s=int(input())
ans=1
for i in range(1,s+1)
    ans*=i

print(ans)

Fixed submission:
s=int(input())
ans=1
for i in range(1,s+1):
    ans *= i

print(ans)
Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
for _ in range(n):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if ((b-d)/(a-c)) == ((f-h)/(e-g)):
        print("Yes")
    else:
        print("No")

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    try:
        i = (b-d)/(a-c)
    except:
        i = 90

    try:
        j = (f-h)/(e-g)
    except:
        j = 90
    
    if i == j:
        print("Yes")
    else:
        print("No")

input()

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (d-b)*(g-e)) < 1e-10:
        print("No")
    else:
        print("Yes")

input()

Fixed submission:
for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        l = list(map(int, input().split(",")))
    except ValueError:
        break
    sum_l = sum(l[:10])
    M = sum_l*l[10]/(l[10] + l[11])
    for i in range(10):
        if M <= 0:
            print(i)
            break
        M -= l[i]




Fixed submission:
while True:
    try:
        l = list(map(int, input().split(",")))
    except:
        break
    sum_l = sum(l[:10])
    M = sum_l*l[10]/(l[10] + l[11])
    for i in range(10):
        M -= l[i]
        if M <= 0:
            print(i+1)
            break
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        l = []
        for i in range(8):
            l += list(map(int, input()))
    except:
        break

    cnt = 0
    for i in range(len(l)):
        if l[i]:
            cnt += i
    cnt -= l.index(1) * 4

    if cnt == 18:
        ans = "A"
    elif cnt == 48:
        ans = "B"
    elif cnt == 6:
        ans = "C"
    elif cnt == 34:
        ans = "D"
    elif cnt == 20:
        ans = "E"
    elif cnt == 34:
        ans = "F"
    else:
        ans = "G"

    print(ans)



Fixed submission:
ans = {"1100000011": "A", "1000000010000000100000001": "B",
       "1111": "C", "1000000110000001": "D",
       "11000000011": "E", "100000001100000001": "F", "110000011": "G"}
while True:
    try:
        st = "".join([input() for _ in range(8)])

        st = st[st.find("1"): st.rfind("1")+1]
        for k, v in ans.items():
            if st == k:
                print(v)
                break
        input()
    except:
        break
Buggy python submission (verdict: Runtime Error):
def pri(s,n):
    tab=[i for i in range(n+1) if s[i] and i>=2]
    return(tab)
  
s=[True for _ in range(999999+1)]
i=2
while i**2<=999999:
    if s[i]:
        j=i*2
        while j<=999999:
            s[j]=False
            j+=i
    i+=1

s=pri(s,10000)
while True:
    n = int(input())
    if n == 0: break
    sum = 0

    for i in range(n):
        sum += s[i]
    print(sum)

Fixed submission:
import math
def pri(n):
    l =[True] * n
    l[0] = l[1] = False
    for i in range(2,n):
        if l[i]:
            for j in range(i*2, n, i):
                l[j] = False
    return l
n=105000
s=pri(n)
l=[i for i in range(n) if s[i]]
while True:
    n = int(input())
    if n == 0: break
    print(sum(l[:n]))
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    sum = 0
    s = list(str(a/b))
    for i in s[2:2+n]:
        sum += int(i)

    print(sum)

Fixed submission:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:x+n]:
        sum += int(i)

    print(sum)

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    sum = 0
    s = list(str(a/b))
    for i in s[2:2+n]:
        sum += int(i)

    print(sum)

Fixed submission:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:x+n]:
        sum += int(i)

    print(sum)

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a, b, n = map(int, input().split())
        s = list(str(a/b))
    except:
        break

    sum = 0
    for i in s[2:2+n]:
        sum += int(i)

    print(sum)

Fixed submission:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:x+n]:
        sum += int(i)

    print(sum)

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    for i in s[2:2+n]:
        sum += int(i)

    print(sum)

Fixed submission:
while True:
    try:
        a, b, n = map(int, input().split())
    except:
        break

    s = str(a/b)
    sum = 0
    x = s.index(".")+1
    for i in s[x:x+n]:
        sum += int(i)

    print(sum)
Buggy python submission (verdict: Runtime Error):
while True:
    try:
        a, b, c = map(int, input().split())
    except:
        break
    l=[True] * 11
    l[a] = l[b] = l[c] = False
    sum = a + b
    over = 0

    fpr i in range(1,11):
        if l[i]:
            if sum + i >= 20:
                over += 1

    if over / 7 < 0.5:
        print("YES")
    else:
        print("NO")

Fixed submission:
while True:
    try:
        a, b, c = map(int, input().split())
    except:
        break

    l=[True] * 11
    l[a] = l[b] = l[c] = False
    sum = a + b
    over = 0

    for i in range(1,11):
        if l[i]:
            if sum + i > 20:
                over += 1

    if over / 7 < 0.5:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
t=int(input())
print("{:0<2}:{0<2}:{:0<2}".format(t//60**2,t%60**2//60,t%60**2%60))

Fixed submission:
t=int(input())
print("{}:{}:{}".format(t//60**2,t%60**2//60,t%60**2%60))

Buggy python submission (verdict: Runtime Error):
t=int(input())
print("{:0>2}:{0>2}:{:0>2}".format(t//60**2,t%60**2//60,t%60**2%60))

Fixed submission:
t=int(input())
print("{}:{}:{}".format(t//60**2,t%60**2//60,t%60**2%60))
Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
print("{:6f} {:6f}".format(r**2*math.pi,r*2*math.pi))

Fixed submission:
import math
r=float(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))

Fixed submission:
import math
r=float(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))

Buggy python submission (verdict: Runtime Error):
r=int(input())
print("{:0.6f} {:0.6f}".format(r**2*3.14159265,r*2*3.14159265))

Fixed submission:
import math
r=float(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
print("{:6f} {:6f}".format(r*r*math.pi,r*2*math.pi))

Fixed submission:
import math
r=float(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))

Buggy python submission (verdict: Runtime Error):
import math
r=int(input())
print("{} {}".format(r*r*math.pi,r*2*math.pi))

Fixed submission:
import math
r=float(input())
print("{:0.6f} {:0.6f}".format(r**2*math.pi,r*2*math.pi))
Buggy python submission (verdict: Runtime Error):
for i=0;i<9;i++
 for j=0;j<9;j++;j++
  print(i+1,"x",j+1"=",(i+1)*(j+1)),
 print("")


Fixed submission:
for i in range(1,10):
	for j in range(1,10):
		print(i,"x",j,"=",i*j,sep="")

Buggy python submission (verdict: Runtime Error):
for i=0;i<9;i++
 for j=0;j<9;j++;j++
  print(i+1,"x",j+1"=",(i+1)*(j+1),)
 print("")


Fixed submission:
for i in range(1,10):
	for j in range(1,10):
		print(i,"x",j,"=",i*j,sep="")
Buggy python submission (verdict: Runtime Error):
    import math
    def int_ceil(src, range):
        return int(math.ceil(src/float(range)) * range)
    
    def main():
        week = int(input())
        debt = 100000
        for _ in range(week):
            risi = debt * 0.05
            debt = int_ceil(debt + risi, 1000)
        print(debt)
    
    if __name__ == "__main__":
        main()


Fixed submission:
import math
def int_ceil(src, range):
    return int(math.ceil(src/float(range)) * range)

def main():
    week = int(input())
    debt = 100000
    for _ in range(week):
        risi = debt * 0.05
        debt = int_ceil(debt + risi, 1000)
    print(debt)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
i=int(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Fixed submission:
import math
i=float(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Buggy python submission (verdict: Runtime Error):
import math
i=int(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Fixed submission:
import math
i=float(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Buggy python submission (verdict: Runtime Error):
import math
i=int(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Fixed submission:
import math
i=float(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Buggy python submission (verdict: Runtime Error):
import math
i=float(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)

Fixed submission:
import math
i=float(raw_input())
print "%.6f %.6f" % (i*i*math.pi,2*i*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
def fib(n):
    if n == 0:
        return 1
    if n == 1:
        return 1
    return fib(n-1) + fib(n-2)

n = int(input())
print(fib(n))

Fixed submission:
def fib(n):
    if n == 0:
        return 1
    if n == 1:
        return 1
    if F[n] > 0:
        return F[n]
    F[n] = fib(n-1) + fib(n-2)
    return F[n]

n = int(input())
F = [0 for i in range(n+1)]
print(fib(n))
Buggy python submission (verdict: Time Limit Exceeded):
import functools

n = int(input())
R = [int(input()) for i in range(n)]

benefit = [[rj - ri for j,rj in enumerate(R[i:]) if j+i > i] for i,ri in enumerate(R)]
print(max(functools.reduce(lambda a,b: a+b, benefit)))

Fixed submission:
n = int(input())
R = [int(input()) for i in range(n)]

minv = float('inf')
maxv = -float('inf')
for r in R:
    maxv = max(maxv, r-minv)
    minv = min(minv, r)
print(maxv)
Buggy python submission (verdict: Time Limit Exceeded):
nq = str(input()).split()
n = int(nq[0])
q = int(nq[1])
p = [str(input()).split() for i in range(n)]
p = [(str(i[0]), int(i[1]), 0) for i in p]
ans = []
while len(p) != 0:
    t = p.pop(0)
    if t[1] > q:
        p = [(s[0], s[1], s[2]+q) for s in p]
        p.append((t[0], t[1]-q, t[2]+q))
    elif t[1] <= q:
        p = [(s[0], s[1], s[2]+t[1]) for s in p]
        ans.append((t[0], t[2] + t[1]))
for t in ans:
    print('{0} {1}'.format(t[0], t[1]))

Fixed submission:
nq = str(input()).split()
n = int(nq[0])
q = int(nq[1])
p = [str(input()).split() for i in range(n)]
p = [(str(i[0]), int(i[1])) for i in p]
ans = []
time = 0
while len(p) != 0:
    t = p.pop(0)
    if t[1] > q:
        #p = [(s[0], s[1], s[2]+q) for s in p]
        time += q
        p.append((t[0], t[1]-q))
    elif t[1] <= q:
        #p = [(s[0], s[1], s[2]+t[1]) for s in p]
        ans.append((t[0], t[1]+time))
        time += t[1]
for t in ans:
    print('{0} {1}'.format(t[0], t[1]))
Buggy python submission (verdict: Runtime Error):
[a,b,c] = raw_input().split(' ')
a = int(a)
b = int(b)
c = int(c)
t = sort([a,b,c])
print t[0],t[1],t[2]

Fixed submission:
[a,b,c] = raw_input().split(' ')
a = int(a)
b = int(b)
c = int(c)
t = 0
if a > b:
    t = a
    a = b
    b = t
if b > c:
    t = b
    b = c
    c = t
if a > b:
    t = a
    a = b
    b = t
print a,b,c
Buggy python submission (verdict: Runtime Error):
r = float(raw_input())
print "%0.6f %0.6f" % (r * r * pi, 2 * pi * r)

Fixed submission:
r = float(raw_input())
P = 3.14159265359
print "%0.6f %0.6f" % (r * r * P, 2 * P * r)
Buggy python submission (verdict: Runtime Error):
key = raw_input().upper()
c = ''
while True:
    s = raw_input()
    if s == 'END_OF_TEXT':
        break
    c = c + ' ' + s.upper()
    
total = 0
ks = key[0]
for i in range(len(c)):
    if c[i] == ks:
        cnt = 0
        for k in range(len(key)):
            if c[i+k] == key[k]:
                cnt = cnt + 1
        if cnt == len(key):
               total = total + 1
                
print total

Fixed submission:
key = raw_input().upper()
c = ''
while True:
    s = raw_input()
    if s == 'END_OF_TEXT':
        break
    c = c + ' ' + s.upper()
   
cs = c.split()
total = 0
for w in cs:
    if w == key:
        total = total + 1
        
print total
Buggy python submission (verdict: Runtime Error):
while True:
	n = int(input())
	ans = [0 for _ in range(7)]
	for _ in range(n):
		age = int(input())
		if age < 10:
			ans[0] += 1
		elif age < 20:
			ans[1] += 1
		elif age < 30:
			ans[2] += 1
		elif age < 40:
			ans[3] += 1
		elif age < 50:
			ans[4] += 1
		elif age < 60:
			ans[5] += 1
		else:
			ans[6] += 1
	for a in ans:
		print(a)

Fixed submission:
while True:
	n = int(input())
	if n == 0: break
	ans = [0 for _ in range(7)]
	for _ in range(n):
		age = int(input())
		if age < 10:
			ans[0] += 1
		elif age < 20:
			ans[1] += 1
		elif age < 30:
			ans[2] += 1
		elif age < 40:
			ans[3] += 1
		elif age < 50:
			ans[4] += 1
		elif age < 60:
			ans[5] += 1
		else:
			ans[6] += 1
	for a in ans:
		print(a)
Buggy python submission (verdict: Runtime Error):
L = []
while True:
    (a, op, b) = map(str, raw_input().split())
    A, B = int(a), int(b)
    if A == 0 and op == '?' and B == 0:
        break
    else:
        if op == '+':
            L.append(A + B)
        elif op == '-':
            L.append(A - B)
        elif op == '*':
            L.append(A * B)
        else:
            L.append(A / B)

for x in range(len(L)):
    print L[x]

Fixed submission:
L = []
while True:
    (a, op, b) = map(str, raw_input().split())
    A, B = int(a), int(b)
    if op == '?':
        break
    else:
        if op == '+':
            L.append(A + B)
        elif op == '-':
            L.append(A - B)
        elif op == '*':
            L.append(A * B)
        else:
            L.append(A / B)

for x in range(len(L)):
    print L[x]
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

import numpy as np

def GCD(a, b):
	dummy1 = max(a, b)
	dummy2 = min(a, b)
	while True:
		dummy = dummy1 % dummy2
		dummy1 = dummy2
		dummy2 = dummy
		if(dummy == 0):
			break

	return dummy1

while True:
	N = input()
	if not N:
		break
	cost = []
	E = []
	root = N * (N - 1) / 2
	for i in range(N):
		S = raw_input().split()
		c1, c2, e1, e2 = list(map(int,S))
		cost.append((c1, c2))
		root -= e1 + e2
		e1 -= 1
		e2 -= 1
		E.append((e1, e2))
	def nums(e):
		N_lst1 = []
		N_lst2 = []
		val_lst1 = []
		val_lst2 = []
		if E[e][0] != -1:
			N_lst1, val_lst1 = nums(E[e][0])
		else:
			N_lst1 = [1]
			val_lst1 = []
		
		if E[e][1] != -1:
			N_lst2, val_lst2 = nums(E[e][1])
		else:
			N_lst2 = [1]
			val_lst2 = []
		
		mul1 = cost[e][0]
		for num in val_lst1:
			mul1 *= num
		mul2 = cost[e][1]
		for num in val_lst2:
			mul2 *= num
		for i in range(len(N_lst1)):
			N_lst1[i] *= mul2
		for i in range(len(N_lst2)):
			N_lst2[i] *= mul1
		
		return N_lst1 + N_lst2, val_lst1 + val_lst2 + [cost[e][0] + cost[e][1]]
	N_lst, v_lst = nums(root - 1)
	#print N_lst
	num_GCD = N_lst[0]
	for num in N_lst:
		num_GCD = GCD(num, num_GCD)
	
	for i in range(len(N_lst)):
		N_lst[i] //= num_GCD
	#print N_lst
	print sum(N_lst)
	


Fixed submission:
#!/usr/bin/env python

def GCD(a, b):
	dummy1 = max(a, b)
	dummy2 = min(a, b)
	while True:
		dummy = dummy1 % dummy2
		dummy1 = dummy2
		dummy2 = dummy
		if(dummy == 0):
			break

	return dummy1

while True:
	N = input()
	if not N:
		break
	cost = []
	E = []
	root = N * (N - 1) / 2
	for i in range(N):
		S = raw_input().split()
		c1, c2, e1, e2 = list(map(int,S))
		cost.append((c1, c2))
		root -= e1 + e2
		e1 -= 1
		e2 -= 1
		E.append((e1, e2))
	def nums(e):
		N_lst1 = []
		N_lst2 = []
		val_lst1 = []
		val_lst2 = []
		if E[e][0] != -1:
			N_lst1, val_lst1 = nums(E[e][0])
		else:
			N_lst1 = [1]
			val_lst1 = []
		
		if E[e][1] != -1:
			N_lst2, val_lst2 = nums(E[e][1])
		else:
			N_lst2 = [1]
			val_lst2 = []
		
		mul1 = cost[e][0]
		for num in val_lst1:
			mul1 *= num
		mul2 = cost[e][1]
		for num in val_lst2:
			mul2 *= num
		for i in range(len(N_lst1)):
			N_lst1[i] *= mul2
		for i in range(len(N_lst2)):
			N_lst2[i] *= mul1
		
		return N_lst1 + N_lst2, val_lst1 + val_lst2 + [cost[e][0] + cost[e][1]]
	N_lst, v_lst = nums(root - 1)
	#print N_lst
	num_GCD = N_lst[0]
	for num in N_lst:
		num_GCD = GCD(num, num_GCD)
	
	for i in range(len(N_lst)):
		N_lst[i] //= num_GCD
	#print N_lst
	print sum(N_lst)
Buggy python submission (verdict: Runtime Error):
while True:
    n, w = map(int, raw_input().split())
    if n == 0:
        break
    lst = []
    for i in range(n):
        num = input()
        num /= w
        lst.append(num)

    ans = 0.0
    cnt = [0 for i in range(100)]
    for i in range(n):
        num = max_num - lst[i]
        ans += num
        cnt[num] += 1
    
    print ans / max(lst) / max(cnt) + 0.01


Fixed submission:
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

while True:
    n, w = map(int, raw_input().split())
    if n == 0:
        break
    lst = []
    for i in range(n):
        num = input()
        num /= w
        lst.append(num)
    max_num = max(lst)

    ans = 0.0
    cnt = [0 for i in range(100)]
    for i in range(n):
        num = max_num - lst[i]
        ans += num
        cnt[num] += 1
    
    max_cnt = max(cnt)
    print ans / max_num / max_cnt + 0.01
    pass