Buggy python submission (verdict: Runtime Error):
dic = {}

def getX(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-y)
    lgst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        if(ex==len(cards)-1):
            return max(abs(i-y),lgst)
        tmpcards.remove(i)
        idx += 1
        #if (i,y,idx) in dic:
            #tmp = dic[(i,y,idx)]
        #else:
        tmp = getY(i, y, tmpcards, idx)
            #dic[(i,y,idx)]= tmp
        if tmp > lgst:
            lgst = tmp
    return lgst

def getY(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-x)
    smlst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        if (ex==len(cards)-1):
            return min(abs(i - x), smlst)
        tmpcards.remove(i)
        idx += 1
        #if (x,i,idx) in dic:
            #tmp = dic[(x,i,idx)]
        #else:
        tmp = getX(x, i, tmpcards, idx)
            #dic[(x,i,idx)]= tmp
        if tmp < smlst:
            smlst = tmp
    return smlst

n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
print(getX(z, w, cards, 0))

Fixed submission:
n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
#print(getX(z, w, cards, 0))
if(abs(cards[len(cards)-1]-w)>abs(cards[len(cards)-1]-cards[len(cards)-2])):
    print(abs(cards[len(cards)-1]-w))
else:
    print(abs(cards[len(cards)-1]-cards[len(cards)-2]))

Buggy python submission (verdict: Runtime Error):
dic = {}

def getX(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-y)
    lgst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        if(ex==len(cards)-1):
            return max(abs(i-y),lgst)
        tmpcards.remove(i)
        idx += 1
        if (i,y,idx) in dic:
            tmp = dic[(i,y,idx)]
        else:
            tmp = getY(i, y, tmpcards, idx)
            dic[(i,y,idx)]= tmp
        if tmp > lgst:
            lgst = tmp
    return lgst

def getY(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-x)
    smlst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        if (ex==len(cards)-1):
            return min(abs(i - x), smlst)
        tmpcards.remove(i)
        idx += 1
        if (x,i,idx) in dic:
            tmp = dic[(x,i,idx)]
        else:
            tmp = getX(x, i, tmpcards, idx)
            dic[(x,i,idx)]= tmp
        if tmp < smlst:
            smlst = tmp
    return smlst

n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
print(getX(z, w, cards, 0))

Fixed submission:
n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
#print(getX(z, w, cards, 0))
if(abs(cards[len(cards)-1]-w)>abs(cards[len(cards)-1]-cards[len(cards)-2])):
    print(abs(cards[len(cards)-1]-w))
else:
    print(abs(cards[len(cards)-1]-cards[len(cards)-2]))

Buggy python submission (verdict: Runtime Error):
dic = {}

def getX(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-y)
    lgst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        if(ex==len(cards)-1):
            return max(abs(i-y),lgst)
        tmpcards.remove(i)
        idx += 1
        if (i,y,idx) in dic:
            tmp = dic[(i,y,idx)]
        else:
            tmp = getY(i, y, tmpcards, idx)
            dic[(i,y,idx)]= tmp
        if tmp > lgst:
            lgst = tmp
    return lgst

def getY(x, y, cards, idx):
    if len(cards)==1:
        return abs(cards[0]-x)
    smlst = 0
    tmpcards = cards.copy()
    for ex, i in enumerate(cards):
        tmpcards.remove(i)
        if (ex==len(cards)-1):
            return min(abs(i - x), smlst)
        idx += 1
        if (x,i,idx) in dic:
            tmp = dic[(x,i,idx)]
        else:
            tmp = getX(x, i, tmpcards, idx)
            dic[(x,i,idx)]= tmp
        if tmp < smlst:
            smlst = tmp
    return smlst

n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
print(getX(z, w, cards, 0))

Fixed submission:
n, z, w = map(int, input().split())
cards = list(map(int, input().split()))
#print(getX(z, w, cards, 0))
if(abs(cards[len(cards)-1]-w)>abs(cards[len(cards)-1]-cards[len(cards)-2])):
    print(abs(cards[len(cards)-1]-w))
else:
    print(abs(cards[len(cards)-1]-cards[len(cards)-2]))