Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    D = int(input())

    if D = 22:
        print('Christmas Eve Eve Eve')
    if D = 23:
        print('Christmas Eve Eve')
    if D = 24:
        print('Christmas Eve')
    if D = 25:
        print('Christmas')

main()

Fixed submission:
def main():
    D = int(input())

    if D == 22:
        print('Christmas Eve Eve Eve')
    if D == 23:
        print('Christmas Eve Eve')
    if D == 24:
        print('Christmas Eve')
    if D == 25:
        print('Christmas')

main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def main():
    N, K = list(map(int,input().split()))
    h = [0] * N
    for i in range(N):
        h[i] = int(input())

    h = sorted(h)

    abs_p = []
    for j in range(0,N-1):
        abs_p.append(abs(h[j]-h[j+1]))

    abon = []
    for k in range(0,N-K+1):
        abon.append(sum(abs_p[k:k+K-1]))

    print(min(abon))

main()

Fixed submission:
import sys

def main():
    N, K = list(map(int,input().split()))
    h = [0] * N
    for i in range(N):
        h[i] = int(input())

    h = sorted(h)

    ave = []
    for j in range(0,N-K+1):
        ave.append(abs(h[j]-h[j+K-1]))

    print(min(ave))

main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
p_y = defaultdict(set)

N,M = map(int,input().split())
PY = [[int(x) for x in input().split()] for _ in range(M)]
for p,y in PY:
        p_y[p].add(y)

def set_rank(retu):
        return {x:i for i,x in enumerate(sorted(retu), 1)}

p_y = {p:set_rank(retu) for p,retu in p_y.items()}
for p,y in PY:
        print('{:06g}{:06g}'.format(p,p_y[p][y]))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

def stgsn(N, maked_num, now_num):
    if now_num != '':
        if int(now_num) > N:
            return

        maked_num.append(now_num)

    stgsn(N, maked_num, now_num + '7')

    stgsn(N, maked_num, now_num + '5')

    stgsn(N, maked_num, now_num + '3')

    return maked_num


def main():
    N = int(input())


    maked_num = []
    now_num = ''

    maked_num = stgsn(N, maked_num, now_num)

    ans = [s for s in maked_num if '3' in s and '5' in s and '7' in s]
    print(len(ans))


main()
Buggy python submission (verdict: Runtime Error):
A, B, X = int(input())

if A <= X <= (A+B):
    print('YES')
else:
    print('NO')

Fixed submission:
A, B, X = list(map(int, input().split()))

if A <= X <= (A+B):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import copy
 
n = int(input())
x = list(map(int,input().split()))
 
 
for i in range(n):
  xx = copy.deepcopy(x)
  xx.pop(i)
  xx.sort()
  print(xx[(len(xx) + 1) // 2 - 1])

Fixed submission:
import copy

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

xx= sorted(x)
L_x = xx[n//2 - 1]
R_x = xx[n//2]

for arr in x:
  print(L_x if R_x <= arr else R_x)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

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


for i in range(n):
  xx = copy.deepcopy(x)
  xx.pop(i)
  xx.sort()
  print(xx[(len(xx) + 1) // 2 - 1])

Fixed submission:
import copy

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

xx= sorted(x)
L_x = xx[n//2 - 1]
R_x = xx[n//2]

for arr in x:
  print(L_x if R_x <= arr else R_x)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
 
 
def bfs(H, W, maze, visited, sharp):
    queue = deque([[0, 0]])
    visited[0][0] = 0
    while queue:
        y, x = queue.popleft()
        if[y, x] == [H-1, W-1]:
            return ((H*W-sharp)-(visited[y][x]+1))
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if  new_y != -1 and new_y != H and  \
                new_x != -1 and new_x != W and  \
                maze[new_y][new_x] == "." and   \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
 
    return -1
 
 
def main():
    sharp = 0
 
    H, W = map(int,input().split())
    maze = [input() for i in range(H)]
    visited = [[-1]*W for j in range(H)]
 
    for k in range(H):
        

Fixed submission:
import sys
from collections import deque


def bfs(H, W, maze, visited, sharp):
    queue = deque([[0, 0]])
    visited[0][0] = 0
    while queue:
        y, x = queue.popleft()
        if[y, x] == [H-1, W-1]:
            return ((H*W-sharp)-(visited[y][x]+1))
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if  new_y != -1 and new_y != H and  \
                new_x != -1 and new_x != W and  \
                maze[new_y][new_x] == "." and   \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])

    return -1












def main():
    sharp = 0

    H, W = map(int,input().split())
    maze = [input() for i in range(H)]
    visited = [[-1]*W for j in range(H)]

    for k in range(H):
        sharp += maze[k].count('#')

    print(bfs(H, W, maze, visited, sharp))

main()
Buggy python submission (verdict: Runtime Error):
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] = "-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
        if(eval("".join(ABCD_tmp))==7):
            print("{}=7".format("".join(ABCD_tmp)))
            sys.exit()

main()
~

Fixed submission:
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] = "-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
        if(eval("".join(ABCD_tmp))==7):
            print("{}=7".format("".join(ABCD_tmp)))
            sys.exit()

main()

Buggy python submission (verdict: Runtime Error):
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] ="-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
            if(eval("".join(ABCD_tmp))==7):
                    print("{}=7".format("".join(ABCD_tmp)))
                    sys.exit()

main()

Fixed submission:
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] = "-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
        if(eval("".join(ABCD_tmp))==7):
            print("{}=7".format("".join(ABCD_tmp)))
            sys.exit()

main()
Buggy python submission (verdict: Runtime Error):
X,Y = list(input.split())

if ord(X) < ord(Y):
  print('<')
elif ord(X) > ord(Y):
  print('>')
else:
  print('=')

Fixed submission:
X,Y = input().split()
 
if ord(X) < ord(Y):
  print('<')
elif ord(X) > ord(Y):
  print('>')
else:
  print('=')
Buggy python submission (verdict: Runtime Error):
import itertools

N, A, B = list(map(int,input().split()))

if N==1:
    if A==B:
        print(1)
        exit()
    else:
        print(0)
        exit()


comb = list(itertools.combinations_with_replacement(range(A,B+1),N-2))

lis=[]
for x in comb:
    lis.append(sum(x))

lis = set(lis)
print(len(lis))

Fixed submission:
import itertools

N, A, B = list(map(int,input().split()))

if N==1:
    if A==B:
        print(1)
        exit()
    else:
        print(0)
        exit()

if A > B:
    print(0)
    exit()

min = A*(N-1)+B
max = A+B*(N-1)

print(max-min+1)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    K, S = map(int, input().split())
    count=0


    if(S<=3725):
        for x in range(0, K+1):
            for y in range(0, K+1):
                for z in range(0, K+1):
                    if(x+y+z==S):
                        count+=1
    else:
        for x in reversed(range(0, K+1)):
            for y in reversed(range(0, K+1)):
                for z in reversed(range(0, K+1)):
                    if(x+y+z==S):
                        count+=1
    print(count)

main()

Fixed submission:
def main():
    K, S = map(int, input().split())
    count=0

    for x in range(0, K+1):
        for y in range(0, K+1):
            if(0<=S-x-y<=K):
                count+=1

    print(count)

main()

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count=0

for x in range(0, K+1):
    for y in range(0, K+1):
        for z in range(0, K+1):
            if(x+y+z==S):
                count+=1

print(count)

Fixed submission:
def main():
    K, S = map(int, input().split())
    count=0

    for x in range(0, K+1):
        for y in range(0, K+1):
            if(0<=S-x-y<=K):
                count+=1

    print(count)

main()

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count=0

for x in range(0, K+1):
    for y in range(0, K+1):
        for z in range(0, K+1):
            if(x+y+z==S):
                count+=1

print(count)

Fixed submission:
def main():
    K, S = map(int, input().split())
    count=0

    for x in range(0, K+1):
        for y in range(0, K+1):
            if(0<=S-x-y<=K):
                count+=1

    print(count)

main()
Buggy python submission (verdict: Runtime Error):
if __name__=="__main__":
    # Problem A
    x = input()
    if x == x.upper()
        print("A")
    else:
        print("a")

Fixed submission:
if __name__=="__main__":
    # Problem A
    x = input()
    if x == x.upper():
        print("A")
    else:
        print("a")
Buggy python submission (verdict: Runtime Error):
if __name__=="__main__":
    # Problem C
    X, N = map(int, (input().split(' ')))
    if N > 0:
        P = map(int, input().split(' '))
        P_max = max(P)
        P_min = min(P)
        if X in P:
            for i in range(0, 100):
                if (X-i) not in P:
                    print(X-i)
                    break

                elif (X+i) not in P:
                    print(X+i)
                    break
        elif X not in P:
            print(X)
    else:
        print(X)

Fixed submission:
if __name__=="__main__":
    # Problem C
    X, N = map(int, (input().split(' ')))
    if N > 0:
        P = sorted(map(int, input().split(' ')))
        P_max = max(P)
        P_min = min(P)
        if X in P:
            for i in range(100):
                if (X-i) not in P:
                    print(X-i)
                    break

                elif (X+i) not in P:
                    print(X+i)
                    break
        elif X not in P:
            print(X)
    else:
        print(X)

Buggy python submission (verdict: Runtime Error):
    X, N = map(int, (input().split(' ')))
    if N > 0:
        P = sorted(map(int, input().split(' ')))
        P_max = max(P)
        P_min = min(P)
        if X in P:
            for i in range(1, max(P_max-X + 1 , X-P_min +1)):
                if (X-i) not in P:
                    print(X-i)
                    break

                elif (X+i) not in P:
                    print(X+i)
                    break
        elif X not in P:
            print(X)
        else:
            print(" ")
    else:
        print(" ")



Fixed submission:
if __name__=="__main__":
    # Problem C
    X, N = map(int, (input().split(' ')))
    if N > 0:
        P = sorted(map(int, input().split(' ')))
        P_max = max(P)
        P_min = min(P)
        if X in P:
            for i in range(100):
                if (X-i) not in P:
                    print(X-i)
                    break

                elif (X+i) not in P:
                    print(X+i)
                    break
        elif X not in P:
            print(X)
    else:
        print(X)
Buggy python submission (verdict: Time Limit Exceeded):
if __name__=="__main__":
    # Problem B
    N = int(input())
    A = [None]*N
    A = list(map(int, input().split(' ')))
    result = 1
    flag = False
    for x in A:
        result = result * x

    if result > 1e18:
        print("-1")
    else:
        print(result)


Fixed submission:
if __name__=="__main__":
    # Problem B
    N = int(input())
    A = [None]*N
    A = list(map(int, input().split(' ')))
    result = 1
    flag = False
    is_zero = False
    if 0 in A:
        print("0")
    else:
        for x in A:
            result = result * x
            if result > 1e18:
                flag = True
                break
        if flag:
            print("-1")
        else:
            print(result)
Buggy python submission (verdict: Runtime Error):
import collections

def prime_factorize(n):
    a = []
    while n%2 == 0:
        a.append(2)
        n //=  2
    f = 3
    while f*f <= n :
        if n % f ==0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__=="__main__":
    N = int(input())
    count = 0
    counter = collections.Counter(prime_factorize(N))
    output = 0
    for prime in counter:
        num_prime = 1
        count = 1
        while True:
            if counter[prime] >= wa:
                output += 1
                count += 1
                num_prime += count
            else:
                break
    print(output)

Fixed submission:
import collections

def prime_factorize(n):
    a = []
    while n%2 == 0:
        a.append(2)
        n //=  2
    f = 3
    while f*f <= n :
        if n % f ==0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__=="__main__":
    N = int(input())
    count = 0
    counter = collections.Counter(prime_factorize(N))
    output = 0
    for prime in counter:
        num_prime = 1
        count = 1
        while True:
            if counter[prime] >= num_prime:
                output += 1
                count += 1
                num_prime += count
            else:
                break
    print(output)
Buggy python submission (verdict: Runtime Error):
if __name__=="__main__":
    # Problem B
    K = input()
    S = input()
    K_len = int(K)
    S_len = len(S)

    if S_len <= K_len:
        print(S)
    else:
        print(S[:K_len]+str("..."))


Fixed submission:
if __name__=="__main__":
    # Problem A
    N = int(input())
    ones_digit = int(N)%10
    if ones_digit in [2, 4, 5, 7, 9]:
        print("hon")
    elif ones_digit in [0, 1, 6, 8]:
        print("pon")
    else:
        print("bon")
Buggy python submission (verdict: Runtime Error):
import numpy

N = int(input())
A = list(map(int, input().split()))

val = numpy.prod(A)

if val > 10**18:
    print('-1')
else:
    print(val)


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


print(A*B)
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(float, input().split())
keta = int(math.log10(A))
A /= 10**keta

print(int(A*B*(10**keta)))


Fixed submission:
import fractions
import math

A, B = map(fractions.Fraction, input().split())

print(int(math.floor(A*B)))
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
	s = input()
	K = int(input())

	subs = set()
	for f in range(len(s)):
		for t in range(f, len(s)+1):
			subs.add(s[f:t])

	l = list(subs)
	l.sort(key=None)
	print(l[K])


Fixed submission:
if __name__ == '__main__':
	s = input()
	K = int(input())

	subs = set()
	if len(s) <= 50:
		for f in range(len(s)):
			for t in range(f, len(s)+1):
				subs.add(s[f:t])
	else:
		for f in range(len(s)):
			for t in range(f, f+6):
				subs.add(s[f:t])

	l = list(subs)
	l.sort()
	print(l[K])
Buggy python submission (verdict: Runtime Error):
import math

def comb(a, b):
	return int(math.factorial(a) / math.factorial(b) / math.factorial(a-b))

if __name__ == '__main__':
	n = int(input())
	a = [int(x) for x in input().split(' ')]

	sa = sorted(a)

	oldcmb = -float('inf')
	oldi, oldj = (-1, -1)
	i, j = (-1, -1)
	for i in range(n):
		for j in range(n):
			if i == j or i < j:
				break
			cmb = comb(sa[i], sa[j])
			# print('old:{} new:{}[{}][{}]'.format(oldcmb, cmb, i, j))
			if cmb > oldcmb:
				oldcmb = cmb
				oldi, oldj = (i, j)
		if j == n-1:
			break

	print('{} {}'.format(sa[oldi], sa[oldj]))
	# print('{}:{} {}:{}'.format(oldi, sa[oldi], oldj, sa[oldj]))

Fixed submission:
if __name__ == '__main__':
	a,b,x = map(int, input().split(' '))
	if x - a < b and x >= a:
		print('YES')
	else:
		print('NO')
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

if x2 == y:
  print('Yes')
  exit()

if x4 == y:
  print('Yes')
  exit()

for i in range(1,x+1):
  if (x-i)2 + i4 == y:
    print('Yes')
    exit()
  if (x-i)4 + i*2 == y:
    print('Yes')
    exit()

print('No')

Fixed submission:
x,y = map(int,input().split())

if x*2 == y:
  print('Yes')
  exit()

if x*4 == y:
  print('Yes')
  exit()

for i in range(1,x+1):
  if (x-i)*2 + i*4 == y:
    print('Yes')
    exit()
  if (x-i)*4 + i*2 == y:
    print('Yes')
    exit()

print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
r =np.prod(a)
if r >= 10**18:
  print(-1)
else:
  print(r)

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

print(a*b)

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = 1
a = list(map(int,input().split()))
for i in range(n):
  x *= a[i]
if x >= 10**18:
  print(-1)
else:
  print(x)

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

print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
x = 1
for i in a:
  if 0 in a:
    x = 0
    break
  x *= i
 
  if x > 10**18:
    x = -1
    break
 
print(x)

Fixed submission:
n = input()
lista = list(map(int,input().split()))
r = 1

if 0 in lista:
  print(0)
else:
  for a in lista:
    r *= a
    if r > 10**18:
      print(-1)
      break
  else:
    print(r)

Buggy python submission (verdict: Runtime Error):
n = input()
lista = list(map(int,input().split()))
r = 1

if 0 in a:
  print(0)
else:
  for a in lista:
    r *= a
    if r > 10**18:
      print(-1)
      break
  else:
    print(r)

Fixed submission:
n = input()
lista = list(map(int,input().split()))
r = 1

if 0 in lista:
  print(0)
else:
  for a in lista:
    r *= a
    if r > 10**18:
      print(-1)
      break
  else:
    print(r)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
r =np.prod(a)
if r >= 10**18:
  print(-1)
else:
  print(r)

Fixed submission:
n = input()
lista = list(map(int,input().split()))
r = 1

if 0 in lista:
  print(0)
else:
  for a in lista:
    r *= a
    if r > 10**18:
      print(-1)
      break
  else:
    print(r)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())

s = [1] * a + [0] * b + [-1] * c
print(sum(s[:k]))


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

if a + b >= k:
  print(min(a,k))
else:
  print(a - (k - a - b))
Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int,input().split())

area = h*w
ans = 0
for i in range(1,area+1):
  if i%2 == 1:
    ans += 1

print(ans)

Fixed submission:
h,w = map(int,input().split())

if w == 1:
  print(1)
  exit()
if h == 1:
  print(1)
  exit()
if w%2 == 0:
  ans = w//2 * h
elif w%2 == 1:
  if h%2 == 0:
    ans = h*w//2
  elif h%2 == 1:
    ans = h*w//2 + 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
ans = []
for i in range(m):
  x,y,c = map(int,input().split())
  ans.append(al[x-1] + bl[y-1] - c)
for i in range(a):
  for j in range(b):
    ans.append(al[i] + bl[j])
print(min(ans))

Fixed submission:
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
yasuiyo = min(al) + min(bl)
ans = []
for i in range(m):
  x,y,c = map(int,input().split())
  ans.append(al[x-1] + bl[y-1] - c)

print(min(min(ans),yasuiyo))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
ans = sys.maxsize
summoney = 0
for i in range(m):
  x,y,c = map(int,input().split())
  summoney = al[x-1] + bl[y-1] - c
  ans = min(ans,summoney)
for i in range(a):
  for j in range(b):
    summoney = al[i] + bl[j]
    ans = min(ans,summoney)
print(ans)

Fixed submission:
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
yasuiyo = min(al) + min(bl)
ans = []
for i in range(m):
  x,y,c = map(int,input().split())
  ans.append(al[x-1] + bl[y-1] - c)

print(min(min(ans),yasuiyo))

Buggy python submission (verdict: Runtime Error):
import sys
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = sys.maxsize
summoney = 0
for i in range(m):
  x,y,c = map(int,input().split())
  summoney = a[x-1] + b[y-1] - c
  ans = min(ans,summoney)
for i in range(a):
  for j in range(b):
    summoney = a[i] + a[j]
    ans = min(ans,summoney)
print(ans)

Fixed submission:
a,b,m = map(int,input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
yasuiyo = min(al) + min(bl)
ans = []
for i in range(m):
  x,y,c = map(int,input().split())
  ans.append(al[x-1] + bl[y-1] - c)

print(min(min(ans),yasuiyo))
Buggy python submission (verdict: Runtime Error):
import math
n,a,b = map(int,input().split())
r = math.ceil(n/(a+b))
retukaioh = ""
for i in range(r):
  retukaioh = retukaioh + "b"*a + "r"*b
print(retukaioh[0:n].count("b"))

Fixed submission:
n,a,b = map(int,input().split())
rest = n%(a+b)
n -= rest
ans = n//(a+b)*a
if rest >= a:
  ans += a
elif rest < a:
  ans += rest

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n,a,b = map(int,input().split())
r = math.ceil(n/(a+b))
retukaioh = ""
for i in range(r):
  retukaioh = retukaioh + "b"*a + "r"*b
print(retukaioh[0:n].count("b"))
print(retukaioh)

Fixed submission:
n,a,b = map(int,input().split())
rest = n%(a+b)
n -= rest
ans = n//(a+b)*a
if rest >= a:
  ans += a
elif rest < a:
  ans += rest

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h = int(input())
m = []
ans = 0
m.append(h)
while True:
  if m[0] == 1:
    del m[0]
    ans += 1
  elif m[0] > 1:
    m.append(m[0]//2)
    m.append(m[0]//2)
    del m[0]
    ans += 1
  if m == []:
    print(ans)
    exit()


Fixed submission:
h = int(input())
ans = 1

while True:
  if h == 1:
    print(ans)
    break
  ans = ans*2 + 1
  h //= 2
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(1,n+1):
  for j in range(n):
    if i == a[j]:
      ans.append(j+1)
      break
print(*ans,sep=' ')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[a[i]-1] = i+1

print(*ans,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(1,n+1):
  for j in range(n):
    if i == a[j]:
      ans.append(j+1)
      break
print(*ans,sep=' ')

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[a[i]-1] = i+1

print(*ans,sep=' ')