Buggy python submission (verdict: Time Limit Exceeded):
read = input
# read = Read(False, """
# 1 1 3
# 1
# 10000000000
# 2
# 9999999999
# 5000000000
# """).read
A,B,Q = list(map(int, read().split(' ')))
arrA = list(map(int, [read() for i in range(A)]))
arrB = list(map(int, [read() for i in range(B)]))
arrQ = list(map(int, [read() for i in range(Q)]))
arrA.sort()
arrB.sort()
import bisect
def cs(x, arr):
    al = bisect.bisect_left(arr, x)
    return list(map(lambda i: arr[i], filter(lambda i:i>=0 and i< len(arr), range(al-1, al + 2))))
def same_s(da,db):
    da = da / abs(da)
    db = db / abs(db)
    return da*db>0
    
def t(q,a,b):
    da = q - a
    db = q - b
    if(min(abs(da), abs(db)) == 0):
        return max(abs(da), abs(db))
    if same_s(da, db):
        return max(abs(da), abs(db))
    else :
        return 2*min(abs(da), abs(db)) + max(abs(da), abs(db))
for q in arrQ:
    optA = cs(q, arrA)
    optB = cs(q, arrB)
    ret = 10 ** 11
    for a in optA:
        for b in optB:
            ret = min(ret, t(q, a,b))
    print(ret)

Fixed submission:
import bisect
read = input
bisect_right = bisect.bisect_right
# @ see https://docs.python.org/zh-cn/3/library/bisect.html
a ,b , q = map(int, read().split())
INF = 10**18
A =[-INF] + [int(read()) for i in range(a)] +[INF]
B =[-INF] + [int(read()) for i in range(b)] +[INF]
A.sort()
B.sort()
try:
    for i in range(q):
        x = int(read())
        sa = bisect_right(A, x)
        sb = bisect_right(B, x)
        ans = INF
        for pa in [A[sa - 1 ], A[sa]]:
            for pb in [B[sb - 1 ], B[sb]]:
                d1 = abs(x - pa) + abs(pa - pb)
                d2 = abs(x - pb) + abs(pb - pa)
                ans = min(ans, d1, d2)
        print(ans)
except:
    print(x, sa, sb)

Buggy python submission (verdict: Runtime Error):
read = input
read = Read(False, """
1 1 3
1
10000000000
2
9999999999
5000000000
""").read
A,B,Q = list(map(int, read().split(' ')))
arrA = list(map(int, [read() for i in range(A)]))
arrB = list(map(int, [read() for i in range(B)]))
arrQ = list(map(int, [read() for i in range(Q)]))
arrA.sort()
arrB.sort()
import bisect
def cs(x, arr):
    al = bisect.bisect_left(arr, x)
    return list(map(lambda i: arr[i], filter(lambda i:i>=0 and i< len(arr), range(al-1, al + 2))))
def same_s(da,db):
    da = da / abs(da)
    db = db / abs(db)
    return da*db>0
    
def t(q,a,b):
    da = q - a
    db = q - b
    if(min(abs(da), abs(db)) == 0):
        return max(abs(da), abs(db))
    if same_s(da, db):
        return max(abs(da), abs(db))
    else :
        return 2*min(abs(da), abs(db)) + max(abs(da), abs(db))
for q in arrQ:
    optA = cs(q, arrA)
    optB = cs(q, arrB)
    ret = 10 ** 11
    for a in optA:
        for b in optB:
            ret = min(ret, t(q, a,b))
    print(ret)

Fixed submission:
import bisect
read = input
bisect_right = bisect.bisect_right
# @ see https://docs.python.org/zh-cn/3/library/bisect.html
a ,b , q = map(int, read().split())
INF = 10**18
A =[-INF] + [int(read()) for i in range(a)] +[INF]
B =[-INF] + [int(read()) for i in range(b)] +[INF]
A.sort()
B.sort()
try:
    for i in range(q):
        x = int(read())
        sa = bisect_right(A, x)
        sb = bisect_right(B, x)
        ans = INF
        for pa in [A[sa - 1 ], A[sa]]:
            for pb in [B[sb - 1 ], B[sb]]:
                d1 = abs(x - pa) + abs(pa - pb)
                d2 = abs(x - pb) + abs(pb - pa)
                ans = min(ans, d1, d2)
        print(ans)
except:
    print(x, sa, sb)