Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int,input().split()))
h.insert(0,0)
h.append(0)
temp = []
cnt = 0

while h.count(0) <= n+2:
    for i in range(n+1):
        if h[i] == 0 and h[i+1] != 0:
            temp.append(h[i+1])
            s_ind = i+1
        if h[i] != 0 and h[i+1] != 0:
            temp.append(h[i+1])
        if h[i] != 0 and h[i+1] == 0:
            f_ind = i
            cnt += min(temp)
            temp = [j-min(temp) for j in temp]
            h = [h[k] if k not in range(s_ind,f_ind+1) else temp[k - s_ind] for k in range(n+2)]
            
print(cnt)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
h = [h[i] if h[i] != 0 else "#" for i in range(n)]

ans = 0
cond = True
while cond:
    for i in range(n):
        if (i == 0 and h[i] != "#") or (h[i-1] == "#" and h[i] != "#"):
            ans += 1
        
        if h[i] != "#":
            h[i] -= 1

    h = [h[i] if h[i] != 0 else "#" for i in range(n)]

    if h.count("#") == n:
        cond = False

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

s = input()
A = "keyence"

ind = 100

for i in range(len(s)):
	if i == 0:
		if s[i] == A[i]:
			continue
		else:
			ind = -1
			break

	if i == 6:
		if s[i] == A[i]:
			print("YES")
			sys.exit()

	else:
		if s[i] == A[i]:
			continue
		else:
			ind == i
			break

if ind == -1:
	print("NO")
	sys.exit()

ind_back = 100

for i in range(1,8):
	if i == 1:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == -1
			break

	if i == 7:
		if s[-i] == A[-i]:
			print("YES")
			sys.exit()

	else:
		if s[-i] == A[-i]:
			continue
		else:
			ind_back == 7-i+1

if ind == ind_back:
	print("YES")
else:
	print("NO")


Fixed submission:
s = input()
l = len(s)
cond = False
for i in range(8):
	if s[:i] + s[-(7-i):] == "keyence":
		cond = True

if cond:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = list(map(int, input().split()))

DP = [0 for _ in range(N)]

for i in range(1,N):
	temp = []
	for j in range(min(i,K)):
		temp.append(DP[i-(j+1)] + abs(H[i]-H[i-(j+1)]))

	DP[i] = min(temp)

print(DP[N-1])

Fixed submission:
N,K = map(int,input().split())
H = list(map(int, input().split()))

DP = [0 for _ in range(N)]

for i in range(1,N):
	temp = []
	for j in range(min(i,K)):
		temp.append(DP[i-(j+1)] + abs(H[i]-H[i-(j+1)]))

	DP[i] = min(temp)

print(DP[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K= map(int,input().split())
H = list(map(int, input().split()))

dp = [[0 for _ in range(N)] for _ in range(K)]

for i in range(1,N):
	dp[0][i] = dp[0][i-1] + abs(H[i]-H[i-1])


for i in range(1,K):
	for j in range(1,N):
		if j <= i:
			dp[i][j] = dp[i-1][j]
		else:
			temp = []
			for k in range(i+1):
				temp.append(dp[i][j-(k+1)]+abs(H[j]-H[j-(k+1)]))
			dp[i][j] = min(dp[i-1][j], min(temp))

print(dp[K-1][N-1])


Fixed submission:
N,K = map(int,input().split())
H = list(map(int, input().split()))

DP = [0 for _ in range(N)]

for i in range(1,N):
	temp = []
	for j in range(min(i,K)):
		temp.append(DP[i-(j+1)] + abs(H[i]-H[i-(j+1)]))

	DP[i] = min(temp)

print(DP[N-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[]
for i in range(n):
    p.append(int(input())

print(sum(p)-(max(p)//2))

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

print(sum(p)-(max(p)//2))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[]
for i in range(n):
    p.append(int(input())

print(int(sum(p))-(int(max(p))/2))

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

print(sum(p)-(max(p)//2))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[]
for i in range(n):
    p.append(int(input())

print(sum(p)-(max(p)/2))

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

print(sum(p)-(max(p)//2))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[int(input() for i in range(n)]

print(sum(p)-(max(p)/2))

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

print(sum(p)-(max(p)//2))

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[input() for i in range(n)]
print(sum(p)-max(p)/2)

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

print(sum(p)-(max(p)//2))
Buggy python submission (verdict: Runtime Error):
N, K=map(int,input().split())2h=[int(input())foriinrange(N)]3h.sort()4print(min(h[i+K-1]-h[i]foriinrange(N-K+1)))

Fixed submission:
n,k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, k = map(int,input().split())
h = sorted([int(input()) for _ in range(n)])

hh = [h[i+1] - h[i] for i in range(n-1)]

ans = float("inf")
for i in range(n-k+1):
    ans = min([ans, sum(hh[i:i+k-1])])

print(ans)

Fixed submission:
n,k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
h = sorted([int(input()) for _ in range(n)])

hh = [h[i+1] - h[i] for i in range(n-1)]

ans = float("inf")
for i in range(n-k+1):
    ans = min([ans, sum(hh[i:i+k-1])])

print(ans)

Fixed submission:
n,k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))
Buggy python submission (verdict: Runtime Error):
s=input()

print(min([abs(int(s[i]+s[i+1]+s[i+2])-753) for i in range(len(s)-3)]))

Fixed submission:
x = int(input())

if x == 7 or x == 5 or x == 3:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

c = A.pop(0)
l = A.pop()
r = A.pop()
ans = (l-c) + (r-c)

cond = 0
while A:
	if cond % 4 == 0:
		tmp = A.pop(0)
		ans += l - tmp
		l = tmp
		cond += 1 
	elif cond % 4 == 1:
		tmp = A.pop(0)
		ans += r - tmp
		r = tmp
		cond += 1
	elif cond % 4 == 2:
		tmp = A.pop()
		ans += tmp - l
		l = tmp
		cond += 1
	else:
		tmp = A.pop()
		ans += tmp - r
		r = tmp
		cond += 1

print(ans)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

l = A.pop()
r = A.pop(0)
ans = abs(l-r)
while A:
	tmp = [abs(l-A[0]),abs(l-A[-1]),abs(r-A[0]),abs(r-A[-1])]
	cond = tmp.index(max(tmp))

	if cond == 0:
		ans += tmp[0]
		l = A.pop(0)
	elif cond == 1:
		ans += tmp[1]
		l = A.pop()
	elif cond == 2:
		ans += tmp[2]
		r = A.pop(0)
	else:
		ans += tmp[3]
		r = A.pop()

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import sys

n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = math.gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

print(LCM)

Fixed submission:
import math
import sys

def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)


n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

print(LCM)

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

n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = math.gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

print(LCM)

	

Fixed submission:
import math
import sys

def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)


n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

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

if n == 1:
    print("Hello World")
else:
    a, b = map(int,input().split())
    print(a+b)
  

Fixed submission:
n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
n,m,x,y = map(int, input().split())
x_city = sorted(list(map(int, input().split())))
y_city = sorted(list(map(int, input().split())))

if x_city[len(x_city)-1] < y_city[0] and (x < y_city[0] <= y)
    print("No War")
else:
    print("War")


Fixed submission:
n,m,x,y = map(int, input().split())
x_city = sorted(list(map(int, input().split())))
y_city = sorted(list(map(int, input().split())))

if x_city[len(x_city)-1] < y_city[0] and (x < y_city[0] <= y):
    print("No War")
else:
    print("War")
Buggy python submission (verdict: Runtime Error):
import sys

def gcd(a,b):
    mod = a % b
    if mod == 0:
        return b
    return gcd(b, a%b)


n, X = map(int,input().split())
x = sorted(list(map(int, input().split())) + [X])

if len(x) == 2:
    print(x[1]- x[0])
    sys.exit()

xx = [x[i+1] -x[i] for i in range(len(x)-1)]

g = gcd(xx[0],xx[1])

if len(xx) >= 3:
    for i in range(2,n-1):
        g = gcd(g,xx[n])

print(g)

Fixed submission:
import sys

def gcd(a,b):
    mod = a % b
    if mod == 0:
        return b
    return gcd(b, a%b)


n, X = map(int,input().split())
x = sorted(list(map(int, input().split())) + [X])

if len(x) == 2:
    print(x[1]- x[0])
    sys.exit()

xx = [x[i+1] -x[i] for i in range(len(x)-1)]

g = gcd(xx[0],xx[1])

if len(xx) >= 3:
    for i in range(2,n):
        g = gcd(g,xx[i])

print(g)

Buggy python submission (verdict: Runtime Error):
n, X = map(int,input().split())
x = sorted(list(map(int, input().split())) + [X])

xx = [x[i+1] -x[i] for i in range(len(x)-1)]

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(xx))


Fixed submission:
import sys

def gcd(a,b):
    mod = a % b
    if mod == 0:
        return b
    return gcd(b, a%b)


n, X = map(int,input().split())
x = sorted(list(map(int, input().split())) + [X])

if len(x) == 2:
    print(x[1]- x[0])
    sys.exit()

xx = [x[i+1] -x[i] for i in range(len(x)-1)]

g = gcd(xx[0],xx[1])

if len(xx) >= 3:
    for i in range(2,n):
        g = gcd(g,xx[i])

print(g)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

if n % K == 0:
    print(0)
else:
    print(1)

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

if n % k == 0:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=[]
t=N
while t != 0:
    if t%(-2)==0:
        ans.append('0')
        t //= -2
    else:
        ans.append('1')
        t=(t-1)//(-2)
        
ans = rereversed(ans)
print(''.join(ans))
        

Fixed submission:
N = int(input())

L = [[0,1]]
i = 1
while True:
	d = (-2) ** i
	if d < 0:
		L.append([L[-1][0]+d,L[-1][1]])
	else:
		L.append([L[-1][0],L[-1][1]+d])

	a,b = L[-1]
	if a <= N <= b:
		break

	i += 1
		
ans = []
tmp = N
for i in reversed(range(len(L))):
	if i == 0:
		if tmp == 1:
			ans.append("1")
		else:
			ans.append("0")
		break

	add = (-2) ** i
	a,b = L[i]
	c,d = L[i-1]
	if a == c:
		if d < tmp <= b:
			ans.append("1")
			tmp -= add
			continue
	elif b == d:
		if a <= tmp < c:
			ans.append("1")
			tmp -= add
			continue

	ans.append("0")

if ans[0] == "0":
	ans.pop(0)

print("".join(ans))

Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=[]
t=N
while t > 0:
    if t%(-2)==0:
        ans.append('0')
        t //= -2
    else:
        ans.appappend('1')
        t=(t-1)//(-2)
        
print(''.join(reversed(ans)))
        

Fixed submission:
N = int(input())

L = [[0,1]]
i = 1
while True:
	d = (-2) ** i
	if d < 0:
		L.append([L[-1][0]+d,L[-1][1]])
	else:
		L.append([L[-1][0],L[-1][1]+d])

	a,b = L[-1]
	if a <= N <= b:
		break

	i += 1
		
ans = []
tmp = N
for i in reversed(range(len(L))):
	if i == 0:
		if tmp == 1:
			ans.append("1")
		else:
			ans.append("0")
		break

	add = (-2) ** i
	a,b = L[i]
	c,d = L[i-1]
	if a == c:
		if d < tmp <= b:
			ans.append("1")
			tmp -= add
			continue
	elif b == d:
		if a <= tmp < c:
			ans.append("1")
			tmp -= add
			continue

	ans.append("0")

if ans[0] == "0":
	ans.pop(0)

print("".join(ans))
Buggy python submission (verdict: Runtime Error):
a = int(input)

if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")

Fixed submission:
a = int(input())

if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")
Buggy python submission (verdict: Runtime Error):
import itertools

D,G = map(int, input().split())
PC = [list(map(int, input().split())) for _ in range(D)]

P_list = list(range(D))
cnt = float('inf')

for i in range(D):
	for bonus in itertools.combinations(P_list, i):

		tmp_cnt = 0
		score = 0

		for j in bonus:
			score += PC[j][0] * 100 * (j+1) + PC[j][1]
			tmp_cnt += PC[j][0]

		res_max_p = max([k for k in range(D) if k not in bonus])
		res_score = G - score
		if res_score > 0:
			t = (-res_score//((res_max_p+1)*100)) * (-1) 
			if t < PC[res_max_p][0]:
				tmp_cnt += t
			else:
				continue

		cnt = min(cnt, tmp_cnt)

if cnt == float('inf'):
	cnt = sum([PC[j][0] for j in rnage(D)])

print(cnt)




Fixed submission:
D, G = map(int, input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

p = []
c = []
for _ in range(D):
	p_tmp, c_tmp = map(int,input().split())
	p.append(p_tmp)
	c.append(c_tmp)
t = [(i+1)*100*p[i] + c[i] for i in range(D)]

ans = float("inf")

for i in range(2**D):
	flg = list(map(int, Base_10_to_n(i,2).rjust(D,"0")))
	tmp_score = sum([t[j] for j in range(D) if flg[j] == 1])
	cnt = sum([p[j] for j in range(D) if flg[j] == 1])

	if tmp_score < G:

		rst_max_q = max([j for j in range(D) if flg[j] == 0])

		rst_q_num = 0
		while rst_q_num < p[rst_max_q]:
			tmp_score += 100*(rst_max_q+1)
			rst_q_num += 1
			cnt += 1
			if tmp_score >= G:
				break

		if tmp_score < G:
			continue

	ans = min(ans, cnt)


print(ans)

Buggy python submission (verdict: Runtime Error):
D, G = map(int,input().split())
num_q = []
bonus = []
for _ in range(D):
	pp,cc = map(int,input().split())
	num_q.append(pp)
	bonus.append(cc)

cnt = [0] * D
ans = float("inf")

def dfs(cnt, i, score):
	global ans

	if sum(cnt) >= ans:
		return True

	if cnt[i] == num_q[i]:
		score += bonus[i]

	if cnt[D-1] == num_q[D-1]:
		if score >= G:
			ans = min([ans,sum(cnt)])
			return True
		else:
			return True

	if score >= G:
		ans = min([ans,sum(cnt)])
		return True
	
	
	for j in range(i,D):
		if cnt[j] < num_q[j]:
			cnt[j] += 1
			dfs(cnt, j, score+(100*(j+1)))
			cnt[j] -= 1

dfs(cnt,0,0)
print(ans)

Fixed submission:
D, G = map(int, input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

p = []
c = []
for _ in range(D):
	p_tmp, c_tmp = map(int,input().split())
	p.append(p_tmp)
	c.append(c_tmp)
t = [(i+1)*100*p[i] + c[i] for i in range(D)]

ans = float("inf")

for i in range(2**D):
	flg = list(map(int, Base_10_to_n(i,2).rjust(D,"0")))
	tmp_score = sum([t[j] for j in range(D) if flg[j] == 1])
	cnt = sum([p[j] for j in range(D) if flg[j] == 1])

	if tmp_score < G:

		rst_max_q = max([j for j in range(D) if flg[j] == 0])

		rst_q_num = 0
		while rst_q_num < p[rst_max_q]:
			tmp_score += 100*(rst_max_q+1)
			rst_q_num += 1
			cnt += 1
			if tmp_score >= G:
				break

		if tmp_score < G:
			continue

	ans = min(ans, cnt)


print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
cnt = 1
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        cnt *= 0

print("No") if cnt else print("Yes")

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

print(data[2] - data[0])

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        print("Yes")
        exit()
print("No")

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

print(data[2] - data[0])

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for _ in range(len(s)):
    s = s[len(s)-1]+"".join([s[i] for i in range(len(s)-1)])
    if s == t:
        print("Yes")
        exit()
        
print("No")

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

print(data[2] - data[0])
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for _ in range(len(s)):
    s = s[len(s)-1]+"".join[s[i] for i in range(len(s)-1)]
    if s == t:
        print("Yes")
        exit()
        
print("No")

Fixed submission:
s = input()
t = input()
cnt = 1
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        cnt *= 0

print("No") if cnt else print("Yes")
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab = sorted(ab, key = lambda x:x[1], reverse = True)
ab = sorted(ab)

def find_seed(ab, t):
	if len(ab) == 0:
		return 1
	if t[0] <= ab[0][0] < t[1]:
		t = [ab[0][0], min([ab[0][1],t[1]])]
		ab.pop(0)
		return find_seed(ab,t)

	return 1

ans = 0

while len(ab) > 0:
	t = ab.pop(0)
	ans += find_seed(ab,t)

print(ans)

Fixed submission:
N, M = map(int,input().split())
E = sorted([list(map(int, input().split())) for _ in range(M)])

c = E[0]
cnt = 0
for i in range(1,M):
	if c[0] <= E[i][0] < c[1]:
		c = [max(c[0],E[i][0]), min(c[1],E[i][1])]
	else:
		cnt += 1
		c = E[i]

print(cnt+1)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab = sorted(ab, key = lambda x:x[1], reverse = True)
ab = sorted(ab)

def find_seed(ab, t):
	if len(ab) == 0:
		return 1
	if t[0] <= ab[0][0] < t[1]:
		t = [ab[0][0], min([ab[0][1],t[1]])]
		ab.pop(0)
		if len(ab) == 0:
			return 1
		else:
			return find_seed(ab,t)

	return 1

ans = 0

while len(ab) > 0:
	t = ab.pop(0)
	ans += find_seed(ab,t)

print(ans)

Fixed submission:
N, M = map(int,input().split())
E = sorted([list(map(int, input().split())) for _ in range(M)])

c = E[0]
cnt = 0
for i in range(1,M):
	if c[0] <= E[i][0] < c[1]:
		c = [max(c[0],E[i][0]), min(c[1],E[i][1])]
	else:
		cnt += 1
		c = E[i]

print(cnt+1)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
s = list(range(a,b+1))
ans = [s[i] for i in range(len(s)) if i < k or i > (len(s) - k -1)]
for i in ans:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
if b-a+1 >= 2*k:
    aa = [a+i for i in range(k)]
    bb = [b-i for i in range(k)]
    cc = sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for s in range(a,b+1):
        print(s)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
nums=list(range(a,b+1))
start=nums[:k]
end=nums[len(nums)-k:]
ans=start+end
for i in ans:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
if b-a+1 >= 2*k:
    aa = [a+i for i in range(k)]
    bb = [b-i for i in range(k)]
    cc = sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for s in range(a,b+1):
        print(s)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
nums = list(range(a,b+1))
ans = [nums[i] for i in range(len(nums)) if i < k or i > (len(nums) - k - 1)]
for i in ans:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
if b-a+1 >= 2*k:
    aa = [a+i for i in range(k)]
    bb = [b-i for i in range(k)]
    cc = sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for s in range(a,b+1):
        print(s)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
nums = list(range(a,b+1))
ans = [nums[i] for i in range(len(nums)) if i < k or i > (len(nums) - k - 1)]
for i in ans:
    print(i)

Fixed submission:
a, b, k = map(int,input().split())
if b-a+1 >= 2*k:
    aa = [a+i for i in range(k)]
    bb = [b-i for i in range(k)]
    cc = sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for s in range(a,b+1):
        print(s)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min[a,b] + min[c,d])

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min([a,b]) + min([c,d]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, input().split())
grid = np.array([list(map(str, input())) for _ in range(H)])

X = np.where(grid == '#')
A = np.zeros([H,W])
A[X] = 1
orig_black = np.count_nonzero(grid=='#')

q = [[0,0,0]]
while q:
	cx,cy,cd = q.pop(0)
	if cx == H-1 and cy == W-1:
		shortest = cd
		break
	elif A[cx,cy] == -1:
		continue

	A[cx,cy] = -1

	for nx,ny in [[cx+1,cy],[cx-1,cy],[cx,cy+1],[cx,cy-1]]:
		if 0 <= nx < H and 0 <= ny < W:
			if A[nx][ny] == 0:
				q.append([nx,ny,cd+1])

print((H*W)-shortest-orig_black-1)

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

H, W = map(int, input().split())
S = [list(map(str, input())) for _ in range(H)]

tmp = 0
for i in range(H):
	tmp += S[i].count("#")

w_count = (H*W) - tmp

def bfs(field, dp, q):
	cp = q.pop(0)
	np = [[cp[0]+1,cp[1]], [cp[0]-1,cp[1]], [cp[0],cp[1]+1], [cp[0],cp[1]-1]]

	for n in np:
		if 0 <= n[0] <= H-1 and 0 <= n[1] <= W-1:
			if field[n[0]][n[1]] == "." and dp[n[0]][n[1]] == inf:
				q.append(n)
				dp[n[0]][n[1]] = dp[cp[0]][cp[1]] + 1
			if n == [H-1,W-1]:
				return dp[n[0]][n[1]]

	if len(q) == 0:
		return -1

	return bfs(field, dp, q)

inf = float("inf")
dp = [[inf for _ in range(W)] for _ in range(H)]
dp[0][0] = 0
nes = bfs(S, dp, [[0,0]])
if nes == -1:
	print(-1)
else:
	print(w_count-nes-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())

#1st query
print(0, flush = True)
sex = input()
if sex == 'Vacant':
	sys.exit()
memo = N-1
crnt = 0
clockwise = True
while True:
	if clockwise:
		next = crnt + (memo-crnt)//2
	else:
		next = crnt - (crnt - memo)//2
	pirnt(next, flush = True)
	S = input()
	if S == 'Vacant':
		sys.exit()
	if S != sex:
		clockwise *= -1
		sex = S
		memo = crnt
	crnt = next


Fixed submission:
import sys
N = int(input())
print(0, flush=True)
cond = input()
if cond == 'Vacant':
    sys.exit()

l = 0
r = N-1
while r-l > 3:
    mid = (l+r)//2
    if mid % 2 == 1:
        mid += 1

    print(mid, flush=True)
    I = input()
    if I == 'Vacant':
        sys.exit()
    else:
        if cond == I:
            l = mid
        else:
            r = mid

for i in range(l,r+1):
    print(i, flush=True)
    if input() == 'Vacant':
        sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

#1st query
print(0)
sex = input()
memo = N-1
crnt = 0
clockwise = True
while True:
	if clockwise:
		next = crnt + (memo-crnt)//2
	else:
		next = crnt - (crnt - memo)//2
	pirnt(next)
	S = input()
	if S != sex:
		clockwise *= -1
		sex = S
		memo = crnt
	crnt = next


Fixed submission:
import sys
N = int(input())
print(0, flush=True)
cond = input()
if cond == 'Vacant':
    sys.exit()

l = 0
r = N-1
while r-l > 3:
    mid = (l+r)//2
    if mid % 2 == 1:
        mid += 1

    print(mid, flush=True)
    I = input()
    if I == 'Vacant':
        sys.exit()
    else:
        if cond == I:
            l = mid
        else:
            r = mid

for i in range(l,r+1):
    print(i, flush=True)
    if input() == 'Vacant':
        sys.exit()
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
print(min([a*n,b])

Fixed submission:
n, a, b = map(int, input().split())
print(min([n*a,b]))