import numpy as np
A, B, Q, *L = map(int, open(0).read().split())
s = L[:A]
t = L[A:A+B]
x = L[A+B:]

s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
sls = np.searchsorted(s,x)
tls = np.searchsorted(t,x)
for ar, br, c in zip(sls,tls,x):
  bl = br-1
  al = ar-1
  n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl])
  m = t[br]-s[al]+min(t[br]-c,c-s[al])
  p = c-min(t[bl],s[al])
  q = max(s[ar],t[br])-c
  print(min(n,m,p,q)) import numpy as np numpy A, B, Q, *L = map(int, open(0).read().split()) A map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split B Q *L L s = L[:A] s L[:A] L :A A t = L[A:A+B] t L[A:A+B] L A:A+B A A+B A B x = L[A+B:] x L[A+B:] L A+B: A+B A B s = [-float('inf')]+s+[float('inf')] s [-float('inf')]+s+[float('inf')] [-float('inf')]+s [-float('inf')] -float('inf') float('inf') float 'inf' s [float('inf')] float('inf') float 'inf' t = [-float('inf')]+t+[float('inf')] t [-float('inf')]+t+[float('inf')] [-float('inf')]+t [-float('inf')] -float('inf') float('inf') float 'inf' t [float('inf')] float('inf') float 'inf' sls = np.searchsorted(s,x) sls np.searchsorted(s,x) np.searchsorted np searchsorted s x tls = np.searchsorted(t,x) tls np.searchsorted(t,x) np.searchsorted np searchsorted t x for ar, br, c in zip(sls,tls,x):
  bl = br-1
  al = ar-1
  n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl])
  m = t[br]-s[al]+min(t[br]-c,c-s[al])
  p = c-min(t[bl],s[al])
  q = max(s[ar],t[br])-c
  print(min(n,m,p,q)) ar br c zip(sls,tls,x) zip sls tls x bl = br-1 bl br-1 br 1 al = ar-1 al ar-1 ar 1 n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl]) n s[ar]-t[bl]+min(s[ar]-c,c-t[bl]) s[ar]-t[bl] s[ar] s ar t[bl] t bl min(s[ar]-c,c-t[bl]) min s[ar]-c s[ar] s ar c c-t[bl] c t[bl] t bl m = t[br]-s[al]+min(t[br]-c,c-s[al]) m t[br]-s[al]+min(t[br]-c,c-s[al]) t[br]-s[al] t[br] t br s[al] s al min(t[br]-c,c-s[al]) min t[br]-c t[br] t br c c-s[al] c s[al] s al p = c-min(t[bl],s[al]) p c-min(t[bl],s[al]) c min(t[bl],s[al]) min t[bl] t bl s[al] s al q = max(s[ar],t[br])-c q max(s[ar],t[br])-c max(s[ar],t[br]) max s[ar] s ar t[br] t br c print(min(n,m,p,q)) print min(n,m,p,q) min n m p q B, Q, *L = map(int, open(0).read().split()) map(int, open(0).read().split()) B Q, *L = map(int, open(0).read().split()) map(int, open(0).read().split()) Q A, B, Q, *L = map(int, open(0).read().split()) map(int, open(0).read().split()) A m = t[br]-s[al]+min(t[br]-c,c-s[al]) t[br]-s[al]+min(t[br]-c,c-s[al]) m sls = np.searchsorted(s,x) np.searchsorted(s,x) sls tls = np.searchsorted(t,x) np.searchsorted(t,x) tls n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl]) s[ar]-t[bl]+min(s[ar]-c,c-t[bl]) n x = L[A+B:] L[A+B:] x s = [-float('inf')]+s+[float('inf')] [-float('inf')]+s+[float('inf')] s t = L[A:A+B] L[A:A+B] t bl = br-1 br-1 bl t = [-float('inf')]+t+[float('inf')] [-float('inf')]+t+[float('inf')] t s = L[:A] L[:A] s p = c-min(t[bl],s[al]) c-min(t[bl],s[al]) p al = ar-1 ar-1 al q = max(s[ar],t[br])-c max(s[ar],t[br])-c q
import numpy as np
A, B, Q, *L = map(int, open(0).read().split())
s = L[:A]
t = L[A:A+B]
x = L[A+B:]

s = [-float('inf')]+s+[float('inf')]
t = [-float('inf')]+t+[float('inf')]
sls = np.searchsorted(s,x)
tls = np.searchsorted(t,x)
for ar, br, c in zip(sls,tls,x):
  bl = br-1
  al = ar-1
  n = s[ar]-t[bl]+min(s[ar]-c,c-t[bl])
  m = t[br]-s[al]+min(t[br]-c,c-s[al])
  p = c-min(t[bl],s[al])
  q = max(s[ar],t[br])-c
  print(min(n,m,p,q))