AtCoder Beginner Contest 093 - Small and Large Integers

Print all the integers that satisfies the following in ascending order:
 - Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

-----Constraints-----
 - 1 \leq A \leq B \leq 10^9
 - 1 \leq K \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B K

-----Output-----
Print all the integers that satisfies the condition above in ascending order.

-----Sample Input-----
3 8 2

-----Sample Output-----
3
4
7
8

 - 3 is the first smallest integer among the integers between 3 and 8.
 - 4 is the second smallest integer among the integers between 3 and 8.
 - 7 is the second largest integer among the integers between 3 and 8.
 - 8 is the first largest integer among the integers between 3 and 8.

Source: atcoder | Difficulty: EASY


Solutions:
(a, b, k) = map(int, input().split())
ans = []
for i in range(k):
	if a <= a + i <= b:
		ans.append(a + i)
	if a <= b - i <= b:
		ans.append(b - i)
ans = list(set(ans))
ans.sort()
for i in range(len(ans)):
	print(ans[i])


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '3 8 2'
		output = '3\n4\n7\n8'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '4 8 3'
		output = '4\n5\n6\n7\n8'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '2 9 100'
		output = '2\n3\n4\n5\n6\n7\n8\n9'
		self.assertIO(input, output)

def resolve():
	(A, B, K) = list(map(int, input().split()))
	ans = []
	for i in range(K):
		if A + i <= B and A + i not in ans:
			ans.append(A + i)
		if B - i >= A and B - i not in ans:
			ans.append(B - i)
	ans.sort()
	for a in ans:
		print(a)

def __starting_point():
	resolve()
__starting_point()


(A, B, K) = map(int, input().split())
ans = []
for j in range(K):
	a = A + j
	b = B - j
	if a > B or b < A:
		break
	ans.append(a)
	ans.append(b)
ans = list(sorted(set(ans), reverse=False))
for i in ans:
	print(i)


(a, b, k) = map(int, input().split())
for i in range(a, min(a + k, b + 1)):
	print(i)
for j in range(max(a + k, b - k + 1), b + 1):
	print(j)


(a, b, k) = map(int, open(0).read().split())
for i in range(a, b + 1):
	if abs(i - a) < k or abs(i - b) < k:
		print(i)


(A, B, K) = map(int, input().split(' '))
for i in range(A, min(A + K, B + 1)):
	print(i)
for j in range(max(A + K, B - K + 1), B + 1):
	print(j)


(a, b, k) = map(int, input().split())
num_limit = b - a + 1
if num_limit <= k * 2:
	ans_list = [i for i in range(a, b + 1, 1)]
else:
	ans_list = []
	for j in range(k):
		low = a + j
		high = b - j
		ans_list.append(low)
		ans_list.append(high)
	ans_list.sort()
for l in ans_list:
	print(l)


(A, B, K) = map(int, input().split())
li = range(A, B + 1)
ans = sorted(set(li[:K]) | set(li[-K:]))
for i in ans:
	print(i)


(a, b, k) = map(int, input().split())
[print(i) for i in sorted(set(list(range(a, min(a + k, b + 1))) + list(range(max(a, b - k + 1), b + 1))))]


(a, b, k) = list(map(int, input().split()))
for i in range(k):
	if a + i > b:
		break
	print(a + i)
start = max(a + k, b - k + 1)
for i in range(start, b + 1):
	print(i)


(A, B, K) = map(int, input().split())
for a in range(A, min(A + K, B + 1)):
	print(a)
for b in range(max(A + K, B - K + 1), B + 1):
	print(b)


lst = input().split()
A = int(lst[0])
B = int(lst[1])
K = int(lst[2])
if B - A + 1 <= 2 * K:
	for n in list(range(A, B + 1)):
		print(n)
else:
	for n in list(range(A, A + K)):
		print(n)
	for n in list(range(B - K + 1, B + 1)):
		print(n)


(A, B, K) = map(int, input().split())
L = range(A, B + 1)
print(*sorted(set(L[:K]) | set(L[-K:])), sep='\n')


(a, b, k) = map(int, input().split())
ans = range(a, b + 1)
for i in sorted(set(ans[:k]) | set(ans[-k:])):
	print(i)


(A, B, K) = map(int, input().split())
ret = range(A, B + 1)
for i in sorted(set(ret[:K]) | set(ret[-K:])):
	print(i)


(a, b, k) = map(int, input().split())
for i in range(a, b + 1):
	if a <= i <= a + k - 1 or b - k + 1 <= i <= b:
		print(i)


(a, b, k) = map(int, input().split())
if b - a < k:
	k = b - a
if k == 0:
	k = 1
ans = []
for i in range(a, a + k):
	ans.append(i)
for j in range(b, b - k, -1):
	ans.append(j)
ans = sorted(set(ans))
for i in ans:
	print(i)


(a, b, k) = map(int, input().split())
l = range(a, b + 1)
new = set(l[:k]) | set(l[-k:])
for i in sorted(new):
	print(i)


def abc():
	(a, b, c) = map(int, input().split())
	n = range(a, b + 1)
	for s in sorted(set(n[:c]) | set(n[-c:])):
		print(s)
abc()


(a, b, k) = list(map(int, input().split()))
k = min(k, b - a + 1)
(*al,) = list(range(a, a + k))
(*al2,) = list(range(b - k + 1, b + 1))
ans = al + al2
ans = list(set(ans))
ans.sort()
for i in ans:
	print(i)


(A, B, K) = map(int, input().split())
S = set()
for i in range(K):
	S.add(A + i)
	S.add(B - i)
print('\n'.join((str(x) for x in sorted(list(S)) if A <= x <= B)))


(A, B, K) = map(int, input().split())
x = range(A, B + 1)
for s in sorted(set(x[:K]) | set(x[-K:])):
	print(s)


(a, b, k) = map(int, input().split())
se = set(set(range(a, a + k)) | set(range(b - k + 1, b + 1)))
li = [x for x in se if a <= x <= b]
li = sorted(li)
print(*li, sep='\n')


(a, b, k) = map(int, input().split())
R = range(a, b + 1)
for x in sorted(set(R[:k]) | set(R[-k:])):
	print(x)


(a, b, k) = map(int, input().split())
n = min(b, a + k - 1)
m = max(b - k + 1, a + k)
for i in range(a, n + 1):
	print(i)
for i in range(m, b + 1):
	print(i)


(a, b, k) = map(int, input().split())
A = a
B = b
l = set([])
for i in range(k):
	if B >= a:
		l.add(a)
	if A <= b:
		l.add(b)
	a += 1
	b -= 1
m = sorted(l)
for x in m:
	print(x)


(A, B, K) = list(map(int, input().split()))
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))
ans = sorted(set(SA + SB))
for a in ans:
	print(a)


(a, b, k) = map(int, input().split())
n = range(a, b + 1)
print(*sorted(set(n[:k]) | set(n[-k:])), sep='\n')


(a, b, k) = map(int, input().split())
r = range(a, b + 1)
print(*sorted(set(r[:k]) | set(r[-k:])))


(a, b, k) = map(int, input().split())
ans = set()
for i in range(k):
	ans.add(a + i)
	ans.add(b - i)
for i in sorted(list(ans)):
	if a <= i <= b:
		print(i)


(a, b, k) = map(int, input().split())
c = [0] * 2 * k
for i in range(k):
	c[i] = min(a + i, b)
	c[k + i] = max(b - i, a)
c = sorted(set(c))
for i in c:
	print(i)


(a, b, k) = map(int, input().split())
s = list(range(a, b + 1)[:k])
t = list(range(a, b + 1)[-k:])
for r in sorted(set([s, s + t][b > k])):
	print(r)


(A, B, K) = [int(_) for _ in input().split()]
n = A
while n <= B:
	print(n)
	n += 1
	if n >= A + K:
		n = max(n, B - K + 1)


(A, B, K) = list(map(int, input().split()))
c = 0
S = []
if B - A <= K:
	for i in range(A, B + 1):
		print(i)
	return
for i in range(A, B + 1):
	if c == K:
		break
	print(i)
	S.append(i)
	c += 1
for i in range(B - K + 1, B + 1):
	if i not in S:
		print(i)


(A, B, K) = map(int, input().split())
ans = list(set(range(A, min(B, A + K))) | set(range(max(A, B - K + 1), B + 1)))
ans.sort()
print(' '.join(map(str, ans)))


(a, b, k) = map(int, input().split())
aa = set(range(a, min(b + 1, a + k)))
bb = set(range(max(b - k + 1, a), b + 1))
print(*sorted(aa | bb), sep='\n')


(a, b, k) = [int(x) for x in input().split()]
res = []
for i in range(a, min(b, k + a - 1) + 1):
	res.append(i)
for i in range(max(b - k + 1, a), b + 1):
	res.append(i)
res = list(set(res))
res.sort()
for i in range(len(res)):
	print(res[i])


(A, B, K) = map(int, input().split())
c = A
while c < A + K and c <= B:
	print(c)
	c += 1
c = max(B - K + 1, c)
while c <= B:
	print(c)
	c += 1


(a, b, n) = map(int, input().split())
Alist = list(range(a, min(a + n, b + 1), 1))
Blist = list(range(max(a, b - n + 1), b + 1, 1))
C = sorted(set(Alist) | set(Blist))
for i in list(C):
	print(i)


(A, B, K) = map(int, input().split())
for n in sorted(set(range(A, A + K)) | set(range(B - K + 1, B + 1))):
	if A <= n <= B:
		print(n)


(a, b, k) = map(int, input().split())
if k > b - a:
	k = b - a + 1
print('\n'.join(map(str, sorted(set(range(a, a + k)) | set(range(b - k + 1, b + 1))))))


from collections import OrderedDict
(A, B, K) = map(int, input().split())
L = []
res = []
if K > B - A:
	for i in range(A, B + 1):
		print(i)
	return
else:
	for i in range(A, A + K):
		res.append(i)
	for i in range(B - K + 1, B + 1):
		res.append(i)
res_unique = list(set(res))
res_unique.sort()
for i in res_unique:
	print(i)


(a, b, k) = map(int, input().split())
if k >= b - a + 1:
	for i in range(a, b + 1):
		print(i)
else:
	a_set = {i for i in range(a, a + k)}
	b_set = {i for i in range(b - k + 1, b + 1)}
	ans_set = sorted(a_set | b_set)
	for i in ans_set:
		print(i)


(A, B, K) = map(int, input().split())
L = []
s = [i for i in range(A, min(A + K, B + 1))]
l = [j for j in range(B, max(A - 1, B - K), -1)]
L += s + l
L = list(set(L))
L.sort()
for i in L:
	print(i)


(a, b, k) = map(int, input().split())
ab = range(a, b + 1)
for c in sorted(set(ab[:k]) | set(ab[-k:])):
	print(c)


(A, B, K) = map(int, input().split())
for i in range(A, B + 1, 1):
	if i - A < K or B - i < K:
		print(i)


(a, b, k) = map(int, input().split())
for i in range(k):
	if a + i <= b:
		print(a + i)
for j in range(k, 0, -1):
	if b - j >= a + k - 1:
		print(b - j + 1)


(A, B, K) = map(int, input().split())
if B - A <= 2 * (K - 1):
	for i in range(A, B + 1):
		print(i)
else:
	for i in range(A, A + K):
		print(i)
	for j in range(B - K + 1, B + 1):
		print(j)


(A, B, K) = map(int, input().split())
ans = list(set(range(A, A + K)) | set(range(B - K + 1, B + 1)))
ans.sort()
for i in ans:
	if A <= i <= B:
		print(i)


(A, B, K) = list(map(int, input().split()))
A1 = A
A2 = min(A + K, B + 1)
for i in range(A1, A2):
	print(i)
B1 = max(B - K + 1, A + K)
B2 = B + 1
for i in range(B1, B2):
	print(i)


(A, B, K) = map(int, input().split())
(*p,) = range(A, min(B + 1, A + K))
(*q,) = range(max(A, B - K + 1), B + 1)
print(*sorted(set(p + q)), sep='\n')


(a, b, k) = map(int, input().split())
ans = set([])
for i in range(a, min(a + k, b)):
	ans.add(i)
for i in range(max(b - k + 1, a), b + 1):
	ans.add(i)
ans = list(ans)
ans.sort()
for i in ans:
	print(i)


(a, b, k) = map(int, input().split())
x = range(a, b + 1)
if b - a + 1 < k * 2:
	print(*x, sep='\n')
else:
	print(*x[:k], sep='\n')
	print(*x[-k:], sep='\n')


(a, b, k) = map(int, input().split())
if b - a < 2 * k:
	for i in range(a, b + 1):
		print(i)
else:
	for i in range(a, a + k):
		print(i)
	for i in range(b - k + 1, b + 1):
		print(i)


(a, b, k) = map(int, input().split())
r = range(2)
an = sorted(set(range(a, min(a + k, b + 1))) | set(range(max(a, b - k + 1), b + 1)))
for i in an:
	print(i)


def resolve():
	(a, b, k) = map(int, input().split())
	if a + k - 1 >= b - k + 1:
		for i in range(a, b + 1):
			print(i)
	else:
		for i in range(a, a + k):
			print(i)
		for i in range(b - k + 1, b + 1):
			print(i)
resolve()


(a, b, k) = map(int, input().split())
st = a
while st <= min(a + k - 1, b):
	print(st)
	st += 1
st = max(st, b - k + 1)
while st <= b:
	print(st)
	st += 1


(a, b, c) = map(int, input().split())
for i in sorted(set(range(a, min(a + c, b))) | set(range(max(a, b - c + 1), b + 1))):
	print(i)


(a, b, k) = [int(n) for n in input().split()]
l = set(list(range(a, b + 1)[:k]) + list(range(a, b + 1)[-k:]))
l = sorted(list(l))
for n in l:
	print(n)


(a, b, k) = map(int, input().split())
k = k - 1
i = a
while True:
	print(i)
	i += 1
	if i > a + k or i > b:
		break
if i < b - k:
	i = b - k
while i <= b:
	print(i)
	i += 1


(a, b, k) = map(int, input().split())
L = range(a, b + 1)
for l in sorted(set(L[:k]) | set(L[-k:])):
	print(l)


(a, b, k) = map(int, input().split())
l = [i for i in range(a, b + 1) if i < a + k or i > b - k]
print(*l, sep='\n', end='')


(A, B, K) = map(int, input().split())
l = range(A, B + 1)
a = [n for n in l[:K]]
b = [n for n in l[-K:]]
for n in sorted(set(a + b)):
	print(n)


(a, b, k) = map(int, input().split())
N = [int(i) for i in range(a, min(a + k, b + 1))]
M = [int(i) for i in range(max(a, b - k + 1), b + 1)]
print(*sorted(set(M + N)), sep='\n')


(a, b, k) = map(int, input().split())
for x in range(a, min(a + k, b + 1)):
	print(x)
for x in range(max(a + k, b - k + 1), b + 1):
	print(x)


(A, B, K) = map(int, input().split())
x = A
while x < A + K and x <= B:
	print(x)
	x += 1
for y in range(max(x, B - K + 1), B + 1):
	print(y)


(a, b, k) = list(map(int, input().split()))
if b - a <= k:
	for i in range(a, b + 1):
		print(i)
else:
	ans = []
	for i in range(a, a + k):
		if i not in ans:
			ans.append(i)
			print(i)
	for j in range(b - k + 1, b + 1):
		if j not in ans:
			print(j)


(a, b, k) = map(int, input().split())
S = sorted(set(range(a, min(a + k, b + 1))) | set(range(max(b + 1 - k, a), b + 1)))
for _ in S:
	print(_)


(a, b, k) = map(int, input().split())
small = [i for i in range(a, a + k) if a <= i <= b]
big = [i for i in range(b - k + 1, b + 1) if a <= i <= b]
for i in range(len(small)):
	if small[i] not in big:
		big.append(small[i])
big.sort()
for i in range(len(big)):
	print(big[i])


(A, B, K) = map(int, input().split())
S = set()
for i in range(K):
	if A + i <= B:
		S.add(A + i)
	if B - i >= A:
		S.add(B - i)
for e in sorted(S):
	print(e)


(a, b, k) = list(map(int, input().split()))
for i in range(k):
	x = a + i
	if x <= b:
		print(a + i)
for i in range(k):
	x = b - k + i + 1
	if x <= a + k - 1 or x < a:
		pass
	else:
		print(x)


(A, B, K) = map(int, input().split())
r = range(A, B + 1)
for j in sorted(set(r[:K]) | set(r[::-1][:K])):
	print(j)


(A, B, K) = map(int, input().split())
W = list(range(A, min(A + K, B + 1)))
w = list(range(max(A, B - K + 1), B + 1))
A = sorted(set(W + w))
for i in A:
	print(i)


(A, B, K) = map(int, input().split())
L = set()
for i in range(A, A + K):
	if i <= B:
		L.add(i)
for i in range(B, B - K, -1):
	if i >= A:
		L.add(i)
print(*sorted(list(L)), sep='\n')


(a, b, k) = map(int, input().split())
li = []
if b - a + 1 < k or b - a < k * 2:
	for i in range(a, b + 1):
		li.append(i)
	for i in li:
		print(i)
	return
for i in range(a, a + k):
	li.append(i)
for i in range(b - k + 1, b + 1):
	li.append(i)
for i in li:
	print(i)


a = input().split(' ')
A = int(a[0])
B = int(a[1])
K = int(a[2])
if B - A + 1 <= K * 2:
	for i in range(A, B + 1):
		print(i)
else:
	for i in range(K):
		print(A + i)
	for i in range(K):
		print(B - K + 1 + i)


(a, b, k) = list(map(int, input().split()))
lis1 = []
lis2 = []
lis3 = []
for i in range(0, k):
	ap = a + i
	bm = b - i
	lis1.append(ap)
	lis2.append(bm)
lis3 = lis1 + lis2
sorted_lis = sorted(set(lis3))
for ans in sorted_lis:
	if a <= ans and ans <= b:
		print(ans)


(a, b, k) = map(int, input().split())
al = list(range(a, min(b + 1, a + k)))
bl = list(range(max(a, b - k + 1), b + 1))
l = sorted(set(al + bl))
for v in l:
	print(v)


(A, B, K) = map(int, input().split())
num = []
if A == B:
	print(A)
elif (B + 1 - A) / 2 <= K:
	for i in range(A, B + 1):
		print(i)
else:
	for j in range(K):
		num.append(A + j)
		num.append(B - j)
	for k in range(len(num)):
		num.sort()
		print(num[k])


(a, b, x) = map(int, input().split())
A = sorted(set(range(a, min(a + x, b + 1))) | set(range(max(b - x + 1, a), b + 1)))
print(*A, sep='\n')


(A, B, K) = map(int, input().split())
g = range(A, B + 1)
s = set(g[:K]) | set(g[len(g) - K:])
[print(n) for n in sorted(list(s))]


(a, b, k) = map(int, input().split())
ans = []
num_min = a + k
num_max = b - k + 1
if b - a + 1 > 2 * k:
	for i in range(a, num_min):
		ans.append(i)
	for i in range(num_max, b + 1):
		ans.append(i)
else:
	for i in range(a, b + 1):
		ans.append(i)
ans = sorted(set(ans))
for i in ans:
	print(i)


(a, b, k) = (int(i) for i in input().split())
list_ans = []
for i in range(1, k + 1):
	if a == b:
		list_ans.append(a)
		break
	if a > b:
		break
	list_ans.append(a)
	list_ans.append(b)
	a = a + 1
	b = b - 1
for i in sorted(list_ans):
	print(i)


(a, b, k) = map(int, input().split())
print(*sorted(list(set(list(range(a, min(a + k, b + 1))) + list(range(max(b + 1 - k, a), b + 1))))), sep='\n')


(a, b, k) = map(int, input().split())
x = list()
for i in range(k):
	if a + i <= b:
		print(a + i)
		x.append(a + i)
for j in range(k):
	f = b - k + j + 1
	if a <= f and f <= b and (f not in x):
		print(f)


import sys
input = sys.stdin.readline
import numpy as np

def main2():
	(A, B, K) = map(int, input().split())
	if A + K - 1 >= B - K + 1:
		for i in range(A, B + 1):
			print(i)
	else:
		for i in range(A, A + K):
			print(i)
		for i in range(B - K + 1, B + 1):
			print(i)

def main():
	numbers = []
	(a, b, k) = map(int, input().split())
	numbers = np.arange(a, b + 1)
	A = set(numbers[:k])
	B = set(numbers[-k:])
	answers = A | B
	for i in sorted(answers):
		print(i)

def __starting_point():
	main2()
__starting_point()


(A, B, K) = map(int, input().split())
print(*sorted(filter(lambda n: A <= n <= B, set(range(A, A + K)) | set(range(B - K + 1, B + 1)))), sep='\n')


(a, b, k) = map(int, input().split())
(c, d) = (set(range(a, a + k)), set(range(b - k + 1, b + 1)))
if b - a >= k:
	e = c | d
else:
	e = c & d
for i in sorted(e):
	print(i)


(A, B, K) = map(int, input().split())
X = [i for i in range(A, min(B, A + K))] + [j for j in range(max(A, B - K + 1), B + 1)]
X = sorted(list(set(X)))
for x in X:
	print(x)


from typing import List

def answer(a: int, b: int, k: int) -> List[int]:
	a_k = set(range(a, min(a + k, b + 1)))
	k_b = set(range(max(b - k + 1, a + 1), b + 1))
	return sorted(a_k.union(k_b))

def main():
	(a, b, k) = list(map(int, input().split()))
	for i in answer(a, b, k):
		print(i)

def __starting_point():
	main()
__starting_point()


(a, b, k) = map(int, input().split())
i = 0
while a + i <= a + k - 1 and a + i <= b:
	print(a + i)
	i += 1
for j in range(max([a + i, b - k + 1]), b + 1):
	print(j)


(A, B, K) = map(int, input().split())
r = range(A, B + 1)
l = list(r[:K])
l.extend(list(r[-K:]))
for i in sorted(set(l)):
	print(i)


(a, b, k) = map(int, input().split())
(i, c) = (0, [])
while a + i < b - i and i < k:
	c += [a + i]
	i += 1
i -= i == k
while -~i:
	c += [b - i]
	i -= 1
print(*sorted(set(c)), sep='\n')


(A, B, K) = map(int, input().split())
for x in range(A, A + K):
	if x <= B:
		print(x)
for x in range(max(x + 1, B - K + 1), B + 1):
	if x >= A:
		print(x)


(A, B, K) = list(map(int, input().split()))
if A + K - 1 >= B - K + 1:
	for i in range(A, B + 1):
		print(i)
else:
	for i in range(A, A + K):
		print(i)
	for i in range(B - K + 1, B + 1):
		print(i)


(a, s, k) = map(int, input().split())
if s - a <= 2 * k - 1:
	print(*list(range(a, s + 1)), sep='\n')
else:
	print(*list(range(a, a + k)) + list(range(s + 1 - k, s + 1)), sep='\n')


(a, b, k) = map(int, input().split())
tmp = range(a, b + 1)
for a in sorted(set(tmp[:k]) | set(tmp[-k:])):
	print(a)


(a, b, k) = map(int, input().split())
setA = set((i for i in range(a, min(a + k, b + 1))))
setB = set((j for j in range(b, max(b - k, a - 1), -1)))
l = list(setA | setB)
l.sort()
for m in l:
	print(m)


(A, B, K) = map(int, input().split())
tmp = set(range(A, min(B + 1, A + K))) | set(range(max(A, B - K + 1), B + 1))
[print(s) for s in sorted(tmp)]


(A, B, K) = map(int, input().split())
for n in sorted(filter(lambda n: A <= n <= B, set(range(A, A + K)) | set(range(B - K + 1, B + 1)))):
	print(n)


(A, B, K) = map(int, input().split())
ans = []
for i in range(K):
	if A + i <= B and A + i not in ans:
		ans.append(A + i)
	if B - i >= A and B - i not in ans:
		ans.append(B - i)
ans.sort()
for i in ans:
	print(i)


(a, b, k) = map(int, input().split())
ans = {}
for i in range(a, a + k):
	if i <= b:
		ans.setdefault(i, 0)
		ans[i] += 1
	else:
		break
for i in range(b - (k - 1), b + 1):
	if a <= i:
		ans.setdefault(i, 0)
		ans[i] += 1
	else:
		break
for i in ans.keys():
	print(i)


import sys
sys.setrecursionlimit(10 ** 9)

def mi():
	return map(int, input().split())

def ii():
	return int(input())

def isp():
	return input().split()

def deb(text):
	print('-------\n{}\n-------'.format(text))
INF = 10 ** 20

def main():
	(A, B, K) = mi()
	ans = set()
	for i in range(A, A + K):
		if A <= i <= B:
			ans.add(i)
	for i in range(B - K + 1, B + 1):
		if A <= i <= B:
			ans.add(i)
	ans = list(ans)
	ans.sort()
	print(*ans, sep='\n')

def __starting_point():
	main()
__starting_point()


(a, b, k) = map(int, input().split())
t = set()
for i in range(min(k, b - a + 1)):
	t.add(a + i)
	t.add(b - i)
l = sorted(list(t))
for i in l:
	print(i)


(a, b, k) = map(int, input().split())
xs = list(range(a, min(a + k, b + 1)))
ys = list(range(max(a + k, b + 1 - k), b + 1))
print('\n'.join(map(str, xs + ys)))


(a, b, c) = map(int, input().split())
l = list(range(a, b + 1)[0:c])
m = list(range(b, a - 1, -1)[0:c])
ans = sorted(set(l + m))
print(*ans)


(A, B, K) = map(int, input().split())
ans = set(range(A, min(A + K, B + 1))).union(set(range(B, max(A - 1, B - K), -1)))
print(*sorted(ans))


(A, B, K) = map(int, input().split())
b = min(A + K - 1, B)
for i in range(A, b + 1):
	print(i)
b2 = max(b + 1, B - K + 1)
for i in range(b2, B + 1):
	print(i)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
if a + c - 1 < b - c + 1:
	for i in range(c):
		print(a + i)
	for i in range(c):
		print(b - c + 1 + i)
else:
	for i in range(a, b + 1):
		print(i)


(a, b, k) = map(int, input().split())
s = {a, b}
for i in range(k):
	s.add(min(b, a + i))
	s.add(max(a, b - i))
print(*sorted(s), sep=' ')


(A, B, K) = list(map(int, input().split()))
S = sorted(list(set([i for i in range(A, min(A + K, B))] + [i for i in range(max(A, B - K + 1), B + 1)])))
for s in S:
	print(s)


(a, b, k) = map(int, input().split())
r = range(a, b + 1)
x = sorted(set(list(r[:k])) | set(list(r[-k:])))
for i in x:
	print(i)


(a, b, k) = map(int, input().split())
c = list(range(a, a + k))
d = list(range(b - k + 1, b + 1))
e = list(set(c + d))
e.sort()
for i in e:
	if a <= i <= b:
		print(i)


(a, b, k) = map(int, input().split())
print(*(list(range(a, b + 1)) if b - a < 2 * k else list(range(a, a + k)) + list(range(b - k + 1, b + 1))))


(a, b, k) = map(int, input().split())
l = min((a + b + 1) // 2, a + k)
r = max((a + b + 1) // 2, b - k + 1)
for i in range(a, l):
	print(i)
for i in range(r, b + 1):
	print(i)


(a, b, k) = map(int, input().split())
ans = set()
r = range(a, b + 1)
for i in range(min(k, len(r))):
	ans.add(r[i])
	ans.add(r[-i - 1])
else:
	[print(i) for i in sorted(ans)]


(a, b, k) = map(int, input().split())
A = set([i for i in range(a, min(a + k, b))])
B = set([i for i in range(max(a, b - k + 1), b + 1)])
print(*sorted(A | B), sep='\n')


(A, B, K) = map(int, input().split(' '))
l = [A + i for i in range(K) if A + i <= B] + [B - i for i in range(K) if B - i >= A]
for s in sorted(list(set(l))):
	print(s)


(a, b, k) = map(int, input().split())
x = []
y = []
if b - a < k:
	k = b - a + 1
for i in range(a, a + k):
	x.append(i)
for i in range(b - k + 1, b + 1):
	x.append(i)
x = list(set(x))
x.sort()
for i in range(len(x)):
	print(x[i])


(A, B, K) = map(int, input().split())
C = A
if K >= B - A:
	for f in range(1 + B - A):
		print(C)
		C += 1
else:
	B -= K - 1
	for i in range(K):
		print(A)
		A += 1
		if A == B:
			break
	for j in range(K):
		print(B)
		B += 1


(A, B, K) = map(int, input().split())
for num in range(A, min(B + 1, A + K)):
	print(num)
for num in range(max(A + K, B - K + 1), B + 1):
	print(num)


(a, b, k) = map(int, input().split())
s = set()
for i in range(min(k, b - a + 1)):
	s.add(a + i)
	s.add(b - i)
print(*sorted(s))


(A, B, K) = map(int, input().split())
S = sorted(set(list(range(A, B + 1)[:K]) + list(range(A, B + 1)[-K:])))
print(*S, sep='\n')


(A, B, K) = map(int, input().split())
i = A
while i <= min(B, A + K - 1):
	print(i)
	i += 1
j = B - K + 1
while j <= B:
	if i <= j:
		print(j)
	j += 1


(A, B, K) = map(int, input().split())
flag = True
for i in range(A, A + K):
	print(i)
	if i == B:
		falg = False
		break
if flag:
	if A + (K - 1) < B - (K - 1):
		for i in range(B - (K - 1), B + 1):
			print(i)
			if i == B:
				break
	else:
		for i in range(A + K, B + 1):
			print(i)
			if i == B:
				break


(a, b, k) = map(int, input().split())
r = range(a, b + 1)
r = list(set(r[:k]) | set(r[-k:]))
r.sort()
for _r in r:
	print(_r)


(A, B, K) = map(int, input().split())
X = list(range(A, min(A + K, B + 1)))
Y = list(range(max(A + K, B - K + 1), B + 1))
for v in X + Y:
	print(v)


(a, b, k) = map(int, input().split())
s = set()
for i in range(k):
	if a + i <= b:
		s.add(a + i)
	if b - i >= a:
		s.add(b - i)
s = sorted(s)
for x in s:
	print(x)


(A, B, K) = map(int, input().split())
r = range(A, B + 1)
S = set(r[:K]) | set(r[-K:])
for i in sorted(S):
	print(i)


(a, b, k) = list(map(int, input().split()))
ans = []
for i in range(k):
	n = a + i
	if n > b:
		break
	ans.append(n)
st = b - k + 1
st = max(st, ans[-1] + 1)
for i in range(st, b + 1):
	ans.append(i)
print(*ans, sep='\n')


(A, B, K) = list(map(int, input().split()))
upstart = max(B - K + 1, 0)
uplim = min(upstart + K, B)
ans = set([a for a in range(A, min(A + K, B))] + [b for b in range(upstart, uplim + 1)])
ans = sorted(list(ans))
for a in ans:
	if a < A:
		continue
	print(a)


(A, B, K) = map(int, input().split())
l = range(A, B + 1)
s = sorted(set(l[:K]) | set(l[-K:]))
for i in s:
	print(i)


(A, B, K) = map(int, input().split())
K = min(K, B - A + 1)
print(*sorted(set([i for i in range(A, A + K)] + [i for i in range(B - K + 1, B + 1)])), sep='\n')


(a, b, k) = map(int, input().split())
n = []
for i in range(k):
	if a + i > b:
		break
	n.append(a + i)
for j in range(k):
	if b - k + 1 + j < a:
		break
	if n.count(b - k + 1 + j) <= 0:
		n.append(b - k + 1 + j)
[print(num) for num in n]


import sys
stdin = sys.stdin

def ns():
	return stdin.readline().rstrip()

def ni():
	return int(stdin.readline().rstrip())

def nm():
	return list(map(int, stdin.readline().split()))

def nl():
	return list(map(int, stdin.readline().split()))

def main():
	(a, b, k) = nm()
	for i in range(a, min(a + k, b + 1)):
		print(i)
	for i in range(max(a + k, b - k + 1), b + 1):
		print(i)

def __starting_point():
	main()
__starting_point()


(A, B, K) = map(int, input().split())
s = set()
for i in range(K):
	s |= {A + i, B - i}
[print(x) for x in sorted(s) if A <= x <= B]


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
(a, b, k) = [int(num) for num in lines.pop(0).split(' ')]
s1 = set(range(a, min(b, a + k)))
s2 = set(range(max(a, b - k + 1), b + 1))
lis = sorted(s1 | s2)
for i in lis:
	print(i)


(a, b, k) = map(int, input().split())
s = set(range(a, a + k))
t = set(range(b - k + 1, b + 1))
u = sorted(s | t)
for i in u:
	if a <= i <= b:
		print(i)


(a, b, k) = map(int, input().split())
for i in range(a, a + k):
	if b < i:
		break
	print(i)
for i in range(max(a + k, b - k + 1), b + 1):
	if i < a:
		continue
	print(i)


(a, b, k) = map(int, input().split())
X = range(a, b + 1)
Y = sorted(list(set(X[:k]) | set(X[-k:])))
print(*Y, sep='\n')


(A, B, K) = map(int, input().split())
list = range(A, B + 1)
set1 = set(list[:K])
set2 = set(list[-K:])
print(*sorted(set1 | set2), sep='\n')


(A, B, K) = map(int, input().split())
ls_1 = [i for i in range(A, min(A + K, B + 1))]
ls_2 = [j for j in range(max(A, B - K + 1), B + 1) if j not in ls_1]
ls = ls_1 + ls_2
for ans in ls:
	print(ans)


(A, B, K) = map(int, input().split())
S = set(range(A, A + K)) | set(range(B - (K - 1), B + 1))
S = list(S)
S.sort()
for x in S:
	if A <= x <= B:
		print(x)


(A, B, K) = map(int, input().split())
X = range(A, B + 1)
for _ in sorted(set(X[:K]) | set(X[-K:])):
	print(_)


(A, B, K) = map(int, input().split())
l = range(A, min(B + 1, A + K))
r = range(max(A, B + 1 - K), B + 1)
print('\n'.join(map(str, sorted(set(l) | set(r)))))


(a, b, k) = [int(x) for x in input().split()]
r = range(a, b + 1)
print('\n'.join(map(str, sorted(set(r[:k]) | set(r[-k:])))))