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: Time Limit Exceeded

Solution code:
a,b,k = [int(i) for i in input().split()]
A = [i for i in range(a,b+1)]
n = len(A)
ans = []
if n <= 2*k:
    for a in A:
        print(a)

else:
    A = A[:k]+A[-k:]
    for a in A:
        print(a)

Submission status: Time Limit Exceeded

Solution code:
import sys

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

Submission status: Time Limit Exceeded

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

a,b,k = na()
f = [i for i in range(a,b+1)]
ans = f[:k]
ans_d = f[-k:]
ans += ans_d
for i in sorted(set(ans), key=ans.index):
    print(i)

Submission status: Time Limit Exceeded

Solution code:

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

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

Submission status: Time Limit Exceeded

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

else:
    for i in range(A,A+K):
        if A+K>B:
            break
        else:
            print(i)
    for i in range(edge,B+1):
        if B-i<K:
            print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k = [int(i) for i in input().split()]
A = [i for i in range(a,b+1)]
n = len(A)
ans = []
for i in range(k):
    if i >= n:
        break
    else:
        ans.append(A[i])

for i in range(1,k+1):
    if i >= n or A[-i] in ans:
        break
    else:
        ans.append(A[-i])


ans.sort()

for a in ans:
    print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
n =[]
for i in range(a,b+1):
    n.append(i)
nf=n[:k]
nb=n[len(n)-k:]
n=nf+nb
n=list(set(n))
n.sort()
for i in n:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    A, B, K = map(int, input().split())

    candidates = {v for v in range(A, B + 1)}

    satisfied_integers = set()
    for i in range(K):
        satisfied_integers |= {A + i}

    for i in range(K):
        satisfied_integers |= {B - K + 1 + i}
        
    satisfied_integers = sorted(candidates & satisfied_integers)
    for v in satisfied_integers:
        print(v)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A, B, K = list(map(int, input().split()))
l1 = {n for n in range(A, A + K)}
l2 = {n for n in range(B - K + 1, B + 1)}
l = sorted(list((l1 | l2) & {n for n in range(A, B+1)}))
for s in l:
    print(s)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

a,b,k = na()
f = [i for i in range(a,b+1)]
ans = []
ans += f[:k]
ans_d = []
ans_d += f[::-1][:k]
ans += ans_d
for i in sorted(set(ans)):
    print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k = [int(i) for i in input().split()]
A = [i for i in range(a,b+1)]
n = len(A)
ans = []
A.sort()
for i in range(k):
    if i >= n:
        break
    else:
        ans.append(A[i])

A.sort(reverse=True)
for i in range(k):
    if i >= n:
        break
    else:
        ans.append(A[i])

ans = list(set(ans))

ans.sort()

for a in ans:
    print(a)

Submission status: Time Limit Exceeded

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

for i in range(len(l)):
  if i < k or i >= len(l)-k:
    print(l[i])

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
s = input().split(" ")
s = [int(i) for i in s]
A = s[0]
B = s[1]
K = s[2]


for i , s in enumerate(range(A , B + 1) ):
    if (i < K) or (i > (B-A-K)) :
        print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Accepted

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

k = k-1
i = a
while True:
    print(i)
    i += 1
    if  i > a + k or i > b:
        break
if i < b-k:
    i = b-k
while i <= b:
    print(i)
    i += 1

Submission status: Accepted

Solution code:
from typing import List


def answer(a: int, b: int, k: int) -> List[int]:
    a_k = set(range(a, min(a + k, b + 1)))
    k_b = set(range(max(b - k + 1, a + 1), b + 1))

    return sorted(a_k.union(k_b))


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,k = list(map(int, input().split()))
ans=[b-i for i in range(k) if b-i>=a]
ans.extend([a+i for i in range(k) if a+k<=b])
ans.sort()
ans=set(ans)
print(*ans,sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 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=[]
num_min=a+k
num_max=b-k+1
if (b-a+1)>2*k:
    for i in range(a,num_min):
        ans.append(i)
    for i in range(num_max,b+1):
        ans.append(i)
else:
    for i in range(a,b+1):
        ans.append(i)
ans=sorted(set(ans))
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
lst = input().split()
A = int(lst[0])
B = int(lst[1])
K = int(lst[2])

if (B - A + 1) <= 2 * K:
   for n in list(range(A, B+1)):
      print(n)
else:
   for n in list(range(A, A+K)):
      print(n)
   for n in list(range(B-K+1, B+1)):
      print(n)

Submission status: Accepted

Solution code:
a,b,k = [int(x) for x in input().split()]
res = []
for i in range(a,min(b,k+a-1) + 1):
  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 range(len(res)):
  print(res[i])

Submission status: Accepted

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b, k = [int(num) for num in lines.pop(0).split(" ")]
s1 = set(range(a, min(b, a + k)))
s2 = set(range(max(a, b - k + 1), b + 1))
lis = sorted(s1 | s2)
for i in lis:
    print(i)

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:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main2():
    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)

def main():
    numbers=[]
    a,b,k = map(int,input().split())
    numbers=np.arange(a,b+1)
    A=set(numbers[:k])
    B=set(numbers[-k:])
    answers = A|B
    
    for i in sorted(answers):
        print(i)

if __name__=="__main__":
    main2()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(A,A+K):
    print(i)
    if i == B:
        falg = False
        break

if flag:
 if A+(K-1) < B-(K-1):
    for i in range(B-(K-1),B+1):
        print(i)
        if i == B:
            break

 else:
    for i in range(A+K,B+1):
        print(i)
        if i == B:
            break

Submission status: Accepted

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

ans=set(ans)
ans=list(ans)
ans.sort()


for a in ans:
    print(a)

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)
for i in sorted(list(ans)):
  if a<=i<=b:
    print(i)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
Alist = list(range(a,min(a+n,b+1),1))
Blist = list(range(max(a,b-n+1),b+1,1))
C = sorted(set(Alist)|set(Blist))
for i in list(C):
  print(i)

Submission status: Accepted

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

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

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    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 j in range(K):
        print(B-K+j+1)
else:
    for k in range(B-A+1):
        print(A+k)

Submission status: Accepted

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

cnt=int(b-a+1)

if cnt<=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())

r = range(a, b + 1)
r = list(set(r[:k]) | set(r[-k:]))
r.sort()

for _r in r:
    print(_r)

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

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

Submission status: Accepted

Solution code:
a=input().split(' ')
A=int(a[0])
B=int(a[1])
K=int(a[2])
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 range(K):
    print(B-K+1+i)

Submission status: Accepted

Solution code:
a,b,k=map(int,input().split())
x=[]
y=[]
if b-a<k:
    k=b-a+1
for i in range(a,a+k):
    x.append(i)
for i in range(b-k+1,b+1):
    x.append(i)
x=list(set(x))
x.sort()
for i in range(len(x)):
    print(x[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, k = map(int, input().split())
n = []
for i in range(k):
    if a + i > b:
        break
    n.append(a + i)
for j in range(k):
    if b - k + 1 + j < a:
        break
    if n.count(b - k + 1 + j) <= 0:
        n.append(b - k + 1 + j)
[print(num) for num in n]

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

num = set()
for v in range(a, a + k):
    if v > b:
        break
    num.add(v)
    print(v)

for v in range(b + 1 - k, b + 1):
    if v < a:
        continue
    if v in num:
        continue
    print(v)

Submission status: Accepted

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

Submission status: Accepted

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

ls_1 = [i for i in range(A,min(A+K,B+1))]
ls_2 = [j for j in range(max(A,B-K+1),B+1) if j not in ls_1]
ls = ls_1 + ls_2

for ans in ls:
  print(ans)

Submission status: Accepted

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

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

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

ans=sorted(list(ans))

for i in (ans):
    print(i)

Submission status: Accepted

Solution code:
a,b,k = list(map(int, input().split()))
ans = []
for i in range(k):
    n = a + i
    if n > b:
        break
    ans.append(n)

st = b - k + 1
st = max(st, ans[-1]+1)
for i in range(st, b+1):
    ans.append(i)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

upstart = max(B - K + 1, 0)
uplim = min(upstart + K, B)
ans = set([a for a in range(A, min(A + K, B))] + [b for b in range(upstart, uplim + 1)])
ans = sorted(list(ans))
for a in ans:
    if a < A:
        continue
    print(a)

Submission status: Accepted

Solution code:
from collections import OrderedDict

A, B, K = map(int, input().split())
L = []
res = []

if K > B-A:
    for i in range(A, B+1):
        print(i)
    exit()
else:
    for i in range(A, A+K):
        res.append(i)
    for i in range(B-K+1, B+1):
        res.append(i)

res_unique = list(set(res))
res_unique.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    A,B,K=mi()
    ans = set()
    for i in range(A,A+K):
        if A<=i<=B:
            ans.add(i)
    
    for i in range(B-K+1,B+1):
        if A<=i<=B:
            ans.add(i)
    
    ans = list(ans)
    ans.sort()
    print(*ans,sep='\n')







if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

else:
  a_set={i for i in range(a,a+k)}
  b_set={i for i in range(b-k+1,b+1)}

  ans_set = sorted(a_set | b_set)

  for i in ans_set:
    print(i)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B, K = map(int, readline().split())
    s = set()

    for i in range(A, A + K):
        if i > B:
            break
        s.add(i)

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

    res = sorted(list(s))

    for x in res:
        print(x)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,k=map(int, input().split())
k=min(k,b-a+1)
*al,=range(a,a+k)
*al2,=range(b-k+1,b+1)
ans=al+al2
ans=list(set(ans))
ans.sort()
for i in ans:print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

lim_1 = min(a + k, b)
lim_2 = max(b - k + 1, a)
ans = set(list(range(a, lim_1)) + list(range(lim_2, b + 1)))

for n in ans:
    print(n)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

num_limit = b-a+1
if num_limit <= k*2:
    ans_list = [i for i in range(a, b+1, 1)]
else:
    ans_list = []
    for j in range(k):
        low = a+j
        high = b-j
        ans_list.append(low)
        ans_list.append(high)
    ans_list.sort()

for l in ans_list:
    print(l)

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

Submission status: Accepted

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

for i in range(k):
    if a + i > b:
        break
    print(a + i)

start = max(a+k, b-k+1)

for i in range(start, b+1):
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

L = []
s = [i for i in range(A, min(A+K, B+1))]
l = [j for j in range(B, max(A-1, B-K), -1)]
L += s + l
L = list(set(L))
L.sort()

for i in L:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    A, B, K = [int(i) for i in input().split()]
    for i in range(A, B + 1):
        if i < A + K or i > B - K:
            print(i)

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
res = set()
for i in range(a, a + k):
    res.add(min(b, i))

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

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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

    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)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if (b-a +1) <= 2 * k:
  for i in range(a,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()
r = range(a, b + 1)
for i in range(min(k, len(r))):
    ans.add(r[i])
    ans.add(r[-i-1])
else:
    [print(i) for i in sorted(ans)]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,k = map(int, input().split())
setA = set(i for i in range(a,min(a+k,b+1)))
setB = set(j for j in range(b,max(b-k,a-1),-1))
l = list(setA|setB)
l.sort()
for m in l:
  print(m)

Submission status: Accepted

Solution code:
n,m,k=map(int,input().split())
if(k>=m-n):
    for i in range(n,m+1):
        print(i)
else:
    l=list(range(n,n+k))
    d=list(range(m-k+1,m+1))
    s=l+d
    s=list(set(s))
    s.sort()
    for i in s:
        print(i)

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
L = set()
for i in range(A, A+K):
  if i <= B:
    L.add(i)
for i in range(B, B-K, -1):
  if i >= A:
    L.add(i)
print(*sorted(list(L)), sep="\n")

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

Submission status: Accepted

Solution code:
a, b, k = map(int, input().split())
n = b - a + 1

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

Submission status: Accepted

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

for i in range(k):
    x = a + i
    if x <= b:
        print(a + i)
    
for i in range(k):
    x = b - k + i + 1
    if x <= a + k - 1 or x < a:
        pass
    else:
        print(x)

Submission status: Accepted

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

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

ans = set([])

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

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

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

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 b - i >= a:
        ans.add(b - i)
for x in sorted(ans):
    print(x)

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

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

ans = []

for i in range(K):
  if A + i <= B and A + i not in ans:
    ans.append(A + i)
  
  if B - i >= A and B - i not in ans:
    ans.append(B - i)
    
ans.sort()

for i in ans:
  print(i)

Submission status: Accepted

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

if K*2 > B-A:
  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())
[print(i) for i in sorted(set(list(range(a,min(a+k,b+1)))+list(range(max(a,b-k+1),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())
C=[]
D=[]
for i in range(K):
    if A+i<=B:
        C.append(A+i)
for i in range(K):
    if B-i>=A:
        D.append(B-i)
E=C+D
E.sort()
F=list(set(E))
F.sort()
for i in range(len(F)):
    print(F[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-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())
S = sorted(list(set([i for i in range(A, min(A + K, B))] + [i for i in range(max(A, B - K + 1), B + 1)])))
for s in S:
    print(s)

Submission status: Accepted

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

x = range(A,B+1)

for s in sorted(set(x[:K]) | set(x[-K:])):
	print(s)

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

Submission status: Accepted

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

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

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

print(*lst)