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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b,k=map(int,input().split())
    # a,a+1,...,a+k-1とb-k+1,...,b
    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()

Submission status: Accepted

Solution code:
from sys import stdin
a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
if b-a < c*2:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+c):
        print(i)
    for j in range(b-c+1,b+1):
        print(j)

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
List = []
for i in range(K):
    c = A + i
    d = B - i
    if((c in List) == False and c >= A and c <= B):
        List.append(c)
    if((d in List) == False and d >= A and d <= B):
        List.append(d)
List = sorted(List)
for i in List:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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=sorted(set(ans))
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
a, b, k = [int(i) for i in input().split()]
print(*([i for i in range(a, min(a + k, b + 1))] + [i for i in range(max(a + k, b - k + 1), b + 1)]), sep="\n")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
if abs(B-A) < K:
    for i in range(A,B+1):
        print(i)
    exit()
min_list = list(range(A,A+K))
max_list = list(range(B-K+1,B+1))
lists = list(set(min_list) | set(max_list))
lists.sort()
for i in range(len(lists)):
    print(lists[i])

Submission status: Accepted

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

if k >= b - a + 1:
    for c in list(range(a, b + 1)):
        print(c)
else:
    s = set(list(range(a, a + k)) + list(range(b - k + 1, b + 1)))
    list_s = list(s)
    list_s.sort()

    for c in list_s:
        print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(A, min(B + 1, A + K)):
    if i < A + K:
        print(i)

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

Submission status: Accepted

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

if B - A + 1 > 2 * K:
  for i in range(K):
    l.append(A + i)
    l.append(B - i)
else:
  l = list(range(A, B+1))
  
l.sort()

for i in l:
  print(i)

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a, b, k = list(map(int, readline().split()))
    if a == b:
        print(a)
    else:
        ans = set()
        for i in range(a, min(a + k, b)):
            ans.add(i)
        for i in range(b, max(b - k, a), - 1):
            ans.add(i)
        print(*sorted(list(ans)))


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
x=[]
if c>b-a+1:
    c=b-a+1
for i in range(c):
    print(a+i)
    x.append(a+i)
for j in range(c-1,-1,-1):
    if b-j not in set(x):
        print(b-j)
        x.append(b-j)
    else:
        continue

Submission status: Accepted

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

ans_l = []
for i in range(k):
    if b >= a+i:
        ans_l.append(a+i)

for i in reversed(range(k)):
    if a <= b-i:
        ans_l.append(b-i)
    
ans_l = sorted(list(set(ans_l)))
for i in range(len(ans_l)):
    print(ans_l[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
from_a = set(list(range(a,a+k)))
from_b = set(list(range(b,b-k,-1)))
ab= from_a | from_b
#print(ab)
list_ab = list(ab)
list_ab.sort()
#print(list_ab)
for i in list_ab:
    if a<= i <= b:
        print(i)

Submission status: Accepted

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

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

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)
ans = sorted(set(ans))
print(*ans, sep="\n")

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,k = inpl()
res = []
for i in range(k):
    if a+i <= b and not a+i in res:
        res.append(a+i)
    if b-i >= a and not b-i in res:
        res.append(b-i)
res.sort()
print(*res)

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 a in sorted(list(set([i for i in range(A, min(A + K, B+1))]) | set([i for i in range(max(A, B-K+1), B+1)]))):
    print(a)

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
se =[]
for i in range(min(K,B-A)):
  se += [A+i]
for j in range(min(K,B-A)):
  se += [B-j]
result=list(set(se))
result=sorted(result)
for p in range(len(result)):
    print(result[p])
if A==B:
  print(A)

Submission status: Accepted

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

if K <= B - A:
    for i in range(K):
        s.add(A + i)
    for i in range(K):
        s.add(B - K + i + 1)
else:
    for i in range(B - A + 1):
        s.add(A + i)

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

Submission status: Accepted

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

for i in range(B-K+1,B+1):
    if i >= A and i <= B:
        ans.append(i)
setans = set(ans)
ans = list(setans)
ans.sort()
for a in ans:
    print(a)

Submission status: Accepted

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

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

num = range(a, b + 1)

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k) | set(k_e)
ans_list = sorted(ans_set)
for i in ans_list:
    print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if K > B-A+1:
    K = B-A+1
t = set()
for i in range(A, A+K):
    t.add(i)
for i in range(B-K+1, B+1):
    t.add(i)
ans = list(t)
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(k):l.append(min(a+i,b))
for i in range(k):l.append(max(a,b-i))
for x in sorted(list(set(l))):print(x)

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())
if A == B:
    print(A)
else:
    if K > B - A:
        K = B - A
    tmp1 = list(range(A,A+K))
    tmp2 = list(range(B-K+1,B+1))
    ans = sorted(list(set(tmp1 + tmp2)))
    for i in ans:
        print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int,input().split())
if A == B:
    print(A)
else:
    if K > B - A:
        K = B - A
    tmp1 = list(range(A,A+K))
    tmp2 = list(range(B-K+1,B+1))
    ans = sorted(list(set(tmp1 + tmp2)))
    for i in ans:
        print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if (b-a)/2 < k:
    [print(i+a) for i in range(b-a+1)]
else:
    al = {i+a for i in range(k)}
    bl = {b-i for i in range(k)}
    [print (i) for i in sorted(list(al | bl))]

Submission status: Accepted

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

Submission status: Accepted

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

small=[n for n in range(A,min(A+K,B+1))]

large=[n for n in range(max(A,B-K+1),B+1)]

ans_set=set(small+large)
ans=list(ans_set)
ans.sort()
ans_str=list(map(str,ans))

print(' '.join(ans_str))

Submission status: Accepted

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

small=[n for n in range(A,min(A+K,B+1))]

large=[n for n in range(max(A+K,B-K+1),B+1)]

ans_set=set(small+large)
ans=list(ans_set)
ans.sort()
ans_str=list(map(str,ans))

print(' '.join(ans_str))

Submission status: Accepted

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

small=[n for n in range(A,min(A+K,B+1))]

large=[n for n in range(max(A+K,B-K+1),B+1)]

ans=small+large
ans.sort()
ans_str=list(map(str,ans))

print(' '.join(ans_str))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
c = []
if b - 2*k < a:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(k):
        c.append(a+i)
        c.append(b-i)
    c.sort()
    for i in c:
        print(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())
if b-a < k:
  for i in range(a, b+1):
    print(i)
else:
  min_a = [i for i in range(a, a+k)]
  max_b = [i for i in range(b, b-k,-1)]
  r = min_a + max_b
  for i in list(sorted(set(r))):
    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:
# A,B,K = map(int, open(0).read().split())
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)

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:
a, b, k = map(int, input().split())
List = []
for i in range(k):
    if a + i <= b:
        List.append(a + i)
for i in range(k):
    if b - i >= a:
        List.append(b-i)
List = sorted(set(List))
for i in range(len(List)):
    print(List[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())
S=[]

for i in range(k):
    if a+i>b:
        break
    S.append(a+i)
    
for i in range(k):
    if b-i<a:
        break
    S.append(b-i)
    
S=sorted(list(set(S)))
for i in S:
    print(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 a < i and i not in ans:
        ans.append(i)
for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

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

A_max = min(B, A+(K-1))
B_min = max(A, B-(K-1))

range_A = list(range(A, A_max+1))
range_B = list(range(B_min, B+1))
for i in sorted(set(range_A + range_B)):
  print(i)

Submission status: Accepted

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


ans = []
for ai in range(a,a+k):
  if ai <= b:
    ans.append(ai)
for bi in range(b,b-k,-1):
  if bi >=a:
    ans.append(bi)
    
for i in sorted(list(set(ans))):
  print(i)

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
lcnt = 0
rcnt = 0
ans = []
for i in range(A, min(A + K, B)):
    ans.append(i)

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

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
ans = []
if A == B:
    print(A)
    exit()
for i in range(A,A+K):
    if B <= i:
        break
    ans.append(i)
for i in range(B-K+1,B+1):
    if i <= A:
        continue
    ans.append(i)
ans2 = set(ans)
ans3 = list(ans2)
ans3.sort()
for i in ans3:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
if a[1]-a[0]+1 <= a[2] * 2:
  for i in range(a[0], a[1]):
    print(i)
  print(a[1], end='')
  exit()

for i in range(a[0], a[0]+a[2]):
  print(i)
for i in range(a[1]-a[2]+1, a[1]):
  print(i)
print(a[1], end='')

Submission status: Accepted

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

ans = set()
for i in range(K):
    if A+i <= B:
        ans.add(A+i)
    if A <= B-i:
        ans.add(B-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())

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

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
c = a + k
d = b - k + 1
number = []

for i in range(a, c):
    if i > b:
        continue

    else:
        number.append(i)

for j in range(d, b + 1):
    if j in number:
        continue

    if j < a:
        continue

    else:
        number.append(j)

for i in number:
    print(i)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, k = list(map(int, input().rstrip('\n').split()))
    ans = []
    for i in range(a, min(a + k, b + 1)):
        ans.append(i)
    for i in range(max(b - k + 1, a), b + 1):
        if i not in ans:
            ans.append(i)
    ans.sort()
    print(*ans, sep="\n")


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

Submission status: Accepted

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

l1 = min(B,A+K-1)
for i in range(A,l1+1):
    ans.add(i)
l2 = max(A,B-K+1)
for i in range(l2,B+1):
    ans.add(i)

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

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

main()

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
list_1 = [i for i in range(a, a+k) if i<=b]
list_2 = [i for i in range(b-k+1, b+1) if a<=i]
list_1.extend(list_2)
print(*sorted(set(list_1)), sep = '\n')

Submission status: Accepted

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

Submission status: Accepted

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

AB = range(A,B+1)
tail = len(AB)
AB_L = set(AB[0:min(K,tail)])
AB_R = set(AB[max(0,tail-K):tail])
AB_SL = sorted(AB_L | AB_R)

for ab in AB_SL:
    print(ab)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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(k): print(a+i)
    for i in reversed(range(k)): print(b-i)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B, K] = string_to_int(inputs[0])
    ret = set()
    count = 0
    for v in range(A, B+1):
        if count >= K:
            break
        ret.add(v)
        count += 1
    count = 0
    for v in reversed(range(A, B+1)):
        if count >= K:
            break
        ret.add(v)
        count += 1
    return sorted(list(ret))


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    for r in ret:
        print(r)

Submission status: Accepted

Solution code:
A,B,K = [int(x) for x in input().split()]
if B-A<K:
  c = [i for i in range(A,B+1)]
  print(*c)
  exit()
c = [i for i in range(A,A+K)]
d = [i for i in range(B-K+1,B+1)]
d =c+d
d = list(set(d))
d.sort()
print(*d)

Submission status: Accepted

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

Submission status: Accepted

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

    c = a+k if (b-a) > k else b+1
    l = list(range(a, c))
    #print(l)

    c = b-k if (b-a) > k else a-1
    l.extend(list(range(b, c, -1)))
    #print(l)

    l = list(set(l)) # uniq 重複を削除
    l.sort()
    for i in l:
        print(i)

bb093()

Submission status: Accepted

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

if b-a < 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:
a, b, k = map(int, input().split())
l = range(a, b + 1)
a = sorted(set(l[:k]) | set(l[-k:]))
print(*a, sep="\n")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
s = set()
for i, n in enumerate(range(A, B+1)):
    if i+1 <= K:
        s.add(n)
    if i+1 > K:
        break
for i, n in enumerate(reversed(range(A, B+1))):
    if i+1 <= K:
        s.add(n)
    if i+1 > K:
        break
for i in sorted(s):
    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)
else:
    for i in range(k): print(a+i)
    arr=[]
    for i in range(k): arr.append(b-i)
    for i in arr[::-1]: print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if B-A+1 >= 2*K:
    res_list = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
else:
    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:
    res_set = set([i for i in range(A, A+K)]) | set([i for i in range(B-K+1, B+1)])
    for i in sorted(res_set):
        print(i)
else:
    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())

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

Submission status: Accepted

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

Submission status: Accepted

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

if A + K > B - 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+=[a+i]
for i in range(k):
    if b-k+i+1 >=a and b-k+i+1 not in ans:
        ans+=[b-k+i+1]
for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

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

C=[]
for i in range(min(K,B-A+1)):
  C.append(A+i)
for i in range(min(K,B-A+1)):
  C.append(B-i)
#print(C)

C=list(set(C))
C.sort()
#print(C)

for i in C:
  print(i)

Submission status: Accepted

Solution code:
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    a, b, k = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    for i in range(a, min(b + 1, a + k)):
        d[i]
    for i in range(b, max(a - 1, b - k), -1):
        d[i]
    for k, v in sorted(d.items()):
        print(k)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

(a, b, k) = [int(i) for i in input().rstrip().split(" ")]
target = set([i for i in range(a, a+k)]).union([i for i in range(b-k+1, b+1)])
target = sorted([i for i in target if a <= i <= b])
for i in target:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

memory = set()
cnt = 0
for n in range(a, b + 1):
    memory.add(n)
    cnt += 1
    if cnt == k:
        break

cnt = 0
for n in reversed(range(a, b + 1)):
    if n not in memory:
        memory.add(n)
    cnt += 1
    if cnt == k:
        break

for n in sorted(list(memory)):
    print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans_set = set(range(a, min(a + k, b + 1))) | set(range(max(a, b - k + 1), b + 1))

for v in sorted(ans_set):
    print(v)

Submission status: Accepted

Solution code:
# ABC093 B - Small and Large Integers
a,b,k = map(int, input().split())

range_ab = set(range(a,a+k))|set(range(b-k+1,b+1))
l = list(range_ab)
l = [x for x in l if a<=x<=b]

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

Submission status: Accepted

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

Answer = set([])
for i in range(K):
    if A+i <=B:
        Answer.add(A+i)
    if B - i >= A:
        Answer.add(B-i)
Answer = sorted(Answer)
for i in Answer:
    print(i)

Submission status: Accepted

Solution code:
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    a, b, k = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    d[a]
    d[b]
    for i in range(a, min(a + k, b)):
        d[i]
    for i in range(b, max(b - k, a), -1):
        d[i]
    d = sorted(d.keys())
    print(*d, sep='\n')


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

for x in sorted(list(set(a + b))):
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

ak = [i for i in range(a, min(b + 1, a + k))]
bk = [i for i in range(max(a, b - k + 1), b + 1)]

abk = list(set(ak) | set(bk))
abk.sort()

for i in abk:
    print(i)

Submission status: Accepted

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