You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from this tower.

Your task is to find minimal r that each city has been provided by cellular network, i.e. for each city there is at least one cellular tower at the distance which is no more than r.

If r = 0 then a tower provides cellular network only for the point where it is located. One tower can provide cellular network for any number of cities, but all these cities must be at the distance which is no more than r from this tower.


-----Input-----

The first line contains two positive integers n and m (1 ≤ n, m ≤ 10^5) — the number of cities and the number of cellular towers.

The second line contains a sequence of n integers a_1, a_2, ..., a_{n} ( - 10^9 ≤ a_{i} ≤ 10^9) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coordinates a_{i} are given in non-decreasing order.

The third line contains a sequence of m integers b_1, b_2, ..., b_{m} ( - 10^9 ≤ b_{j} ≤ 10^9) — the coordinates of cellular towers. It is allowed that there are any number of towers in the same point. All coordinates b_{j} are given in non-decreasing order.


-----Output-----

Print minimal r so that each city will be covered by cellular network.


-----Examples-----
Input
3 2
-2 2 4
-3 0

Output
4

Input
5 3
1 5 10 14 17
4 11 15

Output
3

Source: codeforces | Difficulty: MEDIUM
Tags: Sorting

Amortized analysis

Implementation


Solutions:
(n, m) = map(int, input().split())
c = list(map(int, input().split()))
t = list(map(int, input().split()))
i = 0
ans = 0
for x in c:
	while i < m - 1 and abs(x - t[i]) >= abs(x - t[i + 1]):
		i += 1
	ans = max(ans, abs(x - t[i]))
print(ans)


from bisect import *
(n, m) = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
r = -1
a.sort()
b.sort()
for i in a:
	y = 1000000000000
	x = bisect_left(b, i)
	if x >= 0 and x < m:
		y = min(y, abs(i - b[x]))
	x += 1
	if x >= 0 and x < m:
		y = min(y, abs(i - b[x]))
	x -= 2
	if x >= 0 and x < m:
		y = min(y, abs(i - b[x]))
	r = max(r, y)
print(r)


import bisect

def read():
	return [int(x) for x in input().split()]

def main():
	(n, m) = read()
	a = read()
	b = read()
	res = 0
	for i in range(0, n):
		cover_left = -1
		bi = bisect.bisect_left(b, a[i])
		if bi != m and b[bi] == a[i]:
			cover_left = 0
		elif bi:
			cover_left = a[i] - b[bi - 1]
		cover_right = -1
		bi = bisect.bisect_right(b, a[i])
		if bi != m:
			cover_right = b[bi] - a[i]
		if cover_left != -1 and cover_right != -1:
			res = max(res, min(cover_left, cover_right))
		elif cover_right != -1:
			res = max(res, cover_right)
		else:
			res = max(res, cover_left)
	print(res)
main()


from bisect import bisect_left as bi
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
c = []
e = []
for i in range(n):
	d = bi(b, a[i])
	if d == 0:
		e.append(b[0] - a[i])
	elif d == m:
		e.append(a[i] - b[-1])
	else:
		e.append(min(b[d] - a[i], a[i] - b[d - 1]))
print(max(e))


import bisect
from itertools import accumulate, count
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	for i in range(2, len(primes)):
		if primes[i] == True:
			prime.append(i)
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def NcR(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = math.gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p

def Log2(x):
	if x == 0:
		return False
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def good(mid, a, b):
	i = 0
	j = 0
	f = 0
	for i in range(0, len(a)):
		if abs(a[i] - b[j]) <= mid:
			pass
		else:
			f = 0
			for k in range(j + 1, len(b)):
				if abs(a[i] - b[k]) <= mid:
					j = k
					f = 1
					break
			if f == 0:
				return False
	return True
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
l = 0
r = 1e+18
ans = 0
while l <= r:
	mid = (l + r) // 2
	if good(mid, a, b) == True:
		ans = mid
		r = mid - 1
	else:
		l = mid + 1
print(int(ans))


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

class Zona:

	def __init__(self, vis, gran, t):
		self.v = vis
		self.gr = gran
		self.type = t
		self.towns = []
zones = []
zones.append(Zona(b[0], -10 ** 9 - 1, 1))
for i in range(0, m - 1):
	gr = (b[i] + b[i + 1]) / 2
	zones.append(Zona(b[i], gr, 2))
	zones.append(Zona(b[i + 1], gr, 1))
zones.append(Zona(b[m - 1], 10 ** 9 + 1, 2))
i = 0
for zone in zones:
	if zone.type == 1:
		while a[i] >= zone.gr and a[i] < zone.v:
			zone.towns.append(a[i])
			i += 1
			if i == n:
				break
	if zone.type == 2:
		while a[i] >= zone.v and a[i] < zone.gr:
			zone.towns.append(a[i])
			i += 1
			if i == n:
				break
	if i == n:
		break
r = 0
for zone in zones:
	for town in zone.towns:
		dist = abs(zone.v - town)
		if dist > r:
			r = dist
print(r)


from bisect import bisect_left
(n, m) = list(map(lambda x: int(x), input().split()))
a = list(map(lambda x: int(x), input().split()))
b = list(map(lambda x: int(x), input().split()))
maximum = 0
for i in range(0, len(a)):
	ind = bisect_left(b, a[i])
	if ind == 0:
		maximum = max(maximum, abs(b[ind] - a[i]))
	elif ind == len(b):
		maximum = max(maximum, abs(b[ind - 1] - a[i]))
	else:
		maximum = max(maximum, min(abs(b[ind] - a[i]), abs(b[ind - 1] - a[i])))
print(maximum)


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
l2.sort()
ans = 0
for i in range(n):
	lo = 0
	hi = m - 1
	while lo < hi:
		mid = (lo + hi) // 2
		if l2[mid] < l1[i]:
			lo = mid + 1
		else:
			hi = mid
	ind1 = lo
	lo = 0
	hi = m - 1
	while lo < hi:
		mid = (lo + hi) // 2
		if l2[mid] > l1[i]:
			hi = mid - 1
		else:
			lo = mid
			if hi - lo == 1:
				if l2[hi] <= l1[i]:
					lo = hi
				else:
					hi = lo
	ind2 = lo
	ans = max(ans, min(abs(l2[ind1] - l1[i]), abs(l1[i] - l2[ind2])))
print(ans)


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

def binary_search(arr, k):
	(f, e) = (0, len(arr) - 1)
	res = int(2000000000.0)
	while f <= e:
		m = f + e >> 1
		if arr[m] < k:
			f = m + 1
		else:
			e = m - 1
		res = min(res, abs(arr[m] - k))
	return res
res = 0
for i in a:
	res = max(res, binary_search(b, i))
print(res)


import bisect
import sys
EPS = sys.float_info.epsilon
LENGTH = 10
matrix = [[] for i in range(LENGTH)]
array = [0] * LENGTH
(n, m) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = [-10 ** 12]
b.extend(list(map(int, sys.stdin.readline().split())))
b.append(10 ** 12)
answer = 0
for val in a:
	index = bisect.bisect_left(b, val)
	answer = max(answer, min(abs(val - b[index - 1]), abs(b[index] - val)))
print(answer)


(n, m) = map(int, input().split())
nums = [int(x) for x in input().split()]
mums = [int(x) for x in input().split()]
check = [0] * n
first = 0
second = 0
if m == 1:
	a = abs(mums[0] - nums[0])
	b = abs(mums[0] - nums[-1])
	print(max(a, b))
else:
	while first < n and second < m - 1:
		if abs(nums[first] - mums[second]) < abs(nums[first] - mums[second + 1]):
			check[first] = abs(nums[first] - mums[second])
			first += 1
		else:
			check[first] = abs(nums[first] - mums[second + 1])
			second += 1
	if second == m - 1:
		for i in range(max(m - 1, first), n):
			check[i] = abs(nums[i] - mums[-1])
	print(max(check))


(n, m) = map(int, input().split())
cities = [(int(a), 'c') for a in input().split()]
towers = [(int(b), 't') for b in input().split()]
merged = sorted(cities + towers)
towerIndices = []
for (i, (_, type)) in enumerate(merged):
	if type == 't':
		towerIndices.append(i)
merged = [m[0] for m in merged]
r = 0
if towerIndices[-1] < len(merged) - 1:
	r = max(r, abs(merged[towerIndices[-1]] - merged[-1]))
if towerIndices[0] > 0:
	r = max(r, abs(merged[0] - merged[towerIndices[0]]))
for i in range(len(towerIndices) - 1):
	(left, right) = (towerIndices[i], towerIndices[i + 1])
	for j in range(left + 1, right):
		r = max(r, min(abs(merged[j] - merged[left]), abs(merged[j] - merged[right])))
print(r)


def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	j = 0
	ans = 0
	for x in a:
		while j + 1 < m and abs(x - b[j + 1]) <= abs(x - b[j]):
			j += 1
		ds = abs(x - b[j])
		if ds > ans:
			ans = ds
	print(ans)
main()


import bisect
(a, b) = list(map(int, input().split()))
cities = list(map(int, input().split()))
towers = list(map(int, input().split()))
towers.sort()
dists = []
y = towers[-1]
z = towers[0]
for i in range(len(cities)):
	n = bisect.bisect_left(towers, cities[i])
	if n == b:
		dists.append(cities[i] - y)
	elif n == 0:
		dists.append(z - cities[i])
	else:
		dists.append(min(towers[n] - cities[i], cities[i] - towers[n - 1]))
print(max(dists))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
k = 0
ma = -1
j = 0
while k < n:
	while j < m and a[k] > b[j]:
		j += 1
	if j == 0:
		ma = max(ma, abs(a[k] - b[j]))
	elif j == m:
		ma = max(ma, abs(a[k] - b[j - 1]))
	else:
		ma = max(ma, min(abs(a[k] - b[j]), abs(a[k] - b[j - 1])))
	k += 1
print(ma)


def main():
	from bisect import bisect_left
	(n, m) = map(int, input().split())
	aa = list(map(int, input().split()))
	bb = (-10 ** 10, *map(int, input().split()), 10 ** 10)
	rr = [bb[bisect_left(bb, a)] - a for a in aa]
	bb = [-b for b in reversed(bb)]
	rr.reverse()
	aa.reverse()
	for (i, r, a) in zip(range(n), rr, aa):
		x = bb[bisect_left(bb, -a)] + a
		if r > x:
			rr[i] = x
	print(max(rr))
main()


(n, m) = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
ans = 0
temp = 0
for i in aa:
	tt = abs(i - bb[temp])
	aa = temp
	k = temp
	while k < m:
		if abs(i - bb[k]) > tt:
			break
		else:
			tt = abs(i - bb[k])
			aa = k
			k += 1
	temp = aa
	if tt > ans:
		ans = tt
print(ans)


from collections import Counter

def bin_search(arr, pred):
	lo = 0
	hi = len(arr)
	while lo < hi:
		mid = (lo + hi) // 2
		if pred(arr[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo
MAX_INT = 10 ** 18 + 1
(n, m) = list(map(int, input().split()))
cities = list(map(int, input().split()))
towers = list(map(int, input().split()))
max_len = -1
for c in cities:
	idx = bin_search(towers, lambda x: x >= c)
	right = towers[idx] - c if idx < len(towers) else MAX_INT
	left = c - towers[idx - 1] if idx > 0 else MAX_INT
	max_len = max(max_len, min(right, left))
print(max_len)


I = lambda : map(int, input().split())
(n, m) = I()
(a, b) = ([[i, 0] for i in I()], [[i, -1] for i in I()])
(c, l, a) = (sorted(a + b), a[0][0], 0)
for i in range(n + m):
	if c[i][1] == -1:
		l = c[i][0]
	else:
		c[i][1] = c[i][0] - l
c = c[::-1]
for i in range(n + m):
	if c[i][1] == -1:
		l = c[i][0]
	elif l == b[0][0]:
		c[i][1] = max(abs(l - c[i][0]), c[i][1])
	else:
		c[i][1] = min(abs(l - c[i][0]), c[i][1])
print(max(c, key=lambda x: x[1])[1])


(n, m) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = -1
if m == 1:
	for i in x:
		if abs(i - y[0]) > ans:
			ans = abs(i - y[0])
else:
	c = 0
	p = 0
	q = 1
	while c != n:
		if y[p] <= x[c] and y[q] >= x[c]:
			ans = max(ans, min(y[q] - x[c], x[c] - y[p]))
			c += 1
		elif y[q] < x[c]:
			if q != m - 1:
				p += 1
				q += 1
			else:
				ans = max(ans, x[c] - y[q])
				c += 1
		elif y[p] > x[c]:
			ans = max(ans, y[p] - x[c])
			c += 1
print(ans)


def main():
	from sys import stdin, stdout
	inp = stdin.read().split()
	n = int(inp.pop(0))
	m = int(inp.pop(0))
	cities = []
	for x in inp[0:n]:
		cities.append(int(x))
	towers = []
	upto = n + m
	for x in inp[n:upto]:
		towers.append(int(x))
	(j, ans) = (0, 0)
	for ct in cities:
		while j + 1 < m and abs(ct - towers[j]) >= abs(ct - towers[j + 1]):
			j += 1
		ans = max(ans, abs(ct - towers[j]))
	stdout.write(str(ans) + '\n')
main()


(n, m) = [int(x) for x in input().split(' ')]
ciudades = [int(x) for x in input().split(' ')]
torres = [int(x) for x in input().split(' ')]

def busquedaBinaria(lista, item):
	primero = 0
	ultimo = len(lista) - 1
	existe = False
	while primero <= ultimo and (not existe):
		mitad = (primero + ultimo) // 2
		if lista[mitad] == item:
			existe = True
		elif item < lista[mitad]:
			ultimo = mitad - 1
		else:
			primero = mitad + 1
	return [primero, mitad, ultimo]
r = 0
for ciudad in ciudades:
	indices = busquedaBinaria(torres, ciudad)
	radios = []
	try:
		radios.append(abs(torres[indices[0]] - ciudad))
	except:
		nada = 0
	try:
		radios.append(abs(torres[indices[1]] - ciudad))
	except:
		nada = 0
	try:
		radios.append(abs(torres[indices[2]] - ciudad))
	except:
		nada = 0
	rCercano = min(radios)
	if rCercano > r:
		r = rCercano
print(r)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(l, r) = (0, 0)
ans = [None] * n
for i in range(n):
	while r < m and b[r] < a[i]:
		r += 1
	r = min(r, m - 1)
	l = max(0, r - 1)
	rd = abs(a[i] - b[r])
	ld = abs(a[i] - b[l])
	ans[i] = min(rd, ld)
print(max(ans))


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
hcoordinate = list(map(int, stdin.readline().split()))
tcoordinate = list(map(int, stdin.readline().split()))
l = -1
r = max(abs(tcoordinate[-1] - hcoordinate[-1]), abs(tcoordinate[-1] - hcoordinate[0]))
while r > l + 1:
	t = (r + l) // 2
	(i, j) = (0, 0)
	while i < n and j < m:
		if abs(hcoordinate[i] - tcoordinate[j]) <= t:
			i += 1
		else:
			j += 1
	if i == n:
		r = t
	else:
		l = t
stdout.write(str(r))


(n, m) = (int(t) for t in input().split())
city = [int(t) for t in input().split()]
tower = [int(t) for t in input().split()]

def check(city, tower, r):
	t = 0
	c = 0
	while c < len(city):
		if abs(city[c] - tower[t]) > r:
			t += 1
			if t == len(tower):
				return False
		else:
			c += 1
	return True
hi = 2 * 10 ** 9
lo = 0
out = hi
while hi >= lo:
	mid = (hi + lo) // 2
	if check(city, tower, mid):
		out = mid
		hi = mid - 1
	else:
		lo = mid + 1
print(out)


def min_dist_to_tower(a, x):
	(l, r) = (-1, len(a))
	while r - l > 1:
		m = (l + r) // 2
		if a[m] > x:
			r = m
		else:
			l = m
	w = abs(x - a[l]) if l >= 0 else 'SORRY'
	z = abs(x - a[r]) if r < len(a) else 'SORRY'
	if w != 'SORRY' and z != 'SORRY':
		return min(w, z)
	elif w == 'SORRY':
		return z
	else:
		return w
(n, m) = map(int, input().split())
houses = list(map(int, input().split()))
towers = list(map(int, input().split()))
dist = 0
for i in range(len(houses)):
	if min_dist_to_tower(towers, houses[i]) > dist:
		dist = min_dist_to_tower(towers, houses[i])
print(dist)


k = 0
i = 0
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for j in a:
	if m > 1:
		while j > b[i + 1] and i + 2 < m:
			i += 1
		w = abs(b[i] - j)
		e = abs(b[i + 1] - j)
		k1 = min(w, e)
		k = max(k, k1)
	else:
		k = max(k, abs(b[0] - j))
print(k)


import bisect
input()
cities = [int(x) for x in input().split()]
towers = [int(x) for x in input().split()]
print(max([min([abs(x - c) for x in towers[bisect.bisect(towers, c) - 1 * (bisect.bisect(towers, c) != 0):bisect.bisect(towers, c) + 2]], default=0) for c in cities]))


import sys
import bisect
from bisect import bisect_left as lb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0

def hnbhai(tc):
	(n, m) = sd()
	a = sd()
	b = sd()
	c = []
	for i in range(n):
		c.append([a[i], i])
	for i in range(m):
		c.append([b[i], -1])
	c.sort(key=lambda x: (x[0], x[1]))
	left = [10 ** 10] * n
	l = 10 ** 10
	for i in range(len(c)):
		if c[i][1] == -1:
			l = c[i][0]
		else:
			left[c[i][1]] = l
	right = [10 ** 10] * n
	r = 10 ** 10
	for i in range(len(c) - 1, -1, -1):
		if c[i][1] == -1:
			r = c[i][0]
		else:
			right[c[i][1]] = r
	mn = -1
	for i in range(n):
		mn = max(mn, min(abs(left[i] - a[i]), abs(right[i] - a[i])))
	print(mn)
for _ in range(1):
	hnbhai(_ + 1)


(n, m) = map(int, input().split())
cities = list(map(int, input().split()))
towers = list(map(int, input().split()))
Towers = [-6.9e+70] + towers + [6.9e+70]
i = 0
r = 0
for city in cities:
	while Towers[i + 1] <= city:
		i += 1
	r = max(r, min(city - Towers[i], Towers[i + 1] - city))
print(r)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return list(map(str, input().strip()))

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby
from itertools import permutations as comb

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

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

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
mod2 = 10 ** 12
(n, m) = lint()
c = lint()
t = lint()
c.sort()
t.sort()
ans = 0
for i in c:
	(l, r) = (0, m - 1)
	tmp = mod2
	while l <= r:
		mid = (l + r) // 2
		if t[mid] < i:
			l = mid + 1
		else:
			r = mid - 1
		tmp = min(tmp, abs(t[mid] - i))
	ans = max(ans, tmp)
print(ans)


from sys import stdin

def main():
	(n, m) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	types = []
	for i in range(n):
		types.append((a[i], 0, i))
	for i in range(n, n + m):
		types.append((b[i - n], 1, i - n))
	types.sort()
	max_val = 10 ** 10
	left = [max_val] * n
	cleft = -max_val
	for (val, tp, idx) in types:
		if tp == 1:
			cleft = val
		else:
			left[idx] = cleft
	right = [max_val] * n
	cright = max_val
	types.reverse()
	for (val, tp, idx) in types:
		if tp == 1:
			cright = val
		else:
			right[idx] = cright
	dist = [0] * n
	for i in range(n):
		dist[i] = min(abs(a[i] - left[i]), abs(a[i] - right[i]))
	print(max(dist))
main()


def problem(nm, cities, towers):
	n_c = nm[0]
	n_t = nm[1]
	city_index = 0
	tower_index = 0
	r = 0
	while cities[city_index] < towers[0]:
		r = max([r, towers[0] - cities[city_index]])
		city_index += 1
		if city_index == n_c:
			city_index -= 1
			break
	while tower_index <= n_t - 2:
		while cities[city_index] < towers[tower_index + 1]:
			r = max([r, min([cities[city_index] - towers[tower_index], towers[tower_index + 1] - cities[city_index]])])
			city_index += 1
			if city_index == n_c:
				city_index -= 1
				break
		tower_index += 1
	while city_index <= n_c - 1:
		r = max([r, cities[city_index] - towers[tower_index]])
		city_index += 1
	return r
nm = [int(x) for x in input().split(' ')]
cities = [int(x) for x in input().split(' ')]
towers = [int(x) for x in input().split(' ')]
print(problem(nm, cities, towers))


from bisect import bisect_left, bisect_right

def index(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return None

def find_lt(a, x):
	i = bisect_left(a, x)
	if i:
		return a[i - 1]
	return None

def find_le(a, x):
	i = bisect_right(a, x)
	if i:
		return a[i - 1]
	return None

def find_gt(a, x):
	i = bisect_right(a, x)
	if i != len(a):
		return a[i]
	return None

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return a[i]
	return None

def main():
	(m, n) = [int(v) for v in input().split()]
	vals = [int(v) for v in input().split()]
	towers = [int(v) for v in input().split()]
	alls = []
	for c in vals:
		le = find_le(towers, c)
		if le is None:
			le = 10 ** 10
		else:
			le = abs(le - c)
		ge = find_ge(towers, c)
		if ge is None:
			ge = 10 ** 10
		else:
			ge = abs(ge - c)
		alls.append(min(le, ge))
	print(max(alls))
main()


import bisect
import sys
EPS = sys.float_info.epsilon
LENGTH = 10
matrix = [[] for i in range(LENGTH)]
array = [0] * LENGTH
(n, m) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
answer = 0
for val in a:
	index_l = bisect.bisect_left(b, val)
	index_r = bisect.bisect_left(b, val)
	ans1 = 10000000000000
	ans2 = 10000000000000
	if index_l > 0:
		ans1 = abs(val - b[index_l - 1])
	if index_l <= len(b) - 1:
		ans2 = abs(b[index_l] - val)
	answer1 = min(ans1, ans2)
	ans1 = 10000000000000
	ans2 = 10000000000000
	if index_r > 0:
		ans1 = abs(val - b[index_r - 1])
	if index_r <= len(b) - 1:
		ans2 = abs(b[index_r] - val)
	answer2 = min(ans1, ans2)
	answer = max(answer, min(answer1, answer2))
print(answer)


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

def lower_bound(x):
	bl = 0
	br = m - 1
	while br - bl > 1:
		bm = (bl + br) // 2
		if b[bm] >= x:
			br = bm
		else:
			bl = bm + 1
	if b[bl] >= x:
		return bl
	elif b[br] >= x:
		return br
	else:
		return m

def upper_bound(x):
	bl = 0
	br = m - 1
	while br - bl > 1:
		bm = (bl + br) // 2
		if b[bm] > x:
			br = bm
		else:
			bl = bm + 1
	if b[bl] > x:
		return bl
	elif b[br] > x:
		return br
	else:
		return m
res = 0
for i in range(n):
	pos = lower_bound(a[i])
	tmp = 2 * 10 ** 9 + 1
	if pos < m and tmp > b[pos] - a[i]:
		tmp = b[pos] - a[i]
	pos = upper_bound(a[i]) - 1
	if pos >= 0 and tmp > a[i] - b[pos]:
		tmp = a[i] - b[pos]
	if tmp > res:
		res = tmp
print(res)


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
from bisect import bisect
r = 0
for i in l1:
	a = bisect(l2, i)
	if a != m and a != 0:
		b = min(abs(i - l2[a - 1]), abs(i - l2[a]))
		r = max(r, b)
	elif a == 0:
		r = max(r, abs(i - l2[0]))
	else:
		r = max(r, abs(i - l2[-1]))
print(r)


import sys
input = sys.stdin.buffer.readline

def solution():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	j = 0
	ans = 0
	for i in range(n):
		while j + 1 < m and abs(a[i] - b[j]) >= abs(a[i] - b[j + 1]):
			j += 1
		ans = max(ans, abs(a[i] - b[j]))
	print(ans)
solution()


def bs(num):
	low = 0
	high = m - 1
	while low < high:
		mid = (low + high) // 2
		if b[mid] > num:
			high = mid - 1
		elif b[mid] == num:
			return 0
		else:
			low = mid + 1
	if b[low] > num:
		if low == 0:
			return abs(b[low] - num)
		low -= 1
	if low + 1 >= m:
		return abs(b[low] - num)
	return min(abs(b[low] - num), abs(b[low + 1] - num))
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
ans = 0
for i in range(n):
	ans = max(ans, bs(a[i]))
print(ans)


(n, m) = map(int, input().split())
c = list(map(int, input().split()))
t = list(map(int, input().split()))
r = 0
j = 0
for ct in c:
	while j + 1 < m and abs(ct - t[j]) >= abs(ct - t[j + 1]):
		j += 1
	r = max(r, abs(ct - t[j]))
print(r)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
from bisect import bisect_left, bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = pow(10, 10)
b.append(t)
b.insert(0, -t)
z = [0]
for i in range(len(a)):
	x = bisect_left(b, a[i])
	if x:
		z.append(min(a[i] - b[x - 1], b[x] - a[i]))
	else:
		z.append(b[x] - a[i])
print(max(z))


import bisect
(n, m) = map(int, input().split())
c = list(map(int, input().split()))
p = list(map(int, input().split()))
c = sorted(list(set(c)))
ans1 = 0
ans2 = 0
an = 0
for i in c:
	var = bisect.bisect_left(p, i)
	if var == 0:
		ans1 = max(ans1, p[0] - c[0])
	if var == m:
		ans2 = max(ans2, i - p[m - 1])
	else:
		ans3 = min(i - p[var - 1], p[var] - i)
		an = max(ans3, an)
print(max(ans1, ans2, an))


(n, m) = map(int, input().split())
city = list(map(int, input().split()))
tower = list(map(int, input().split()))
j = 0
ans = 0
for i in range(n):
	while j + 1 < m and abs(city[i] - tower[j]) >= abs(city[i] - tower[j + 1]):
		j = j + 1
	ans = max(ans, abs(city[i] - tower[j]))
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.append(b[m - 1])
p = 0
r = 0
for i in range(n):
	while p + 2 < len(b) and abs(a[i] - b[p]) >= abs(a[i] - b[p + 1]):
		p += 1
	mn = min(abs(a[i] - b[p]), abs(a[i] - b[p + 1]))
	r = max(r, mn)
print(r)


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = tuple(map(int, input().split()))
s = i = 0
for c in A:
	while m > i and c > B[i]:
		i += 1
	n = c - B[i - 1] if i else 2147483647
	if m > i:
		n = min(n, B[i] - c)
	s = max(s, n)
print(s)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
l1 = [-9999999999999] + l1 + [999999999999999999]
r = 1
ans = 0
for i in range(n):
	while l[i] >= l1[r]:
		r += 1
	ans = max(ans, min(abs(l[i] - l1[r]), abs(l[i] - l1[r - 1])))
print(ans)


import sys
import bisect
input = sys.stdin.readline
(ncity, ntower) = list(map(int, input().split()))
city = list(map(int, input().split()))
tower = list(map(int, input().split()))
for k in range(ncity):
	ops = bisect.bisect_right(tower, city[k])
	if ops == ntower:
		city[k] = abs(tower[ops - 1] - city[k])
	else:
		city[k] = min(abs(tower[ops - 1] - city[k]), abs(tower[ops] - city[k]))
print(max(city))


t = input
p = print
r = range
(n, m) = map(int, t().split())
a = list(map(int, t().split()))
b = list(map(int, t().split()))
ans = 0
i = 0
for j in a:
	while i < m - 1 and abs(j - b[i]) >= abs(j - b[i + 1]):
		i += 1
	ans = max(ans, abs(j - b[i]))
p(ans)


import bisect
I = lambda : list(map(int, input().split()))
N = 10 ** 10
(n, m) = I()
a = I()
b = [-N] + I() + [N]
z = 0
for i in a:
	t = bisect.bisect(b, i)
	z = max(z, min(b[t] - i, i - b[t - 1]))
print(z)


import sys
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

def solve(x):
	i = 0
	for j in range(m):
		if a[i] < b[j] - x:
			return False
		while i < n and a[i] <= b[j] + x:
			i += 1
		if i == n:
			return True
	return False
(ok, ng) = (10 ** 18, -1)
while abs(ok - ng) > 1:
	mid = ok + ng >> 1
	if solve(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, m) = [int(i) for i in input().split()]
cities = [int(i) for i in input().split()]
towers = [int(i) for i in input().split()]
cities.sort()
towers.sort()
d_list = []
curr_d = 0
while m > 0 and n > 0:
	tower_flag = 0
	cities_end = cities[-1]
	towers_end = towers[-1]
	while m != 0 and towers[-1] > cities[-1]:
		towers_end = towers.pop()
		m -= 1
	if towers_end > cities_end:
		tower_flag = 1
		d_right = towers_end - cities_end
	else:
		d_right = 2 * 10 ** 9
	if m != 0:
		d_left = cities_end - towers[-1]
		cities.pop()
		n -= 1
	else:
		d_left = d_right
		cities.pop()
		n -= 1
	if tower_flag:
		towers.append(towers_end)
		m += 1
	dmin = min(d_left, d_right)
	curr_d = max(curr_d, dmin)
print(curr_d)


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	a.sort()
	b.sort()
	la = 0
	lb = 0
	ans = 0
	while la < n:
		prev = abs(a[la] - b[lb])
		while lb + 1 < m and prev >= abs(a[la] - b[lb + 1]):
			lb += 1
			prev = abs(a[la] - b[lb])
		ans = max(ans, abs(a[la] - b[lb]))
		la += 1
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def lower_bownd(key):
	left = -1
	right = m
	while left < right - 1:
		middle = (left + right) // 2
		if b[middle] <= key:
			left = middle
		else:
			right = middle
	if right < m:
		r = b[right] - key
	else:
		r = INF
	if left > -1:
		l = key - b[left]
	else:
		l = INF
	return min(l, r)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [0] * n
INF = 10 ** 10
for i in range(n):
	ans[i] = lower_bownd(a[i])
print(max(ans))


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	(n, m) = mii()
	(a, b, td, cd, ans, ind) = (slmii(), slmii(), defaultdict(int), defaultdict(int), defaultdict(list), -sys.maxsize - 1)
	for i in a:
		cd[i] = 1
	for i in b:
		td[i] = 1
	lst = sorted(list(a) + list(b))
	for i in range(n + m):
		if td[lst[i]] == 1:
			ind = lst[i]
		if cd[lst[i]] == 1 and ind != -sys.maxsize - 1:
			ans[lst[i]].append(lst[i] - ind)
	(lst, ind, pp) = (lst[::-1], -sys.maxsize - 1, -sys.maxsize - 1)
	for i in range(n + m):
		if td[lst[i]] == 1:
			ind = lst[i]
		if cd[lst[i]] == 1 and ind != -sys.maxsize - 1:
			ans[lst[i]].append(ind - lst[i])
	for i in ans:
		pp = max(pp, min(ans[i]))
	print(pp)
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from bisect import bisect as b
[_, cities, towers] = [[int(x) for x in input().split()] for i in range(3)]
print(max([min([abs(x - c) for x in towers[b(towers, c) - 1 * (b(towers, c) != 0):b(towers, c) + 2]], default=0) for c in cities]))


import bisect
import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
cities = [int(i) for i in input().split()]
towers = [int(i) for i in input().split()]
ans = []
for i in range(n):
	index = bisect.bisect_right(towers, cities[i])
	indL = abs(cities[i] - towers[max(0, index - 1)])
	indR = abs(cities[i] - towers[min(m - 1, index)])
	ans.append(min(indL, indR))
print(max(ans))


def main():
	from bisect import bisect_left
	input()
	aa = list(map(int, input().split()))
	bb = (-10 ** 10, *list(map(int, input().split())), 10 ** 10)
	for (i, a) in enumerate(aa):
		j = bisect_left(bb, a)
		(u, v) = (bb[j] - a, a - bb[j - 1])
		aa[i] = u if u < v else v
	print(max(aa))

def __starting_point():
	main()
__starting_point()


from io import BytesIO, IOBase
from math import sqrt
import sys, os
from os import path
inpl = lambda : list(map(int, input().split()))
inpm = lambda : map(int, input().split())
inpi = lambda : int(input())
inp = lambda : input()
(rev, ra, l) = (reversed, range, len)
P = print
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def B(n):
	return bin(n).replace('0b', '')

def factors(n):
	arr = []
	for i in ra(2, int(sqrt(n)) + 1):
		if n % i == 0:
			arr.append(i)
			if i * i != n:
				arr.append(int(n / i))
	return arr

def dfs(arr, n):
	pairs = [[i + 1] for i in ra(n)]
	vis = [0] * (n + 1)
	for i in ra(l(arr)):
		pairs[arr[i][0] - 1].append(arr[i][1])
	pairs[arr[i][1] - 1].append(arr[i][0])
	comp = []
	for i in ra(n):
		stack = [pairs[i]]
		temp = []
		if vis[stack[-1][0]] == 0:
			while len(stack) > 0:
				if vis[stack[-1][0]] == 0:
					temp.append(stack[-1][0])
					vis[stack[-1][0]] = 1
					s = stack.pop()
					for j in s[1:]:
						if vis[j] == 0:
							stack.append(pairs[j - 1])
				else:
					stack.pop()
			comp.append(temp)
	return comp
from bisect import bisect_left as bl
from bisect import bisect_right as br
import sys, operator, math, operator
from collections import Counter
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import random, heapq
(n, m) = inpm()
(li1, li2) = (inpl(), inpl())
ans = float('-inf')
for i in ra(n):
	pos1 = br(li2, li1[i])
	pos2 = bl(li2, li1[i])
	req1 = float('inf')
	if pos1 - 1 >= 0:
		req1 = min(req1, abs(li2[pos1 - 1] - li1[i]))
	if pos1 < m:
		req1 = min(req1, abs(li2[pos1] - li1[i]))
	req2 = float('inf')
	if pos2 - 1 >= 0:
		req1 = min(req2, abs(li2[pos2 - 1] - li1[i]))
	if pos2 < m:
		req2 = min(req2, abs(li2[pos2] - li1[i]))
	ans = max(ans, min(req1, req2))
P(ans)


def closest_side(a, b):
	(b_ptr, bl) = (0, len(b))
	result = []
	for x in a:
		while b_ptr + 1 < bl and b[b_ptr + 1] <= x:
			b_ptr += 1
		result.append(abs(x - b[b_ptr]))
	return result

def from_back(l):
	return list(reversed(list(map(lambda x: -x, l))))

def main():
	input()
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	res_first = closest_side(a, b)
	res_second = reversed(closest_side(from_back(a), from_back(b)))
	print(max(map(lambda x: min(x[0], x[1]), zip(res_first, res_second))))
main()


import sys
r = lambda : sys.stdin.readline()
(n, m) = map(int, r().split())
nrr = [int(x) for x in r().split()]
mrr = [int(x) for x in r().split()]
lrr = []
rrr = []
pointer = 0
for x in mrr:
	while True:
		if pointer == n:
			break
		if nrr[pointer] <= x:
			rrr.append(x - nrr[pointer])
			pointer += 1
		else:
			break
for i in range(pointer, n):
	rrr.append(10 ** 10)
pointer = n - 1
for i in range(m - 1, -1, -1):
	while True:
		if pointer == -1:
			break
		if mrr[i] <= nrr[pointer]:
			lrr.append(nrr[pointer] - mrr[i])
			pointer -= 1
		else:
			break
for i in range(pointer, -1, -1):
	lrr.append(10 ** 10)
srr = [min(lrr[i], rrr[n - i - 1]) for i in range(n)]
print(max(srr))


import bisect
x = map(int, input().split())
gor = sorted(list(set(map(int, input().split()))))
vysh = sorted(list(set(map(int, input().split()))))
r = 0
for x in gor:
	vh = bisect.bisect_left(vysh, x)
	if vh == len(vysh) or vysh[vh] != x:
		if vh == 0:
			r = max(r, vysh[vh] - x)
		elif vh == len(vysh):
			r = max(r, x - vysh[vh - 1])
		else:
			r = max(r, min(vysh[vh] - x, x - vysh[vh - 1]))
print(r)


line1 = input().split()
n = int(line1[0])
m = int(line1[1])
cities = input().split()
towers = input().split()
for i in range(n):
	cities[i] = int(cities[i])
for i in range(m):
	towers[i] = int(towers[i])
worst = 0
i = 0
for city in cities:
	if m > 1:
		while city > towers[i + 1] and i + 2 < m:
			i += 1
		a = abs(towers[i] - city)
		b = abs(towers[i + 1] - city)
		this = min(a, b)
		worst = max(worst, this)
	else:
		worst = max(worst, abs(towers[0] - city))
print(worst)


import sys
from math import *
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()

def check(r):
	last = 0
	for x in a:
		while last < len(b) and (not (b[last] - r <= x and x <= b[last] + r)):
			last += 1
		if last == len(b):
			return False
	return True
(l, r) = (0, int(2000000000.0))
(m, res) = (0, int(2000000000.0))
while l <= r:
	m = l + r >> 1
	if check(m):
		res = min(res, m)
		r = m - 1
	else:
		l = m + 1
print(res)


import bisect

def main0():
	(n, m) = map(int, input().split())
	cities = list(map(int, input().split()))
	towers = list(map(int, input().split()))
	ans = 0
	for city in cities:
		idx = bisect.bisect_left(towers, city)
		if idx == 0:
			ans = max(ans, towers[0] - city)
		elif idx == len(towers):
			ans = max(ans, city - towers[-1])
		else:
			ans = max(ans, min(abs(towers[idx] - city), abs(city - towers[idx - 1])))
	print(ans)

def main():
	(n, m) = map(int, input().split())
	cities = list(map(int, input().split()))
	towers = list(map(int, input().split()))

	def binary_dist(city):
		(low, high) = (0, len(towers) - 1)
		while low <= high:
			mid = low + (high - low) // 2
			if towers[mid] == city:
				return 0
			elif towers[mid] > city:
				high = mid - 1
			else:
				low = mid + 1
		if high == -1:
			return abs(towers[0] - city)
		elif high >= len(towers) - 1:
			return abs(towers[-1] - city)
		else:
			return min(abs(city - towers[high]), abs(city - towers[high + 1]))
	print(max((binary_dist(city) for city in cities)))
main()


import sys
import bisect
from math import ceil, floor
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
mod = 10 ** 9 + 7
(n, m) = RI()
a = RI()
b = RI()
b.sort()
b = [-10 ** 10] + b + [10 ** 10]
r = -1
for i in range(len(a)):
	l = bisect.bisect_left(b, a[i])
	if l != 0:
		dist = min(a[i] - b[l - 1], b[l] - a[i])
	else:
		dist = b[l] - a[i]
	r = max(dist, r)
print(r)


import sys
import bisect
input = sys.stdin.readline
(n, m) = map(int, input().split())
city = list(map(int, input().split()))
tower = list(map(int, input().split()))
ans = []
for i in range(n):
	a = bisect.bisect_right(tower, city[i])
	x = abs(city[i] - tower[max(0, a - 1)])
	y = abs(city[i] - tower[min(m - 1, a)])
	ans.append(min(x, y))
print(max(ans))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
from bisect import bisect
for (i, x) in enumerate(a):
	y = bisect(b, x)
	if y == m:
		res = max(res, x - b[m - 1])
	elif y == 0:
		res = max(res, b[0] - x)
	else:
		result = min(x - b[y - 1], b[y] - x)
		res = max(res, result)
print(res)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
r = 0
bi = 0
for i in range(n):
	cd = abs(a[i] - b[bi])
	while bi < m - 1 and abs(a[i] - b[bi + 1]) <= cd:
		bi += 1
		cd = abs(a[i] - b[bi])
	if cd > r:
		r = cd
print(r)


def binSearchModified(a, searchKey, l, r):
	if r <= l + 1:
		return (l, r)
	mid = (l + r) // 2
	if a[mid] == searchKey:
		return (mid, mid)
	elif a[mid] > searchKey:
		return binSearchModified(a, searchKey, l, mid)
	else:
		return binSearchModified(a, searchKey, mid, r)
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
radius = 0
for i in range(n):
	(l, r) = binSearchModified(b, a[i], 0, m - 1)
	min_Dist = min(abs(a[i] - b[l]), abs(b[r] - a[i]))
	radius = max(radius, min_Dist)
print(radius)


import bisect
(n, m) = map(int, input().split())
C = sorted(list(set(map(int, input().split()))))
T = sorted(list(set(map(int, input().split()))))
r = 0
for x in C:
	ind = bisect.bisect_left(T, x)
	if ind == len(T) or T[ind] != x:
		if ind == 0:
			r = max(r, T[ind] - x)
		elif ind == len(T):
			r = max(r, x - T[ind - 1])
		else:
			r = max(r, min(T[ind] - x, x - T[ind - 1]))
print(r)


import bisect
limit = 1 << 32
(n, m) = input().split()
towns = [int(x) for x in input().split()]
towers = [int(x) for x in input().split()]
answer = 0
for town in towns:
	lpos = bisect.bisect_right(towers, town)
	rpos = bisect.bisect_left(towers, town)
	ldiff = abs(town - towers[lpos - 1]) if lpos != 0 else limit
	rdiff = abs(town - towers[rpos]) if rpos != len(towers) else limit
	diff = min(ldiff, rdiff)
	answer = max(answer, diff)
print(answer)


def binary_search(can):
	lo = 0
	hi = len(b)
	while lo < hi:
		mi = (lo + hi) // 2
		if can(b[mi]):
			hi = mi
		else:
			lo = mi + 1
	return lo
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r = 0
for v in a:
	x = min(binary_search(lambda t: v <= t), len(b) - 1)
	r = max(r, min(abs(v - b[x]), abs(v - b[x - 1])))
print(r)


import math
import bisect
import sys
from collections import OrderedDict
input = sys.stdin.readline

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

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
(N, M) = invr()
A = inlt()
B = inlt()
a = 0
b = 0
dist = []
while a < N and b < M + 1:
	if b < M and A[a] >= B[b]:
		b += 1
	else:
		if b == M:
			dist.append(A[a] - B[b - 1])
		elif b == 0:
			dist.append(B[b] - A[a])
			b += 1
		elif B[b] - A[a] >= A[a] - B[b - 1]:
			dist.append(A[a] - B[b - 1])
		else:
			dist.append(B[b] - A[a])
		b -= 1
		a += 1
print(max(dist))


(n, m) = [int(x) for x in input().split()]
city = list(map(int, input().split()))
tower = list(map(int, input().split()))
r = 0
k = 0
ma = max(abs(city[0] - tower[-1]), abs(city[-1] - tower[0]))
for i in range(n):
	dis = [ma]
	a = 0
	for j in range(k, m):
		distance = abs(city[i] - tower[j])
		if distance > dis[-1]:
			k = j - 1
			r = max(r, dis[-1])
			a = 1
			break
		else:
			dis.append(distance)
	if a == 0:
		k = j
		r = max(r, dis[-1])
print(r)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [-10 ** 21] + list(map(int, input().split())) + [10 ** 21]
ans = 0
j = 0
for i in range(n):
	while a[i] >= b[j + 1]:
		j += 1
	ans = max(ans, min(b[j + 1] - a[i], a[i] - b[j]))
print(ans)


import sys
import bisect
input = sys.stdin.readline
(m, n) = input().strip().split()
(m, n) = (int(m), int(n))
cities = list(map(int, input().strip().split()))
cells = list(map(int, input().strip().split()))
cells.sort()
R = []
for i in range(m):
	x = cities[i]
	l = bisect.bisect_left(cells, x)
	if l == 0:
		left = cells[0]
	else:
		left = cells[l - 1]
	if l >= n:
		right = cells[-1]
	else:
		right = cells[l]
	R.append(min(abs(x - right), abs(x - left)))
print(max(R))


from bisect import bisect as b
[_, k, t] = [list(map(int, input().split())) for i in [0] * 3]
print(max([min([abs(x - c) for x in t[max(0, b(t, c) - 1):b(t, c) + 2]] + [9 ** 99]) for c in k]))


import sys
import bisect
input = sys.stdin.readline
(citn, celn) = list(map(int, input().split()))
cities = list(map(int, input().split()))
cells = list(map(int, input().split()))
mingw = 0
for i in cities:
	cat = bisect.bisect_left(cells, i + 1)
	try:
		dog = abs(cells[cat] - i)
	except:
		dog = 99999999999999
	cat = abs(cells[cat - 1] - i)
	cat = min(cat, dog)
	if cat > mingw:
		mingw = cat
print(mingw)


import bisect
I = lambda : map(int, input().rstrip().split())
(n, m) = I()
city = list(sorted(I()))
tower = list(sorted(I()))
maxm = 0
for x in city:
	ind = bisect.bisect_left(tower, x)
	after = 10 ** 10
	before = 10 ** 10
	if ind < m:
		after = tower[ind] - x
	if ind > 0:
		before = x - tower[ind - 1]
	maxm = max(maxm, min(after, before))
print(maxm)


(n, m) = [int(i) for i in input().strip().split()]
c = [int(i) for i in input().strip().split()]
t = [int(i) for i in input().strip().split()]
ci = 0
ti = 0
ans = 0
while ci < n:
	if ti == m - 1:
		ans = max(ans, abs(t[-1] - c[ci]), abs(t[-1] - c[-1]))
		break
	while ti <= m - 2:
		if abs(t[ti] - c[ci]) >= abs(t[ti + 1] - c[ci]):
			ti += 1
		else:
			break
	ans = max(ans, abs(t[ti] - c[ci]))
	ci += 1
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.insert(0, -2 ** 40)
b.append(2 ** 40)
ans = 0
j = 0
for i in range(0, n):
	while a[i] >= b[j + 1]:
		j += 1
	ans = max(ans, min(b[j + 1] - a[i], a[i] - b[j]))
print(ans)


import math
line = input().split()
n = int(line[0])
m = int(line[1])
inhabited_localities = [int(x) for x in input().split()]
columns = [int(x) for x in input().split()]
max_distance = 0
current_distanse = 0
j = 0
for i in inhabited_localities:
	while j < m - 1 and i > columns[j]:
		j += 1
	if j != 0:
		current_distanse = min(abs(columns[j] - i), abs(columns[j - 1] - i))
	else:
		current_distanse = abs(columns[j] - i)
	if max_distance < current_distanse:
		max_distance = current_distanse
print(max_distance)


from bisect import bisect_left
(n, m) = map(int, input().split())
cities = list(map(int, input().split()))
towers = [-10 ** 19] + list(map(int, input().split())) + [10 ** 19]
ans = 0
for c in cities:
	i = bisect_left(towers, c)
	dist = min(abs(towers[i - 1] - c), abs(towers[i] - c))
	ans = max(ans, dist)
print(ans)


import sys
input = sys.stdin.readline

def solve(city: list, tower: list) -> int:
	MAX = 1e+17
	left = []
	i = j = 0
	while i < len(city) and j < len(tower):
		if city[i] < tower[j]:
			if j == 0:
				left.append(MAX)
			else:
				left.append(city[i] - tower[j - 1])
			i += 1
		else:
			j += 1
	while i < len(city):
		left.append(city[i] - tower[-1])
		i += 1
	right = []
	i = len(city) - 1
	j = len(tower) - 1
	while i >= 0 and j >= 0:
		if city[i] > tower[j]:
			if j == len(tower) - 1:
				right.append(MAX)
			else:
				right.append(tower[j + 1] - city[i])
			i -= 1
		else:
			j -= 1
	while i >= 0:
		right.append(tower[0] - city[i])
		i -= 1
	right.reverse()
	res = 0
	for i in range(len(city)):
		d = min(left[i], right[i])
		res = max(res, d)
	return res
(n, m) = map(int, input().split())
city = list(map(int, input().split()))
tower = list(map(int, input().split()))
print(solve(city, tower))


(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
flag = True
l = -1
r = 2 * 10 ** 9

def radius(r, a):
	l1 = 0
	l2 = 0
	while l1 < n and l2 < m:
		if b[l2] - r <= a[l1] and b[l2] + r >= a[l1]:
			l1 += 1
		else:
			l2 += 1
	if l1 == n:
		return True
	else:
		return False
while l + 1 != r:
	M = (l + r) // 2
	if radius(M, a) == False:
		l = M
	else:
		r = M
print(r)


import sys
import os.path
import math
import heapq
import copy
from sys import stdin, stdout
from collections import *
from math import gcd, ceil, floor
from bisect import bisect
mod = int(1000000000.0 + 7)
if os.path.exists('Updated prg/Input3d.txt'):
	sys.stdout = open('Updated prg/Output3d.txt', 'w')
	sys.stdin = open('Updated prg/Input3d.txt', 'r')

def sinp():
	return input()

def ninp():
	return int(sinp())

def mapinp():
	return map(int, sinp().split())

def smapinp():
	return map(str, sinp().split())

def linp():
	return list(mapinp())

def sl():
	return list(sinp().split())

def prnt(a):
	print(a)

def prntl(a):
	print(a, end=' ')

def prntlist(l1):
	print(*l1)

def power(n):
	return 1 << n
(n, m) = mapinp()
a = linp()
b = linp()
m2 = 0
for i in a:
	l1 = bisect(b, i)
	if l1 != m:
		if l1 != 0:
			a1 = abs(i - b[l1 - 1])
			a2 = abs(i - b[l1])
			m1 = min(a1, a2)
			m2 = max(m2, m1)
		elif l1 == 0:
			a3 = abs(i - b[0])
			m2 = max(m2, a3)
	else:
		a3 = abs(i - b[-1])
		m2 = max(m2, a3)
prnt(m2)


(n, m) = map(int, input().split())
b = list(map(int, input().split()))
a = list(map(int, input().split()))
r = 0
i = 0
for v in b:
	while a[i] < v and i + 1 < len(a):
		i += 1
	r = max(r, min(abs(a[i] - v), abs(a[i - 1] - v)))
print(r)


def UpperBound(A, key):
	left = -1
	right = len(A)
	while right > left + 1:
		middle = (left + right) // 2
		if A[middle] > key:
			right = middle
		else:
			left = middle
	return right

def LowerBound(A, key):
	left = -1
	right = len(A)
	while right > left + 1:
		middle = (left + right) // 2
		if A[middle] >= key:
			right = middle
		else:
			left = middle
	return right
(n, m) = map(int, input().split())
N = list(map(int, input().split()))
M = list(map(int, input().split()))
INF = 10 ** 9
dist = [INF] * n
min_dist = 0
for i in range(n):
	l = LowerBound(M, N[i])
	if l > len(M) - 1:
		l = len(M) - 1
	d1 = abs(N[i] - M[l])
	if 0 < l:
		d2 = abs(N[i] - M[l - 1])
	else:
		d2 = d1
	dist[i] = min(d1, d2)
print(max(dist))


import bisect

def main():
	(n, m) = map(int, input().split())
	cities = list(map(int, input().split()))
	towers = list(map(int, input().split()))
	ans = 0
	for city in cities:
		idx = bisect.bisect_left(towers, city)
		if idx == 0:
			ans = max(ans, towers[0] - city)
		elif idx == len(towers):
			ans = max(ans, city - towers[-1])
		else:
			ans = max(ans, min(abs(towers[idx] - city), abs(city - towers[idx - 1])))
	print(ans)
main()


def find_cellular_range():
	(n, m) = (int(x) for x in input().split())
	cities = [int(c) for c in input().split()]
	towers = [int(t) for t in input().split()]
	(i, j) = (0, 0)
	min_range = 0
	while i < len(cities) and cities[i] < towers[0]:
		i += 1
	if i > 0:
		min_range = abs(towers[0] - cities[0])
	while i < len(cities) and j < len(towers) - 1:
		if towers[j] <= cities[i] <= towers[j + 1]:
			min_dist = min(abs(cities[i] - towers[j]), abs(towers[j + 1] - cities[i]))
			min_range = max(min_range, min_dist)
			i += 1
		else:
			j += 1
	if j == len(towers) - 1:
		min_range = max(min_range, abs(towers[-1] - cities[-1]))
	return min_range
print(find_cellular_range())


def intify(string):
	x = string.split()
	for i in range(len(x)):
		x[i] = int(x[i])
	return x

def search(item, lst):
	mid = len(lst) // 2
	start = 0
	end = len(lst) - 1
	while start < end:
		mid = (end + start) // 2
		if mid == end or mid == start:
			break
		if item < lst[mid]:
			end = mid
		elif item == lst[mid]:
			return 0
		elif item > lst[mid]:
			start = mid
	if abs(lst[start] - item) < abs(lst[end] - item):
		return abs(lst[start] - item)
	return abs(lst[end] - item)

def evaluate():
	numbers = intify(input())
	cities = intify(input())
	towers = intify(input())
	maxi = 0
	for i in range(len(cities)):
		if maxi < search(cities[i], towers):
			maxi = search(cities[i], towers)
	return maxi
print(evaluate())


(n, m) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
arr2 = sorted(arr2)
ans = 0
for j in arr1:
	l = 0
	r = m - 1
	res = int(2000000000.0)
	while l <= r:
		mid = (l + r) // 2
		if arr2[mid] < j:
			l = mid + 1
		else:
			r = mid - 1
		res = min(res, abs(arr2[mid] - j))
	ans = max(ans, res)
print(ans)


import sys
input = sys.stdin.readline
from bisect import *

def judge(x):
	for ai in a:
		idx = bisect_left(b, ai)
		if min(abs(ai - b[idx]), abs(ai - b[idx - 1])) > x:
			return False
	return True

def binary_search():
	(l, r) = (0, 10 ** 10)
	while l <= r:
		mid = (l + r) // 2
		if judge(mid):
			r = mid - 1
		else:
			l = mid + 1
	return l
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = [-10 ** 18] + list(map(int, input().split())) + [10 ** 18]
print(binary_search())