Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def change_num(tmp, i):
    if tmp[i] == "0":
        return int(tmp, 2)+pow(2, N-i-1)
    else:
        return int(tmp, 2)-pow(2, N-i-1)


def popcount(num):
    tmp1 = bin(num)
    tmp2 = tmp1[2:]
    return tmp2.count("1")


N = int(input())
X = input()
flag = 0

for i in range(N):
    tmp = change_num(X, i)
    # num1 = str(tmp).count("1")
    num1 = popcount(tmp)
    while tmp > 0:
        # print(f"tmp={tmp},num1={num1}")
        tmp = tmp % num1
        num1 = popcount(tmp)
        flag += 1
    print(flag)
    flag = 0

Fixed submission:
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)

Buggy python submission (verdict: Runtime Error):
def change_num(tmp, i):
    if tmp[i] == "0":
        return int(tmp, 2)+pow(2, N-i-1)
    else:
        return int(tmp, 2)-pow(2, N-i-1)


N = int(input())
X = input()
flag = 0

for i in range(N):
    tmp = change_num(X, i)
    while True:
        num1 = 0
        for i in bin(tmp):
            # if i == 1:
            if "1" in i:
                num1 += 1

        tmp = tmp % num1
        flag += 1
        if tmp == 0:
            break
    print(flag)
    flag = 0


Fixed submission:
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)

Buggy python submission (verdict: Runtime Error):
def change_num(tmp, i):
    if tmp[i] == "0":
        return int(tmp, 2)+pow(2, N-i-1)
    else:
        return int(tmp, 2)-pow(2, N-i-1)


N = int(input())
X = input()
flag = 0

for i in range(N):
    tmp = change_num(X, i)
    while True:
        num1 = 0
        for i in bin(tmp):
            # if i == 1:
            if "1" in i:
                num1 += 1

        tmp = tmp % num1
        flag += 1
        if tmp == 0:
            break
    print(flag)
    flag = 0


Fixed submission:
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

S = input()
T = input()
print(T+S)

Fixed submission:
# -*- coding: utf-8 -*-

S,T = input().split()
print(T+S)
Buggy python submission (verdict: Time Limit Exceeded):
# # 整数の入力
# a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# # 文字列の入力
# s = input()
# a = []
# a = list(map(int, input().split()))
# import math

# 解説参照済み

n, k = map(int, input().split())
a = []
a = list(map(int, input().split()))
f = []
f = list(map(int, input().split()))

a.sort()
f.sort(reverse=True)
ans = 0

maxaf = 0
for i in range(n):
    maxaf = max(maxaf, a[i] * f[i])

left = 0
right = maxaf

while left < right:
    # print(left, right)
    mid = (left + right) // 2
    ktemp = k
    renewleft = False
    for i in range(n):
        if a[i] * f[i] > mid:
            if (a[i] * f[i] - mid + f[i] - 1) // f[i] > ktemp:
                left = mid + 1
                renewleft = True
                break
            else:
                ktemp -= (a[i] * f[i] - mid + f[i] - 1) // f[i]
    if not renewleft:
        right = mid

print(left)


Fixed submission:
# # 整数の入力
# a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# # 文字列の入力
# s = input()
# a = []
# a = list(map(int, input().split()))
# import math
 
# 解説参照済み
 
n, k = map(int, input().split())
a = []
a = list(map(int, input().split()))
f = []
f = list(map(int, input().split()))
 
a.sort()
f.sort(reverse=True)
ans = 0
 
maxaf = 0
for i in range(n):
    maxaf = max(maxaf, a[i] * f[i])
 
left = 0
right = maxaf
 
while left < right:
    # print(left, right)
    mid = (left + right) // 2
    ktemp = k
    renewleft = False
    for i in range(n):
        if a[i] * f[i] > mid:
            if (a[i] * f[i] - mid + f[i] - 1) // f[i] > ktemp:
                left = mid + 1
                renewleft = True
                break
            else:
                ktemp -= (a[i] * f[i] - mid + f[i] - 1) // f[i]
    if not renewleft:
        right = mid
 
print(left)
Buggy python submission (verdict: Runtime Error):
age = int(input())
shichigosanAges = {3, 5, 7}
print(age in shichigosanAges ? "YES" : "NO")

Fixed submission:
age = int(input())
shichigosanAges = {3, 5, 7}
print("YES" if age in shichigosanAges else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

n = int(input())
a = list(map(int, input().split()))

l = 1
for x in a:
    l = lcm(x, l)

ans = 0
for x in a:
    ans += l//x

print(ans%(10**9+7))

Fixed submission:
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

def modpow(x, n, mod):
    res = 1
    while n > 0:
        if n%2 == 1:
            res = res*x%mod
        x = x*x%mod
        n >>= 1
    return res

mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))

g = 0
for x in a:
    g = gcd(g, x)

l = 1
for i in range(n):
    a[i] //= g
    l = lcm(l, a[i])
l %= mod

ans = 0
for i in range(n):
    ans += l*modpow(a[i], mod-2, mod)
    ans %= mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

n = int(input())
a = list(map(int, input().split()))

g = 0
for x in a:
    g = gcd(g, x)

l = 1
for i in range(n):
    a[i] //= g
    l = lcm(l, a[i])

ans = 0
for i in range(n):
    ans += l//a[i]
    ans %= 10**9+7

print(ans)

Fixed submission:
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

def modpow(x, n, mod):
    res = 1
    while n > 0:
        if n%2 == 1:
            res = res*x%mod
        x = x*x%mod
        n >>= 1
    return res

mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))

g = 0
for x in a:
    g = gcd(g, x)

l = 1
for i in range(n):
    a[i] //= g
    l = lcm(l, a[i])
l %= mod

ans = 0
for i in range(n):
    ans += l*modpow(a[i], mod-2, mod)
    ans %= mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

n = int(input())
a = list(map(int, input().split()))

g = 0
for x in a:
    g = gcd(g, x)

l = 1
for i in range(n):
    a[i] //= g
    l = lcm(l, a[i])

ans = 0
for i in range(n):
    ans += l//a[i]
    ans %= 10**9+7

print(ans)

Fixed submission:
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

def modpow(x, n, mod):
    res = 1
    while n > 0:
        if n%2 == 1:
            res = res*x%mod
        x = x*x%mod
        n >>= 1
    return res

mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))

g = 0
for x in a:
    g = gcd(g, x)

l = 1
for i in range(n):
    a[i] //= g
    l = lcm(l, a[i])
l %= mod

ans = 0
for i in range(n):
    ans += l*modpow(a[i], mod-2, mod)
    ans %= mod

print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

def lcm(x, y):
    return x // gcd(x, y) * y

n, m = map(int, input().split())
a = list(map(int, input().split()))

l = 1
for i in range(n):
    a[i] //= 2
    l = lcm(a[i], l)

flg = True
for x in a:
    if (l / x) % 2 == 0:
        flg = False
        continue

if flg:
    print(m // l - m // (l * 2))
else:
    print(0)

Fixed submission:
def gcd(x, y):
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

def lcm(x, y):
    return x // gcd(x, y) * y

n, m = map(int, input().split())
a = list(map(int, input().split()))

l = 1
for i in range(n):
    a[i] //= 2
    l = lcm(a[i], l)

flg = True
for x in a:
    if (l // x) % 2 == 0:
        flg = False
        break

if flg:
    print(m // l - m // (l * 2))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import queue

INF = 1 << 30

s = [-1, -1]
n, s[0], s[1] = map(int, input().split())
s[0] -= 1
s[1] -= 1

g = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

cost = [[INF for j in range(n)] for i in range(2)]

for i in range(2):
    cost[i][s[i]] = 0
    que = queue.Queue(n)
    que.put(s[i])

    while not que.empty():
        now = que.get()
        for j in range(len(g[now])):
            if cost[i][g[now][j]] > cost[i][now] + 1:
                cost[i][g[now][j]] = cost[i][now] + 1
                que.put(g[now][j])

maxi = -1
maxdex = -1
for i in range(n):
    if len(g[i]) == 1 and maxi < cost[1][i] and cost[0][i] < cost[1][i]:
        maxi = cost[1][i]
        maxdex = i

dif = cost[1][maxdex] - cost[0][maxdex]

ans = cost[0][maxdex] + dif - 1
print(ans)

Fixed submission:
import queue

INF = 1 << 30

s = [-1, -1]
n, s[0], s[1] = map(int, input().split())
s[0] -= 1
s[1] -= 1

g = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

cost = [[INF for j in range(n)] for i in range(2)]

for i in range(2):
    cost[i][s[i]] = 0
    que = queue.Queue(n)
    que.put(s[i])

    while not que.empty():
        now = que.get()
        for j in range(len(g[now])):
            if cost[i][g[now][j]] > cost[i][now] + 1:
                cost[i][g[now][j]] = cost[i][now] + 1
                que.put(g[now][j])

maxi = -1
maxdex = -1
for i in range(n):
    if len(g[i]) == 1 and maxi < cost[1][i] and cost[0][i] < cost[1][i]:
        maxi = cost[1][i]
        maxdex = i

dif = cost[1][maxdex] - cost[0][maxdex]

ans = cost[0][maxdex] + dif - 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()

ans = 0
for i in range(n):
    for j in range(i):
        ans += bisect.bisect_left(l, l[i]+l[j], j+1, i)-bisect.bisect_right(l, l[i]-l[j], j+1, i)

print(ans)


Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()

ans = 0
for i in range(n):
    for j in range(i):
        ans += bisect.bisect_left(l, l[i]+l[j], j+1, i)-bisect.bisect_right(l, l[i]-l[j], j+1, i)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0

for i in range(1 << n):
	tmp = 0
	for j in range(n):
		if(i >> j & 1):
			tmp += v[j] - c[j]
	ans = max(ans, tmp)

print(ans)

Fixed submission:
n = int(input())

v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0

for i in range(n):
	if v[i] - c[i] > 0:
		ans += v[i] - c[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))

cnt = {}
for x in a:
    if x in cnt:
        cnt[x] += 1
    else:
        cnt[x] = 1

ans = 0
for i in range(n - 1, -1, -1):
    for d in range(30, -1, -1):
        k = bisect.bisect_left(a, (1 << d) - a[i])
        if k < n and a[i] + a[k] == (1 << d) and (a[i] == a[k] and cnt[a[i]] >= 2 or a[i] != a[k] and cnt[a[i]] >= 1 and cnt[a[k]] >= 1):
            ans += 1
            cnt[a[i]] -= 1
            cnt[a[k]] -= 1

print(ans)

Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))

cnt = {}
for x in a:
    if x in cnt:
        cnt[x] += 1
    else:
        cnt[x] = 1

ans = 0
for i in range(n - 1, -1, -1):
    for d in range(30, -1, -1):
        k = bisect.bisect_left(a, (1 << d) - a[i])
        if k < n and a[i] + a[k] == (1 << d) and (a[i] == a[k] and cnt[a[i]] >= 2 or a[i] != a[k] and cnt[a[i]] >= 1 and cnt[a[k]] >= 1):
            ans += 1
            cnt[a[i]] -= 1
            cnt[a[k]] -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = 1
seg = []

def get(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    elif a <= l and r <= b:
        return seg[k]
    
    return get(a, b, k * 2 + 1, l, (l + r) // 2) + get(a, b, k * 2 + 2, (l + r) // 2, r)

def update(k, x):
    k += N - 1
    seg[k] += x

    while k > 0:
        k = (k - 1) // 2
        seg[k] = seg[k * 2 + 1] + seg[k * 2 + 2]
    
    return

n, k = map(int, input().split())

a = [int(input()) for _ in range(n)]

v = [0]

for i in range(n):
    v.append(v[i] + a[i])

for i in range(n + 1):
    v[i] -= i * k

st = sorted(list(set(v)))
mp = {t:i for i, t in enumerate(st)}

while N < len(mp):
    N <<= 1

for i in range(N * 2 - 1):
    seg.append(0)

ans = 0

for i in range(n + 1):
    ans += get(0, mp[v[i]] + 1, 0, 0, N)
    update(mp[v[i]], 1)

print(ans)

Fixed submission:
bit = [0 for _ in range(252525)]

def get(r):
    r += 1

    res = 0
    while r > 0:
        res += bit[r]
        r -= r & -r
    
    return res

def update(k, x):
    k += 1

    while k < 252525:
        bit[k] += x
        k += k & -k
    
    return

n, k = map(int, input().split())

a = [int(input()) for _ in range(n)]

v = [0]

for i in range(n):
    v.append(v[i] + a[i])

for i in range(n + 1):
    v[i] -= i * k

st = sorted(list(set(v)))
mp = {t:i for i, t in enumerate(st)}

ans = 0

for i in range(n + 1):
    ans += get(mp[v[i]])
    update(mp[v[i]], 1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = 1
seg = []

def get(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    elif a <= l and r <= b:
        return seg[k]
    
    return get(a, b, k * 2 + 1, l, (l + r) // 2) + get(a, b, k * 2 + 2, (l + r) // 2, r)

def update(k, x):
    k += N - 1
    seg[k] += x

    while k > 0:
        k = (k - 1) // 2
        seg[k] = seg[k * 2 + 1] + seg[k * 2 + 2]
    
    return

n, k = map(int, input().split())

a = [int(input()) for _ in range(n)]

v = [0]

for i in range(n):
    v.append(v[i] + a[i])

for i in range(n + 1):
    v[i] -= i * k

st = sorted(list(set(v)))
mp = {t:i for i, t in enumerate(st)}

while N < len(mp):
    N <<= 1

for i in range(N * 2 - 1):
    seg.append(0)

ans = 0

for i in range(n + 1):
    ans += get(0, mp[v[i]] + 1, 0, 0, N)
    update(mp[v[i]], 1)

print(ans)

Fixed submission:
bit = [0 for _ in range(252525)]

def get(r):
    r += 1

    res = 0
    while r > 0:
        res += bit[r]
        r -= r & -r
    
    return res

def update(k, x):
    k += 1

    while k < 252525:
        bit[k] += x
        k += k & -k
    
    return

n, k = map(int, input().split())

a = [int(input()) for _ in range(n)]

v = [0]

for i in range(n):
    v.append(v[i] + a[i])

for i in range(n + 1):
    v[i] -= i * k

st = sorted(list(set(v)))
mp = {t:i for i, t in enumerate(st)}

ans = 0

for i in range(n + 1):
    ans += get(mp[v[i]])
    update(mp[v[i]], 1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=[]
for i in range(1,n+1):
  a=0
  for x in range(1,100):
    for y in range(1,x+1):
      for z in range(1,y+1):
        if x**2+y**2+z**2+x*y+y*z+z*x==i:
          if x==y and y==z:
            a+=1
          elif x==y or y==z:
            a+=3
          else:
            a+=6
  ans.append(a)
for i in ans:
  print(i)

Fixed submission:
n=int(input())
ans=[0 for i in range(n)]
for x in range(1,100):
  for y in range(1,x+1):
    for z in range(1,y+1):
      i=x**2+y**2+z**2+x*y+y*z+z*x
      if i<=n:
        if x==y and y==z:
          ans[i-1]+=1
        elif x==y or y==z:
          ans[i-1]+=3
        else:
          ans[i-1]+=6
for i in ans:
  print(i)
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[i]:
    for j in range(a[-1]//a[i]):
      if j<2:
        continue
      num[a[i]*j]=False
    if i!=n-1 and a[i]==a[i+1]:
      num[a[i]]=False
  else:
    pass
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)

Fixed submission:
n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[a[i]]:
    for j in range(a[-1]//a[i]+1):
      if j<2:
        continue
      num[a[i]*j]=False
    if i==n-1:
      pass
    elif a[i]==a[i+1]:
      num[a[i]]=False
    else:
      pass
  else:
    continue
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,*a=map(int,open(0).read().split())
a.sort()
p=0
a=np.array(a)
ans=0
while True:
  i=0
  if len(a)>1:
    while a[i]==a[i+1]:
      i+=1
      if i==n-1:
        break
    first=a[i]
    ans+=1
    a=a[i:]
  elif len(a)==1:
    ans+=1
    break
  else:
    break
  b=a.copy()
  if len(b)==0:
    break
  b%=first
  a=a[b!=0]
print(ans)

Fixed submission:
n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[a[i]]:
    for j in range(a[-1]//a[i]+1):
      if j<2:
        continue
      num[a[i]*j]=False
    if i==n-1:
      pass
    elif a[i]==a[i+1]:
      num[a[i]]=False
    else:
      pass
  else:
    continue
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
ans=1
for i in range(n):
  ans*=a[i]
if ans>10**18:
  ans=-1
print(ans)

Fixed submission:
n,*a=map(int,open(0).read().split())
ans=1
if 0 in a:
  ans=0
else:
  for i in range(n):
    ans*=a[i]
    if ans>10**18:
      ans=-1
      break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
n=int(n)
k=int(k)
n = n % k
minimam = k
for i in range(k):
  if n < minimam:
    minimam = n
  n = abs(n-k)
print(minimam)

Fixed submission:
n,k=map(int,input().split())
n=int(n)
k=int(k)
n = n % k
minimam = n
record=[]
for i in range(k):
  n=abs(n-k)
  if n < minimam:
    minimam = n
  record.append(n)
  if n in record:
    break
print(minimam)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())
dis=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    d=min(j-i,min(abs(j-x)+1+abs(i-y),abs(j-y)+1+abs(i-x)))
    dis[d-1]+=1
for i in dis:
  print(i)

Fixed submission:
n,x,y=map(int,input().split())
dis=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    d=j-i
    if d>abs(j-x)+1+abs(i-y):
      d=abs(j-x)+1+abs(i-y)
    if d>abs(j-y)+1+abs(i-x):
      d=abs(j-y)+1+abs(i-x)
    dis[d-1]+=1
for i in dis:
  print(i)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
n=int(N)
m=int(M)
numlist=[0,0,0]
access_log=[0,0,0]
answer=0
for i in range(m):
  s,c=map(int,input().split())
  s=int(s)
  c=int(c)
  if access_log[s]==1 and numlist[s]!=c:
    answer=-1
    break
  else:
    numlist[s]=c
    access_log[s]=1
if answer==-1:
  print(answer)
else:
  answer=numlist[2]*10**2+numlist[1]*10+numlist[0]
  if answer==0:
    print(-1)
  else:
    print(answer)

Fixed submission:
N,M=map(int,input().split())
n=int(N)
m=int(M)
numlist=[]
loglist=[]
for i in range(n):
  numlist.append(0)
  loglist.append(0)
answer=0

for i in range(m):
  s,c=map(int,input().split())
  s=int(s)
  c=int(c)
  if s==1 and c==0 and n!=1:
    answer=-1
  elif loglist[s-1]!=0 and numlist[s-1]!=c:
    answer=-1
  else:
    numlist[s-1]=c
    loglist[s-1]=1

if answer==-1:
  print(answer)
elif n==1 and numlist[0]==0:
  print(0)
else:
  if numlist[0]==0:
    numlist[0]=1
  else:
    pass
  for i in range(n):
    answer+=numlist[i]*10**(n-i-1)
  print(answer)
Buggy python submission (verdict: Runtime Error):
h=int(input())
def f(n):
  if n==1:
    return 1
  else:
    return 2 * f(n) + 1
hit=f(h)
print(hit)

Fixed submission:
h=int(input())
def f(n):
  if n==1:
    return 1
  else:
    return 2 * f(n//2) + 1
hit=f(h)
print(hit)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b
m=a[0]
for i in range(n):
  m=m//eucrid(m,a[i])*a[i]
b=0
for i in a:
  b+=m*pow(i,mod-2,mod)%mod
print(b%mod)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b
m=a[0]
for i in range(n):
  m=m//eucrid(m,a[i])*a[i]
b=0
m=m%mod
for i in a:
  b+=m*pow(i,mod-2,mod)%mod
print(b%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import fractions
n=int(input())
a=list(map(int,input().split()))
a2=np.array(a.copy())
mod=10**9+7
def f(n,i):
  for j in range(i+1,n):
    c=fractions.gcd(a[i],a[j])
    a[j]//=c

for i in range(n):
  f(n,i)
m = 1
for i in a:
  m = m * i
b=(m//a2)%mod
ans=np.sum(b)%mod
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b
m=a[0]
for i in range(n):
  m=m//eucrid(m,a[i])*a[i]
b=0
m=m%mod
for i in a:
  b+=m*pow(i,mod-2,mod)%mod
print(b%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a2=np.array(a.copy())
mod=10**9+7
def f(n,i):
  for j in range(i+1,n):
    c=eucrid(a[i],a[j])
    a[j]//=c
    
def eucrid(a,b):
  if a < b:
    a,b=b,a
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b

for i in range(n):
  f(n,i)
m = 1
for i in a:
  m = m * i
b=(m//a2)%mod
ans=np.sum(b)%mod
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b
m=a[0]
for i in range(n):
  m=m//eucrid(m,a[i])*a[i]
b=0
m=m%mod
for i in a:
  b+=m*pow(i,mod-2,mod)%mod
print(b%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a2=a.copy()
a2=np.array(a2)
mod=10**9+7
def f(n,i):
  if i==n-1:
    return
  for j in range(i+1,n):
    c=eucrid(a[i],a[j])
    a[j]//=c
    
def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b

for i in range(n):
  f(n,i)
m=1
for i in a:
  m = m * i
b=m//a2
ans=b.sum()%mod
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

def eucrid(a,b):
  a,b=max(a,b),min(a,b)
  while True:
    if a%b==0:
      return b
    else:
      a,b=b,a%b
m=a[0]
for i in range(n):
  m=m//eucrid(m,a[i])*a[i]
b=0
m=m%mod
for i in a:
  b+=m*pow(i,mod-2,mod)%mod
print(b%mod)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
  if a>0:
    a-=1
  elif b>0:
    b-=1
  else:
    pass
print(str(a)+' '+str(b))

Fixed submission:
a,b,k=map(int,input().split())
if a>k:
  a-=k
elif a+b>k:
  a,b=0,b-k+a
else:
  a=0
  b=0
print(str(a)+' '+str(b))