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):
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range;R=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def MI():return map(int,input().split())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def NLI(n):return [[int(i) for i in input().split()] for i in range(n)]
def NLI_(n):return [[int(i)-1 for i in input().split()] for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def RLI(n=8,a=1,b=10):return [random.randint(a,b)for i in range(n)]
def RI(a=1,b=10):return random.randint(a,b)
def INP():
    N=10;A=10
    n=random.randint(1,N)
    a=[random.randint(1,A) for i in range(n)]
    return n,a
def Rtest(T):
    case,err=0,0
    for i in range(T):
        inp=INP()
        a1=naive(*inp)
        a2=solve(*inp)
        if a1!=a2:
            print((a1,a2),inp)
            err+=1
        case+=1
    print('Tested',case,'case with',err,'errors')
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'
    
    mp=[boundary]*(w+2);found={}
    for i in R(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in R(base**n):s=[tb//(base**bt)%base for bt in R(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7

inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase

read=sys.stdin.buffer.read;readline=sys.stdin.buffer.readline;input=lambda:sys.stdin.readline().rstrip()


class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True



n=I()
p=[]
m=[]

for i in range(n):
    x,y=LI()
    p+=[x+y]
    m+=[x-y]

ans=max(max(p)-min(p),max(m)-min(m))
print(ans)

Solution (Python):



from math import *
from copy import *                      
from heapq import *                     
from string import *                    
from random import *                    
from bisect import *                    
from sys import stdin                   
from sys import maxsize                 
from operator import *                  
from itertools import *                 
from decimal import Decimal             
from collections import Counter         
from collections import defaultdict     

'''
3
1 1
2 4
3 2
'''

def solve(l):
	n = len(l)
	d = defaultdict(int)
	l1,l2,l3 = [],[],[]
	for x,y in l:
		l1.append(x+y)
		l2.append(x-y)
		l3.append(y-x)
	a = abs(max(l1) - min(l1))
	b = abs(max(l2) - min(l2))
	c = abs(max(l3) - min(l3))
	return max(a,b,c)

N = int(stdin.readline())
L = []
for i in range(N):
	a,b = map(int, input().split())
	L.append([a,b])
ans = solve(L)
print(ans)

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)


A.sort()
B.sort()

print(max(abs(A[0]-A[-1]),abs(B[0]-B[-1])))

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

xpys = [x + y for x, y in xys]
dist1 = max(xpys) - min(xpys)
xmys = [x - y for x, y in xys]
dist2 = max(xmys) - min(xmys)
print(max(dist1, dist2))

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    p = LIR(n)
    r = [(x+y,x-y) for x,y in p]
    mx = [float("inf"),float("inf")]
    my = [float("inf"),float("inf")]
    Mx = [-float("inf"),float("inf")]
    My = [float("inf"),-float("inf")]
    for X,Y in r:
        if X < mx[0]:
            mx = [X,Y]
        if Y < my[1]:
            my = [X,Y]
        if Mx[0] < X:
            Mx = [X,Y]
        if My[1] < Y:
            My = [X,Y]
    ans = 0
    for X,Y in r:
        x = (X+Y)//2
        y = (X-Y)//2
        for A,B in (mx,my,Mx,My):
            a = (A+B)//2
            b = (A-B)//2
            d = abs(x-a)+abs(y-b)
            if ans < d:
                ans = d
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
que= [[]for i in range(2)]
for i in range(N):
    x,y = map(int,input().split())
    que[0].append(x-y)
    que[1].append(x+y)
que[0].sort()
que[1].sort()
ans = max(que[0][-1]-que[0][0],que[1][-1]-que[1][0])
print(ans)

Solution (Python):

"""

xを小さい順に見ていく
あるY以下で-x-yが最大のものと, -x+yが最大の物を保持
Yを座圧しておく
→セグ木

"""



class SegTree:

    def __init__(self,N,first):
        self.NO = 2**(N-1).bit_length()
        self.First = first
        self.data = [first] * (2*self.NO)

    def calc(self,l,r):
        return max(l,r)

    def update(self,ind,x):
        ind += self.NO - 1
        self.data[ind] = max( x , self.data[ind] )
        while ind >= 0:
            ind = (ind - 1)//2
            self.data[ind] = self.calc(self.data[2*ind+1],self.data[2*ind+2])

    def query(self,l,r):
        L = l + self.NO
        R = r + self.NO
        s = self.First
        while L < R:
            if R & 1:
                R -= 1
                s = self.calc(s , self.data[R-1])
            if L & 1:
                s = self.calc(s , self.data[L-1])
                L += 1
            L >>= 1
            R >>= 1
        return s

from sys import stdin
N = int(stdin.readline())

xy = []
dic = {}
lis = []
for i in range(N):

    x,y = map(int,stdin.readline().split())
    xy.append((x,y))

    if y not in dic:
        dic[y] = 0
        lis.append(y)

xy.sort()
lis.sort()
for i in range(len(lis)):
    dic[lis[i]] = i

LT = SegTree(len(lis),float("-inf"))
RT = SegTree(len(lis),float("-inf"))
ans = 0

for X,Y in xy:

    ans = max(ans , X+Y+LT.query(0,dic[Y]+1))
    ans = max(ans , X-Y+RT.query(dic[Y],len(lis)))

    LT.update(dic[Y] , -X-Y )
    RT.update(dic[Y] , -X+Y )

print (ans)

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))


 

N = I()
x,y = LIR(N,2)

max1 = -float('inf')
min1 = float('inf')
for i in range(N):
    max1 = max(max1,x[i]-y[i])
    min1 = min(min1,x[i]-y[i])

max2 = -float('inf')
min2 = float('inf')
for i in range(N):
    max2 = max(max2,x[i]+y[i])
    min2 = min(min2,x[i]+y[i])

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

Solution (Python):
n=int(input())
arr1=[]
arr2=[]
for i in range(n):
    x,y=map(int,input().split())
    arr1.append(x-y)
    arr2.append(x+y)
ma2=max(arr2)-min(arr2)
ma1=max(arr1)-min(arr1)
print(max(ma1,ma2))

Solution (Python):

N = int(input())

M1 = -10 ** 10
M2 = - 10 ** 10

m1 = 10 ** 10
m2 = 10 ** 10

for i in range(N):
  x, y = map(int, input().split())
  M1 = max(x + y, M1)
  m1 = min(x + y, m1)
  M2 = max(x - y, M2)
  m2 = min(x - y, m2)
print(max(M1 - m1, M2 - m2))

Solution (Python):
n = int(input())
raw = []
p = []
m = []
for _ in range(n):
  x,y = map(int,input().split())
  p.append(x+y)
  m.append(x-y)
print(max((max(p)-min(p)),max(m)-min(m)))

Solution (Python):
N = int(input())
points = []
for _ in range(N):
    points.append([int(s) for s in input().split()])
def dist(x, y):
    return abs(x[0] - y[0]) + abs(x[1] - y[1])
points.sort(key=lambda x: x[0] + x[1])
d1 = dist(points[0], points[-1])

points.sort(key=lambda x: x[0] - x[1])
d2 = dist(points[0], points[-1])

print(max(d1, d2))

Solution (Python):
N=int(input())
x=[0 for i in range(N)]
y=[0 for i in range(N)]
for i in range(N):
    x[i],y[i]=map(int,input().split())
A=[(x[i],y[i]) for i in range(N)]
B=[(x[i],y[i]) for i in range(N)]
A.sort(key=lambda p:p[0]+p[1])
B.sort(key=lambda p:p[0]-p[1])
def dist(a,b):
    return abs(a[0]-b[0])+abs(a[1]-b[1])
ans0=dist(A[0],A[-1])
ans1=dist(B[0],B[-1])
print(max(ans0,ans1))

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

n = int(input())

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

x.sort()
y.sort()

res = max(x[-1]-x[0],y[-1]-y[0])

print(res)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
l = [(item[0]+item[1], item[0]-item[1]) for item in xy]
l.sort()
v0 = l[-1][0]-l[0][0]
l.sort(key=lambda x: x[1])
v1 = l[-1][1]-l[0][1]
ans = max(v0,v1)
print(ans)

Solution (Python):
from sys import stdin
def input():
    return stdin.readline().strip()

def main():
    n = int(input())
    p, m = [0]*n, [0]*n
    for i in range(n):
        x, y = map(int, input().split())
        p[i] = x + y
        m[i] = x - y

    print(max(max(p) - min(p), max(m) - min(m)))

main()

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
pa,ma=-10**10,-10**10
pi,mi=10**10,10**10
for i in range(N):
    x,y=map(int,input().split())
    s=x+y
    if s>pa:
        pa=s
    if s<pi:
        pi=s
    s=x-y
    if s>ma:
        ma=s
    if s<mi:
        mi=s
print(max(pa-pi,ma-mi))

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n = II()
    xy = LIR(n)
    f0 = [x - y for x, y in xy]
    f0.sort()
    f1 = [x + y for x, y in xy]
    f1.sort()
    print(max(f0[-1] - f0[0], f1[-1] - f1[0]))

    return



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

N=intput()
xy=[]
wa=[]
sa=[]
for i in range(N):
    x,y=mint()
    wa.append(x+y)
    sa.append(x-y)
print(max(max(wa)-min(wa), max(sa)-min(sa)))

Solution (Python):
import numpy as np

n = int(input())
xy = np.array([list(map(int,input().split())) for _ in range(n)],int)

x = xy[:,0]
y = xy[:,1]

a = x+y
b = -x+y

ans = max(a.max() - a.min(), b.max()-b.min())
print(ans)

Solution (Python):


import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,*xy = map(int,read().split())

wa = []
sa = []
for x,y in zip(xy[::2],xy[1::2]):
    wa.append(x+y)
    sa.append(x-y)

v = max(wa)-min(wa)
w = max(sa)-min(sa)

print(max(v,w))

Solution (Python):
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
U = [x+y for x, y in XY]
V = [x-y for x, y in XY]
min_u = min(U)
max_u = max(U)
min_v = min(V)
max_v = max(V)
print(max(
    max_u - min_u,
    max_v - min_v
))

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

z = []
w = []
for i in range(N):
    x,y = xy[i]
    z.append(x+y)
    w.append(x-y)
ans = max(max(z)-min(z),max(w)-min(w))
print(ans)

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

def main():
    n = int(input())
    p = [list(map(int, input().split())) for i in range(n)]

    p0, p1 = [0]*n, [0]*n

    for i in range(n):
        p0[i] = p[i][0] - p[i][1]
        p1[i] = p[i][0] + p[i][1]
    
    ans = max(max(p0)-min(p0), max(p1)-min(p1))
    print(ans)



    
if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
XY = list(map(int, input().split()) for _ in range(n))
x_max = -float("inf")
y_max = -float("inf")
x_min = float("inf")
y_min = float("inf")
for x, y in XY:
    a, b = x-y, x+y
    x_max = max(x_max, a)
    x_min = min(x_min, a)
    y_max = max(y_max, b)
    y_min = min(y_min, b)
s = x_max - x_min
t = y_max - y_min
ans = max(s, t)
print(ans)

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

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

def main():
    mod=10**9+7
    N=I()
    XL=[0]*N
    YL=[0]*N
    for i in range(N):
        x,y=MI()
        X=x+y
        Y=x-y
        XL[i]=X
        YL[i]=Y
        
    x=max(XL)-min(XL)
    y=max(YL)-min(YL)
    
    print(max(x,y))
        

main()

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]



def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N = I()
data = ILL(N)

dicplus = DD(int)
dicminus = DD(int)

for x,y in data:
  dicplus[x+y] = 1
  dicminus[x-y] = 1
k_plus = [k for k in dicplus]
k_minus = [k for k in dicminus]

ans1 = max(k_plus)-min(k_plus)
ans2 = max(k_minus)-min(k_minus)

print(max(ans1,ans2))

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

XY = np.array(read().split(), np.int64)[1:]

X, Y = XY[::2], XY[1::2]

A = X + Y
B = X - Y

a = A.max() - A.min()
b = B.max() - B.min()
print(max(a, b))

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