Buggy python submission (verdict: Time Limit Exceeded):
A,B,Q = list(map(int,input().split()))
shrine_list = []
temple_list = []
question_list = []
for _ in range(A):
    shrine_list.append(int(input()))
for _ in range(B):
    temple_list.append(int(input()))
shrine_list.sort()
temple_list.sort()
for i in range(Q):
    question_list.append(int(input()))
for i in range(Q):
    east_shrine_list = []
    west_shrine_list = []
    east_temple_list = []
    west_temple_list = []
    current = question_list[i]
    for shrine in shrine_list:
        if shrine < current:
            east_shrine_list.append(shrine)
        else:
            west_shrine_list.append(shrine)
    for temple in temple_list:
        if temple < current:
            east_temple_list.append(temple)
        else:
            west_temple_list.append(temple)
    if east_shrine_list:
        most_east_shrine = max(east_shrine_list)
    if west_shrine_list:
        most_west_shrine = min(west_shrine_list)
    if east_temple_list:
        most_east_temple = max(east_temple_list)
    if west_temple_list:
        most_west_temple = min(west_temple_list)
    likelyhood_list = []
    if east_shrine_list:
        if east_temple_list:
            likelyhood_list.append(abs(current - most_east_shrine) + abs(most_east_shrine - most_east_temple))
            likelyhood_list.append(abs(current - most_east_temple) + abs(most_east_shrine - most_east_temple))
        if west_temple_list:
            likelyhood_list.append(abs(current - most_east_shrine) + abs(most_east_shrine - most_west_temple))
            likelyhood_list.append(abs(current - most_west_temple) + abs(most_east_shrine - most_west_temple))
    if west_shrine_list:
        if east_temple_list:
            likelyhood_list.append(abs(current - most_west_shrine) + abs(most_west_shrine - most_east_temple))
            likelyhood_list.append(abs(current - most_east_temple) + abs(most_west_shrine - most_east_temple))
        if west_temple_list:
            likelyhood_list.append(abs(current - most_west_shrine) + abs(most_west_shrine - most_west_temple))
            likelyhood_list.append(abs(current - most_west_temple) + abs(most_west_shrine - most_west_temple))
    print(min(likelyhood_list))


Fixed submission:
import bisect

A,B,Q = list(map(int,input().split()))
INF = 10 ** 18
shrine_list = [-INF] + [int(input()) for _ in range(A)] + [INF]
temple_list = [-INF] + [int(input()) for _ in range(B)] + [INF]
question_list = [int(input()) for _ in range(Q)]
for i in range(Q):
    x = question_list[i]
    index_s = bisect.bisect_right(shrine_list,x)
    index_t = bisect.bisect_right(temple_list,x)
    most_east_shrine = shrine_list[index_s - 1]
    most_east_temple = temple_list[index_t - 1]
    most_west_shrine = shrine_list[index_s]
    most_west_temple = temple_list[index_t]
    likelyhood_list = []
    likelyhood_list.append(abs(x - most_east_shrine) + abs(most_east_shrine - most_east_temple))
    likelyhood_list.append(abs(x - most_east_temple) + abs(most_east_shrine - most_east_temple))
    likelyhood_list.append(abs(x - most_east_shrine) + abs(most_east_shrine - most_west_temple))
    likelyhood_list.append(abs(x - most_west_temple) + abs(most_east_shrine - most_west_temple))
    likelyhood_list.append(abs(x - most_west_shrine) + abs(most_west_shrine - most_east_temple))
    likelyhood_list.append(abs(x - most_east_temple) + abs(most_west_shrine - most_east_temple))
    likelyhood_list.append(abs(x - most_west_shrine) + abs(most_west_shrine - most_west_temple))
    likelyhood_list.append(abs(x - most_west_temple) + abs(most_west_shrine - most_west_temple))
    print(min(likelyhood_list))