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())
ak = a+k
bk = b-k

if a+k>=b:
  for i in range(a,b+1):
    if i<ak or i>bk:
      print(i)
else:
  for i in range(a,a+k+1):
    if i<ak or i>bk:
      print(i)
  if i<b-k:
    for n in range(b-k,b+1):
      if n<b-k or n>bk:
        print(n)
  else:
    for j in range(i+1,b+1):
      if j<ak or j>bk:
        print(j)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
ans_list = list()
for i in range(a, min(a + k, b + 1)):
    ans_list.append(str(i))
for j in range(max(a, b - k + 1), b + 1):
    if str(j) not in ans_list:
        ans_list.append(str(j))
print("\n".join(ans_list))

Submission status: Accepted

Solution code:
import sys
import math

a,b,k = map(int, input().split())
if (b - a+1 < 2*k):
    for i in range(a, b+1):
        print(i)
    sys.exit()
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,a+k):
  if i > b:
    break
  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_th = B+1 if A+K > B+1 else A+K
A_l = list(range(A, A_th, 1))
#print(A_l)

B_th = B-K+1 if B-K > A-1 else A
B_l = list(range(B_th, B+1, 1))
#print(B_l)

X_l = sorted(set(A_l + B_l))

for x in X_l:
  print(x)

Submission status: Accepted

Solution code:

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

for i in range(a,min(a+k, b)):
  c.append(i)
  print(i)
for j in range(max(a, b-k+1),b+1):
  if j not in c:
    print(j)

Submission status: Accepted

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

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

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

for num in range(k):
    if a + num <= b:
        ans_set.add(a + num)

for num in range(k):
    num = k - num - 1
    if b - num >= a:
        ans_set.add(b - num)
for num in sorted(ans_set):
    print(num)

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
A, B, K = ri_()
a = [i for i in range(A, B + 1) if i <= A + K - 1 or i >= B - K + 1]
for ai in a:
    print(ai)

Submission status: Accepted

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

ans = []
for i in range(a, a+k):
    if i not in ans and (a <= i and i <= b):
        ans.append(i)

for i in range(b-k+1, b+1):
    if i not in ans and (a <= i and i <= b):
        ans.append(i)
    
for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

Solution code:
import sys

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

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

 # 左側の幅だけで全部網羅する場合
if b < a + k:
    print(b)
    sys.exit()

 # ベン図みたいにかぶってる時
for i in range(max( a + k, b + 1 - k ), b + 1):
    print(i)

Submission status: Accepted

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

def it():
    for i in range(a, min(a+k, b)):
        yield i

    for i in range(max(b-k+1, a), b+1):
        yield i

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

Submission status: Accepted

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

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)

for j in range(k):
    if b-j not in ans and b-j>=a:
        ans.append(b-j)

ans.sort()
for num in ans:
    print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = []
for i in range(k):  
    ans.append(a+i)
    ans.append(b-i)
    
ans = sorted(set(ans))
for i in ans:
    if a <= 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(A, B+1):
    print(i)
else:
  for i in range(0, K):
    print(A+i)
  for i in reversed(range(0, K)):
    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, a+k):
        print(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans = []
ans.append(a)
ans.append(b)
for i in range(min(k,b-a)):
    ans.append(a+i)
    ans.append(b-i)
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)
# print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

hoge = [A + i for i in range(K) if A + i <= B]
huga = [B - i for i in range(K) if A <= B - i]
for x in sorted(set(hoge+huga)):
    print(x)

Submission status: Accepted

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

ans = []
end = A + K if A + K < B else B
for a in range(A, end):
    ans.append(a)

start = B - K + 1 if B - K + 1 > A else A
for b in range(start, B + 1):
    ans.append(b)

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

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 j in range(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(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 a+k < b-k+1:
  for i in range(k):
    print(a+i)
  for i in range(k):
    print(b-k+i+1)
    
else:
  for i in range(b-a+1):
    print(a+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())
m=[i for i in range(a,min(a+k,b+1))]
M=[i for i in range(b,max(b-k,a-1),-1)]
ans=sorted(set(m)|set(M))
for i in ans:
  print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

a,b,k=MI()
u=[]
ans=[]
for i in range(a,a+k):
    u.append(i)
for j in range(b-k+1,b+1):
    u.append(j)
for s in u:
    if a<=s<=b:
        ans.append(s)
printni(sorted(list(set(ans))))

Submission status: Accepted

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

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 list(range(a, a + k)) + list(range(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)
  if b-i>=a:
    List.append(b-i)

List = list(set(List))
List= sorted(List)
for i in List:
  print(i)

Submission status: Accepted

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

li = []
for i in range(a, min(a+k,b+1)):
    li.append(i)
for i in range(max(b-k+1, a), b+1):
    li.append(i)
for i in sorted(list(set(li))):
    print(i)

Submission status: Accepted

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

aa = list(range(a,min(a+k,b)))
bb = list(range(max(b-k+1,a),b+1))
aa.extend(bb)
c = set(aa)
d = list(c)
d = sorted(d)
for i in range(len(d)):
    print(d[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:
    a_list = [i for i in range(a, a+k)]
    b_list = [i for i in range(b, b-k, -1)]
    c = set(a_list + b_list)
    sort_c =sorted(c)
    for i in sort_c:
        print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
MOD = 1000000007

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

res = []
for i in range(A,min(A+K,B+1)):
    res.append(i)

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

for x in sorted(list(set(res))):
    print(x)

Submission status: Accepted

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

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

range1=[a,min(b,a+k-1)]
range2=[max(a,b-k+1),b]

if range1[1]>=range2[0]:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(range1[0],range1[1]+1):
        print(i)
    for i in range(range2[0],range2[1]+1):
        print(i)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

for i in range(k)[::-1]:
    if b - i > prev:
        print(b - i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
ans = set()
for i in range(a, min(a+k, b+1)):
    ans.add(i)
for i in range(max(a, b-k+1), b+1):
    ans.add(i)
ans = sorted(ans)
for i in ans:
    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 j in range(b-k+1, b+1):
    if a <= i <= b:
        li.append(j)
s = set(li)
d = sorted(s)
for x in d:
    print(x)

Submission status: Accepted

Solution code:
A,B,K = map(int, input().split())
ans = []
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(reverse=False)
for i in ans:
  if i>=A and i<=B:
    print(i)

Submission status: Accepted

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

ans = set([])
if b > a+k:
    for i in range(a,a+k):
        ans.add(i)
    for i in range(b-k+1,b+1):
        ans.add(i)
else:
    for i in range(a,b+1):
        ans.add(i)
ans = sorted(ans)
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
la = list(range(a, a+k))
lb = list(range(b-k+1, b+1))
set = sorted(set(la+lb))

for i in set:
    if a <= i <= b:
        print(i)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, K = MAP()

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

if (B - A + 1 <= K):
    for i in range(A, B + 1):
        print(i)
    exit()
else:
    L = []
    for i in range(K):
        L.append(A + i)

    for j in range(K - 1, -1, -1):
        L.append(B - j)

    for i in sorted(list(set(L))):
        print(i)

Submission status: Accepted

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

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

S=set()

for i in range(A, min(B+1, A+K)):
    S.add(i)
for i in range(max(A, B-K+1), B+1):
    S.add(i)
for k in sorted(S):
    print(k)

Submission status: Accepted

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

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:
# AtCoder
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, A+K), B+1):
    print(j)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
list = range(A, B+1) #上限下限を先に決めておく
set1 = set(list[:K])
set2 = set(list[-K:])
print(*sorted(set1|set2), sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(max(b - k + 1, a), b + 1):
    l.append(i)
l = list(set(l))
l.sort()
for i in l:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
list = [i for i in range(A, A+K)]
list.extend(i for i in range(B+1-K, B+1))
list = sorted(set(list))
for i in list:
    if A<=i<=B:
        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.append(i)
for i in range(max(b - k + 1, a), b + 1):
    ans.append(i)
print(*sorted(list(set(ans))), sep="\n")

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
a_st=a
b_st=b
num=[]
cnt=0
for i in range(a,b+1):
    if cnt<k:
        num.append(i)
        cnt+=1
    else:
        break
cnt=0
for i in range(b,a,-1):
    if cnt<k:
        num.append(i)
        cnt+=1
    else:
        break
num2=list(set(num))
num2.sort()
[print(x) for x in num2]

Submission status: Accepted

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    a, b, k = nm()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,K=map(int,input().split())
ks=[]
for i in range(K):
    if (A+i)<=B:
        ks.append(A+i)
    if A<=(B-i):
        ks.append(B-i)
new_ks=list(set(ks))
new_ks.sort()
for i in range(len(new_ks)):
    print(new_ks[i])

Submission status: Accepted

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

if 2*(K-1)>=B-A:
  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:
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    A, B, K = map(int, readline().split())
    left = set(list(range(A, min(A+K, B+1))))
    right = set(list(range(B, max(B-K, A-1), -1)))
    ans = list(left | right)
    ans.sort()
    for i in ans:
        print(i)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

x = b - a
if x < 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())

x = b-a
if x < 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:
# coding:utf-8
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 + 1, a + k), 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 i in range(B-K+1,B+1):
    print(i)
elif A+K-1>= B-K+1:
  for i in range(A,B+1):
    print(i)

Submission status: Accepted

Solution code:
def main():
    A, B, K = map(int, input().split())
    ans = set()
    for i in range(K):
        if A + i <= B:
            ans.add(A + i)
        if B - i >= A:
            ans.add(B - i)
    print('\n'.join(map(str, sorted(ans))))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print('\n'.join(map(str,sorted(set(min_li+max_li)))))

Submission status: Accepted

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

s = set()
if a==b:
    s.add(a)
for x in range(a,min(a+k,b)):
    s.add(x)
for x in range(b,max(a,b-k),-1):
    s.add(x)

l = [x for x in s]
l.sort()
for x in l:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
A,B,K = map(int,input().split())

slis = []
llis = []
if 2*K>=(B-A+1):
    ans = list(range(A,B+1))
else:
    for i in range(K):
        slis.append(A+i)
        if not B-i in slis:
            llis.append(B-i)
    ans = slis + llis[::-1]

print(*ans,sep="\n")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

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, K = map(int, input().split())

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

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

Submission status: Accepted

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


def solve(A: int, B: int, K: int):
    for i in sorted(
            set(range(A, min(B + 1, A + K))) |
            set(range(max(A, B + 1 - K), B + 1))):
        print(i)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, K)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a = set(range(A,min(A+K, B)))
b = set(range(B,max(B-K,A),-1))
a = sorted(a|b)

if A == B:
    print(A)
else:
    for i in a:
        print(i)

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

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


if __name__ == '__main__':
    main()

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

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

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

li = []
for i in range(A, A+K):
    if i <= B:
        li.append(i)
for j in range(B-K+1, B+1):
    if j >= A:
        li.append(j)
li = sorted(list(set(li)))
for a in li:
    print(a)

Submission status: Accepted

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

ans = []
k = min(k,b-a+1)
ans += range(a, a + k )
ans += range(b, b - k , -1)

ans = list(sorted(set(ans)))
for i in range(len(ans)):
    print(ans[i])

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if A+K <= B-K:
    for i in range(A, A+K):
        print(i)
        # print(A+K, B-K, 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 = []
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)
ans = sorted(list(set(ans)))
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int,input().split())
left = A + K - 1
right = B - K + 1
if left < right:
    for i in range(A, left + 1):
        print(i)
    for i in range(right, 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())

i=A
while i<=min(B,A+K-1):
    print(i)
    i+=1

j=B-K+1
while j<=B:
    if i<=j:
        print(j)
    j+=1

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    a,b,k=map(int,input().split()) 
    if a+k-1<b-k+1:
        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 = []
for i in range(a, a+k):
    ans += [i]*(i<=b)
for i in range(b, b-k, -1):
    ans += [i]*(a<=i)
print(*(sorted(set(ans))), sep='\n')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# solution
import io

n,m,k = map(int,input().split())
if 2*k >= m-n+1:
    for i in range(n,m+1):
        print(i)
else:
    for j in range(n,n+k):
        print(j)
    for p in range(m-k+1,m+1):
        print(p)

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())
if k*2>b:
    for i in range(a,b+1):
        if i<a+k:
            print(i)
        elif b-k<i:
            print(i)
else:
    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())

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