Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import bisect
import numpy as np

A,B,Q = map(int,input().split())
s = np.array([int(input()) for i in range(A)])
t = np.array([int(input()) for i in range(B)])
x = np.array([int(input()) for i in range(Q)])

def lr(s,c,A):
#    si = bisect.bisect(s,c)
    si = s.searchsorted(c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import numpy as np
import bisect

A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
x = [int(input()) for i in range(Q)]

def lr(s,c,A):
    si = bisect.bisect(s,c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import bisect
import numpy as np

A,B,Q = map(int,input().split())
s = np.array([int(input()) for i in range(A)])
t = np.array([int(input()) for i in range(B)])
x = np.array([int(input()) for i in range(Q)])

def lr(s,c,A):
#    si = bisect.bisect(s,c)
    si = np.searchsorted(s,c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import numpy as np
import bisect

A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
x = [int(input()) for i in range(Q)]

def lr(s,c,A):
    si = bisect.bisect(s,c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import numpy as np

A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
x = [int(input()) for i in range(Q)]

def lr(s,c,A):
    si = np.searchsorted(s,c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 22:10:01 2019

@author: Yamazaki Kenichi
"""
import numpy as np
import bisect

A,B,Q = map(int,input().split())
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
x = [int(input()) for i in range(Q)]

def lr(s,c,A):
    si = bisect.bisect(s,c)
    if si == A:
        return [c-s[si-1], 10**11]
    elif si == 0:
        return [10**11, s[0]-c]
    else:
        return [c-s[si-1], s[si]-c]
for c in x:
    ans = 0
    slr = lr(s,c,A)
    tlr = lr(t,c,B)
    ans = min(max(slr[0],tlr[0]),
              max(slr[1],tlr[1]),
              slr[0]*2+ tlr[1],
              slr[0]+ tlr[1]*2,
              slr[1]*2 + tlr[0],
              slr[1]+ tlr[0]*2
              )
    print(ans)