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:
a, b, k = map(int, input().split())
s = {a + i for i in range(min(k, b - a + 1))} | {b - i for i in range(min(k, b - a + 1))}
l = sorted(list(s))
for i in l:
    print(i)

Submission status: Accepted

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

if (b-a<1000):
  for i in range(a,b+1):
    if (i<a+k or b-k<i):
      print(i)
else:
  for i in range(k):
    print(a+i)
  for i in range(k-1,-1,-1):
    print(b-i)

Submission status: Accepted

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

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:
def myAnswer(A:int,B:int,K:int) -> int:
   if(B - A >= K):
      ans = [i for i in range(A,A+K) ]
      for i in range(B,B-K,-1):
         ans.append(i)
   else:
      ans = [i for i in range(A,B+1)]
   ans = list(set(ans))
   ans.sort()
   for a in ans:
      print(a)

   

def modelAnswer():
   tmp=1
def main():
   A,B,K = map(int,input().split())
   myAnswer(A,B,K)

if __name__ == '__main__':
   main()

Submission status: Accepted

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

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

l = list(ans)
l.sort()
for n in l:
    print(n)

Submission status: Accepted

Solution code:
# int(input()) # 入力が1つ
a, b, k = map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字

ans = []

if a + k > b:
    for i in range(a, b + 1):
        ans.append(i)
else:
    for i in range(a, a + k):
        ans.append(i)
    for i in range(b - k + 1, b + 1):
        ans.append(i)
ans = list(set(ans))
ans.sort()
for a in ans:
    print(a)

Submission status: Accepted

Solution code:
# ABC 093: B – Small and Large Integers
a, b, k = [int(s) for s in input().split()]
nums = []

if k >= b - a + 1:
    nums = list(range(a, b + 1))
else:
    nums = list(set(list(range(a, a + k)) + list(range(b - k + 1, b + 1))))
    nums.sort()

for num in nums:
    print(num)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
num_list = []
for i in range(K):
    num_list.append(A + i)
for i in range(K):
    num_list.append(B - i)
num_list = sorted(set(num_list))

for i in num_list:
    if A <= i <= B:
        print(i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
#%%
a_s = set(list(range(a, min(b+1, a+k))))
b_s = set(list(range(max(a, b-k+1), b+1)))
s_uni = b_s | a_s
print(*sorted(s_uni), sep='\n')

Submission status: Accepted

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

st = set(list(range(A, A+K)) + list(range(B-K+1, B+1)))
#print(st)
st = sorted(list(st))
for val in st:
    if A <= val <= B:
        print(val)

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    a, b, k = MII()
    if b-a <= k:
        for i in range(a, b+1): print(i)
    else:
        n = []
        for i in range(a, a+k): n.append(i)
        for i in reversed(range(b-k+1, b+1)): n.append(i)
        n = sorted(list(set(n)))
        for i in n: print(i)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

abset=set()
for i in range(K):
  abset.add(A+i)
  abset.add(B-i)
  
ablist=[]
for x in abset:
  if A<=x and x<=B:
    ablist.append(x)
ablist.sort()

for ab in ablist:
  print(ab)

Submission status: Accepted

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

ans = []
for i in range(K):
    ans.append(A + i)

for i in range(K):
    ans.append(B - i)

ans = sorted(list(set(ans)))
for x in ans:
    if (A <= x and x <= B):
        print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,K = map(int,open(0).read().split()) 

a = [min(i,B) for i in range(A,A+K)]
b = [max(i,A) for i in range(B,B-K,-1)]
s = sorted(set(a) | set(b))
for i in s:
  print(i)

Submission status: Accepted

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

upper = min(a + k, b)
bottom = max(b - k + 1, upper)

for i in range(a, upper):
    print(i)
for j in range(bottom, b + 1):
    print(j)

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:
import sys
import os
import math

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)]

MOD = 10 ** 9 + 7


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

    A, B, K = il()
    ret = set()
    for n in range(A, min(A+K, B)):
        ret.add(n)
    for n in range(max(B-K+1, A), B+1):
        ret.add(n)
    print(*sorted(ret), sep="\n")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ans = list(ans)
ans.sort()
for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a, b, k = iim()
l = []
if b-a+1 > 2*k:
    for i in range(a,a+k):
        l.append(i)
    for j in range(b-k+1,b+1):
        l.append(j)
else:
    for n in range(a,b+1):
        l.append(n)

for k in l:
    print(k)

Submission status: Accepted

Solution code:
import sys

def resolve():
    A, B, K = list(map(int, input().split(" ")))
    out = []
    for i in range(A, A+K):
        if i <= B:
            out.append(i)
    for j in range(B-K+1, B+1):
        if j >= A and not j in out:
            out.append(j)
    
    [print(s) for s in out]

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

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]:
  if a+k <= b-i:
    print(b-i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k=[int(i) for i in 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())

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
if c <= (b - a + 1) // 2:
  for i in range(a, a+c):
    print(i)
  for i in range(b-c+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())
print(*[i for i in range(a,b+1)if i<a+k or i>b-k])

Submission status: Accepted

Solution code:
A,B,K = (int(i) for i in input().split())

answers = []
for i in range(K):
  if A+i <= B:
    answers.append(A+i)
  if B-i >= A:
    answers.append(B-i)

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
ans = []
for i in range(A,A+K):
    if i<=B and i not in ans:
        ans.append(i)
for i in range(B-K+1,B+1):
    if i>=A and i not in ans:
        ans.append(i)
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
ans = []
for i in range(A,A+K):
  if i<=B and i not in ans:
    ans.append(i)
for i in range(B-K+1,B+1):
  if i>=A and i not in ans:
    ans.append(i)
print(*ans, sep='\n')

Submission status: Accepted

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

if 2*k >= b-a+1:
    for i in range(b-a+1):
        print(a+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:
# abc093_b.py
A, B,K = map(int,input().split())
ans = []
for i in range(K):
#    print(i)
    ans.append(i+A)
    if i >(B-A-1):
        break
for i in range(K):
#    print(A-i)
#    print(i)
    ans.append(B-i)
    if i >(B-A-1):
        break
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)

Submission status: Accepted

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

print(A)

max_A = A

for _ in range(1, K):
    max_A += 1
    if max_A > B:
        break
    print(max_A)

min_B = B - K + 1
if min_B < max_A:
    min_B = max_A
if min_B > max_A:
    print(min_B)

while min_B < B:
    min_B += 1
    if min_B > max_A:
        print(min_B)

Submission status: Accepted

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

L = [A+i for i in range(K) if A+i <= B]
R = [B-i for i in range(K) if B-i >= A]
S = set(L+R)
S = sorted(S)
for v in S:
    print(v)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
if b-a > pow(10, 5):
    list_ANS = [i for i in range(a, a+pow(10, 5))] + [i for i in range(b - pow(10, 5), b+1)]
else:
    list_ANS = [i for i in range(a, b+1)]

for _ in range(k):
    if len(list_ANS) != 0:
        a = list_ANS.pop(0)
        print(a)
    else:
        break
list_A = []
for _ in range(k):
    if len(list_ANS) != 0:
        b = list_ANS.pop(-1)
        list_A.append(b)

    else:
        break
if len(list_A) != 0:
    list_A.reverse()
    for i in list_A:
        print(i)

Submission status: Accepted

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

Submission status: Accepted

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

if abs(A - B) >= 2 * K:
  for i in range(K):
    print(A + i)
  for j in reversed(range(K)):
    print(B - j)
else:
  for k in range(A, B+1):    
    print(k)

Submission status: Accepted

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

ans = []
for i in range(a, min(b, a + k)):
    if i in ans:
        continue
    else:
        ans.append(i)
for i in range(max(a, b - k + 1), b + 1):
    if i in ans:
        continue
    else:
        ans.append(i)

for i in range(len(ans)):
    print(ans[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)
  
for i in range(b-k+1,b+1):
  if i>=a and i not in ans:
    ans.append(i)
    
ans.sort()

for a in ans:
  print(a)

Submission status: Accepted

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

Submission status: Accepted

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

# かぶりなし
if A + K - 1 < B - K + 1:
    for i in range(K):
        print(A + i)
    for i in reversed(range(K)):
        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())

res = []
for i in range(a, min(b + 1, a + k)):
    res.append(i)


for i in range(max(a, b - k + 1), b + 1):
    if i not in res:
        res.append(i)

res = sorted(res)
for i in res:
    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)
ANS = list(set(ans))
ANS.sort()
[print(j) for j in ANS]

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 i in range(max(a + k, b - k + 1), b + 1):
    if i > b:
        break
    print(i)

Submission status: Accepted

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

    array = range(a,b+1)
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a,b,k = map(int,input().split())
  L = []
  R = []
  for i in range(k):
    if a<=a+i<=b:
      L.append(a+i)
  for j in range(-k+1,1,1):
    if a<=b+j<=b:
      R.append(b+j)
  L[len(L):len(L)] = R
  W = sorted(list(set(L)))
  for i in range(len(W)):
    print(W[i])
if __name__ == '__main__':
  main()

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,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)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
if k <= (b-a+1)//2:
  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())
if K <= (B - A + 1) // 2:
  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())
s = []
for i in range(k):
    if a + i <= b:
        s.append(a + i)
for i in range(k):
    if b - k + i + 1 >= a:
        s.append(b - k + i + 1)
s = list(set(s))
s.sort()
for i in s:
    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(B - K, A) , B):
  if i + 1 >= A + K: print(i + 1)

Submission status: Accepted

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

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

for i in range(max(a, b - k + 1), b + 1):
    if i not in list:
        list.append(i)

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
#import collections
a, b, k = list(map(int, input().split()))
l = []

"""
if k > b-a:
    k = b-a
"""

for i in range(k):
    l.append(a+i)
    l.append(b-i)


ans = list(set(l))
ans.sort()
for i in range(len(ans)):
    if ans[i] >= a and ans[i] <= b:
        print(ans[i])

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    A, B, K = map(int, input().split())
    Ans = set()
    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(Ans)
    Ans.sort()
    print("\n".join(map(str, Ans)))
        
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans = []
ans += list(range(a,min(a+k,b+1) ) )
ans += list(range(max(a,b-k+1), b+1))
ans = list(set(ans))
ans.sort()
print(*ans)

Submission status: Accepted

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

aa = [i for i in range(a, a+k)]
bb = [i for i in range(b-k+1,b+1)]
c = [i for i in set(aa + bb) if a <= i <= b]
[print(i) for i in sorted(c)]

Submission status: Accepted

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

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)
    exit()
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 sys
A,B,K=map(int,input().split())
if((B-A) < K):
    for i in range(A,B+1):
        print(i)
    sys.exit()
ansmin=[i for i in range(A,A+K,1)]
ansmax=[i for i in range(B,B-K,-1)]

ans=ansmin+ansmax
ans=set(ans)
ans=sorted(ans)
for a in ans:
    print(a)

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):
        print(i)

Submission status: Accepted

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

k=0
for i in range(B,A-1,-1):
    L.append(i)
    k+=1
    if(k>=K):
        break

S=set(L)
for s in sorted(list(S)):
    print(s)

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)
l = sorted(set(l), key=l.index)
l.sort()
print(*l, sep="\n")

Submission status: Accepted

Solution code:
A,B,K=map(int, input().split())
L = []
for i in range(min(K,(B-A+2)//2)):
  L.append(A+i)
for i in range(min(K,(B-A+2)//2)):
  L.append(B-i)
L = sorted(list(set(L)))
for i in L:
  print(i)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


A, B, K = MI()

ans = set(x for x in range(A, A + K) if A <= x <= B)
ans.update(set(x for x in range(B - K + 1, B + 1) if A <= x <= B))
for x in sorted(list(ans)):
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(B-K+1,B+1):
    if i < A:
        continue
    ans.append(i)

ans = set(ans)
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())

X = []

for i in range(k):
    if a+i <= b:
        X.append(a+i)
    if a <= b-i:
        X.append(b-i)
        
X = sorted(set(X))

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

Submission status: Accepted

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

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

ans=set()
for i in range(k):
	if a+i<=b:
		ans.add(a+i)

for i in range(k):
	if b-i>=a:
		ans.add(b-i)

lists=list(ans)
lists.sort()
for i in lists:
	print(i)

Submission status: Accepted

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

ans=[]
for num in range(a,a+k):
        if num>b:
                break
        ans.append(num)
for num in range(b-k,b):
        if num < a:
                continue
        ans.append(num+1)
ans=list(set(ans))
ans.sort()
for a in ans:
        print(a)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
l = []
for i in range(a, min(a + k, b)):
    l.append(i)

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

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

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 j in range(a, a+k):
        print(j)
    for k in range(b-k+1, b+1):
        print(k)

Submission status: Accepted

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

Submission status: Accepted

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

    for i in range(a, min(a+k, b+1)):
        s.add(i)

    for i in range(b, max(a-1, b-k), -1):
        s.add(i)

    s = sorted(s)

    for i in s:
        print(i)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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)
#print(s)

lis=sorted(s)
for item in lis:
  print(item)

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())

N = set()
for i in range(A, min(A + K, B + 1)):
    N.add(i)
for i in range(B, max(B - K, A - 1), -1):
    N.add(i)

N = list(N)
N.sort()
print(*N, sep='\n')

Submission status: Accepted

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

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

for j in range(b,max(a-1,b-k),-1):
    li.append(j)

li=list(set(li))
li.sort()

for i in li:
    print(i)

Submission status: Accepted

Solution code:
def Small_and_Large(a , b , k):

    ans = []

    for i in range(k):
        if a + i <= b:
            ans.append(a + i)
        if b - i >= a:
            ans.append(b - i)

    return sorted(set(ans))

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


if __name__ == '__main__':
    main()

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:
data = input().split()

a,b,c = int(data[0]), int(data[1]), int(data[2])

for i in range (a, min(b+1,a + c)):
    if (i < a + c or i > b - c):
        print(i)

for j in range (max(i + 1, b - c + 1), b + 1):
    if (j < a + c or j > b - c):
        print(j)

Submission status: Accepted

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

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,c = map(int,input().split())
l = []
for i in range(c):
  d = a+i
  e = b-i
  if d<=b and a<=e:
    l.append(a+i)
    l.append(b-i)
l = sorted(set(l))
for i in l:
  print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
s = set()
for i in range(K):
    tmp = A+i
    if (tmp >= A)and(tmp <= B):
        s.add(tmp)

for i in range(B-K,B):
    tmp = i+1
    if (tmp >= A)and(tmp <= B):
        s.add(tmp)

l = list(s)
l.sort()

for i in l:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,K=map(int,input().split())
answers=[]
for a in range(K):
    if A+a<=B and not A+a in answers:
        answers.append(A+a)
for b in range(K):
    if B-b>=A and not B-b in answers:
        answers.append(B-b)
answers=sorted(answers)
for a in answers:
    print(a)

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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)
# print(l)
ll = sorted(set(l))
for i in range(len(ll)):
    print(ll[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
A 以上 B 以下の整数、小さい方 K 番目以内、大きい方 K 番目以内、昇順

制約
1 <= A <= B <= 10 の 9 乗
1 <= K <= 100

A と B の 間 を 全探索 したら TLE となる。
A と B の 間 は 最大で 10 の 9 乗 離れている為。

次に素直に A から K 個 取り、B から K 個 取り、集合に格納する。
これも A から K 個 取った時に、Bを超えるとダメで、逆も同様。

そこで、in range の 終了条件に min max を使う。
min(A + K, B + 1) ならば A + K - 1 と B のうち、小さい方までとなる。
max(A - 1, B - K) ならば A と B - K + 1のうち、大きい方までとなる。

in range の 終了条件 の インデックス 自体 は 含まず
一つ前のまでとなるので注意する。
'''


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

s = set()

for i in range(A, min(A + K, B + 1)):
    s.add(i)

for i in range(B, max(A - 1, B - K), -1):
    s.add(i)

s = sorted(s)

for i in s:
    print(i)

Submission status: Accepted

Solution code:
# coding: utf-8

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

ans = []

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

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

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

Submission status: Accepted

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

if 2*k < b-a:
    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 (a <= i and i < a+k) or (b-k < i and i <= b):
            print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc093 b
a,b,k=map(int,input().split())
l1=[i for i in range(a,min(a+k,b+1))]
l2=[i for i in range(max(a,b-k+1),b+1)]
ans=set(l1+l2)
for i in sorted(ans):
    print(i)

Submission status: Accepted

Solution code:
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    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)


if __name__ == '__main__':
    main()