Problem:
 Score : 500 points    Problem Statement There are N points on the 2D plane, i -th of which is located on (x_i, y_i) .
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?  Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j| .      Constraints  2 \leq N \leq 2 \times 10^5  1 \leq x_i,y_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  x_1  y_1  x_2  y_2  :  x_N  y_N       Output Print the answer.        Sample Input 1 3
1 1
2 4
3 2      Sample Output 1 4  The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4 , which is maximum possible.       Sample Input 2 2
1 1
1 1      Sample Output 2 0

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    N = int(input())
    xy = [0] * N
    d = {}
    offset = 0
    mina = 10 ** 9
    minb = 2 * (10 ** 9 + 1)
    maxa = -10 ** 9 -1
    maxb = 2
    for n in range(N):
        x, y = [int(x) for x in input().strip().split()]
        if (x, y) in d:
            offset += 1
            continue
        d[(x, y)] = 1
        a, b = y - x, y + x
        xy[n-offset] = (x, y, a, b)
        mina = min(mina, a)
        minb = min(minb, b)
        maxa = max(maxa, a)
        maxb = max(maxb, b)
    
    print(max(maxa-mina, maxb-minb))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = []; b = []
for i in range(n):
    x, y = map(int, input().split())
    a.append(x+y); b.append(x-y)
print(max(max(a)-min(a), max(b)-min(b)))

Solution (Python):
N = int(input())

x_list = []
y_list = []
for i in range(N):
    x, y = map(int, input().split())
    x_list.append(x)
    y_list.append(y)

ans_max_p = 0
ans_min_p = 2*10**9+1
ans_max_n = 0
ans_min_n = 2*10**9+1
ans = 0

for i in range(N):
    ans_min_p = min(ans_min_p, x_list[i] + y_list[i])
    ans_max_p = max(ans_max_p, x_list[i] + y_list[i])
    ans_min_n = min(ans_min_n, -1*x_list[i] + y_list[i])
    ans_max_n = max(ans_max_n, -1*x_list[i] + y_list[i])
    
ans_p = ans_max_p - ans_min_p
ans_n = ans_max_n - ans_min_n
ans = max(ans_p, ans_n)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
C = [list(map(int,input().split())) for i in range(n)]

a = 2*10**9+5
b = -2*10**9+5
c = 2*10**9+5
d = -2*10**9+5

for i in range(n):
    a = min(a, C[i][0]+C[i][1])
    b = max(b, C[i][0]+C[i][1])
    c = min(c, C[i][0]-C[i][1])
    d = max(d, C[i][0]-C[i][1])

print(max(b-a,d-c))

Solution (Python):
n = int(input())
pp = []
pm = []
mp = []
mm = []

for i in range(n):
    x, y = list(map(int, input().split()))
    pp.append(x + y)
    pm.append(x - y)
    mp.append(-x + y)
    mm.append(-x - y)

max_pp = max(pp)
min_pp = min(pp)
max_pm = max(pm)
min_pm = min(pm)
max_mp = max(mp)
min_mp = min(mp)
max_mm = max(pm)
min_mm = min(pm)

max_val = max(max_pp - min_pp, max_pm - min_pm, max_mp - min_mp, max_mm - min_mm)
print(max_val)

Solution (Python):
n = int(input())
s = []
m = []
for i in range(n):
  a, b = map(int, input().split())
  s.append(a+b)
  m.append(a-b)
print(max(max(s)-min(s), max(m)-min(m)))

Solution (Python):
n=int(input())
a=[]
b=[]

for i in range(n):
    x,y=list(map(int,input().split()))
    a.append(x+y)
    b.append(x-y)

mnp=min(a)
mxp=max(a)
mnm=min(b)
mxm=max(b)

res=[mxp-mnp,mxm-mnm,mnm,mxm,mnp-mxp]
print(max(res))

Solution (Python):
n = int(input())
x,y = map(int,input().split())
max_xpy = x+y
min_xpy = x+y
max_xmy = x-y
min_xmy = x-y
for i in range(n-1):
  x,y = map(int,input().split())
  max_xpy = max(max_xpy,x+y)
  min_xpy = min(min_xpy,x+y)
  max_xmy = max(max_xmy,x-y)
  min_xmy = min(min_xmy,x-y)
print(max(max_xpy-min_xpy,max_xmy-min_xmy))

Solution (Python):
n = int(input())
answer1 = 0
answer2 = 0
answer = 0
a = [0]*n
b = [0]*n
x = 0
y = 0
for i in range(n):
  x,y = map(int,input().split())
  a[i] = x-y
  b[i] = x+y
answer1 = max(a)-min(a)
answer2 = max(b)-min(b)
print(max(answer1,answer2))

Solution (Python):

import sys

def s(points, k, l):
    np = list(map(lambda arg:  k*arg[0] + l*arg[1], points))
    return abs(max(np)-min(np))

def solve(N: int, x: "List[int]", y: "List[int]"):
    points = list(zip(x, y))
    print(max([
            s(points, +1, +1),
            s(points, -1, -1),
            s(points, +1, -1),            
            s(points, -1, +1),            
    ]))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    x = [int()] * (N)  
    y = [int()] * (N)  
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
p=[]
for i in range(n):
    p.append(list(map(int,input().split())))
a=[]
b=[]
for i in range(n):
    a.append(p[i][0]+p[i][1])
    b.append(p[i][0]-p[i][1])
a.sort()
b.sort()
print(max(a[n-1]-a[0],b[n-1]-b[0]))

Solution (Python):
n=int(input())
D=0
d=10**10
f=10**10
F=-10**10
for i in range(n):
    x,y=[int(x) for x in input().split()]
    l=x+y
    d=min(d,l)
    D=max(D,l)
    if y-x<f:
        m=[x,y]
        f=y-x
    if y-x>F:
        M=[x,y]
        F=y-x
e=abs(m[0]-M[0])+abs(m[1]-M[1])
ans=max(D-d,e)
print(ans)

Solution (Python):

n=int(input())
lx=[]
ly=[]
for i in range(n):
  x,y=map(int,input().split())
  lx.append(x+y)
  ly.append(x-y)
ax,bx,ay,by=max(lx),min(lx),max(ly),min(ly)
print(max(ax-bx,ay-by))

Solution (Python):
N = int(input())
Y_MAX = 0
X_MAX = 0
Y_MIN = 1000000000000
X_MIN = 1000000000000

for i in range(N):
    x, y = map(int, input().split())
    if abs(0 - x) + abs(y - 1000000000000) > Y_MAX:
        Y_MAX = abs(0 - x) + abs(y - 1000000000000)
    if abs(0 - x) + abs(y - 1000000000000) < Y_MIN:
        Y_MIN = abs(0 - x) + abs(y - 1000000000000)
    if abs(0 - x) + abs(0 - y) > X_MAX:
        X_MAX = abs(0 - x) + abs(0 - y)
    if abs(0 - x) + abs(0 - y) < X_MIN:
        X_MIN = abs(0 - x) + abs(0 - y)

print(max(Y_MAX - Y_MIN, X_MAX - X_MIN))

Solution (Python):
import sys
N=int(sys.stdin.readline().strip())
XY=[ map(int, sys.stdin.readline().split()) for _ in range(N) ]
X=[]
Y=[]
for x,y in XY:
    X.append(x-y)
    Y.append(x+y)
X.sort()
Y.sort()
print max(abs(X[0]-X[-1]),abs(Y[0]-Y[-1]))

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    x, y = MI()
    x1 = x
    x2 = x
    x3 = x
    x4 = x
    y1 = y
    y2 = y
    y3 = y
    y4 = y
    for _ in range(n-1):
        x, y = MI()
        if x+y > x1+y1:
            x1 = x
            y1 = y
        if -x+y > -x2+y2:
            x2 = x
            y2 = y
        if -x-y > -x3-y3:
            x3 = x
            y3 = y
        if x-y > x4-y4:
            x4 = x
            y4 = y
    temp = [abs(x1-x2)+abs(y1-y2), abs(x1-x3)+abs(y1-y3), abs(x1-x4)+abs(y1-y4), abs(x2-x3)+abs(y2-y3), abs(x2-x4)+abs(y2-y4), abs(x3-x4)+abs(y3-y4)]
    ans = max(temp)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
if x1+y1 > x2+y2:
    max1 = x1+y1
    min1 = x2+y2
else:
    max1 = x2+y2
    min1 = x1+y1

if x1-y1 > x2-y2:
    max2 = x1-y1
    min2 = x2-y2
else:
    max2 = x2-y2
    min2 = x1-y1

for i in range(N-2):
    x, y = map(int, input().split())
    if x+y > max1:
        max1 = x+y
    elif x+y < min1:
        min1 = x+y
    
    if x-y > max2:
        max2 = x-y
    elif x-y < min2:
        min2 = x-y


ans = print(max((max1-min1),(max2-min2)))

Solution (Python):
N=int(input())

P=[tuple(map(int,input().split())) for _ in [0]*N]

xM,yM,xm,ym=-3*10**9,-3*10**9,-3*10**9,-3*10**9
xM_list,xm_list,yM_list,ym_list=[],[],[],[]

for i in range(N):
    x,y=P[i]
    nr=(x+y,x-y,-x+y,-x-y)
    
    if xM<nr[0]:
        xM=nr[0]
        xM_list=[P[i]]
    elif xM==nr[0]:
        xM_list.append(P[i])
    if xm<nr[1]:
        xm=nr[1]
        xm_list=[P[i]]
    elif xm==nr[1]:
        xm_list.append(P[i])
    if yM<nr[2]:
        yM=nr[2]
        yM_list=[P[i]]
    elif yM==nr[2]:
        yM_list.append(P[i])
    if ym<nr[3]:
        ym=nr[3]
        ym_list=[P[i]]
    elif ym==nr[3]:
        ym_list.append(P[i])

xm_list.sort(lambda x:x[1])
xM_list.sort(lambda x:x[1])
ym_list.sort(lambda x:x[0])
yM_list.sort(lambda x:x[0])


goodP=[]

if len(xm_list)>1:
    goodP.append(xm_list[-1])
    goodP.append(xm_list[0])
else:
    goodP.append(xm_list[0])
if len(xM_list)>1:
    goodP.append(xM_list[-1])
    goodP.append(xM_list[0])
else:
    goodP.append(xM_list[0])
if len(ym_list)>1:
    goodP.append(ym_list[-1])
    goodP.append(ym_list[0])
else:
    goodP.append(ym_list[0])
if len(yM_list)>1:
    goodP.append(yM_list[-1])
    goodP.append(yM_list[0])
else:
    goodP.append(yM_list[0])

res=[]
for i in range(len(goodP)):
    for j in range(len(goodP)):
        if not i<j:
            continue
        res.append(abs(goodP[i][0]-goodP[j][0])+abs(goodP[i][1]-goodP[j][1]))
print(max(res))

Solution (Python):
N = int(input())
z = [0]*N
w = [0]*N
for n in range(N):
  x,y = map(int, input().split())
  z[n] = x + y
  w[n] = x - y
print(max(max(z)-min(z),max(w)-min(w)))

Solution (Python):
n=int(input())
a=[]
b=[]

for i in range(n):
    x,y=list(map(int,input().split()))
    a.append(x+y)
    b.append(x-y)

aaa=min(a)
aaaa=max(a)
bbb=min(b)
bbbb=max(b)

ans=[]

ans.append(aaaa-aaa)
ans.append(bbbb-bbb)
ans.append(bbb)
ans.append(bbbb)
ans.append(aaa-aaaa)

res=max(ans)
print(res)

Solution (Python):
N = int(input())
p = []
for _ in range(N):
    x, y = map(int, input().split())
    p.append((x, y))
p = sorted(p, key=lambda i: i[0] + i[1])
x1, y1 = p[0]
x2, y2 = p[-1]
res = abs((x1 + y1) - (x2 + y2))
p = sorted(p, key=lambda i: i[0] - i[1])
x1, y1 = p[0]
x2, y2 = p[-1]
res = max(abs((x1 - y1) - (x2 - y2)), res)
print(res)

Solution (Python):

import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def manhattan(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])


n = I()

points = set()
hmin = 10 ** 9
wmin = 10 ** 9
hmax = -(10 ** 9)
wmax = -(10 ** 9)
for _ in range(n):
    x, y = MI()
    points.add((x, y))
    hmin = min(hmin, y)
    hmax = max(hmax, y)
    wmin = min(wmin, x)
    wmax = max(wmax, x)

max_dist = manhattan((wmin, hmin), (wmax, hmax))
hs = max_dist
ms = max_dist
mu = max_dist
hu = max_dist
for p in points:
    hs = min(hs, manhattan((wmin, hmin), p))
    ms = min(ms, manhattan((wmax, hmin), p))
    mu = min(mu, manhattan((wmax, hmax), p))
    hu = min(hu, manhattan((wmin, hmax), p))

print(max_dist - min(hs + mu, hu + ms))

Solution (Python):
N = int(input())

M = 10**9

x,y = map(int, input().split())
r = (x,y)
l = (x,y)
u = (x,y)
d = (x,y)

for i in range(N-1):
    x,y = map(int, input().split())
    if abs(x-0)+abs(y-0)<abs(l[0]-0)+abs(l[1]-0):
        l = (x,y)
    if abs(x-M)+abs(y-0)<abs(r[0]-M)+abs(r[1]-0):
        r = (x,y)
    if abs(x-0)+abs(y-M)<abs(u[0]-0)+abs(u[1]-M):
        u = (x,y)
    if abs(x-M)+abs(y-M)<abs(d[0]-M)+abs(d[1]-M):
        d = (x,y)

print(max(
    abs(l[0]-r[0])+abs(l[1]-r[1]),
    abs(l[0]-u[0])+abs(l[1]-u[1]),
    abs(l[0]-d[0])+abs(l[1]-d[1]),
    abs(r[0]-u[0])+abs(r[1]-u[1]),
    abs(r[0]-d[0])+abs(r[1]-d[1]),
    abs(u[0]-d[0])+abs(u[1]-d[1]),
))

Solution (Python):
N = int(input())
x = [] * N
y = [] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    x.append(a)
    y.append(b)
d = 0
ma = x[0] + y[0]
ima = 0
mi = x[0] + y[0]
imi = 0
for i in range(N):
    if x[i] + y[i] < mi:
        mi = x[i] + y[i]
        imi = i
    if x[i] + y[i] > ma:
        ma = x[i] + y[i]
        ima = i
d1 = abs(x[ima] - x[imi]) + abs(y[ima] - y[imi])
ma = - x[0] + y[0]
ima2 = 0
mi = - x[0] + y[0]
imi2 = 0
for i in range(N):
    if -x[i] + y[i] < mi:
        mi = -x[i] + y[i]
        imi2 = i
    if -x[i] + y[i] > ma:
        ma = -x[i] + y[i]
        ima2 = i
d2 = abs(x[ima2] - x[imi2]) + abs(y[ima2] - y[imi2])
if d1 > d2:
    print(d1)
else:
    print(d2)

Solution (Python):
def main():
    point_count = int(input())
    inf = 10 ** 10
    max_sum, min_sum, max_diff, min_diff = - inf, inf,  - inf, inf
    for _ in range(point_count):
        x, y = [int(x) for x in input().split()]
        max_sum = max(x + y, max_sum)
        min_sum = min(x + y, min_sum)
        max_diff = max(x - y, max_diff)
        min_diff = min(x - y, min_diff)
    return max(max_sum - min_sum, max_diff - min_diff)


if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())
ori = []
tra = []
for i in range(n):
    x,y = map(int,input().split())
    ori.append((x,y))
    tra.append((x+y,x-y))

i_maxu = None
i_minu = None
maxu = None
minu = None
i_maxv = None
i_minv = None
maxv = None
minv = None
for i,(u,v) in enumerate(tra):
    if maxu is None or u > maxu:
        maxu = u
        i_maxu = i
    if maxv is None or v > maxv:
        maxv = v
        i_maxv = i
    if minu is None or u < minu:
        minu = u
        i_minu = i
    if minv is None or v < minv:
        minv = v
        i_minv = i

if maxu - minu > maxv - minv:
    i,j = i_minu,i_maxu
else:
    i,j = i_minv,i_maxv

x1,y1 = ori[i]
x2,y2 = ori[j]
print( abs(x1-x2) + abs(y1-y2) )

Solution (Python):
N = int(input())
A = 0
Xmin = Ymin = 3e9 + 5
Xmax = Ymax = -3e9 - 5
for _ in range(N):
    x, y = map(int, input().split())
    X = x + y
    Y = x - y
    Xmin = min(Xmin, X)
    Xmax = max(Xmax, X)
    Ymin = min(Ymin, Y)
    Ymax = max(Ymax, Y)
if Xmin == 3e9 + 5:
    Xmin = Xmax
if Ymin == 3e9 + 5:
    Ymin = Ymax
if Xmax == -3e9 - 5:
    Xmax = Xmin
if Ymax == -3e9 -5:
    Ymax = Ymin
Z = max(Xmax - Xmin, Ymax - Ymin)
print(Z)

Solution (Python):
N = int(input())
points = [list(map(int, input().split())) for _ in range(N)]
INF = 10**10
xmax = -INF
xmin = INF
ymax = -INF
ymin = INF
for x, y in points:
  minus = x-y
  plus = x+y
  xmax = max(xmax, minus)
  xmin = min(xmin, minus)
  ymax = max(ymax, plus)
  ymin = min(ymin, plus)
print(max(xmax-xmin, ymax-ymin))

Solution (Python):
n=int(input())
xy_1 = [0]*n
xy_2 = [0]*n
for i in range(n):
  x,y = map(int,input().split())
  xy_1[i] = x + y
  xy_2[i] = x - y

print(max(max(xy_1) - min(xy_1), max(xy_2)-min(xy_2)))

Solution (Python):
n = int(input().rstrip())
xmax = -10_000_000_000
xmin = 10_000_000_000
ymax = -10_000_000_000
ymin = 10_000_000_000
for i in range(n):
    x, y = map(int,input().split())
    xpy = x+y
    xmy = x-y
    xmax = max(xpy,xmax)
    xmin = min(xpy,xmin)
    ymax = max(xmy,ymax)
    ymin = min(xmy,ymin)
print(max(xmax-xmin,ymax-ymin))

Solution (Python):
n = int(input())
X = []
Y = []
for i in range(n):
    x,y = map(int, input().split())
    x,y = x-y,x+y
    X.append(x)
    Y.append(y)

a = max(Y) - min(Y)
b = max(X) - min(X)

print(max(a,b))

Solution (Python):
n = int(input())
maxPlus, minPlus, maxMinus, minMinus = 0, 10**9 , -10**9, 10**9
for _ in range(n):
    x, y = map(int, input().split())
    maxPlus = max(x + y, maxPlus)
    minPlus = min(x + y, minPlus)
    maxMinus = max(x - y, maxMinus)
    minMinus = min(x - y, minMinus)
print(max(abs(maxPlus - minPlus), abs(maxMinus - minMinus)))

Solution (Python):

N=int(input())
x=[0 for i in range(N)]
y=[0 for i in range(N)]

Cx=[0 for i in range(N)]
Cy=[0 for i in range(N)]

for i in range(N):
    x[i],y[i]=map(int,input().split())
    Cx[i]=x[i]+y[i]
    Cy[i]=x[i]-y[i]
    
ans=max(max(Cx)-min(Cx),max(Cy)-min(Cy))
print(ans)

Solution (Python):
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

for i in range(n):
  buf = x[i]
  x[i] = x[i]+y[i]
  y[i] = buf-y[i]

dx = max(x) - min(x)
dy = max(y) - min(y)
  
print(max(dx,dy))

Solution (Python):
n = int(input())
a = []
b = []
c = []
d = []
for i in range(n):
  x, y = map(int, input().split(' '))
  a.append(x + y)
  b.append(x - y)
  c.append(-x + y)
  d.append(-x - y)
  
l = [a, b, c, d]

ans = 0
for i in range(4):
  mi = l[i][0]
  for j in range(n):
    mi = min(mi, l[i][j])
    ans = max(ans, l[i][j] - mi)

print(ans)

Solution (Python):
N = int(input())

f0 = []
f1 = []
for _ in range(N):
    x, y = list(map(int, input().split()))
    f0.append(x-y)
    f1.append(x+y)
max_0 = max(f0)
max_1 = max(f1)
min_0 = min(f0)
min_1 = min(f1)
print(max(max_0-min_0, max_1-min_1))

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
xy = [[int(i) for i in input().split()] for _ in range(N)]

d1 = []
d2 = []
for x, y in xy :
  d1.append(x + y)
  d2.append(x - y)

d1.sort(reverse=True)
d2.sort(reverse=True)

print(max(
  d1[0] - d1[-1],
  d2[0] - d2[-1],
))

Solution (Python):
N = int (input())
x = []*N
y = []*N
for i in range (N):
    a,b = list(map(int,input().split()))
    x.append(a)
    y.append(b)
syou = x[0]+y[0]
dai = x[0]+y[0]
for i in range (N):
    if x[i]+y[i]>dai:
        dai = x[i]+y[i]
    if x[i]+y[i]<syou:
        syou = x[i]+y[i]
ans = dai - syou
gyakusyou = 10**9 -x[i] +y[i]
gyakudai = 10**9 -x[i] + y[i]
for i in range (N):
    if 10**9 -x[i] +y[i]>gyakudai:
        gyakudai = 10**9 -x[i] +y[i]
    if 10**9 -x[i] +y[i]<gyakusyou:
        gyakusyou = 10**9 -x[i] +y[i]
if gyakudai - gyakusyou > ans:
    ans = gyakudai - gyakusyou
print (ans)

Solution (Python):
n = int(input())
p = []
for _ in range(n):
    x,y = map(int,input().split())
    p += [(x,y)]
p.sort()


def dist(p1, p2):
    return abs(p1[0]-p2[0]) + abs(p1[1]-p2[1])


ans = 0
q = set()
pmax = p[0]
pmin = p[0]
for i in range(1, n):
    for point in q:
        ans = max(ans, dist(point, p[i]))
    ans = max(ans, dist(p[i], pmax), dist(p[i], pmin))
    if pmax[1] < p[i][1]:
        q.add(pmax)
        pmax = p[i]
    if pmin[1] > p[i][1]:
        q.add(pmin)
        pmin = p[i]

    qrem = set()
    for point in q:
        if pmin[0]-point[0] <= point[1]-pmin[1] and pmax[0]-point[0] <= pmax[1]-point[1]:
            qrem.add(point)
    q -= qrem

print(ans)

Solution (Python):
N = int(input())
i = []
j = []
for k in range(N):
    x, y = map(int, input().split())
    i.append(x+y)
    j.append(x-y)

print(max(max(i)-min(i), max(j)-min(j)))

Solution (Python):
import numpy as np

N = int(input())
XY_set = np.array(list(set(tuple(map(int, input().split())) for _ in range(N))))

XpY = XY_set[:, 0] + XY_set[:, 1]
XmY = XY_set[:, 0] - XY_set[:, 1]

ans = max(XpY.max() - XpY.min(), XmY.max() - XmY.min())
print(ans)

Solution (Python):
def main():
    N = int(input())
    points = [list(map(int, input().split())) for _ in range(N)]
    ks = [x + y for x, y in points]
    ls = [x - y for x, y in points]
    kk = max(ks) - min(ks)
    ll = max(ls) - min(ls)
    print(max(kk, ll))


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

p1 = []
p2 = []
p3 = []

for i in range(N):
    p1.append(xy[i][0] + xy[i][1])
    p2.append(xy[i][0] - xy[i][1])
    p3.append(-xy[i][0] + xy[i][1])

p1_r = max(p1) - min(p1)
p2_r = max(p2) - min(p2)
p3_r = max(p3) - min(p3)

print(max(p1_r, p2_r, p3_r))

Solution (Python):
n=int(input())
p=[]
m=[]
bb=0
tt=False
for i in range(n):
    x,y=list(map(int,input().split()))
    p.append(x+y)
    m.append(x-y)
    bb+=1

minp=min(p)
maxp=max(p)
minm=min(m)
maxm=max(m)

ans=[maxp-minp,maxm-minm,minm,maxm,minp-maxp]
print(max(ans))

Solution (Python):
N = int(input())
Array1 = []
Array2 = []

for i in range(N):
    next_x, next_y = map(int, input().split())
    s = next_x + next_y
    t = next_x - next_y
    Array1.append(s)
    Array2.append(t)

print(max(max(Array1)-min(Array1),max(Array2)-min(Array2)))

Solution (Python):
from math import sqrt

N = int(input())
ps = set()
for _ in range(N):
  ps.add(tuple(map(int, input().split())))
ps = list(ps)
ps.sort()

def cross3(a, b, c):
  return (b[0]-a[0])*(c[1]-a[1]) - (b[1]-a[1])*(c[0]-a[0])

def cross(a, b, c, d):
  return (b[0]-a[0])*(d[1]-c[1]) - (b[1]-a[1])*(d[0]-c[0])


def convex_hull(ps):
  qs = []
  N = len(ps)
  for p in ps:
    
    while len(qs) > 1 and cross3(qs[-1], qs[-2], p) > 0:
      qs.pop()
    qs.append(p)
  t = len(qs)
  for i in range(N-2, -1, -1):
    p = ps[i]
    while len(qs) > t and cross3(qs[-1], qs[-2], p) > 0:
      qs.pop()
    qs.append(p)
  return qs



def dist(a, b):
  return abs(a[0]-b[0]) + abs(a[1]-b[1])

def rotating_calipers(ps):
  qs = convex_hull(ps)
  n = len(qs)
  if n == 2:
    return dist(qs[0], qs[1])
  i = j = 0
  for k in range(n):
    if qs[k] < qs[i]: i = k
    if qs[j] < qs[k]: j = k
  res = 0
  si = i; sj = j
  while i != sj or j != si:
    res = max(res, dist(qs[i], qs[j]))
    if cross(qs[i], qs[i-n+1], qs[j], qs[j-n+1]) < 0:
      i = (i + 1) % n
    else:
      j = (j + 1) % n
  return res

if len(ps) == 1:
  print(0)
elif len(ps) == 2:
  print(dist(ps[0], ps[1]))
else:
  print(rotating_calipers(ps))