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=map(int,input().split())
d=[i for i in range(a,b+1)]
ans=[]
n=len(d)
if n>=2*k:
  for i in range(k):
    ans.append(d[i])
    ans.append(d[n-1-i])
elif n<2*k:
  for i in range(n):
    print(d[i])
  exit()
    
ans.sort()
for i in ans:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
d=[i for i in range(a,b+1)]
ans=[]
n=len(d)
if n>=2*k:
  for i in range(k):
    ans.append(d[i])
    ans.append(d[n-1-i])
elif k<=n<2*k:
  for i in range(k):
    ans.append(d[i])
  for j in range(n-k):
    ans.append(d[n-1-j])
elif n<k:
  for i in range(n):
    print(d[i])
  exit()
    
ans.sort()
for i in ans:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
d=[i for i in range(a,b+1)]
ans=[]
n=len(d)
if n>=2*k:
  for i in range(k):
    ans.append(d[i])
    ans.append(d[n-1-i])
elif k<=n<2*k:
  for i in range(k):
    ans.append(d[i])
  for j in range(n-k):
    ans.append(d[n-1-j])
elif n<k:
  for i in range(n):
    ans.append(d[i])
    
ans.sort()
for i in ans:
  print(i)

Submission status: Time Limit Exceeded

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

num_list = [i for i in range(a, b+1, 1)]
copy = num_list.copy()
copy.sort(reverse=True)
ans_list = []
for j in num_list:
    if num_list.index(j) <= k-1 or copy.index(j) <= k-1:
        ans_list.append(j)

for k in ans_list:
    print(k)

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())
n = range(a, b+1)
for i in n:
  if i in sorted(set(n[:k]) | set(n[-k:])):
    print(i)

Submission status: Time Limit Exceeded

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

  print(*[str(i)+'\n' for i in ans] )

Submission status: Time Limit Exceeded

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

for i in ans:
  print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map (int, input ().split ())
x = A
while x <= B:
  if abs(A-x)+1 <= K or abs(B-x)+1 <= K:
    print (x)
  x += 1

Submission status: Time Limit Exceeded

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

num_list = [i for i in range(A, B+1)]

ans_list = sorted((set(num_list[:K] + num_list[-K:])))

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

Submission status: Time Limit Exceeded

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

num_list = [i for i in range(A, B+1)]

ans_list = sorted((set(num_list[:K] + num_list[-K:])))

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

Submission status: Time Limit Exceeded

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

num_list = [i for i in range(A, B+1)]
ans_list1 = num_list[:K]
ans_list2 = num_list[-K:]

ans_list = sorted((set(ans_list1 + ans_list2)))

for i in range(len(ans_list)):
    print(ans_list[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 i>B-K :
    print(i)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K=map(int,input().split())
L={i for i in range(A,A+K)}
R={i for i in range(B-K+1,B+1)}
S=[i for i in range(A,B+1) if i in L or i in R]
for i in range(len(S)):
  print(S[i])

Submission status: Time Limit Exceeded

Solution code:
A,B,K=map(int,input().split())
L=range(A,A+K)
R=range(B-K+1,B+1)
S=[i for i in range(A,B+1) if i in L or i in R]
for i in range(len(S)):
  print(S[i])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, k = inintm()

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

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

ans = sorted(ans)

for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, k = inintm()

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

cnt = 0
for i in range(a,b+1)[::-1]:
    cnt += 1
    if cnt <= k:
        ans.append(i)

ans = sorted(list(set(ans)))

for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k = map(int,input().split())
L=[]
for i in range(a,b+1):
    L.append(i)
L.sort(reverse=True)
O=L[:k]+L[-k:]
O=list(set(O))
O.sort(reverse=False)
for j in range(len(O)):
    print(O[j])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 > 2 * K_ban):
    num_list = num_list[:K_ban] + num_list[-K_ban:]


[print(n) for n in num_list]

Submission status: Time Limit Exceeded

Solution code:
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 <= 2 * K_ban):
    ans = num_list
else:
    ans = num_list[:K_ban] + num_list[-K_ban:]


[print(n) for n in ans]

Submission status: Time Limit Exceeded

Solution code:
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 <= 2 * K_ban):
    ans = num_list
else:
    ans = num_list[:K_ban] + num_list[-K_ban:]

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

Submission status: Time Limit Exceeded

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

for i in range(A,B+1):
    if abs(A-i)<K or abs(B-i)<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-1 or i >= B-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 i < a + k or i > b - k:
        print(i)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
b, t, k = list(map(int,input('').split()))
 
a = b
while b<=t:
  if b < a + k or (t-k < b <= t):
    print(b)
  b += 1

Submission status: Time Limit Exceeded

Solution code:
a, b, k = map(int, input().split())
# print(f"{a} {b} {k}")

# l = []
# for i in range(a, b + 1):
#     l.append(i)
# print(l)

# l_small = set()
# for i in range(a, a + k):
#     l_small.add(i)
# print(l_small)

# l_large = set()
# for i in range(b, b - k, -1):
#     l_large.add(i)
# print(l_large)

l = [i for i in range(a, b + 1)]
# print(l)

l_ans = set()
for i in range(len(l)):
    if i + 1 <= k:
        l_ans.add(l[i])
l = sorted(l, reverse=True)
for i in range(len(l)):
    if i + 1 <= k:
        l_ans.add(l[i])
# print(sorted(l_ans))
for num in sorted(l_ans):
    print(num)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split());*r,=range(a,b+1);print(*sorted({*r[:k]+r[-k:]}))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A, B, K = input().split(' ')
A = int(A)
B = int(B)
K = int(K)
N = []
for i in range(A, B+1):
  if i < A + K:
    N.append(i)
  elif i > B-K:
    N.append(i)
for i in range(len(N)):
  print(N[i])

Submission status: Time Limit Exceeded

Solution code:
s = input().split()
a = int(s[0])
b = int(s[1])
k = int(s[2])

arrays = []

for i in range(a, b + 1):
    arrays.append(i)

answer = []

if k > len(arrays):
    k = len(arrays)

for i in range(k):
    answer.append(arrays[i])

for i in range(k):
    x = arrays.pop()
    check = False
    for i in range(len(answer)):
        if answer[i] == x:
            check = True
    if not check:
        answer.append(x)

answer.sort()

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

    elif i >=b-k+1:
        print(i)

Submission status: Time Limit Exceeded

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

for n in range(A,B+1):
  L.append(n)
  
ans = sorted(set(L[:K]+L[-K:]))
  
print(*ans,sep="\n")

Submission status: Time Limit Exceeded

Solution code:
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & ({*range(a, a + k)} | {*range(b - k + 1, b + 1)})),sep="\n")

Submission status: Time Limit Exceeded

Solution code:
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & {*range(a, a + k), *range(b - k + 1, b + 1)}),sep="\n")

Submission status: Time Limit Exceeded

Solution code:
import math
def main():
  a,b,k = list(map(int,input().split()))
  for i in range(a,b+1):
    if (i < a+k) or(b-k+1 <= i):
      print(i)
  
main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

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

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

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


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

    A, B, K = il()
    R = range(A, B + 1)
    for r in R:
        if A <= r <= A + K - 1 or B >= r >= B - K + 1:
            print(r)


if __name__ == '__main__':
    main()

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K=map(int,input().split())
S=(set(range(A,A+K))|set(range(B-(K-1),B+1)))&set(range(A,B+1))
S=list(S)
S.sort()

for x in S:
    print(x)

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

ans = []

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = [int(i) for i in input().split()]
    numbers = [i for i in range(A, B + 1)]
    ans = numbers[:K]
    ans.extend(numbers[-K:])
    print(*sorted(set(ans)), sep="\n")


resolve()

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map(int,input().split())
box = [i for i in range(A,B+1)]
for j in range(len(box)):
	if box[j] in box[:K]:
		print(box[j])
	elif box[j] in box[-K:]:
		print(box[j])

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map(int,input().split())
box = []
for i in range(A,B+1):
	box.append(i)
for j in range(len(box)):
	if box[j] in box[:K]:
		print(box[j])
	elif box[j] in box[-K:]:
		print(box[j])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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, B+1):
        if i <= left or right <= i:
            print(i)
else:
    for i in range(A, B+1):
        print(i)

Submission status: Time Limit Exceeded

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

left = A+K-1
right = B-K+1

if left < right:
    l1 = [i for i in range(A, B + 1) if i <= left or right <= i ]
else:
    l1 = [i for i in range(A, B+1)]

for i in l1:
    print(i)

Submission status: Time Limit Exceeded

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

ans = list(set(l1) | set(l2))
ans.sort()

for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map(int, input().split())
C = [i for i in range(A,B+1)]
if B-A+1<= 2*K:
    print(*C, sep="\n")
else:
    print(*C[:K], sep="\n")
    print(*C[-K:], sep="\n")

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map(int, input().split())
print(*[k for k in range(A,B+1) if k < A+K or B-K < k], sep="\n")

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 重なるところに注意
A, B, K = lr()
answer = [x for x in range(A, B+1) if x < A+K or x > B-K]
print('\n'.join(map(str, answer)))

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    def input(): return sys.stdin.readline()[:-1]
    pl = lambda x: print(*x, sep='\n')

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

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

N = B-A+1
ini = set(range(A, B+1))
st = [v for i, v in enu(range(A, A+K))]
en = [v for i, v in enu(range(B-K+1, B+1))]
sten = set(st)|set(en)
res = ini&sten
for i in sorted(res):
    print(i)

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

N = B-A+1
res = [v for i, v in enu(range(A, B+1)) if i<K or N-K<=i]
res.sort()
for r in res:
    print(r)

Submission status: Time Limit Exceeded

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

def judge(x,a,b,k):
    return x < a+k or b-k < x

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

    l = list(filter(lambda x: judge(x,a,b,k),range(a,b+1)))
    for s in l:
        print(s)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = list(map(int, input().split()))
    l = [i for i in range(A, B+1)]
    if len(l) >= 2 * K:
        ls = l[:K] + l[-K:]
    else:
        ls = l

    print('\n'.join(map(str, ls)))
    return

resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = list(map(int, input().split()))
    l = [int(i) for i in range(A, B+1)]
    if len(l) >= 2 * K:
        ls = l[:K] + l[-K:]
    else:
        ls = l
    for _ in ls:
        print(_)
    return

resolve()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[25]:


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


# In[26]:


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


# In[ ]:

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    a, b,x = map(int, input().split())
    y = [i for i in range(a,b+1)]
    set1=set(y[:x])
    set2=set(y[len(y)-x:])
    sumSet = set1 | set2
    list = list(sumSet)
    list.sort()

    for i in list:
        print(i)

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = map(int, input().split())
    count = []
    for _ in range(B-A+1):
        count.append(A+_)
    if K > B-A-1:
        K = B-A+1
    for i in range(K):
        print(count[i])
    for j in range(K):
        if count[(K*-1)+j] > count[K-1]:
            print(count[(K*-1)+j])
resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = map(int, input().split())
    count = []
    ans = []
    for _ in range(B-A+1):
        count.append(A+_)
    if K > B-A-1:
        K = B-A+1
    for i in range(K):
        ans.append(count[i])
        ans.append(count[(i+1)*-1])
    an = sorted(set(ans))
    for i in range(len(an)):
        print(an[i])
resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = map(int, input().split())
    count = [A]
    ans = []
    for _ in range(1, B-A+1):
        count.append(A+_)
    if K > B-A-1:
        K = B-A+1
    for i in range(K):
        ans.append(count[i])
        if count[(i+1)*-1] > A+K-1:
            ans.append(count[(i+1)*-1])
    an = sorted(ans)
    for i in range(len(an)):
        print(an[i])
resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    A, B, K = map(int, input().split())
    count = [A]
    ans = []
    for _ in range(1, B-A+1):
        count.append(A+_)
    if K > B-A-1:
        K = B-A+1
    for i in range(K):
        ans.append(count[i])
        if count[(i+1)*-1] >= A+K-1:
            ans.append(count[(i+1)*-1])
    an = sorted(set(ans))
    for i in range(len(an)):
        print(an[i])
resolve()

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

Submission status: Time Limit Exceeded

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

ans = []

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(A,B+1,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-1 or i >= B - K + 1:
        print(i)

Submission status: Time Limit Exceeded

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

ans = [i for i in range(A, B+1) if i <= A+K-1 or i >= B-K+1]

for j in ans:
    print(j)

Submission status: Time Limit Exceeded

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

ans = []
for i in range(A, B+1):
    if i <= A+K-1  or i >= B - K + 1:
        ans.append(i)
for j in ans:
    print(j)

Submission status: Time Limit Exceeded

Solution code:
a,b,k = map(int,input().split())
n = b-a+1
ok = 0
print(a)
while a < b:
    ok += 1
    a += 1
    if k/2 >= n:
        print(a)
    else:
        if ok < k or ok >= n-k:
            print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
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())
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: Time Limit Exceeded

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)
        k -= 1
k = K
for i in range(B, A-1, -1):
    if k > 0:
        if i not in r1:
            r2.append(i)
        k -= 1
r2 = sorted(r2)
for i in r2:
    print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
list=[]
for i in range(a,b+1):
    list.append(i)
#print(list)
del list[k:-k]
#print(list)
for i in range(len(list)):
    print(list[i],end="")
    print()

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
list=[]
for i in range(a,b+1):
    list.append(i)
#print(list)
del list[k:-k]
#print(list)
for i in range(len(list)):
    print(list[i],end="")
    print()

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-1 or i>=B-K+1:print(i)
  else:A+=0

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

Submission status: Time Limit Exceeded

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)}
whole = {i for i in range(A, B+1)}

ans = list(tmp_s.union(tmp_l).intersection(whole))
ans.sort()

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K = map(int, input().split())
List = [i for i in range(A,B+1)]
s = List[0:K]
r = List[::-1]
l = r[0:K]
for i in l:
    s.append(i)
w = sorted(set(s))
for j in w:
    print(j)

Submission status: Time Limit Exceeded

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(a,b+1):
  if i<ak or i>bk:
    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())

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