Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
s = 2*x/(a*b)
if s < a:
	print(math.atan(b/s)/math.pi*180)
else:
	s = 2*b-2*x/(a**2)
	print(90-math.atan(a/s)/math.pi*180)

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

if b*a**2 == x:
	print(0)
	exit()

s = 2*x/(a*b)
if s < a:
	print(math.atan(b/s)/math.pi*180)
else:
	s = 2*b-2*x/(a**2)
	print(90-math.atan(a/s)/math.pi*180)
Buggy python submission (verdict: Time Limit Exceeded):
def zalgo(s):
	lens = len(s)
	a = [0 for _ in range(lens)]
	maxa = 0
	saisho = -1
	saigo = -1
	for i in range(lens):
		cnt = 0
		j = 0
		if saisho != -1:
			j = min(a[i-saisho], max(0, saigo-i))
		while i+j < lens and s[i+j] == s[j]:
			cnt += 1
			j += 1
		if saigo < i+j:
			saigo = i+j
			saisho = i
		a[i] = cnt
		if cnt > maxa and cnt <= i and i != 0:
			maxa = cnt
	return maxa


n = int(input())
s = input()

ans = 0
for i in range(n):
	k = zalgo(s[i:])
	if ans < k:
		ans = k
print(ans)

Fixed submission:
n = int(input())
s = input()

tmp = 0
for i in range(n-1):
	for j in range(i+tmp+1, n):
		if not s[i:j] in s[j:]:
			break
	tmp = max(tmp, j-i-1)

"""
二重ループ型だが実際はO(ans N)でうごく.
"""

print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
def zalgo(s):
	lens = len(s)
	a = [0 for _ in range(lens)]
	maxa = 0
	saisho = -1
	saigo = -1
	for i in range(lens):
		cnt = 0
		j = 0
		if saisho != -1:
			j = min(a[i-saisho], max(0, saigo-i))
		while i+j < lens and s[i+j] == s[j]:
			cnt += 1
			j += 1
		if saigo < i+j:
			saigo = i+j
			saisho = i
		a[i] = cnt
		if cnt > maxa and cnt <= i and i != 0:
			maxa = cnt
	return maxa


n = int(input())
s = input()

ans = 0
for i in range(n):
	k = zalgo(s[i:])
	if ans < k:
		ans = k
print(ans)

Fixed submission:
n = int(input())
s = input()

tmp = 0
for i in range(n-1):
	for j in range(i+tmp+1, n):
		if not s[i:j] in s[j:]:
			break
	tmp = max(tmp, j-i-1)

"""
二重ループ型だが実際はO(ans N)でうごく.
"""

print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import collections
n=int(input())
s=[sorted(input()) for _ in range(n)]
c=[str(collections.Counter(s[i])) for i in range(n)]
k=collections.Counter(c).values()
ans = 0
for i in k:
	if i >= 2:
		ans += math.factorial(i)//2//math.factorial(i-2)
print(ans)

Fixed submission:
import math
import collections
n=int(input())
s=[sorted(input()) for _ in range(n)]
c=[str(collections.Counter(s[i])) for i in range(n)]
k=collections.Counter(c).values()
ans = 0
for i in k:
	if i >= 2:
		ans += math.factorial(i)//2//math.factorial(i-2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = input()
p = 10 ** 9 + 7
dp = np.zeros((len(s)+1, 13), dtype=np.int64)
dp[0][0] = 1
for cnt, i in enumerate(reversed(s)):
	if i == "?":
		for f in range(10):
			k = pow(10, cnt, 13)*f%13
			for j in range(13):
				dp[cnt+1][(j+k)%13] = (dp[cnt+1][(j+k)%13] + dp[cnt][j])%p
	else:
		targ = int(i)
		k = pow(10, cnt, 13)*targ%13
		for j in range(13):
			dp[cnt+1][(j+k)%13] = (dp[cnt+1][(j+k)%13] + dp[cnt][j])%p
#print(dp)
print(dp[len(s)][5])

Fixed submission:
from collections import defaultdict
s = input()
lens = len(s)
"""
1, 10, 100～900に対して13で割って5余るものは存在する？
"""
modl = [[] for i in range(len(s))]
modl[0] = [i for i in range(10)]
for i in range(1, len(s)):
	modl[i] = [(modl[i-1][j]*10)%13 for j in range(10)]
mod = 10**9+7

unta = defaultdict(lambda: 0)
unta[0] += 1
for i, j in enumerate(s[::-1]):
	newunta = defaultdict(lambda: 0)
	if j != "?":
		a = modl[i][int(j)]
		for k in range(13):
			newunta[(k+a)%13] = (newunta[(k+a)%13] + unta[k]) % mod
	else:
		for l in range(10):
			a = modl[i][l]
			for k in range(13):
				newunta[(k+a)%13] = (newunta[(k+a)%13] + unta[k]) % mod
	unta = newunta

print(unta[5] % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0 for _ in range(n)]
for i in range(n):
	a[i] = int(input())
for i in range(n):
	b = [a[j] for j in range(n)]
	b[i] = 0
	print(max(b))

Fixed submission:
n = int(input())
a = [0 for _ in range(n)]
for i in range(n):
	a[i] = int(input())
maxa = max(a)
basho = a.index(maxa)
a[basho] = 0
for i in range(n):
	if i != basho:
		print(maxa)
	else:
		print(max(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = []
c = [0 for _ in range(n)]

def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

#半分より上は, すべてa通り.
for i in range(1,n+1)[::-1]:
	if c[i-1] % 2 != a[i-1]:
		b.append(i)
		for j in make_divisors(i):
			c[j-1] += 1
print(len(b))
print(" ".join(list(map(str, b))))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = []
c = [0 for _ in range(n)]

def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

#半分より上は, すべてa通り.
for i in range(1,n+1)[::-1]:
	if c[i-1] % 2 != a[i-1]:
		b.append(i)
		for j in make_divisors(i):
			c[j-1] += 1
print(len(b))
print(" ".join(list(map(str, b))))

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

def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

#半分より上は, すべてa通り.
for i in range(1,n+1)[::-1]:
	if len(c[i-1]) % 2 != a[i-1]:
		b.append(i)
		for j in make_divisors(i):
			c[j-1].append(0)
print(len(b))
print(" ".join(list(map(str, b))))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = []
c = [0 for _ in range(n)]

def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

#半分より上は, すべてa通り.
for i in range(1,n+1)[::-1]:
	if c[i-1] % 2 != a[i-1]:
		b.append(i)
		for j in make_divisors(i):
			c[j-1] += 1
print(len(b))
print(" ".join(list(map(str, b))))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
y = [0 for _ in range(n)]
suma = sum(a)
ans = []
for i in range(n):
	t = 2*sum([a[j%n] for j in range(i, i+n, 2)])-suma
	ans.append(str(t))
print(" ".join(ans))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
y = [0 for _ in range(n)]
suma = sum(a)
ans = []
memo1 = 2*sum([a[j%n] for j in range(0, 0+n, 2)])-suma
memo2 = 2*sum([a[j%n] for j in range(1, 1+n, 2)])-suma
ans.append(str(memo1))
ans.append(str(memo2))
# (i+n-2)%n - (i-2)%n
for i in range(2,n):
	if i%2 == 0:
		memo1 = memo1 + 2*(a[(i+n-1)%n] - a[(i-2)%n])
		ans.append(str(memo1))
	else:
		memo2 = memo2 + 2*(a[(i+n-1)%n] - a[(i-2)%n])
		ans.append(str(memo2))
print(" ".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from numpy.linalg import solve
n = int(input())
a = list(map(int,input().split()))
l = [[0 for j in range(n)] for _ in range(n)]

for i in range(n):
	if i != n-1:
		l[i][i], l[i][i+1] = 1/2, 1/2
	else:
		l[i][0], l[i][i] = 1/2, 1/2

left = l
right = a

ans = solve(left,right)
print(" ".join(list(map(str,list(map(int,ans))))))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
y = [0 for _ in range(n)]
suma = sum(a)
ans = []
memo1 = 2*sum([a[j%n] for j in range(0, 0+n, 2)])-suma
memo2 = 2*sum([a[j%n] for j in range(1, 1+n, 2)])-suma
ans.append(str(memo1))
ans.append(str(memo2))
# (i+n-2)%n - (i-2)%n
for i in range(2,n):
	if i%2 == 0:
		memo1 = memo1 + 2*(a[(i+n-1)%n] - a[(i-2)%n])
		ans.append(str(memo1))
	else:
		memo2 = memo2 + 2*(a[(i+n-1)%n] - a[(i-2)%n])
		ans.append(str(memo2))
print(" ".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n,m = map(int, input().split())
cnt = [0 for _ in range(n)]
for i in range(m):
	l,r = map(int, input().split())
	for i in range(l-1, r):
		cnt[i] += 1
c = collections.Counter(cnt)
print(c[m])

Fixed submission:
n,m = map(int, input().split())
minn, maxn = 1, n
for i in range(m):
	l, r = map(int,input().split())
	minn, maxn = max(minn, l), min(maxn, r)
print(max(maxn-minn+1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
u = set(range(1, n+1))
for i in range(m):
	l,r = map(int, input().split())
	u = u & set(range(l, r+1))
print(len(u))

Fixed submission:
n,m = map(int, input().split())
minn, maxn = 1, n
for i in range(m):
	l, r = map(int,input().split())
	minn, maxn = max(minn, l), min(maxn, r)
print(max(maxn-minn+1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
u = set(range(1, n+1))
for i in range(m):
	l,r = map(int, input().split())
	u = u & set(range(l, r+1))
print(len(u))

Fixed submission:
n,m = map(int, input().split())
minn, maxn = 1, n
for i in range(m):
	l, r = map(int,input().split())
	minn, maxn = max(minn, l), min(maxn, r)
print(max(maxn-minn+1, 0))
Buggy python submission (verdict: Runtime Error):
import numpy as np
ans = 0
r,g,b,n = map(int,input().split())
for i in range(n//r+1):
	targ = i*r
	for j in range(n//g+1):
		if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) >= 0:
			ans += 1
print(ans)

Fixed submission:
ans = 0
r,g,b,n = map(int,input().split())
for i in range(n//r+1):
	targ = i*r
	for j in range(n//g+1):
		if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) >= 0:
			ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)[::-1]
"""
あるn以外の最大公約数が, 最大になる組み合わせ
7 6 8 -> gcd(7,6)=1, gcd(6,8)=2 gcd(7,8)=1
12 15 18 -> gcd(12,15)=3, gcd(15,18)=3, gcd(12, 18)=6
1 2 4 6 -> 2,4,6のやつがでかい
"""
if n == 2:
	print(a[0])
	exit()
ans = 0
for i in range(n):
	tmp = 0
	for j in range(n):
		if j != i:
			tmp = gcd(tmp, a[j])
		if tmp < ans:
			break
	ans = max(tmp, ans)
print(ans)

Fixed submission:
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
"""
あるn以外の最大公約数が, 最大になる組み合わせ
7 6 8 -> gcd(7,6)=1, gcd(6,8)=2 gcd(7,8)=1
12 15 18 -> gcd(12,15)=3, gcd(15,18)=3, gcd(12, 18)=6
1 2 4 6 -> 2,4,6のやつがでかい
"""
l = [0 for _ in range(n+1)]
tmp = 0
for i in range(n):
	tmp = gcd(tmp, a[i])
	l[i+1] = tmp
r = [0 for _ in range(n+1)]
a = a[::-1]
tmp = 0
for i in range(n):
	tmp = gcd(tmp, a[i])
	r[n-i-1] = tmp

m=[gcd(l[i],r[i+1]) for i in range(n)]
print(max(m))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import fractions
n=int(input())
a=list(map(int,input().split()))
ans = 10**18
for i,j in itertools.combinations(a,2):
	ans = min(ans, fractions.gcd(i, j))
print(ans)

Fixed submission:
import itertools
import fractions
n=int(input())
a=list(map(int,input().split()))
a.sort()
mina=a[0]
ans = 10**18
for i in range(n):
	ans = min(ans, fractions.gcd(a[i], mina))
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())
 
dp = [[0 for i in range(k+1)] for j in range(n+1)]
 
for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
val1 = [0 for _ in range(n)]
val2 = [0 for _ in range(n)]
val = [0 for _ in range(n)]
for i in range(n):
	if i + 1 <= n - 1:
		val1[i] = abs(h[i] - h[i + 1])
	if i + 2 <= n - 1:
		val2[i] = abs(h[i] - h[i + 2])
for i in range(n):
	if i-2 >= 0:
		val[i] = min([val[i-1]+val1[i-1], val[i-2]+val2[i-2]])
	elif i-1 >= 0:
		val[i] = val[i-1]+val1[i-1]
print(val[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int, input().split()))
v = [0 for _ in range(n)]
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int, input().split()))
v = [0 for _ in range(n)]
for i in range(1,n):
	v[i] = min([v[j] + abs(h[j]-h[i]) for j in range(max(0, i-k), i)])
print(v[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int, input().split()))
v = [0 for _ in range(n)]
for i in range(n):
	if i-1 >= 0:
		v[i] = min([v[i-j-1] + abs(h[i] - h[i-j-1]) for j in range(min([k, i]))])
print(v[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int, input().split()))
val = [[0 for i in range(n)] for j in range(k)]
v = [0 for _ in range(n)]

for i in range(n):
	for j in range(k):
		if i+j+1 <= n-1:
			val[j][i] = abs(h[i+j+1] - h[i])

for i in range(n):
	if i-1 >= 0:
		v[i] = min([v[i-j-1] + val[j][i-j-1] for j in range(min([k, i]))])
print(v[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int, input().split()))
v=[0]*n
for i in range(1,n):
	u = h[i]
	v[i] = min([v[j] + abs(h[j]-u) for j in range(max(0, i-k), i)])
print(v[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())
 
dp = [[0 for i in range(k+1)] for j in range(n+1)]
 
for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())

dp = [[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Buggy python submission (verdict: Runtime Error):
import numpy as np

n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())

dp = np.full((n+1, k+1), 0, dtype=np.int64)

for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())

dp = [[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())

dp = np.full((n+1, k+1), 0, dtype=np.int64)

for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())

dp = [[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
k=[[] for _ in range(n)]
p=[0 for _ in range(m)]
y=[0 for _ in range(m)]
for i in range(m):
	a,b = map(int,input().split())
	y[i] = b
	p[i] = a
	k[a-1].append(b)
for i in range(n):
	k[i].sort()
ansl = []
for i in range(m):
	d1 = str(p[i]).zfill(6)
	d2 = str(k[p[i]-1].index(y[i])+1).zfill(6)
	ansl.append(d1+d2)
print("\n".join(ansl))

Fixed submission:
import bisect
n,m=map(int,input().split())
k=[[] for _ in range(n)]
p=[0 for _ in range(m)]
y=[0 for _ in range(m)]
for i in range(m):
	a,b = map(int,input().split())
	y[i] = b
	p[i] = a
	k[a-1].append(b)
for i in range(n):
	k[i].sort()
ansl = []
for i in range(m):
	d1 = str(p[i]).zfill(6)
	d2 = str(bisect.bisect_right(k[p[i]-1], y[i])).zfill(6)
	ansl.append(d1+d2)
print("\n".join(ansl))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ansl = []
if n == 0:
	print(0)
    exit()
while n != 0:
	if n % 2 == 1:
		ansl.append("1")
		n -= 1
	else:
		ansl.append("0")
	n //= -2
print("".join(ansl)[::-1])

Fixed submission:
n = int(input())
ansl = []
if n == 0:
	print(0)
	exit()
while n != 0:
	if n % 2 == 1:
		ansl.append("1")
		n -= 1
	else:
		ansl.append("0")
	n //= -2
print("".join(ansl)[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

d,g=map(int,input().split())
p=[0 for _ in range(d)]
c=[0 for _ in range(d)]
l=[[] for _ in range(d)]

for i in range(d):#値を取得！
	p[i],c[i]=map(int,input().split())

for i in range(d):#リストつくる！
	for j in range(p[i]+1):
		l[i].append((i+1)*100*j)
	l[i][p[i]] += c[i]

r = list(itertools.product(*l))
m = len(r)
for i in r:
	if sum(i)>=g:
		count = 0
		for j in range(d):
			count += l[j].index(i[j])
		if count <= m:
			m = count
print(m)

Fixed submission:
d,g=map(int,input().split())
p=[0 for _ in range(d)]
c=[0 for _ in range(d)]
ans = 100**10

for i in range(d):#値を取得！
	p[i],c[i]=map(int,input().split())

for i in range(2**d):
	score = 0
	count = 0
	horyu = 0
	for j in range(d):
		if ((i >> j) & 1):
			score += (j+1)*p[j]*100 + c[j]
			count += p[j]
		else:
			horyu = j #あとまわし(最高点数の1種類)
	for i in range(p[horyu]):
		if score >= g and count < ans:
			ans = count
		score += (horyu + 1) * 100
		count += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def pfact(m):
	pf = {}
	for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	if m>1 : pf[m]=1
	return pf

n = int(input())
a = list(map(int,input().split()))
ans = 0
for j in a:
	targ = pfact(j)
	ans += targ.get(2, 0)
print(ans)

Fixed submission:
def twos(m):
	rt = 0
	while m%2 == 0:
		m //= 2
		rt += 1
	return rt

n = int(input())
a = list(map(int,input().split()))
ans = 0
for j in a:
	ans += twos(j)
print(ans)
Buggy python submission (verdict: Runtime Error):
import statistics
n = int(input())
x = list(map(int,input().split()))
a = x[:]
a.sort()
kijun = a[n//2]
a1 = a[n//2]
a2 = a[n//2-1]
for i in x:
	if i < kijun:
		print(a1)
	else:
		print(a2)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
a = x[:]
a.sort()
kijun = a[n//2]
a1 = a[n//2]
a2 = a[n//2-1]
for i in x:
	if i < kijun:
		print(a1)
	else:
		print(a2)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ikeru = [[] for _ in range(n)]
for i in range(m):
	a, b = map(int, input().split())
	ikeru[a-1].append(b-1)
	ikeru[b-1].append(a-1)

fukasa = [10**18 for _ in range(n)]
kaisuu = 0
settansaku = set([])
listmada = [0]
setmada = set([0])

while len(setmada) != 0:
	kaisuu += 1
	for i in listmada[:]:
		settansaku.add(i)
		listmada.remove(i)
		setmada.remove(i)
		for k in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					listmada.append(k)
					setmada.add(k)
					fukasa[k] = kaisuu

if fukasa[n-1] <= 2:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Fixed submission:
n, m = map(int, input().split())
ikeru = [[] for _ in range(n)]
for i in range(m):
	a, b = map(int, input().split())
	ikeru[a-1].append(b-1)
	ikeru[b-1].append(a-1)

fukasa = [10**18 for _ in range(n)]
kaisuu = 0
settansaku = set([])
setmada = set([0])

while len(setmada) != 0:
	kaisuu += 1
	for i in list(setmada):
		settansaku.add(i)
		setmada.remove(i)
		for k in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					fukasa[k] = kaisuu

if fukasa[n-1] <= 2:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(input()) for _ in range(n)]
"""
b := ruisekiwa
b[r]-b[l] >= (r-l)k
b[r]-rk >= b[l]-lk (1-indexed)
c := b[i]-ik
"""
b = [0 for _ in range(n)]
b[0] = a[0]
for i in range(1, n):
	b[i] = b[i-1] + a[i]
 
c = [b[i]-(i+1)*k for i in range(n)]
 
"""
cr >= cl なる ペア(l, r)の個数を求めたい.
for i in range(n), find (i,j)
"""
 
class BIT:
	"""
	<Attention> 0-indexed.
	query ... return the sum [0 to m]
	sum ... return the sum [a to b]
	sumall ... return the sum [all]
	add ... 'add' number to element (be careful that it doesn't set a value.)
	search ... the sum version of bisect.right
	output ... return the n-th element
	listout ... return the BIT list
	"""
	def query(self, m):
		res = 0
		while m > 0:
			res += self.bit[m]
			m -= m&(-m)
		return res
	
	def sum(self, a, b):
		return self.query(b)-self.query(a)
	
	def sumall(self):
		bitlen = self.bitlen-1
		return self.query(bitlen)
 
	def add(self, m, x):
		m += 1
		bitlen = len(self.bit)
		while m <= bitlen-1:
			self.bit[m] += x
			m += m&(-m)
		return
	
	def search(self, a):
		tmpsum = 0
		i = 0
		k = (self.bitlen-1).bit_length()
		while k >= 0:
			tmpk = 2**k
			if i+tmpk <= self.bitlen-1:
				if tmpsum + self.bit[i+tmpk] < a:
					tmpsum += self.bit[i+tmpk]
					i += tmpk
			k = k - 1
		return i+1
	
	def output(self, a):
		return self.query(a+1)-self.query(a)
	
	def listout(self):
		return self.bit
	
	def __init__(self, a):
		self.bitlen = len(a)+1
		self.bit = [0]*(len(a)+1)
		for i, j in enumerate(a):
			self.add(i, j)
 
def compress(arr):
	*XS, = set(arr)
	XS.sort()
	target = {e: i for i, e in enumerate(XS)}
	rtl = []
	for i in range(n):
		rtl.append(target[arr[i]])
	return rtl
 
d = compress(c)
 
bit = BIT([0 for _ in range(n)])
ans = 0
for i in range(n):
	bit.add(d[i], 1)
	ans += bit.query(d[i]+1)
	if c[i] < 0:
		ans -= 1
print(ans)

Fixed submission:
n = int(input())
s = [int(input()) for _ in range(n)]
k = sum(s)
if k % 10 != 0:
	print(k)
else:
	for i in sorted(s):
		if i % 10 != 0:
			print(k-i)
			exit()
	print(0)
Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [[] for _ in range(h)]
for i in range(h):
  a[h] = list(map(str, input().split()))
print("#"*(w+2))
for i in range(h):
  print("#"+a[h].join("")+"#")
print("#"*(w+2))


Fixed submission:
h,w = map(int, input().split())
print("#"*(w+2))
for i in range(h):
  print("#"+input()+"#")
print("#"*(w+2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

chokudai = 0
aoki = 0
ans = 0
for i in range(n):
	t, a = map(int,input().split())
	if i == 0:
		chokudai = t
		aoki = a
		continue
	tmpt, tmpa = t, a
	while tmpt < chokudai or tmpa < aoki:
		tmpt += t
		tmpa += a
	ans += (tmpt-chokudai) + (tmpa-aoki)
	chokudai = tmpt
	aoki = tmpa
print(chokudai + aoki)

Fixed submission:
def ceil(a, b):
	return -(-a//b)

n = int(input())
chokudai, aoki = 0, 0
for i in range(n):
	t, a = map(int,input().split())
	if i == 0:
		chokudai, aoki = t, a
		continue
	bairitsu = max(ceil(chokudai, t), ceil(aoki, a))
	t *= bairitsu
	a *= bairitsu
	#print(t, a)
	chokudai, aoki = t, a
print(chokudai + aoki)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
if(s[-1] == 's'):
    s += 'es'
else:
    s += 's'
print(s)


Fixed submission:
s = input()
if(s[-1] == 's'):
    s += 'es'
else:
    s += 's'
print(s)
Buggy python submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())
if(d <= t*s):
    print("Yes")
else:
    print("No")    


Fixed submission:
d,t,s = map(int, input().split())
if(d <= t*s):
    print("Yes")
else:
    print("No")