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:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, k = mi()
    for i in range(a, min(b, a+k)):
        print(i)
    for j in range(max(min(b, a+k), b-k+1), b+1):
        print(j)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

W = list(range(A,min(A+K,B+1)))
w = list(range(max(A,B-K+1),B+1))

A = sorted(set(W+w))
for i in A: print(i)

Submission status: Accepted

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

ans = list(sorted(list(set(candidate1+candidate2))))
ans = [str(ans[i]) for i in range(len(ans))]

print('\n'.join(ans))

Submission status: Accepted

Solution code:
from itertools import chain
A, B, K = map(int, input().split())
L = range(A, B + 1)
if K < (B - A + 2) // 2:
    L = chain(L[:K], L[-K:])
print("\n".join(str(i) for i in L))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if 2*K-1 >= 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 = []
for i in range(k):
    x = a+i
    if (x not in ans) and x<=b: 
        ans.append(x)
for j in range(k,0,-1):
    x = b-j+1
    if (x not in ans) and x>=a:
        ans.append(x)
print('\n'.join(map(str,ans)))

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
if A + K - 1 >= B - K + 1:
    print("\n".join(map(str, [i for i in range(A, B + 1)])))
else:
    print("\n".join(map(str, [i for i in range(A, A + K)])))
    print("\n".join(map(str, [i for i in range(B - K + 1, B + 1)])))

Submission status: Accepted

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

ans = list(ans)
ans.sort()
for l in range(len(ans)):
    print(ans[l])

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B, K = map(int, input().split())
a = set(i for i in range(A, min(A + K, B + 1)))
b = set(j for j in range(max(B - K + 1, A), B + 1))
c = list(a | b)
c.sort()
for k in c:
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
ans1 = set()
ans2 = set()
for i in range(A, B + 1):
  if len(ans1) < K:
    ans1.add(i)
  else:
    break
    
for i in reversed(range(A, B + 1)):
  if len(ans2) < K:
    ans2.add(i)
  else:
    break

ans = ans1 | ans2
for a in sorted(list(ans)):
  print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = []

for i in range(0,k):
  if(a+i < a or b-i > b or a+i > b or b-i < a):
    continue
  else:
    if(a+i not in x and b-i not in x):
      if(a+i != b-i):
        x.append(a+i)
        x.append(b-i)
      else:
        x.append(a+i)
  
  
x.sort()  

for i in range(0,len(x)):
  print(x[i])

Submission status: Accepted

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

Submission status: Accepted

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

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

for x in range(max(a+k, b-k+1), b+1):
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B, K = map(int, input().split())
a = set(i for i in range(A, min(A + K, B + 1)))
b = set(j for j in range(max(B - K + 1, A), B + 1))
c = list(a | b)
c.sort()
for k in c:
    print(k)

Submission status: Accepted

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

a_l = [a+i for i in range(k)]
b_l = [b-i for i in range(k)]
if b-a < k:
    [print(i) for i in range(a,b+1)]
else:
    [print(i) for i in sorted(set(a_l+b_l))]

Submission status: Accepted

Solution code:
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    l = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    l = list(range(a, b + 1))
for ans in l:
    print(ans)

Submission status: Accepted

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

if b-a>200:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b-k+1+i)
    
else:
    arr=[]
    for i in range(a,b+1):
        if i<a+k or i>b-k:
            arr.append(i)
    for i in range(len(arr)):
        print(arr[i])

Submission status: Accepted

Solution code:
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    ans_list = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    ans_list = list(range(a, b + 1))
for ans in ans_list:
    print(ans)

Submission status: Accepted

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


A, B, K = invr()
r1 = []
r2 = []
k = K
for i in range(A, B+1):
    if k > 0:
        r1.append(i)
        print(i)
    else:
        break
    k -= 1
k = K
for i in range(B, A-1, -1):
    if k > 0:
        if i not in r1:
            r2.append(i)
    else:
        break
    k -= 1
r2 = sorted(r2)
for i in r2:
    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)
#print(ans)
for j in range(B,B-K,-1):
  #print("j",j)
  if j >= A+K:
    ans.append(j)
ans.sort()
for k in ans:
  print(k)

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+1-k,a),b+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

def main():
    ans = ''
    n = '\n'
    A, B, K = map(int, input().split())
    AK = min(A+K, B)
    for i in range(A, AK):
        ans += str(i) + n
    BK = max(B-K+1, AK)
    for i in range(BK, B+1):
        ans += str(i) + n
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

ans = sorted(ans)

for a in ans:
    print(a)

Submission status: Accepted

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

def main(a,b,k):
    s = set(range(a,min(a+k,b+1)))
    s|=set(range(max(b-k+1,a),b+1))
    ans=sorted(list(s))
    return ans

if __name__=='__main__':
    a,b,k = readinput()
    ans=main(a,b,k)
    for _ in ans:
        print(_)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]


#############
# Main Code #
#############

A,B,K = inputIL()
if B==1000000000:
  S1 = list(range(A,A+K))
  S2 = list(range(max(B+1-K,A+K),B+1))
  print(*S1,sep="\n")
  print(*S2,sep="\n")
  exit()
S = list(filter(lambda x: (A+K>x or B-K<x),list(range(A,B+1))))
print(*S,sep="\n")

Submission status: Accepted

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

for i in range(a,a+c):
  if i <= b:
    l.append(i)
for j in range(b,b-c,-1):
  if j >= a:
    l.append(j)
l = list(set(l))
l.sort()

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

Submission status: Accepted

Solution code:
a, b, k = list(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 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())
s = set()
for i in range(a, a+k):
    if a <=  i <= b:
        s.add(i)
for i in range(b-k+1, b+1):
    if a <=  i <= b:
        s.add(i)
for i in sorted(s):
    print(i)

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


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

s = set()

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

Ans = list(s)
Ans.sort()

for ans in Ans:
    print(ans)

Submission status: Accepted

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

s1 = [i for i in range(a, a+k) if i<=b]
s2 = [i for i in range(b-k+1, b+1) if i>=a]

s = list(set(s1+s2))
s.sort()

for i in s:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

for a in ans:
	print(a)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
l=[]
for i in range(k):
    if a+i<=b:
        if a+i not in l:
            l.append(a+i)#小さい方からk番目以内
    if b-i>=a:
        if b-i not in l:
            l.append(b-i)#小さい方からk番目以内
l.sort()
[print(i) for i in l]

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(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)
    ans = sorted(set(ans))
    return ans

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(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)
    ans = list(sorted(set(ans)))
    return ans

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
ans_list = []
for i in range(a,a+k):
    ans_list.append(i)
    if ans_list[-1] == b:
        [print(i) for i in ans_list]
        exit()
for i in range(b-k+1,b+1):
    if ans_list.count(i) == 0:
        ans_list.append(i)
[print(i) for i in ans_list]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

tmp_s = {i for i in range(A, A+K)}
tmp_l = {i for i in range(B+1-K, B+1)}

ans = list(tmp_s.union(tmp_l))
ans = [i for i in ans if A<=i<=B]
ans.sort()

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
if k<=(b-a)-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:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 17:30:58 2020

@author: shinba
"""

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

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

Submission status: Accepted

Solution code:
import math
a , b , k = map(int , input().split())
ans = set()
for i in range(min(k , math.ceil((b - a + 1) / 2))):
  ans.add(a + i)
  ans.add(b - i)
ans = sorted(list(ans))
print('\n'.join([str(n) for n in ans]))

Submission status: Accepted

Solution code:

def main():
    a, b, k = map(int, input().split())
    r = set()
    for i1 in range(a, min(a + k, b)):
        r.add(i1)
    for i2 in range(max(a, b - k + 1), b + 1):
        r.add(i2)
    r = list(r)
    r.sort()
    for j in r:
        print(j)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if A+K-1 < B-K+1:
    l = list(range(A, A+K))+list(range(B-K+1, B+1))
else:
    l = list(range(A, B+1))

for v in l:
    print(v)

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
if b+2 <= 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+1-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, 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,N=list(map(int,input().split()))
l=set()
for i in range(A,A+N):
    if i > B:
        break
    l.add(i)
for i in reversed(range(B-N+1,B+1)):
    if i < A:
        break
    l.add(i)
l=list(l)
l.sort()
for i in l:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    A,B,K=pin()
    s=set()
    for i in range(K):
        if A+i<=B:s.add(A+i)
    
    for k in range(K):
        if (B+k-K+1)>=A: s.add(B+k-K+1)
    print(*sorted(list(s)),sep='\n')
    #print()
#%%submit!
resolve()

Submission status: Accepted

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

for i in range(K):
    ans.add(A + i)
    ans.add(B - i)
ans = [a for a in ans if A <= a <= B]
print(*sorted(ans), sep='\n')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for small in range(a, min(a + k, b + 1)):
    result.add(small)

for large in range(max(a, b - k + 1), b + 1):
    result.add(large)

result = sorted(list(result))

for r in result:
    print(r)

Submission status: Accepted

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

  
s = sorted(list(s))
for i in s:
  print(i)

Submission status: Accepted

Solution code:
A,B,K = list(map(int,input().split()))
s = set()
for i in range(0,K):
    s.add(A+i)
for i in range(0,K):
    s.add(B-i)
l = sorted(filter(lambda x: A <= x <=B,list(s)))
for i in l:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    a = [i for i in range(A, A + K) if i <= B]
    b = [i for i in range(B - K + 1, B + 1) if A <= i]

    ans = sorted(set(a + b))
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

l = [i for i in range(a, b+1) if (i < a+k) or (i > b-k)]

print(*l, sep="\n", end="")

Submission status: Accepted

Solution code:
#2:03

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if (B - A) // 2 < K:
    num_list = [i for i in range(A, B+1)]
    for i in num_list:
        print(i)
else:
    left = [i for i in range(A, A+K)]
    right = [i for i in range(B-K+1, B+1)]
    num_list = left + right
    for i in num_list:
        print(i)