AtCoder Beginner Contest 137 - One Clue

There are 2000001 stones placed on a number line. The coordinates of these stones are -1000000, -999999, -999998, \ldots, 999999, 1000000.
Among them, some K consecutive stones are painted black, and the others are painted white.
Additionally, we know that the stone at coordinate X is painted black.
Print all coordinates that potentially contain a stone painted black, in ascending order.

-----Constraints-----
 - 1 \leq K \leq 100
 - 0 \leq X \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
K X

-----Output-----
Print all coordinates that potentially contain a stone painted black, in ascending order, with spaces in between.

-----Sample Input-----
3 7

-----Sample Output-----
5 6 7 8 9

We know that there are three stones painted black, and the stone at coordinate 7 is painted black. There are three possible cases:
 - The three stones painted black are placed at coordinates 5, 6, and 7.
 - The three stones painted black are placed at coordinates 6, 7, and 8.
 - The three stones painted black are placed at coordinates 7, 8, and 9.
Thus, five coordinates potentially contain a stone painted black: 5, 6, 7, 8, and 9.

Source: atcoder | Difficulty: EASY


Solutions:
(k, x) = [int(n) for n in input().split()]
if x + (k - 1) >= 1000000:
	r = 1000000
else:
	r = x + (k - 1)
if x - (k - 1) <= -1000000:
	l = -1000000
else:
	l = x - (k - 1)
print(' '.join([str(n) for n in range(l, r + 1)]))


(k, x) = map(int, input().split())
l = max(-1000000, x - k + 1)
for i in range(l, l + k * 2 - 1):
	print(i, end=' ')


(k, x) = list(map(int, input().split()))
b = []
for i in range(x - k + 1, x + k):
	b.append(str(i))
b = ' '.join(b)
print(b)


import numpy as np
(K, X) = map(int, input().split())
a = np.arange(X - K + 1, X + K)
print(*a)


(k, x) = map(int, input().split())
for i in range(-k + 1, k):
	print(x + i)


(k, x) = map(int, input().split())
for i in range(x - ~-k, x + k):
	print(i, end=' ')


(K, X) = map(int, input().split())
print(' '.join([str(_) for _ in range(X - K + 1, X + K)]))


(K, X) = map(int, input().split())
print(*range(X - K + 1, X + K))


(k, x) = map(int, input().split())
res = range(x - k + 1, x + k)
print(*res)


(k, x) = map(int, input().split())
val = x - k + 1
while val < k + x:
	print(val)
	val = val + 1


(n, k) = [int(x) for x in input().split(' ')]
for x in range(k - n + 1, k + n):
	print(x)


(k, x) = list(map(int, input().split()))
ans = [str(i) for i in range(x - k + 1, k + x)]
print(' '.join(ans))


(a, b) = map(int, input().split())
print(*range(b - (a - 1), b + (a - 1) + 1))


def my_input():
	return list(map(int, input().split()))
(k, x) = my_input()
ans = [x + i for i in range(-(k - 1), k)]
print(*ans, sep=' ')


(k, x) = map(int, input().split())
print(*list(range(x - k + 1, x + k)))


(K, X) = [int(i) for i in input().split()]
print(*range(X - K + 1, X + K))


(K, X) = map(int, input().split())
List = list(range(X - K + 1, X + K))
print(*List)


(K, X) = map(int, input().split())
for a in range(X - K + 1, X + K):
	print(a, end=' ')


(K, X) = map(int, input().split())
result = []
for i in range(1, K):
	result.append(X + i)
	result.append(X - i)
result.append(X)
result.sort()
b = []
for n in result:
	num = str(n)
	b.append(num)
print(' '.join(b))


(K, X) = map(int, input().split())
L = list(range(X - K + 1, K + X))
print(*L, sep=' ')


(k, x) = map(int, input().split())
for num in range(x - k + 1, x + k):
	print(num)


(K, X) = map(int, input().split())
x = list(range(X - K + 1, X + K))
print(*x)


(k, x) = map(int, input().split())
ans = range(x - (k - 1), x + k)
print(*ans)


(n, m) = map(int, input().split())
print(*[x for x in range(m - n + 1, m + n)])


(K, X) = map(int, input().split())
print(' '.join(list(map(str, range(X - K + 1, X + K)))))


(k, x) = map(int, input().split())
start = max(-1000000, x - k + 1)
end = min(1000000, x + k - 1)
for i in range(start, end + 1):
	print(i, end=' ')


(a, b) = map(int, input().split())
l = [i for i in range(b - a + 1, b + a)]
print(*l)


(K, X) = map(int, input().split())
a = X - K + 1
b = X + K
while a < b:
	print(a, end=' ')
	a += 1


(K, X) = map(int, input().split())
ans = list(range(X - K + 1, X + K, 1))
print(*ans)


(K, X) = map(int, input().split())
A = list(range(X - K + 1, X + K))
print(*A)


(x, k) = map(int, input().split())
print(*range(k - x + 1, x + k), sep=' ')


(k, x) = map(int, input().split())
print(' '.join(map(str, range(x + 1 - k, x + k))))


(K, X) = map(int, input().split())
print(*[X - K + 1 + i for i in range(2 * K - 1)])


(k, x) = map(int, input().split())
a_list = []
for i in range(2 * k - 1):
	a_list.append(str(x - k + 1 + i))
print(' '.join(a_list))


(k, x) = map(int, input().split())
lists = []
for i in range(x - k + 1, x + k):
	lists.append(str(i))
print(' '.join(lists))


(K, X) = map(int, input().split())
l = [int(x) for x in range(X - (K - 1), X + K)]
print(*l)


(K, X) = map(int, input().split())
x = X - K + 1
while x <= X + K - 1:
	print(x)
	x += 1


(K, X) = map(int, input().split())
l = list(range(X - K + 1, X + K, 1))
print(*l)


(K, X) = map(int, input().split())
start = X - K + 1
goal = X + K
lst = [i for i in range(start, goal)]
print(*lst)


(k, x) = map(int, input().split())
N = 1000000
print(*list(range(max(x - k, -N) + 1, min(x + k, N))))


(K, X) = map(int, input().split())
black_stone = []
for i in range(X - K + 1, X + K):
	black_stone.append(i)
black_stone = [str(a) for a in black_stone]
black_stone = ' '.join(black_stone)
print(black_stone)


a = list(map(int, input().split()))
K = a[0]
X = a[1]
for i in range(2 * K - 1):
	print(X - (K - 1) + i, end=' ')


(N, X) = list(map(int, input().split()))
L = list(range(X - N + 1, X + N))
print(*L)


(a, b) = map(int, input().split())
x = list(range(b - a + 1, b + a))
print(*x)


(k, x) = map(int, input().split())
for l in range(k * 2 - 1):
	print(x - k + l + 1)


(a, b) = map(int, input().split())
for i in range(2 * a - 1):
	print(b - a + 1 + i, end=' ')


(k, n) = map(int, input().split())
arr = list(range(n - k + 1, n + k))
print(' '.join([str(n) for n in arr]))


url = 'https://atcoder.jp//contests/abc137/tasks/abc137_b'

def main():
	(k, x) = list(map(int, input().split()))
	for i in range(x - k + 1, k + x):
		print(i, end=' ')
	print()

def __starting_point():
	main()
__starting_point()


(k, x) = map(int, input().split())
min = x - k + 1
max = x + k - 1
for i in range(min, max + 1):
	if i < x + k - 1:
		print(i, end=' ')
	else:
		print(i)


(K, X) = map(int, input().split())
P = []
for i in range(-K + 1, K):
	P.append(X + i)
print(' '.join(map(str, P)))


(a, b) = map(int, input().split())
c = []
x = 1
c.append(b - a + 1)
for i in range((abs(a) - 1) * 2):
	c.append(c[0] + x)
	x += 1
c = [str(n) for n in c]
c = ' '.join(c)
print(c)


(K, X) = map(int, input().split())
lists = [X]
for i in range(1, K):
	if X + i <= 1000000:
		lists.append(X + i)
	if X - i >= -1000000:
		lists.append(X - i)
lists.sort()
print(*lists)


(K, X) = map(int, input().split())
print(*[n for n in range(1 + X - K, X + K)])


(re, x) = map(int, input().split())
print(*list(range(x - re + 1, x + re)))


(N, K) = map(int, input().split())
for x in range(K - N + 1, K + N):
	print(x)


(k, x) = map(int, input().split())
ans = []
if x - k + 1 < -1000000:
	for i in range(-1000000, x + k):
		ans.append(i)
elif x + k - 1 > 1000000:
	for i in range(x - k + 1, 1000001):
		ans.append(i)
else:
	for i in range(x - k + 1, x + k):
		ans.append(i)
print(' '.join(map(str, ans)))


(a, b) = map(int, input().split())
x = b - a + 1
while x < b + a:
	print(x)
	x = x + 1


(a, b) = map(int, input().split())
ans = ''
for i in range(-1 * 10 ** 6, 10 ** 6):
	if b - a + 1 <= i <= b + a - 1:
		ans += str(i) + ' '
print(ans[:-1])


(a, b) = map(int, input().split())
for val in range(a * 2 - 1):
	print(b - a + val + 1)


(k, x) = map(int, input().split())
ans = [x for x in range(x - k + 1, x + k)]
print(*ans)


def resolve():
	(k, x) = map(int, input().split())
	print(' '.join((str(i) for i in range(x - k + 1, x + k))))
resolve()


def answer(k: int, x: int) -> str:
	may_be_black = map(str, range(x - k + 1, x + k))
	return ' '.join(may_be_black)

def main():
	(k, x) = map(int, input().split())
	print(answer(k, x))

def __starting_point():
	main()
__starting_point()


(K, X) = map(int, input().split())
ans = []
for i in range(K):
	if i == 0:
		ans.append(X)
	else:
		ans.append(X - i)
		ans.append(X + i)
ans = sorted(ans)
ans = [str(x) for x in ans]
print(' '.join(ans))


import sys
pin = sys.stdin.readline
pout = sys.stdout.write
(K, X) = map(int, pin().split())
for i in range(X - K + 1, X + K):
	pout(f'{i} ')
print()


(k, x) = map(int, input().split())
s = x + 1 - k
print(*range(s, s + (2 * k - 1)))


(k, x) = [int(x) for x in input().split()]
print(*list(range(x - k + 1, x + k)))


(k, x) = map(int, input().split())
st = x - k + 1
en = x + k
print(*list(range(st, en)))


(k, y) = map(int, input().split())
for i in range(y - k + 1, k + y):
	print(i, end=' ')


(K, X) = map(int, input().split())
num = []
for i in range(X - (K - 1), X + (K - 1) + 1):
	num.append(i)
num = [str(a) for a in num]
answer = ' '.join(num)
print(answer)


(k, x) = map(int, input().split())
min_ans = x - k + 1
max_ans = x + k - 1
for x in range(min_ans, max_ans + 1):
	print(x, end=' ')


(K, X) = map(int, input().split())
if K == 1:
	print(X)
elif K > 1:
	print(*range(X - K + 1, X + K))


(K, X) = map(int, input().split())
if X - K + 1 >= -1000000:
	min = X - K + 1
else:
	min = -1000000
if X + K - 1 <= 1000000:
	max = X + K - 1
else:
	max = 1000000
ans = []
for i in range(min, max + 1):
	ans.append(str(i))
print(' '.join(ans))


(k, x) = map(int, input().split())
for y in range(x - k + 1, x + k):
	print(y)


(n, x) = map(int, input().split())
lis = list(range(x - n + 1, x + n))
print(*lis)


(k, x) = map(int, input().split())
l = range(x - k + 1, x + k)
print(*l)


(k, x) = [int(i) for i in input().split()]
m = list(range(x - k + 1, x + k))
print(*m)


(n, m) = map(int, input().split())
l = range(m - n + 1, m + n)
print(' '.join(map(str, l)))


(k, x) = (int(i) for i in input().split())
list_ans = []
for i in range(0, 2 * k - 1):
	list_ans.append(str(x + i - (k - 1)))
print(' '.join(list_ans))


(K, X) = list(map(int, input().split()))
rocks = [rock for rock in range(-10000, 10001)]
blacks = list(rocks[X - K + 10001:X + K + 10000])
print(' '.join([str(rock) for rock in blacks]))


(k, x) = map(int, input().split())
maxk = x + k - 1
mink = x - k + 1
l = []
for i in range(mink, maxk + 1):
	l.append(str(i))
print(' '.join(l))


(K, X) = map(int, input().split())
i = X - K + 1
while i < X + K:
	print(i)
	i += 1


(x, k) = map(int, input().split())
ans1 = [0] * (x - 1)
ans2 = [0] * (x - 1)
for i in range(1, x):
	ans1[i - 1] = k - i
	ans2[i - 1] = k + i
ans = ans1 + ans2
ans.append(k)
ans.sort()
ke = map(str, ans)
print(' '.join(ke))


(K, X) = map(int, input().split())
if X - K + 1 < -1000000:
	ans = list(range(-100000, X + K))
elif X + K > 1000000:
	ans = list(range(X - K + 1, 1000000))
else:
	ans = list(range(X - K + 1, X + K))
ans = map(str, ans)
print(' '.join(ans))


(k, x) = map(int, input().split())
lst = []
for i in range(x - k + 1, x + k):
	if -1000000 <= i <= 1000000:
		lst.append(i)
for i in range(len(lst)):
	print(lst[i], end='')
	if i != len(lst) - 1:
		print(' ', end='')
print()


(k, x) = map(int, input().split())
for a in range(x - k + 1, x + k):
	print(a, end=' ')


(k, n) = map(int, input().split())
for i in range(k * 2 - 1):
	print(n - k + i + 1)


(k, x) = map(int, input().split())
y = []
for i in range(x - (k - 1), x + k):
	if -1000000 < i and i < 1000000:
		y.append(i)
print(' '.join(map(str, y)))


(K, X) = map(int, input().split())
inc = X + K - 1
dec = X - K + 1
for i in range(dec, K + X):
	print(i, end=' ')


(K, X) = list(map(int, input().split()))
min_value = X - K + 1
max_value = X + K
A = []
for i in range(min_value, max_value):
	i = str(i)
	A.append(i)
answer = ' '.join(A)
print(answer)


(A, B) = map(int, input().split(' '))
for i in range(B - A + 1, B + A):
	print(i, end=' ')


(k, x) = map(int, input().split())
list01 = []
for i in range(1 + x - k, 0 + x + k):
	if -1000000 <= i <= 1000000:
		list01.append(i)
print(' '.join(map(str, list01)))


(K, X) = map(int, input().split())
if -100000 <= X - K + 1 and X + K - 1 <= 100000:
	for i in range(K * 2 - 2):
		print(X - K + 1 + i, end='')
		print(' ', end='')
	print(X + K - 1)
if X - K + 1 < -100000:
	for i in range(-100000, X + K - 1):
		print(i, end='')
		print(' ', end='')
	print(X + K - 1)
if X + K - 1 > 100000:
	for i in range(X - K + 1, 100000):
		print(i, end='')
		print(' ', end='')
	print(100000)


(k, x) = map(int, input().split())
print(*range(max(-1000000, x - k + 1), min(x + k, 1000001)))


(K, X) = list(map(int, input().split()))
num = []
for i in range(X - (K - 1), X + (K - 1) + 1):
	num.append(i)
num_str = [str(n) for n in num]
num = ' '.join(num_str)
print(num)


(k, x) = map(int, input().split())
ans_list = [x]
original_x = x
for _ in range(k - 1):
	x = x - 1
	ans_list.append(x)
for _ in range(k - 1):
	if _ == 0:
		x = original_x
	x = x + 1
	ans_list.append(x)
ans_list.sort()
print(' '.join(map(str, ans_list)))


(K, X) = map(int, input().split())
L = str()
for i in range(-K + 1, K):
	L += str(X + i) + ' '
print(L)


(k, x) = map(int, input().split())
number = []
for i in range(x - (k - 1), x + (k - 1) + 1):
	number.append(i)
number_str = [str(n) for n in number]
num = ' '.join(number_str)
print(num)


(k, x) = map(int, input().split())
ans = [i for i in range(abs(x) - k + 1, abs(x) + k)]
for i in ans:
	if -1000000 <= i <= 1000000:
		print(i, '', end='')


(K, X) = map(int, input().split())

def ans137(K: int, X: int):
	ansstr = ''
	for i in range(-1000000, 1000000):
		if abs(X - i) < K:
			ansstr += str(i) + ' '
	return ansstr[:-1]
print(ans137(K, X))


(K, X) = map(int, input().split())
first = X - K + 1
second = X + K - 1
if first < -1000000:
	first = -1000000
if second > 1000000:
	second = 1000000
ans = list(range(first, second + 1))
print(*ans)


(k, x) = map(int, input().split())
a = range(x - k + 1, x + k)
print(*a)


(k, x) = list(map(int, input().split()))

def answer(k: int, x: int) -> str:
	answer = []
	for i in range(x - (k - 1), x + k):
		answer.append(i)
	return ' '.join(map(str, answer))
print(answer(k, x))


(k, x) = [int(s) for s in input().split()]
print(*range(x - k + 1, x + k))


(K, X) = map(int, input().split())
num_list = []
for i in range(1, K):
	num_list.append(X + i)
	num_list.append(X - i)
num_list.append(X)
num_list.sort()
result_list = []
for n in num_list:
	num = str(n)
	result_list.append(num)
print(' '.join(result_list))