Problem p03240 (python)

Fixed submission:
N = int(input())
info = []
for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        N -= 1
        continue
    info.append([x,y,h])
for i in range(101):
    for j in range(101):
        H_0 = info[0][2] + abs(info[0][0] - i) + abs(info[0][1] - j)
        for k in range(1,N):
            H = info[k][2] + abs(info[k][0] - i) + abs(info[k][1] - j)
            if H_0 != H:
                break
            elif k == N-1:
                print(i,j,H_0)
                exit()
print(info[0][0],info[0][1],info[0][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
info = [list(map(int,input().split())) for _ in range(N)]

def judge(Cx,Cy):
    x0,y0,h0 = info[0]
    pH = abs(x0-Cx) + abs(y0-Cy) + h0
    for x, y, h in info:
        H = abs(x-Cx) + abs(y-Cy) + h
        if h == 0:
            if not H <= 0:
                return
        elif H != pH:
            return
        pH = H
    global ans
    ans = [Cx,Cy,H]
    
for Cx in range(101):
    for Cy in range(101):
        judge(Cx,Cy)

print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
info = [list(map(int,input().split())) for _ in range(N)]

def judge(Cx,Cy):
    x0,y0,h0 = info[0]
    pH = abs(x0-Cx) + abs(y0-Cy) + h0
    for x, y, h in info:
        if h == 0: continue
        H = abs(x-Cx) + abs(y-Cy) + h
        if H != pH:
            return
        pH = H
    global ans
    ans = [Cx,Cy,H]
    
for Cx in range(101):
    for Cy in range(101):
        judge(Cx,Cy)

print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
info = []
for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        N -= 1
        continue
    info.append([x,y,h])
for i in range(101):
    for j in range(101):
        H_0 = info[0][2] + abs(info[0][0] - i) + abs(info[0][1] - j)
        for k in range(1,N):
            H = info[k][2] + abs(info[k][0] - i) + abs(info[k][1] - j)
            if H_0 != H:
                break
            elif k == N-1:
                print(i,j,H_0)
                exit()
print(info[0],info[1],info[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
info = []
for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        N -= 1
        continue
    info.append([x,y,h])
for i in range(101):
    for j in range(101):
        H_0 = info[0][2] + abs(info[0][0] - i) + abs(info[0][1] - j)
        for k in range(1,N):
            H = info[k][2] + abs(info[k][0] - i) + abs(info[k][1] - j)
            if H_0 != H:
                break
            elif k == N-1:
                print(i,j,H_0)
                exit()
print(e[0],e[1],e[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
info = []
for i in range(N):
    x,y,h = map(int,input().split())
    info.append([x,y,h])
for i in range(101):
    for j in range(101):
        H_0 = info[0][2] + abs(info[0][0] - i) + abs(info[0][1] - j)
        for k in range(1,N):
            if info[k][2] == 0:
                continue
            H = info[k][2] + abs(info[k][0] - i) + abs(info[k][1] - j)
            if H_0 != H:
                break
            elif k == N-1:
                ans = [i,j,H_0]
print(" ".join([str(e) for e in ans]))