Problem:
 Score : 500 points    Problem Statement We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i -th card from the top is a_i .  Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:   Draw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.   The game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.  X will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?      Constraints  All input values are integers.  1 \leq N \leq 2000  1 \leq Z, W, a_i \leq 10^9         Input Input is given from Standard Input in the following format:  N  Z  W  a_1  a_2  ...  a_N       Output Print the score.        Sample Input 1 3 100 100
10 1000 100      Sample Output 1 900  If X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900 .       Sample Input 2 3 100 1000
10 100 100      Sample Output 2 900  If X draws all the cards first, the score will be |1000 - 100| = 900 .       Sample Input 3 5 1 1
1 1 1 1 1      Sample Output 3 0       Sample Input 4 1 1 1
1000000000      Sample Output 4 999999999

Solution (Python):
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, Z, W] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    if N > 1:
        print max(abs(A[N - 1] - W), abs(A[N - 2] - A[N - 1]))
    else:
        print abs(A[0] - W)

  


if __name__ == '__main__':
    main()

Solution (Python):
N, Z, W = map(int, input().split())

A = list(map(int, input().split()))

if N == 1:
    print(abs(A[0]-W))
else:
    print(max(abs(A[-2] - A[-1]), abs(A[-1] - W)))

Solution (Python):
def d_abs(N, Z, W, A):
    
    
    
    
    ans = abs(A[0] - W) if N == 1 else max(abs(A[N - 1] - W), abs(A[N - 1] - A[N - 2]))
    return ans

N,Z,W = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(d_abs(N, Z, W, A))

Solution (Python):
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
if N == 1:
    print(abs(a[0] - W))
else:
    print(max([abs(a[N - 1] - W), abs(a[N - 1] - a[N - 2])]))

Solution (Python):
n, _, y = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    print(abs(a[0]-y))
else:
    print(max(abs(a[-1]-y), abs(a[-2]-a[-1])))
exit(0)

Solution (Python):
n, z, w = map(int, input().split())
A = list(map(int, input().split()))

if n == 1:
    print(abs(A[0]-w))
else:
    print(max(abs(A[n-1]-w), abs(A[n-2]-A[n-1])))

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(x) for x in input().split()]

if len(a) > 1:
    ans = max(abs(a[-2] - a[-1]), abs(a[-1] - W))
else:
    ans = abs(a[-1] - W)
print(ans)

Solution (Python):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

if N == 1:
    print(abs(W - A[-1]))
else:
    print(max(abs(W - A[-1]), abs(A[-2] - A[-1])))

Solution (Python):
n, z, w = map(int, input().split())
a = [int(x) for x in input().split()]
 
if n == 1:
    print(abs(a[0] - w))
else:
    print(max(abs(a[n-2]-a[n-1]), abs(a[n-1]-w)))

Solution (Python):
n, z, w = map(int, input().split())
A = list(map(int, input().split()))

if n == 1:
    print(abs(A[0]-w))
else:
    print(max(abs(A[n-2]-A[n-1]), abs(A[n-1]-w)))

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(ai) for ai in input().split()]
if len(a) == 1:
    print(abs(a[0] - W))
else:
    print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(ai) for ai in input().split()]
if len(a) == 1:
    print(abs(a[0] - W))
else:
    print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))

Solution (Python):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]
A = [Z] + A
if len(A) > 2:
  print(max(abs(A[-1] - W), abs(A[-2] - A[-1])))
else:
  print(abs(A[-1] - W))

Solution (Python):
N,Z,W = map(int, input().split())
A = list(map(int, input().split()))

if N >2:
    print(max(abs(A[-2]-A[-1]), abs(A[-1]-W)))
else:
    print(abs(A[-1]-W))

Solution (Python):
N, Z, W = map(int, input().split())
deck = list(map(int, input().split()))
if N == 1:
    print(abs(deck[0] - W))
else:
    print(max(abs(deck[-1] - deck[-2]), abs(deck[-1] - W)))

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def warshall_floyd(g):
    d = defaultdict(dict)
    V = list(g.keys())
    for v in g.values():
        V.extend(list(v))
    V = set(V)
    for i in V:
        for j in V:
            if i in g and j in g[i]:
                d[i][j] = g[i][j]
            else:
                d[i][j] = sys.maxsize
    for k in g:
        for i in g:
            for j in g:
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

    return d


@mt
def slv(N, Z, W, A):
    if N > 1:
        return max(abs(W-A[-1]), abs(A[-1] - A[-2]))
    else:
        return abs(W-A[-1])


def main():
    N, Z, W = read_int_n()
    A = read_int_n()
    print(slv(N, Z, W, A))


if __name__ == '__main__':
    main()

Solution (Python):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

if N == 1:
    print(abs(A[0] - W))
else:
    print(max(abs(A[N - 2] - A[N - 1]), abs(A[N - 1] - W)))

Solution (Python):
N, Z, W = map(int, input().split())
A = list(map(int, input().split()))

if len(A)!=1:
    print(max(abs(A[-1]-W), abs(A[-2]-A[-1])) )

else:
    print(abs(A[-1]-W))

Solution (Python):
N,Z,W = map(int,input().split())
a = list(map(int,input().split())) 
alast = a[N-1]
if N == 1:
    print(abs(W-alast))
    exit()
print(max(abs(W-alast),abs(a[N-2]-alast)))

Solution (Python):
a=list(map(int, input().split()))
b=list(map(int, input().split()))

c=max((abs(b[len(b)-1]-a[2])), (abs(b[len(b)-2]-b[len(b)-1])))
print(c)

Solution (Python):
n, z, w=map(int, input().split())
a = list(map(int, input().split()))
if n==1:
    print(abs(a[0]-w))
else:
    print(max(abs(a[-1]-w), abs(a[-2]-a[-1])))

Solution (Python):
n, z, w = map(int, input().split())
l = list(map(int, input().split()))

if n >= 2:
  print(max(abs(l[-1] - w), abs(l[-2] - l[-1])))
else:
  print(abs(l[-1] - w))

Solution (Python):
n, z, w = map(int, input().split())
a = list(map(int, input().split()))
print(max(abs(a[n-1]-a[n-2]),abs(a[n-1]-w)))

Solution (Python):
N,Z,W = map(int, input().split())
a = list(map(int, input().split()))
if N == 1:
    print(abs(W-a[0]))
else:
    print(max(abs(W-a[N-1]), abs(a[N-1]-a[N-2])))

Solution (Python):
def m():
    N, Z, W = map(int, input().split())
    a = list(map(int, input().split()))
    if N == 1:
        return abs(a[0] - W)
    return max(abs(a[N - 1] - a[N - 2]), abs(a[N - 1] - W))


print(m())

Solution (Python):
n,z,w = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
if n==1: print(abs(a[0]-w))
else: print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

Solution (Python):
N,Z,W = map(int,input().split())
A = list(map(int,input().split()))
if N == 1:
    print(abs(A[0]-W))
else:
    print(max(abs(A[N-1]-W),abs(A[N-1]-A[N-2])))

Solution (Python):
n, x, y = map(int,input().split())
numbers = list(map(int,input().split()))
print(max(abs(numbers[n-1]-y), abs(numbers[n-2] - numbers[n-1])))

Solution (Python):
n,z,w=map(int, input().split())
a=list(map(int, input().split()))

if len(a)==1: print(abs(a[-1]-w))
elif abs(a[-2]-a[-1])>abs(a[-1]-w):
    print(abs(a[-2]-a[-1]))
else: print(abs(a[-1]-w))

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(s) for s in input().split()]

ans = 0
if N == 1:
    ans = abs(a[0] - W)
else:
    ans = max(abs(a[-1] - W), abs(a[-2] - a[-1]))

print(ans)

Solution (Python):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n == 1:
    print(abs(a[0]- w))
else:
    print(max([abs(a[-1] - a[-2]), abs(w - a[-1])]))

Solution (Python):
import sys

sys.setrecursionlimit(10000)

cm = None
cM = None
def m(a, n, i, w):
    if w in cm[i]: return cm[i][w]
    m = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        m = min(m, abs(M(a, n, k + 1, a[k])))
    cm[i][w] = m
    return m

def M(a, n, i, w):
    if w in cM[i]: return cM[i][w]
    M = abs(a[n - 1] - w)
    for k in range(i, n - 1):
        M = max(M, abs(m(a, n, k + 1, a[k])))
    cM[i][w] = M
    return M

n, z, w = map(int, raw_input().split())
a = map(int, raw_input().split())
cm = [dict() for _ in range(n)]
cM = [dict() for _ in range(n)]
print M(a, n, 0, w)

Solution (Python):
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

print(max(abs(a[N-1]-W),abs(a[N-2]-a[N-1])))

Solution (Python):
N,Z,W = map(int,input().split())
list = [0]*N
tmp = input().split()
for i in range(N):
  list[i] = int(tmp[i])
print(max(abs(W-list[N-1]),abs(list[N-1]-list[N-2])))

Solution (Python):
n, z, w = list(map(int, input().split()))
nums = list(map(int, input().split()))

if n == 1:
    print(abs(nums[0] - w))
else:
    print(max(abs(nums[-1] - w), abs(nums[-2] - nums[-1])))

Solution (Python):
N,Z,W=map(int,input().split())
A=[int(x) for x in input().split()]

if len(A)==1:
  print(abs(W-A[0]))
else:
  print(max(abs(A[N-1]-W),abs(A[N-1]-A[N-2])))

Solution (Python):

line = input().split(" ")
n = int(line[0])
z = int(line[1])
w = int(line[2])

a = []
for x in input().split(" "):
    a.append(int(x))

print(max(abs(w-a[n-1]), abs(a[n-2]-a[n-1])))

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)


def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))


def to_bin(x):
    return bin(x)[2:]


def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, input())))
    return li



dp = None

def main():
    N, Z, W = list(map(int, input().split()))
    A = list(map(int, input().split()))

    if N == 1:
        print(abs(A[0] - W))
    else:
        print(max(
            abs(A[-1] - W),
            abs(A[-1] - A[-2])
        ))

main()

Solution (Python):
N,Z,W=map(int, input().split())
cards=[int(i) for i in input().split()]

if N == 1:
    print(abs(cards[0]-W))
elif abs(cards[-1]-W) > abs(cards[-2]-cards[-1]):
    print(abs(cards[-1]-W))
else:
    print(abs(cards[-2]-cards[-1]))

Solution (Python):
N, Z, W = map(int, input().split())
A = list(map(int, input().split()))

if N == 1:
    print(abs(A[-1] - W))
else:
    print(max(abs(A[-1] - W), abs(A[-1] - A[-2])))

Solution (Python):
N, Z, W = list(map(int, input().split()))
a = list(map(int, input().split()))
if N == 1:
    print(abs(a[0] - W))
else :
    print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))

Solution (Python):
N, Z, W = list(map(int, input().split()))
a = list(map(int, input().split()))

if abs(a[N-1] - W) >= abs(a[N-2] - a[N-1]):
    print(abs(a[N-1] - W))
elif abs(a[N-1] - W) <= abs(a[N-2] - a[N-1]):
    print(abs(a[N-2] - a[N-1]))

Solution (Python):
def max(a,b):
	if a>=b:
		return a
	else:
		return b

n,z,w = map(int,input().split())
a = list(map(int,input().split()))
print(max(abs(a[n-1]-w),abs(a[n-1]-a[n-2])))

Solution (Python):
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
if N == 1:
    print(abs(a[0] - W))
elif abs(a[-1] - W) > abs(a[-1] - a[-2]):
    print(abs(a[-1] - W))
else:
    print(abs(a[-1] - a[-2]))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)

a = []
memo = []



def dfs(turn, i):
    global memo, a
    if memo[turn][i] != -1:
        return memo[turn][i]

    ans = 0 if turn == 0 else INF
    for j in range(i + 1, len(a)):
        if j == len(a) - 1:
            s = abs(a[j] - a[i])
        else:
            s = abs(dfs(1 - turn, j))

        
        if turn == 0:
            ans = max(ans, s)
        
        else:
            ans = min(ans, s)

    memo[turn][i] = ans
    return ans


def solve2(N, Z, W):
    global a, memo
    a = [W] + a
    memo = [[-1] * len(a) for _ in range(2)]
    return dfs(0, 0)


def solve(N, Z, W):
    global a
    ans = abs(a[-1] - W)
    if len(a) > 1:
        ans = max(ans, abs(a[-2] - a[-1]))
    return ans


def main():
    global a
    N, Z, W = map(int, input().split())
    a = list(map(int, input().split()))
    print(solve2(N, Z, W))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


def solve(N, Z, W, a):
    ans = abs(a[-1] - W)
    if len(a) > 1:
        ans = max(ans, abs(a[-2] - a[-1]))
    return ans


def main():
    N, Z, W = map(int, input().split())
    a = list(map(int, input().split()))
    print(solve(N, Z, W, a))


if __name__ == '__main__':
    main()

Solution (Python):


n,z,w=map(int,raw_input().split())
a=map(int,raw_input().split())

print max(abs(a[n-1]-w),abs(a[n-1]-a[n-2]))

Solution (Python):


def takeAllByX(z, w, xs):
    return abs(w - xs[-1])

def forceLastByX(z, w, xs):
    return abs(xs[-2] - xs[-1])

def forceLast2ByX(z, w, xs):
    return play2ByY(z, w, xs[-2:])


def takeAllByY(z, w, xs):
    return abs(z - xs[-1])

def forceLastByY(z, w, xs):
    return abs(xs[-2] - xs[-1])

def play2ByY(z, w, xs):
    ta = takeAllByY(z, w, xs)
    fl = forceLastByY(z, w, xs)
    return min(ta, fl)



if __name__ == "__main__":
    n, z, w = list(map(int, input().split()))
    xs = tuple(map(int, input().split()))
    i = len(xs)
    if i == 1:
        print(takeAllByX(z, w, xs))
    elif i == 2:
        print(max(takeAllByX(z, w, xs), forceLastByX(z, w, xs)))
    else:
        print(max(takeAllByX(z, w, xs), forceLastByX(z, w, xs), forceLast2ByX(z, w, xs)))

Solution (Python):


n,z,w=map(int,input().split())
xs=list(map(int,input().split()))
a=abs(w-xs[-1])
if n == 1:
    print(a)
else:
    b=abs(xs[-1]-xs[-2])
    print(max(a,b))

Solution (Python):
n,z,w=[int(i) for i in input().split(' ')]
a=[int(i) for i in input().split(' ')]

if len(a)>1:
  l0=abs(a[-1]-a[-2])
else:
  l0=-1000000000000000000
l1=abs(a[-1]-w)

if l1>l0:
  print(l1)
else:
  print(l0)

Solution (Python):
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

if N >= 2:
    ans = max((abs(W - a[-1]), abs(a[-1] - a[-2])))
    print(ans)
else:
    print(abs(W - a[-1]))

Solution (Python):
w=int(input().split()[-1])
*a,b,c=map(int,[w]+input().split())
print(max(abs(b-c),abs(w-c)))

Solution (Python):



n, z, w = map(int, input().split())
li = list(map(int, input().split()))


if n == 1:
    print(abs(w - li[0]))
else:
    print(max(abs(li[-2] - li[-1]), abs(w - li[-1])))

Solution (Python):
n,z,w = list(map(lambda x:int(x),input().split()))
a = list(map(lambda x: int(x),input().split()))

result1 = abs(w-a[-1])
if len(a) >= 2:
    result2 = abs(a[-2]-a[-1])
else:
    result2 = result1

print(max(result1,result2))

Solution (Python):
N, Z, W = map(int, input().split())
a = [W]
a.extend(map(int, input().split()))
print(max(abs(a[N] - W), abs(a[N] - a[N - 1])))

Solution (Python):
def getNum():
    N,Z,W = map(int,input().split())
    cards = input()
    cards = cards.split()
    return N,Z,W,cards

def cal(N,Z,W,cards):
    if len(cards) > 1:
        cand1 = abs(W - int(cards[-1]))
        cand2 = abs(int(cards[-1]) - int(cards[-2]))
        if cand1 >= cand2:
            print(cand1)
        else:
            print(cand2)
    else:
        print(abs(W - int(cards[-1])))

def main():
    N,Z,W,cards = getNum()
    cal(N,Z,W,cards)

main()

Solution (Python):
n, z, w = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))

if n == 1:
  print(abs(w-a[-1]))
else:
  print(max(abs(w-a[-1]), abs(a[-2]-a[-1])))

Solution (Python):
N, Z, W = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = a[::-1]
b.append(W)
alpha = abs(b[0]-b[1])
beta = abs(b[0]-b[N])
ans = max(alpha,beta)
print(ans)

Solution (Python):
print(lambda n,c:max(abs(n[2]-c[-1]),abs(([n[2]]+c)[-2]-c[-1])))(map(int,raw_input().split()),map(int,raw_input().split()))

Solution (Python):
print (lambda nzw,c: abs(nzw[2]-c[-1]) if nzw[0] == 1 else (abs(nzw[2]-c[-1]) if abs(nzw[2]-c[-1]) > abs(c[-2]-c[-1]) else abs(c[-2]-c[-1])))(map(int, raw_input().split()), map(int, raw_input().split()))

Solution (Python):
N,Z,W = map(int, input().split())

a = list(map(int, input().split()))

if len(a) == 1:
    ans = abs(a[N-1]-W)
else:
    ans = max(abs(a[N-2]-a[N-1]),abs(a[N-1]-W))

print(ans)

Solution (Python):
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]

if x == 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Solution (Python):
N, Z, W = map(int, input().split())
A = list(map(int,input().split()))

if N == 1: print (abs(A[-1]-W))
else: print(max(abs(A[-1]-A[-2]), abs(A[-1]-W)))

Solution (Python):


def main():
    N, Z, W = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))

    if N == 1:
        print(abs(a[N - 1] - W))
    else:
        print(max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])))

if __name__ == '__main__':
    main()

Solution (Python):

N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

ans = abs(a[-1] - W)
if N != 1:
    ans = max(ans, abs(a[-1] - a[-2]))

print(ans)

Solution (Python):
n, z, w = map(int, input().split())
a = list(map(int, input().split()))

print(max(abs(a[n-1]-a[n-2]),abs(a[n-1]-w)))

Solution (Python):
N,Z,W=map(int,raw_input().split())
a=[]
a=map(int,raw_input().split())

if len(a)!=1:
	print max ( abs(a[-1]-W), abs(a[-2]-a[-1]) )
else:
	print abs(a[0]-W)

Solution (Python):
def main():
    N, Z, W = map(int, input().split())
    A = tuple(map(int, input().split()))

    ans = max(abs(A[N-1] - W), abs(A[N-2] - A[N-1]))
    print(ans)

main()

Solution (Python):
N, Z, W = map(int, input().split())
cards = list(map(int, input().split()))

if N == 1:
    print(abs(cards[0] - W))
else:
    print(max(abs(cards[-1] - W), abs(cards[-2] - cards[-1])))

Solution (Python):



from sys import stdin

def solve(a):
  n = len(a)
  xmemo = [0 for i in range(n)]  
  ymemo = [0 for i in range(n)]  

  
  for i in range(n - 2, -1, -1):
    
    f = abs(a[i] - a[n - 1])
    
    xmemo[i] = max([f] + [ymemo[jj] for jj in range(i + 1, n - 1)])
    ymemo[i] = min([f] + [xmemo[jj] for jj in range(i + 1, n - 1)])

  return xmemo[1]

N, Z, W = map(int, stdin.readline().split())
a       = map(int, stdin.readline().split())
if len(a) != N: raise


a = [Z, W] + a

print(solve(a))

Solution (Python):
def D_abs(N, Z, W, A):
    if N == 1:
        
        return abs(A[0] - W)
    else:
        
        
        
        
        return max(abs(A[N - 1] - W), abs(A[N - 1] - A[N - 2]))

N,Z,W = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(D_abs(N, Z, W, A))

Solution (Python):
n, z, w = map(int, input().split())
a = [int(i) for i in input().split()]

ans = max(abs(a[n - 1] - w), abs(a[n - 2] - a[n - 1]))
print(ans)

Solution (Python):


N,Z,W =  map(int,input().split(" "))

a = list(map(int,input().split(" ")))

if N == 1:
	ans = abs(a[-1]-W)
else:
	ans = max(abs(a[-1]-a[-2]),abs(a[-1]-W))


print(ans)

Solution (Python):
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,z,w = Is()
a = Is()
ans = ""
if n == 1:
    ans = abs(a[n-1]-w)
else:
    ans = max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]))
print(ans)

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(n) for n in input().split()]

if N == 1:
    ans = abs(a[-1] - W)
else:
    ans = max(abs(a[-1] - W), abs(a[-1] - a[-2]))
print(ans)

Solution (Python):
n, z, w = [int(x) for x in raw_input().split()]
c = [int(x) for x in raw_input().split()]
if abs(c[n - 1] - w) > abs(c[n - 1] - c[n - 2]):
    print abs(c[n - 1] - w)
else:
    print abs(c[n - 1] - c[n - 2])

Solution (Python):
def alphabeta(a, X, Z, W, alpha, beta):
    if len(a) == 0:
        return abs(Z-W)
    if X:
        for i in reversed(range(len(a))):
            Z = a[i]
            alpha = max(alpha, alphabeta(a[i+1:len(a)], not X, Z, W, alpha, beta))
            if alpha >= beta:
                return beta
        return alpha
    else:
        for i in reversed(range(len(a))):
            W = a[i]
            beta = min(beta, alphabeta(a[i+1:len(a)], not X, Z, W, alpha, beta))
            if alpha >= beta:
                return alpha
        return beta

N, Z, W = tuple(map(int, input().split()))
a = list(map(int, input().split()))
print(alphabeta(a, True, Z, W, 0, 2e9))

Solution (Python):
N, Z, W = map(int, input().split())
a = [int(i) for i in input().split()]
if len(a) > 1:
    print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))
else:
    print(abs(a[-1] - W))

Solution (Python):
import numpy as np
n, z, w = map(int, input().split())
tmp = list(map(int, input().split()))
a = np.array(tmp)

if len(a) == 1:
    score = abs(a[0] - w)
else:
    score = max(abs(a[-2] - a[-1]), abs(a[-1] - w))

print(score)

Solution (Python):
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
a = a[::-1]
if N == 1:
    print(abs(a[0]-W))
elif abs(a[0]-a[1]) > abs(a[0] - W):
    print(abs(a[0]-a[1]))
else:
    print(abs(a[0] - W))

Solution (Python):
A, B, C =  map(int, input().split())
M = list(map(int, input().split()))

if abs(M[A-1] - M[A-2]) >= abs(M[A-1] - C):
    print(abs(M[A-1] - M[A-2]))
else:
    print(abs(M[A-1] -C))

Solution (Python):
N,Z,W = map(int,input().split())
a = list(map(int,input().split()))

std = abs(Z-W)
last = a[N-1]

absList = [abs(last-i) for i in a]
absList.pop(N-1)
ans = max(abs(last-W), abs(last-a[N-2]))
for i in range(N-1):
	testList = absList[i+1:]
	if min(absList) > ans:
		ans = max(absList)
print(ans)

Solution (Python):


n, z, w = map(int,input().split())
a = list(map(int,input().split()))

ans = []
ans.append( abs( a[-1] - w ) )
if len(a) > 1: ans.append( abs( a[-1] - a[-2] ) )

print(max(ans))

Solution (Python):
import sys
line = sys.stdin.readline().strip()
n, z, w = map(int, line.split()[:3])
line = sys.stdin.readline().strip()
a = list(map(int, line.split()[:n]))



if n > 2:
  result = max(
    abs(a[-1] - w),
    abs(a[-2] - a[-1])
  )
else:
  result = abs(a[-1] - w)

print(result)

Solution (Python):


n, z, w = list(map(int,input().split()))
a = list(map(int,input().split()))

if(n==1):
    print(abs(a[0]-w))
else:
    print(max(abs(a[-2]-a[-1]),abs(a[-1]-w)))

Solution (Python):
N,Z,W = map(int, raw_input().split(" "))
cards = map(int, raw_input().split(" "))

if abs(cards[N-1]-W) >= abs(cards[N-1] - cards[N-2]):
    print abs(cards[N-1]-W)
else:
    print abs(cards[N-1] - cards[N-2])

Solution (Python):
if __name__ == '__main__':
    N, Z, W = map(int, input().split())
    a = list(map(int, input().split()))

    if N == 1:
        print(abs(W - a[-1]))
    else:
        print(max(abs(W - a[-1]), abs(a[-2] - a[-1])))

Solution (Python):
a = list(map(int, input().split()))
b = list(map(int, input().split()))
try:
    print(max(abs(a[2] - b[-1]), abs(b[-1] - b[-2])))
except:
    print(abs(a[2] - b[0]))

Solution (Python):



def main():
    n, z, w = list(map(int, input().split()))
    As = list(map(int, input().split()))
    if len(As) > 1:
        answer = max(abs(w - As[-1]), abs(As[-1] - As[-2]))
    else:
        answer = abs(w-As[-1])
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
n, z, w = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    ans = abs(a[0] - w)
else:
    a1 = abs(a[-1] - w)
    a2 = abs(a[-2] - a[-1])
    ans = max(a1, a2)

print(ans)

Solution (Python):
import sys
import math

S = list(map(int,input().split()))

A = list(map(int,input().split()))

X=S[1]
Y=S[2]

if S[0]==1:
	print(int(math.fabs(A[-1]-Y)))
else:
	r1=math.fabs(A[-1]-Y)
	r2=math.fabs(A[-2]-A[-1])

	if r1<r2:
		print(int(r2))
	else:
		print(int(r1))

Solution (Python):
n,z,w = [int(i) for i in input().split()]
a = list(int(i) for i in input().split())

abs1 = abs(a[n-1] - w)
abs2 = abs(a[n-2]-a[n-1])
print(max(abs1,abs2))

Solution (Python):




 
import numpy as np
import bisect

N , Z ,W = input().split()
N = int(N)
Z = int(Z)
W = int(W)
a = input().split()
a = [int(i) for i in reversed(a)]

if N == 1 : 
    print(np.abs(W - a[0]))
else : 
    rst = [ np.abs(W - a[0]) , np.abs(a[1] - a[0]) ]
    print(np.max(rst))

Solution (Python):
from sys import stdin, stdout
def IL():return list(map(int, stdin.readline().split()))

def main():
    N,Z,W = IL()
    a = IL()
    if len(a)>1:
        p=abs(a[-2] - a[-1])
        q=abs(a[-1] - W)
        print(max(p,q))
    else:
        print(abs(a[0]-W))
        
if __name__ == "__main__": main()