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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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)
ans = sorted(list(set(l[:k] + l[-k:])))
for a in ans:
    print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = lis[:k]+ lis[-k:]

if len(lis)<k*2:
  for i in lis:
    print(i)
else:
  for i in ans:
    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 + 1 <= K or B - i + 1 <= K:
        print(i)
    else:
        continue

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

if A == B:
    print(A)
else:
    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())

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 = [int(n) for n in input().split(' ')]

nums = [n for n in range(a, b+1)]
nums_set = set()

limit = k if k < len(nums) else len(nums)

for i in range(limit):
    nums_set.add(nums[i])
    nums_set.add(nums[-1-i])

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

Submission status: Time Limit Exceeded

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

ans = set()

nums = [n for n in range(a, b+1)]
for i, num in enumerate(nums):
    if i < k:
        ans.add(num)

nums = list(reversed(nums))
for i, num in enumerate(nums):
    if i < k:
        ans.add(num)

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

Submission status: Time Limit Exceeded

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


rn = range(A, B+1)
ln = len(rn)
if K > ln:
    for i in rn:
        print(i)
    exit()

for i, e in enumerate(rn, 1):
    if K >= i:
        print(e)
    elif ln - K < i:
        print(e)

Submission status: Time Limit Exceeded

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

rn = range(A, B+1)
ln = len(rn)
for i, e in enumerate(rn, 1):
    if K >= i:
        print(e)
    elif ln - K < i:
        print(e)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A, B, K = map(int, input().split())
list = [i for i in range(A, B+1)]
list1 = list[:K]
list2 = list[(B-K-A+1):]
for i in list1:
    print(i)
for i in list2:
    if i not in list1:
        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 b - k + 1 <= i:
        print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans_li = [i for i in range(a,b+1) if not a+k<=i<=b-k]
print('\n'.join(map(str,ans_li)))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(a,b+1):
    if i>=a+x and i<=b-x:
        continue
    else:
        print(i)

Submission status: Time Limit Exceeded

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

for i in range(a,b+1):
    if i>=a+x and i<=b-x:
        continue
    else:
        print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
icase=0
if icase==0:
    a,b,k=map(int,input().split()) 
    ab=[]
    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:
icase=0
if icase==0:
    a,b,k=map(int,input().split()) 
    ab=[]
    for i in range(a,b+1):
#        print(i,a+k-1,b-k+1)
        if i<=a+k-1 or b-k+1<=i:
            ab.append(i)
    for i in range(len(ab)):
        print(ab[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)
    else:
        continue

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i, x in enumerate(range(a, b+1)):
  if i < k or (0 <= (b-a) - i and (b-a) - i < k):
    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:
        print(i)
    elif b-k<i:
        print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,k=map(int,input().split())
l=[]
ll=[]
for i in range(a,b+1):
    l.append(i)
i=0
j=0
while True:
    print(l[0])
    l.pop(0)
    j+=1
    if len(l)==0 or j==k:
        break
while True:   
    if len(l)==0 or i==k:
        break    
    ll.append(l[-1])
    l.pop()
    i+=1
ll.sort()
for i in range(len(ll)):
    print(ll[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:
def main():
    A, B, K = map(int, input().split())
    count = 0
    for i in range(A, B+1):
        if count < K or  (B-A)-K < count:        
            print(i)
        count += 1
main()

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
def main():
    A, B, K = map(int, input().split())
    number = deque()
    for i in range(A, B+1):
        number.append(i)
    for i in range(K):
        if len(number) > 0:
            print(number.popleft())
    l = deque()
    for i in range(K):
        if len(number) > 0:
            l.append(number.pop())
    for i in range(len(l)):
        if len(l) > 0:
            print(l.pop())
main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a, b, k = map(int, input().split())
se = set()
for i in range(1, 1000000000):
    if i > b:
        break
    if (i >= a and i <= b) and (i < a + k or i >= b + 1 - 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:ans.append(i)
print(*ans)

Submission status: Time Limit Exceeded

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

for j in range(len(n)):
    if n.index(n[j])<x or abs(len(n)-x)<=n.index(n[j]):
        print(n[j])

Submission status: Time Limit Exceeded

Solution code:
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


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

    A, B, K = il()
    ret = []
    for n in range(A, B + 1):
        ret.append(n)
    a = sorted(set(ret[:K] + ret[::-1][:K]))

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:

url = "https://atcoder.jp//contests/abc093/tasks/abc093_b"

def main():
    f, t, no = list(map(int, input().split()))
    nums = [i for i in range(f, t + 1)]
    ans = set()
    no = len(nums) if no > len(nums) else no
    for i in range(no):
        ans.add(nums[i])
    for i in range(no * -1, 0, 1):
        ans.add(nums[i])

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k=[int(i) for i in input().split()]
c=[]
for i in range(a,b+1):
    c.append(i)
head=c[:k]
tail=c[::-1][:k]
d=head+tail
e=list(set(d))
e.sort()
for i in e:
    print(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 or i > b-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 or i > b-k], sep="\n")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for _ in range(k):
    if len(list_ANS) != 0:
        a = list_ANS.pop(0)
        print(a)
    else:
        break
list_A = []
for _ in range(k):
    if len(list_ANS) != 0:
        b = list_ANS.pop(-1)
        list_A.append(b)

    else:
        break
if len(list_A) != 0:
    list_A.reverse()
    for i in list_A:
        print(i)

Submission status: Time Limit Exceeded

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

for _ in range(k):
    if len(list_ANS) != 0:
        a = list_ANS.pop(0)
        print(a)
    else:
        break
list_A = []
for _ in range(k):
    if len(list_ANS) != 0:
        b = list_ANS.pop(-1)
        list_A.append(b)
    else:
        break

list_A.reverse()
for i in list_A:
    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:
        print(i)
    elif 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:
A, B, K = map(int, input().split())
[print(i) for i in range(A, B + 1) if i <= A + K - 1 or i >= B - K + 1]

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

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

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)
        continue
    if i >= B - K + 1:
        print(i)
        continue

Submission status: Time Limit Exceeded

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

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:
data = input().split()

a,b,c = int(data[0]), int(data[1]), int(data[2])

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

numlist.sort()
 
for l in range(len(numlist)):
    print(numlist[l])

Submission status: Time Limit Exceeded

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

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

numSet = set(numlist)
numlist = list(numSet)
numlist.sort()
 
for l in range(len(numlist)):
    print(numlist[l])

Submission status: Time Limit Exceeded

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

for i in range(a, b+1):
    if i <= a + k - 1:
        numlist.append(i)
for j in reversed(range(a, b+1)):
    if j >= b - k + 1:
        numlist.append(j)

numSet = set(numlist)
numlist = list(numSet)
numlist.sort()
 
for l in range(len(numlist)):
    print(numlist[l])

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)
if B - A + 1 < K:
    for j in l:
        print(j)

else:
    m = l[:K] + l[B - A + 1 - K:]
    
    M = list(set(m))
    M.sort()
    for k in M:
        print(k)

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)
if B - A + 1 < K:
    for j in l:
        print(j)

else:
    m = l[:K] + l[B - A + 1 - K:]
    
    
    
    for k in sorted(set(m), key = l.index):
        print(k)

Submission status: Time Limit Exceeded

Solution code:
a,b,k=list(map(int,input().split()))
l=[]
v=[]
for i in range(a,b+1):
    l.append(i)
for i in range(k):
    if i>=len(l):
        break
    v.append(l[i])
l.reverse()
for i in range(k-1,-1,-1):
    if i>=len(l):
        continue
    v.append(l[i])
s=set(v)
l=list(s)
l.sort()
for i in l:
    print(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 (a <= i and i < a+k) or (b-k < i and i <= b):
        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) if i<a+k or b-k<i]
for j in l:
  print(j)

Submission status: Time Limit Exceeded

Solution code:
#abc093 b
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:
        print(i)
    else:
        continue

Submission status: Time Limit Exceeded

Solution code:
#abc093 b
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:
        print(i)

Submission status: Time Limit Exceeded

Solution code:
#abc093 b
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:
        ans.append(i)
for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
a,b,K = map(int,input().split())
k = []
count = 1
if a<b:
    count_g = b-a+1
    for i in range(a,b+1):
        if count<=K or count_g<=K:
            k.append(i)
        count += 1
        count_g -= 1
else:
    count_g = a-b+1
    for i in range(b,a+1):
        if count<=K or count_g<=K:
            k.append(i)
        count += 1
        count_g -= 1
for i in range(len(k)):
    print(k[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:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

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


        for i in ans:
            print(i)


resolve()

Submission status: Time Limit Exceeded

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

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


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


resolve()

Submission status: Time Limit Exceeded

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

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

        ans.extend([i for i in range(a,a+k)])
        ans.extend([i for i in range(b,b-1-(k-1),-1)])

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


resolve()

Submission status: Time Limit Exceeded

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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

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

        ans.extend([i for i in range(a,a+k)])
        ans.extend([i for i in range(b,b-1-(k-1),-1)])

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


resolve()

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:
# Problem B - Small and Large Integers

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

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


# output process 1
for i in range(K):
    if len(num_list)<=0:
        break
    n = num_list[0]
    print(n)
    num_list.remove(n)

# output process 2
output2_list = []
for i in range(K):
    if len(num_list)<=0:
        break
    n = num_list[-1]
    output2_list.append(n)
    num_list.remove(n)
output2_list = output2_list[::-1]
for o in output2_list:
    print(o)

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

Submission status: Time Limit Exceeded

Solution code:
A,B,K = [int(i) for i in input().rstrip().split()]

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

if K <= len(nums)/2:
  print(*(nums[:K] + nums[-K:]),sep="\n")
else:
  print(*nums,sep="\n")

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

x = []
if k*2 > c:
    x = l
else:
    for j in range(k):
        x.append(l[j])
        x.append(l[-(j+1)])

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

Submission status: Time Limit Exceeded

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

x = []
if k*2 > c:
    x = l
else:
    for j in range(k):
        x.append(l[j])
        x.append(l[-(j+1)])

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k = map(int, input().split())
l = [i for i in range(a,b+1)]
#print(l)
c = len(l)
d = min(c,k)
x = []

if k*2 > c:
    x = l
else:
    for p in range(k):
        x.append(l[p])
        x.append(l[-(p+1)])

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

Submission status: Time Limit Exceeded

Solution code:
a,b,k = map(int, input().split())
l = []
for i in range(b-a+1):
    l.append(a+i)
#print(l)
c = len(l)
d = min(c,k)
x = []
for j in range(d):
    x.append(l[j])
    x.append(l[-(j+1)])

x = list(set(x))
print(*sorted(x), sep='\n')

Submission status: Time Limit Exceeded

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

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


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

for j in range(len(ans)):
    if k <= j < (len(ans) - k):
        pass
    else:
        print(ans[j])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

if b - a < k*2:
    for i in l:
        print(i)
else:
    for i in l[:k]:
        print(i)
    for i in l[-k:]:
        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)]
l = sorted(set(l[:k] + l[-k:]))

for i in l:
  print(i)

Submission status: Time Limit Exceeded

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

for i in sorted(list(set(ans[:k]) | set(ans[-k:]))):
  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)]

ans = []
for i in l[:k]:
    ans.append(i)

for i in l[len(l)-k:]:
    if not(i in ans):
        ans.append(i)

for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,c=INTM()
    abl=b-a+1
    ablist=[i for i in range(a,b+1)]
    #print(ablist)
    ansa=ablist[0:min(c,abl)]
    ansb=ablist[max(0,abl-c):abl]
    #print(ansa,ansb)
    ans=set(ansa) | set(ansb)
    ans=sorted(ans)
    for i in ans:
        print(i)
    
if __name__ == '__main__':
    do()

Submission status: Time Limit Exceeded

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,c=INTM()
    abl=b-a+1
    ablist=[i for i in range(a,b+1)]
    #print(ablist)
    ansa=ablist[0:min(c,abl)]
    ansb=ablist[max(0,abl-c):abl]
    #print(ansa,ansb)
    ans=set(ansa) | set(ansb)
    anslist=[]
    for i in ans:
        anslist.append(i)
    anslist.sort()
    for i in anslist:
        print(i)
if __name__ == '__main__':
    do()

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=[]
for i in range(A, B+1):
    x.append(i)
a=x[:K]
b=x[-K:]
c=sorted(set(a)|set(b))
for i in c:
    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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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