Problem:


Score : 200 points

Problem Statement

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 1

3 8 2

Sample Output 1

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.

Sample Input 2

4 8 3

Sample Output 2

4
5
6
7
8

Sample Input 3

2 9 100

Sample Output 3

2
3
4
5
6
7
8
9



Sample input:
3 8 2


Sample output:
3
4
7
8

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

A,B,K = list(map(int,input().split()))
num_lis = []
for i in range(A,A+K):
    if i <= B:
        num_lis.append(i)
    else:
        break
    
for i in range(B,B-K,-1):
    if i>= A:
        num_lis.append(i)
    else:
        break
b = sorted(list(set(num_lis)))

for i in range(len(b)):
    print(b[i])

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
l = []
for i in range(A,A+K):
  if i > B:
    break
  l.append(i)

for i in range(B, B-K,-1):
  if i < A:
    break
  if not i in l:
    l.append(i)
l.sort()

for i in l:
  print(i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())

if b - a < 2 * k:
    for v in range(a, b+1):
        print(v)
else:
    for v in range(a, a+k):
        print(v)
    for v in range(b-k+1, b+1):
        print(v)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


def main():
    a, b, k = map(int, input().split())
    ans = set()
    for i in range(k):
        if a + i + 1 <= b: ans.add(a + i)
        if b - i >= a: ans.add(b - i)
    ans = list(ans)
    ans.sort()
    for x in ans: print(x)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, K = il()
    st = set()
    for a in range(A, A + K):
        if a > B: break
        st.add(a)
    for b in reversed(range(B - K+1, B+1)):
        if b < A: break
        st.add(b)
    print(*sorted(st), sep="\n")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b,k = i2()
if b - (a-1) <= 2*k:
	for i in range(a,b+1):
		print(i)
else:
	for i in range(k):
		print(a+i)
	for i in range(-k+1,1):
		print(b+i)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a, b, k = [int(w) for w in input().split()]

ak = a + k
bk = b - k + 1

for i in range(a, min(ak, b+1)):
    print(i)
for i in range(max(ak, bk), b + 1):
    print(i)

Submission status: Accepted

Solution code:
a,b,k = map(int, input().split())

ans = []
t = 0
for i in range(a,b+1):
  t += 1
  if t > k: break
  ans.append(i)
  
t = 0
for i in range(b,a-1,-1):
  t += 1
  if t > k: break
  ans.append(i)

for i in sorted(set(ans)): print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
l = []
for i in range(K):
    if A+i <= B:
        l.append(A+i)
    if B-i >= A:
        l.append(B-i)

for i in sorted(set(l)):
    print(i)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    a, b, k = [int(x) for x in input().split()]
    ans = set()

    for x in range(a, min(a+k, b)):
        ans.add(x)
    for x in range(max(a, b-k+1),b+1):
        ans.add(x)
        
    ans = list(ans)
    ans.sort()
    for e in ans:
        print(e)
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""

4
1 2
2 4
1 3
3
2 2 4
4 5 6

6
1 2
2 3
3 4
4 5
4 6
3
3 5 6
2 17 31 5 11

"""

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())

min = [0] * k
max = [0] * k

for i in range(k):
  if a+i > b:
    break
  min[i] = a+i

for n in range(k):
  if b-n < a:
    break
  max[n] = b-n

ans = min + max
ans = set(ans)
ans = list(ans)
ans.sort()

for j in ans:
  if j == 0:
    continue
  print(j)

Submission status: Accepted

Solution code:
def actual(A, B, K):
    min_left = A
    max_left = min(A + (K - 1), B)

    min_right = max(B - (K - 1), max_left + 1)
    max_right = B

    left = set(range(min_left, max_left + 1))
    right = set(range(min_right, max_right + 1))

    unique_nums = left | right

    return '\n'.join(map(str, sorted(unique_nums)))

A, B, K = map(int, input().split())
print(actual(A, B, K))

Submission status: Accepted

Solution code:
def actual(A, B, K):
    min_a = A
    max_a = min(A + (K - 1), B)

    min_b = max(B - (K - 1), max_a + 1)
    max_b = B

    left = list(range(min_a, max_a + 1))
    right = list(range(min_b, max_b + 1))

    return '\n'.join(map(str, sorted(set(left + right))))

  
A, B, K = map(int, input().split())
print(actual(A, B, K))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,k=nm()
nums=set()
for i in range(a,min(a+k,b)):
  nums.add(i)
for i in range(max(a,b-k+1),b+1):
  nums.add(i)

for n in sorted(nums):
  print(n)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())

N = B - A + 1
limit = int(N / 2)
if K > limit:
  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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans1 = [i for i in range(a,min(a+k,b+1))]
ans2 = [i for i in range(max(b-k+1,a),b+1)]

ans = set(ans1 + ans2)

print(*sorted(ans),sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int, input().split())
s = []
for i in range(a,min(a+k,b+1)):
  s.append(i)
for i in range(max(a,b-k+1,a+k),b+1):
  s.append(i)
sorted(s)
for i in s:
  print(i)

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans = set()

if(b-a <= k-1):
    for i in range(a,b+1):
        ans.add(i)
else:
    for i in range(a,a+k):
        ans.add(i)

    for i in reversed(range(b-k+1,b+1)):
        ans.add(i)

ans = list(ans)
ans.sort()

for i in range(len(ans)):
  print(ans[i])

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
lst=[]
for i in range(a,a+k):
    if i>b:
        break
    lst.append(i)
    print(i)
for i in range(b-k+1,b+1):
    if i<a:
        continue
    if not i in lst:
        print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())

for i in range(A, min(B, A + K - 1) + 1):
    print(i)
for i in range(max(B - K + 1, A + K), B + 1):
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1),1):
    ans.append(i)
for i in range(b,max(a-1,b-k),-1):
    ans.append(i)
ans=list(set(ans)) #重複を削除
ans.sort() #ソート
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1),1):
    ans.append(i)
for i in range(b,max(a,b-k),-1):
    ans.append(i)
ans=list(set(ans)) #重複を削除
ans.sort() #ソート
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
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)

Submission status: Accepted

Solution code:
def solve():
    a, b, k = map(int, input().split())
    ans = list()
    for i in range(a, min(a+k, b+1), 1):
        ans.append(i)
    for i in range(b, max(b-k,a), -1):
        ans.append(i)
    ans = list(set(ans))
    ans.sort()
    for i in ans:
        print(i)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def resolve():
    A, B, K = [int(i) for i in input().split()]
    offset = 0
    while offset < K and A + offset <= B:
        print(A + offset)
        offset += 1
    begin = A + offset
    r = max(B - K + 1, begin)
    while r <= B:
        print(r)
        r += 1


resolve()

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())

ansl=[]

for i in range(a,min(b+1,a+k)):
    ansl.append(i)
for i in range(b,max(b-k,a-1),-1):
    ansl.append(i)

ansl=list(set(ansl))
ansl.sort()
for ans in ansl:
    print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if K > B-A:
    ans = list(range(A, B+1))
else:
    ans = list(range(A, A+K)) + list(range(B, B - K, -1))
ans = list(set(ans))
ans.sort()
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
# input
A, B, K = map(int, input().split())

# check
if A + K > B:
    res = list(range(A, B + 1))
else:
    res = set(list(range(A, A + K)) + list(range(B, B - K, -1)))
    
for n in sorted(list(res)):
    print(n)

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
n = b - a + 1
if n <= k*2:
  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)

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans = []
for i in range(a,a+k):
    if i <= b:
        ans.append(i)
if b-a+1 >= 2*k:
    for j in range(b-k+1,b+1):
        ans.append(j)
else:
    for j in range(a+k,b+1):
        if j <= b:
            ans.append(j)

for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans = []
for i in range(a,a+k):
    if i <= b:
        ans.append(i)
if b-a+1 >= 2*k:
    for j in range(b-k+1,b+1):
        ans.append(j)
else:
    for j in range(a+k,b+1):
        if j <= b:
            ans.append(j)

for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
n = b - a + 1
if n <= k * 2:
    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)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if B-A+1 >= 2*K: # A以上B以下の整数の数が2K以上
    res_list = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
else: # A以上B以下の整数の数が2K未満
    res_list = [i for i in range(A, B+1)]
for i in res_list:
    print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())

if B-A+1<= 2*K:
    print(*range(A,B+1), sep="\n")
else:
    a = list(range(A,A+K))
    b = list(range(B-K+1,B+1))
    C = sorted(set(a+b))
    print(*C, sep="\n")

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 重なるところに注意
A, B, K = lr()
answer = [x for x in range(A, min(A+K, B+1))] + [x for x in range(max(B-K+1, A), B+1)]
answer = sorted(set(answer))
print('\n'.join(map(str, answer)))

Submission status: Accepted

Solution code:
def main():
    import sys
    def input(): return sys.stdin.readline()[:-1]
    pl = lambda x: print(*x, sep='\n')

    A, B, K = map(int, input().split())

    for val in range(A, B+1):
        if val<=A+K-1 or B-K+1<=val:
            print(val)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
 
 

 
 
ans = []
for x in range(A, min(A+K,B+1)):
    ans.append(x)
for x in range(max(A,B-K+1), B+1):
    ans.append(x)
for x in sorted(list(set(ans))):
    print(x)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    a,b,k = map(int,input().split())
    s = list(set(range(a,min(a+k,b+1))) | set(range(max(b-k+1,a),b+1)))
    s = sorted(s)

    for i in range(len(s)):
        print(s[i])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
l_left = list(range(a, min(a+k, b+1)))
l_right = list(range(b, max(b-k, a-1), -1))
s = sorted(list(set(l_left+l_right)))
for e in s:
  print(e)

Submission status: Accepted

Solution code:
def resolve():
    A, B, K = list(map(int, input().split()))
    if B - A + 1 >= 2 * K:
        ls = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
    else:
        ls = [i for i in range(A, B+1)]

    print('\n'.join(map(str, ls)))
    return

resolve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[41]:


A,B,K = map(int, input().split())


# In[42]:


ans = []
for x in range(A, min(A+K,B+1)):
    ans.append(x)
for x in range(max(A,B-K+1), B+1):
    ans.append(x)
for x in sorted(list(set(ans))):
    print(x)


# In[ ]:

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if B - A + 1 <= 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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int, input().split())

A = list(range(a,min(a+k,b+1)))
B = list(range(max(a,b-k+1),b+1))
ans = list(set(A)|set(B))
ans.sort()
for i in range(len(ans)):
  print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
ans = []
for i in range(A, min(A+K, B+1)):
    ans += [i]
for i in range(max(A, B-K+1), B+1):
    ans += [i]

ans = list(set(ans))
ans = sorted(ans)
for a in ans:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a, b,x = map(int, input().split())
    set1=set([i for i in range(a,min(a+x,b))])
    set2=set([i for i in range(max(a,b-x+1),b+1)])
    sumSet = set1 | set2
    list = list(sumSet)
    list.sort()

    for i in list:
        print(i)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
def resolve():
    A, B, K = map(int, input().split())
    if 2*K > B-A+1:
        for _ in range(B-A+1):
            print(A+_)
    else:
        for i in range(K):
            print(A+i)
        for j in range(K):
            print(B-K+j+1)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

a,b,k = readInts()

o = set(range(a,min(a+k,b)))
t = set(range(max(a,b-k+1),b+1))
ans = sorted(list(o|t))

for i in ans:
	print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
a = [i for i in range(A, min(A+K, B+1))]
b = [i for i in range(max(B-K+1, A), B+1)]
s = list(set(a+b))
s.sort()
for r in s:
    print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())

if B - A > 2 * K:
    for i in range(A, A + K):
        print(i)
    for i in range(B - K+1, B+1):
        print(i) 
else:
    for i in range(A, B+1):
        if i < A + K or i > B - K:
            print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())

N = []

for i in range(K):
    if A + i < B:
        N.append(A + i)
    if B - i >= A:
        N.append(B - i)
    
for n in sorted(set(N)):
    print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
out=[]
for i in range(k):
  if a+i>=b-i:
    if a+i==b-i:
      out.append(a+i)
    break
  out.append(a+i)
  out.append(b-i)
out.sort()
for i in out:
  print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
[print(i) for i in sorted(list(set([i for i in range(A,A+K)] + [i for i in reversed(range(B-K+1, B+1))]))) if A <= i <= B]

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
if B-A+1 <= K*2:
    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)

Submission status: Accepted

Solution code:
import math
import re
import copy
import sys

a,b,k = map(int,input().split())

for i in range(a,min(a+k,b+1)):
    print(i)

for j in range(max(b-k+1,i+1),b+1,1):
    print(j)

Submission status: Accepted

Solution code:
a, b, k = list(map(int, input().split()))

if b - a >= 2 * k:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
else:
    for i in range(a, b+1):
        print(i)

Submission status: Accepted

Solution code:
a,b,k = map(int, input().split())
ans = []
if b-a < 2*k:
    ans = list(range(a,b+1))
else:
    ans = [a+i for i in range(k)] + [b-i for i in reversed(range(k))]
print('\n'.join(map(str, ans)))

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
[print(i) for i in sorted(list(set([i for i in range(A,A+K)] + [i for i in reversed(range(B-K+1, B+1))]))) if A <= i <= B]

Submission status: Accepted

Solution code:
A,B,K=map(int,input().split())
if B==A:
    print(A)
    exit()
K=min(K,B-A)
ans=set()
for i in range(K):
    ans.add(A+i)
    ans.add(B-i)
ans=list(ans)
ans=sorted(ans)
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
a, b, k = [int(i) for i in input().split()]

if k < b-a+1:
    tmp1 = list(range(a, a+k))
    tmp2 = list(range(b-k+1, b+1))
    tmp1.extend(tmp2)
    tmp = sorted(list(set(tmp1)))
    
else:
    tmp = list(range(a, b+1))
    
for i in tmp:
    print(i)

Submission status: Accepted

Solution code:
a, b, k = (int(i) for i in input().split())
s = set()
for i in range(a, a+k):
    if i >= a and i <= b:
        s.add(i)
for i in range(b-k+1, b+1):
    if i > a and i <= b:
        s.add(i)
s = sorted(list(s))
for a in s:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
num=set()
for i in range(a,min(a+k,b+1)):
    num.add(i)
for j in range(max(a,b-k+1),b+1):
    num.add(j)
for i in sorted(list(num)):
    print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
if B - A + 1> 2*K:
    a = list(range(A, A+K))
    b = list(range(B-K+1,B+1))
    c = sorted(set(a+b))
    print(*c, sep="\n")
else:
    print(*range(A,B+1), sep="\n")

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
if a+2*k-1>=b:
  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)

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())

if (b+a)/2 - a < 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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
ll = []
for i in range(k):
    if a+i <= b:
        ll.append(a+i)
for j in range(k):
    if not b-k+j+1 in ll and b-k+j+1>=a:
        ll.append(b-k+j+1)
for k in ll:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a,b,k = map(int,input().split())
ans = []
if k > b-a:
    for i in range(a,b+1):
        print(i)
    sys.exit()
    
for i in range(k):
    t1 = a+i
    t2 = b-i
    ans.append(t1)
    ans.append(t2)
A = list(set(ans))
A.sort()

for i in A:
    print(i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())

if b+1 - a <= 2*k:
    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)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
if k>(b-a):
    k=b-a
list1=[i for i in range(a,a+k)]
list1.extend([i for i in range(b-k+1,b+1)])
ans=list(set(list1))
ans.sort()
if a==b:
    ans=[a]
for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
S = []
#list(range(A,B+1))
for i in range(K):
	S.append(A+i)
	S.append(B-i)

S = sorted(list(set(S)))

for i in range(len(S)):
	if A<=S[i]<=B:
		print(S[i])

Submission status: Accepted

Solution code:
def main():
    A, B, K = map(int, input().split())

    ans = list()

    ans.extend(range(A, A+K))
    ans.extend(range(B, B-K, -1))

    ans = list(set(ans))
    ans.sort()
    for a in ans:
        if A <= a <= B:
            print(a)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B, K = list(map(int, input().split()))

if A + K > B - K:
    for num in range(A, B + 1):
        print(num)
else:
    for num in range(A, A + K):
        print(num)
    for num in range(B - K + 1, B + 1):
        print(num)

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())

for i in range(a,a+k):
    if a <= i and i <= b:
        print(i)

for i in range(b-k+1,b+1):
    if i not in range(a,a+k):
        if a <= i and i <= b:
            print(i)

Submission status: Accepted

Solution code:
a, b, k=map(int, input().split())

if b-a>=2*k:
  for i in range(k):
    print(a+i)
  for i in range(k-1,-1,-1):
    print(b-i)
else:
  for i in range(a,b+1):
    print(i)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
if k<=(b-a+1)//2:
    A=set()
    for i in range(k):
        A.add(a+i)
        A.add(b-i)
    print(*sorted(A),sep="\n")
else:
    for i in range(a,b+1):
        print(i)