Problem p02556 (python)

Fixed submission:
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
zmax=-float('inf')
zmin = float('inf')
wmax = -float('inf')
wmin = float('inf')

for _ in range(N):
    x,y=map(int,input().split())
    z=x+y
    w=x-y
    zmax = max(z,zmax)
    zmin = min(z,zmin)
    wmax = max(w,wmax)
    wmin = min(w,wmin)
print(max(zmax-zmin,wmax-wmin))

Buggy submission (verdict: Runtime Error):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
XY = []
xAve = 0
yAve = 0
for _ in range(N):
    x,y=map(int,input().split())
    if (x,y) not in XY
        XY.append((x,y))
        xAve += x
        yAve += y
xAve = xAve//N
yAve = yAve//N
XYnorm = [0]*4
for x,y in XY:
    nX = x-xAve
    nY = y-yAve
    if nX>=0 and nY>0:#第1象限
        XYnorm[0]=max(XYnorm[0],nX+nY)
    if nX <0 and nY >=0:#第2象限
        XYnorm[1]=max(XYnorm[1],-nX+nY)
    if nX <=0 and nY <0:#第3象限
        XYnorm[2]=max(XYnorm[2],-nX-nY)
    if nX >0 and nY <=0:#第4象限
        XYnorm[3]=max(XYnorm[3],nX-nY)
print(int(max(XYnorm[2]+XYnorm[0],XYnorm[3]+XYnorm[1])))

Buggy submission (verdict: Runtime Error):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
XY = []
xAve = 0
yAve = 0
for _ in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])
    xAve += x
    yAve += y
xAve = xAve/N
yAve = yAve/N
XYnorm = [0]*4

for x,y in XY:
    nX = x-xAve
    nY = y-yAve
    if nX>=0 and nY>=0:#第1象限
        if XYnorm[0]<= nX+nY:
            XYnorm[0] = nX+nY
            XY0 =[x,y]

    if nX <=0 and nY >=0:#第2象限
        if XYnorm[1]<= -nX+nY:
            XYnorm[1] = -nX+nY
            XY1 =[x,y]
            
    if nX <=0 and nY <=0:#第3象限
        if XYnorm[2]<= -nX-nY:
            XYnorm[2] = -nX-nY
            XY2 =[x,y]
            
    if nX >=0 and nY <=0:#第4象限
        if XYnorm[3]<= nX-nY:
            XYnorm[3] = nX-nY
            XY3 =[x,y]

try:
    XY01 = abs(XY0[0]-XY1[0])+abs(XY0[1]-XY1[1])
except:
    XY01=0
    
try:
    XY02 = abs(XY0[0]-XY2[0])+abs(XY0[1]-XY2[1])
except:
    XY02=0
try:
    XY03 = abs(XY0[0]-XY3[0])+abs(XY0[1]-XY3[1])
except:
    XY03=0
try:
    XY12 = abs(XY1[0]-XY2[0])+abs(XY1[1]-XY2[1])
except:
    XY12 = 0
try:
    XY13 = abs(XY1[0]-XY3[0])+abs(XY1[1]-XY3[1])
except:
    XY13 = 0
try:
    XY23 = abs(XY2[0]-XY3[0])+abs(XY2[1]-XY3[1])
except:
    XY23 = 0
print(max([XY01,XY02,XY03,XY12,XY13,XY23])

Buggy submission (verdict: Runtime Error):
    import sys,math,collections,itertools
    input = sys.stdin.readline

    N=int(input())
    XY = []
    xAve = 0
    yAve = 0
    for _ in range(N):
        x,y=map(int,input().split())
        XY.append([x,y])
        xAve += x
        yAve += y
    xAve = xAve/N
    yAve = yAve/N
    XYnorm = [0]*4

    for x,y in XY:
        nX = x-xAve
        nY = y-yAve
        if nX>=0 and nY>=0:#第1象限
            if XYnorm[0]<= nX+nY:
                XYnorm[0] = nX+nY
                XY0 =[x,y]

        if nX <=0 and nY >=0:#第2象限
            if XYnorm[1]<= -nX+nY:
                XYnorm[1] = -nX+nY
                XY1 =[x,y]
                
        if nX <=0 and nY <=0:#第3象限
            if XYnorm[2]<= -nX-nY:
                XYnorm[2] = -nX-nY
                XY2 =[x,y]
                
        if nX >=0 and nY <=0:#第4象限
            if XYnorm[3]<= nX-nY:
                XYnorm[3] = nX-nY
                XY3 =[x,y]

    try:
        XY01 = abs(XY0[0]-XY1[0])+abs(XY0[1]-XY1[1])
    except:
        XY01=0
        
    try:
        XY02 = abs(XY0[0]-XY2[0])+abs(XY0[1]-XY2[1])
    except:
        XY02=0
    try:
        XY03 = abs(XY0[0]-XY3[0])+abs(XY0[1]-XY3[1])
    except:
        XY03=0
    try:
        XY12 = abs(XY1[0]-XY2[0])+abs(XY1[1]-XY2[1])
    except:
        XY12 = 0
    try:
        XY13 = abs(XY1[0]-XY3[0])+abs(XY1[1]-XY3[1])
    except:
        XY13 = 0
    try:
        XY23 = abs(XY2[0]-XY3[0])+abs(XY2[1]-XY3[1])
    except:
        XY23 = 0
    print(max([XY01,XY02,XY03,XY12,XY13,XY23]))

Buggy submission (verdict: Runtime Error):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
XY = []
xAve = 0
yAve = 0
for _ in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])
    xAve += x
    yAve += y
xAve = xAve/N
yAve = yAve/N
XYnorm = [0]*4

for x,y in XY:
    nX = x-xAve
    nY = y-yAve
    if nX>=0 and nY>=0:#第1象限
        if XYnorm[0]<= nX+nY:
            XYnorm[0] = nX+nY
            XY0 =[x,y]

    if nX <=0 and nY >=0:#第2象限
        if XYnorm[1]<= -nX+nY:
            XYnorm[1] = -nX+nY
            XY1 =[x,y]
            
    if nX <=0 and nY <=0:#第3象限
        if XYnorm[2]<= -nX-nY:
            XYnorm[2] = -nX-nY
            XY2 =[x,y]
            
    if nX >=0 and nY <=0:#第4象限
        if XYnorm[3]<= nX-nY:
            XYnorm[3] = nX-nY
            XY3 =[x,y]

try:
    XY01 = abs(XY0[0]-XY1[0])+abs(XY0[1]-XY1[1])
except:
    XY01=0
    
try:
    XY02 = abs(XY0[0]-XY2[0])+abs(XY0[1]-XY2[1])
except:
    XY02=0
try:
    XY03 = abs(XY0[0]-XY3[0])+abs(XY0[1]-XY3[1])
except:
    XY03=0
try:
    XY12 = abs(XY1[0]-XY2[0])+abs(XY1[1]-XY2[1])
except:
    XY12 = 0
try:
    XY13 = abs(XY1[0]-XY3[0])+abs(XY1[1]-XY3[1])
except:
    XY13 = 0
try:
    XY23 = abs(XY2[0]-XY3[0])+abs(XY2[1]-XY3[1])
except:
    XY13 = 0
print(max([XY01,XY02,XY03,XY12,XY13,XY23]))

Buggy submission (verdict: Runtime Error):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
XY = []
xAve = 0
yAve = 0
for _ in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])
    xAve += x
    yAve += y
xAve = xAve/N
yAve = yAve/N
XYnorm = [0]*4

for x,y in XY:
    nX = x-xAve
    nY = y-yAve
    if nX>=0 and nY>=0:#第1象限
        if XYnorm[0]<= nX+nY:
            XYnorm[0] = nX+nY
            XY0 =[x,y]

    if nX <=0 and nY >=0:#第2象限
        if XYnorm[1]<= -nX+nY:
            XYnorm[1] = -nX+nY
            XY1 =[x,y]
            
    if nX <=0 and nY <=0:#第3象限
        if XYnorm[2]<= -nX-nY:
            XYnorm[2] = -nX-nY
            XY2 =[x,y]
            
    if nX >=0 and nY <=0:#第4象限
        if XYnorm[3]<= nX+nY:
            XYnorm[3] = nX+nY
            XY3 =[x,y]
XY02 = abs(XY0[0]-XY2[0])+abs(XY0[1]-XY2[1])
XY13 = abs(XY1[0]-XY3[0])+abs(XY1[1]-XY3[1])
print(max(XY02,XY13))