qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] >= 0:
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(x-Cx) + abs (y - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(x-Cx)-abs(y-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if set(xyh) == set(xyhcand):
            ans = '.'.join([x,y,H])
            break
        
print(ans)




Fixed code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)
Buggy code:
N = int(input())

xyh = [[0, 0, 0] for i in range(N)]

for i in range(N):
    x, y, h = input().split(' ')
    xyh[i][0] = int(x)
    xyh[i][1] = int(y)
    xyh[i][2] = int(h)

finish = False
for cx in range(N):
    for cy in range(N):
        top = abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
        for x, y, h in xyh:
            finish = True
            if (top - abs(x-cx)-abs(y-cy)) != h:
                finish = False
                break
        if finish == True:
            print ('{} {} {}'.format(cx, cy, top))
            exit()

Fixed code:
N = int(input())

xyh = [[0, 0, 0] for i in range(N)]

for i in range(N):
    x, y, h = input().split(' ')
    xyh[i][0] = int(x)
    xyh[i][1] = int(y)
    xyh[i][2] = int(h)

finish = False
for cx in range(101):
    for cy in range(101):
        top = 0
        for x, y, h in xyh:
            if h != 0:
                top = abs(x-cx)+abs(y-cy)+h
        for x, y, h in xyh:
            finish = True
            if max(top - abs(x-cx)-abs(y-cy), 0) != h:
                finish = False
                break
        if finish == True:
            print ('{} {} {}'.format(cx, cy, top))
            exit()
Buggy code:
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]

li.sort(key=lambda x: x[2])
a, b, c = li[-1]

for x in range(101):
    for y in range(101):
        h=c+abs(a-x)+abs(b-y)
        if all(k==max(h-abs(i-x)-abs(j-y),0) for i,j,k in li):
        print(x,y,h)
        exit()

Fixed code:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()
Buggy code:
import itertools

N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi, cyi in itertools.product(range(101), range(101)):
    for k in range(N):
        if params[k][2] > 0:
            hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

    for i in range(N):
        if params[i][2] != max(h - abs(params[k][0] - cxi) - abs(params[k][1] - cyi), 0)
            break
    
    else:
        print(cxi, cyi, hight)

Fixed code:
N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi in range(101):
    for cyi in range(101):
        for k in range(N):
            if params[k][2] > 0:
                hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

        for k in range(N):
            if params[k][2] != max((hight - abs(params[k][0] - cxi) - abs(params[k][1] - cyi)), 0):
                break
        
        else:
            print(cxi, cyi, hight)
Buggy code:
n = int(input())
xyh = []
for i in range(n):
    xyh.append(list(map(int,input().split())))
H = []
for cx in range(0,101):
    for cy in range(0,101):
        hantei = False
        for i in range(n):
            if xyh[i][2] > 0:
                if not H:
                    H.append(xyh[i][2] + abs(cx-xyh[i][0]) + abs(cy-xyh[i][1]))
                else:
                    hantei = True
                    if xyh[i][2] + abs(cx-xyh[i][0]) + abs(cy-xyh[i][1]) != H[0]:
                        H.pop(0)
                        break
        else:
            if H[0] <= 100 and hantei: 
                print(cx,cy,H[0])
                exit()
else:
    mx = 0
    for i in range(n):
        if mx < xyh[i][2]:
            ansind = i
            mx = xyh[i][2]
    print(xyh[ansind][0],xyh[ansind][1],xyh[ansind][2])


Fixed code:
n = int(input())
xyh = []
for i in range(n):
    xyh.append(list(map(int,input().split())))
H = []
for cx in range(0,101):
    for cy in range(0,101):
        hantei = False
        for i in range(n):
            if xyh[i][2] > 0:
                if not H:
                    H.append(xyh[i][2] + abs(cx-xyh[i][0]) + abs(cy-xyh[i][1]))
                else:
                    hantei = True
                    if xyh[i][2] + abs(cx-xyh[i][0]) + abs(cy-xyh[i][1]) != H[0]:
                        H.pop(0)
                        break
        else:
            if hantei: 
                print(cx,cy,H[0])
                exit()
else:
    mx = 0
    for i in range(n):
        if mx < xyh[i][2]:
            ansind = i
            mx = xyh[i][2]
    print(xyh[ansind][0],xyh[ansind][1],xyh[ansind][2])
Buggy code:
N=int(input())
p=[list(map(int, input().split())) for _ in range(N)]
ax, ay, ah = list(filter(lambda x: x[2], p))[0]
for i in range(101):
  for j in range(101):
    center=[i,j,ah+abs(ax-i)+abs(ay-j)]
    if all(t[2]==max(center[2]-abs(t[0]-center[0])-abs(t[1]-center[1]),0) for t in x) :
      print(center[0],center[1],center[2])


Fixed code:
N=int(input())
p=[list(map(int, input().split())) for _ in range(N)]
ax, ay, ah = list(filter(lambda x: x[2], p))[0]
for i in range(101):
  for j in range(101):
    center=[i,j,ah+abs(ax-i)+abs(ay-j)]
    if all(t[2]==max(center[2]-abs(t[0]-center[0])-abs(t[1]-center[1]),0) for t in p) :
      print(center[0],center[1],center[2])
Buggy code:
N = int(input())
x = [list(map(int, input().split()))for _ in range(n)]
ax=x[0][0]
ay=x[0][1]
ah=x[0][2]
for x in range(101):
    for y in range(101):
        H = ah+abs(ax-x)+abs(ay-y)
        if all(max(H-abs(t[0]-x)-abs(t[1]-y), 0) == t[2]for t in p):
            print(x, y, H)


Fixed code:
n = int(input())
p = [list(map(int, input().split()))for _ in range(n)]
ax, ay, ah = list(filter(lambda x: x[2], p))[0]
for x in range(101):
    for y in range(101):
        H = ah+abs(ax-x)+abs(ay-y)
        if all(max(H-abs(t[0]-x)-abs(t[1]-y), 0) == t[2]for t in p):
            print(x, y, H)
Buggy code:
import sys
n=int(input())
x=[]
y=[]
h=[]
for i in range(n):
    a,b,c=map(int,input().split())
    x.append(a)
    y.append(b)
    h.append(c)
inf=2e31-1
for i in range(101):
    for j in range(101):
        judge=True
        H1=inf
        for k in range(n): 
            if h[k-1]!=0:
                H1=h[k-1]+abs(i-1-x[k-1])+abs(j-1-y[k-1])
                break

        for k in range(n):
            if h[k-1]==0:
                if H1>abs(i-1-x[k-1])+abs(j-1-y[k-1]):
                    judge=False
                    break
            else:
                H2=h[k]+abs(i-1-x[k-1])+abs(j-1-y[k-1])
                if H1!=H2:
                    judge=False
                    break
                    
        if judge:
            sys.stdout.write(str(i-1))
            sys.stdout.write(' ')
            sys.stdout.write(str(j-1))
            sys.stdout.write(' ')
            print(H1)
            sys.exit()

Fixed code:
import sys
n=int(input())
x=[]
y=[]
h=[]
for i in range(n):
    a,b,c=map(int,input().split())
    x.append(a)
    y.append(b)
    h.append(c)
inf=2e31-1
for i in range(101):
    for j in range(101):
        judge=True
        H1=inf
        for k in range(n): 
            if h[k]!=0:
                H1=h[k]+abs(i-x[k])+abs(j-y[k])
                break

        for k in range(n):
            if h[k]==0:
                if H1>abs(i-x[k])+abs(j-y[k]):
                    judge=False
                    break
            else:
                H2=h[k]+abs(i-x[k])+abs(j-y[k])
                if H1!=H2:
                    judge=False
                    break
                    
        if judge:
            sys.stdout.write(str(i))
            sys.stdout.write(' ')
            sys.stdout.write(str(j))
            sys.stdout.write(' ')
            print(H1)
            sys.exit()
Buggy code:
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = h0-abs(x-arrays[0])-abs(y-arrays[1])
      if h != arrays[2]:
        break
    print(x,y,h0)
      sys.exit()
    x += 1
  y += 1

Fixed code:
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    flag = 0
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = max(0,h0-abs(x-arrays[0])-abs(y-arrays[1]))
      if h != arrays[2]:
        flag = 1
    if flag == 0:
      print(x,y,h0)
      sys.exit()
    x += 1
  y += 1
Buggy code:
N = int(input())

info = []
for i in range(N):
    info.append(list(map(int,input().split())))

for i in range(101):
    for j in range(101):
        H = -1
        judge = True
        for k in range(N):
            if info[k][2] == 0:
                continue
            dis = abs(i - info[k][0]) + abs(j - info[k][0])
            if H == -1:
                H = info[k][2] + dis
            else:
                if H != (info[k][2] + dis):
                    judge = False
        if judge == True:
            print("{} {} {}".format(i,j,H))
            exit()




Fixed code:
N = int(input())

info = []
for i in range(N):
    info.append(list(map(int,input().split())))

ans = []
ans_c = 0
for i in range(101):
    for j in range(101):
        H = -1
        judge = True
        for k in range(N):
            if info[k][2] == 0:
                continue
            dis = abs(i - info[k][0]) + abs(j - info[k][1])
            if H == -1:
                H = info[k][2] + dis
            else:
                if H != (info[k][2] + dis):
                    judge = False
        if judge == True:
            for k in range(N):
                if info[k][2] == 0:
                    h = max(H - (abs(i - info[k][0]) + abs(j - info[k][1])), 0)
                    if h != 0:
                        judge = False
        if judge == True:
            print("{} {} {}".format(i,j,H))
            exit()
Buggy code:
N = int(input())
x_list=[]
y_list=[]
h_list=[]
hantei = 0
count=0
for i in range(N):
    a,b,c=map(int,input().split())
    x_list.append(a)
    y_list.append(b)
    h_list.append(c)
    if c>0: 
        judge_x = a
        judge_y = b
        judge_h = c
for x in range(101):
    for y in range(101):
        for j in range(N):
            if h_list[j] == 0 : count+=1
            elif judge_h + abs(x-judge_x) + abs(y-judge_y) != h_list[j] + abs(x-x_list[j]) + abs(y-y_list[j]):
                break
            else: count+=1
        if count == N-1:
            hantei=1
        if(hantei):break
    if(hantei): break

print(x,y,judge_h + abs(x-judge_x) + abs(y-judge_y))

Fixed code:
N = int(input())
x_list=[]
y_list=[]
h_list=[]
hantei = 0
count=0
for i in range(N):
    a,b,c=map(int,input().split())
    x_list.append(a)
    y_list.append(b)
    h_list.append(c)
    if c>0: 
        judge_x = a
        judge_y = b
        judge_h = c

for x in range(101):
    for y in range(101):
        H = judge_h + abs(judge_x-x)+abs(judge_y-y)
        for j in range(N):
            if h_list[j] != max(0,H-abs(x-x_list[j])-abs(y-y_list[j])): break
            if j == N-1 : print(x,y,judge_h + abs(x-judge_x) + abs(y-judge_y))
Buggy code:
n = int(input())
data = [tuple(map(int, input().split())) for _ in range(n)]
ax, ay, ah = list(filter(lambda x:x[2], data))[0]

for cx in range(101):
    for cy in range(101):
        H = h + abs(ax-cx) + abs(ay-cy)
        if all(max(H-abs(d[0]-cx)-abs(d[1]-cy),0)==d[2]) for d in data):
            print(cx, cy, H)
            exit()

Fixed code:
n = int(input())
data = [tuple(map(int, input().split())) for _ in range(n)]
ax, ay, ah = list(filter(lambda x:x[2], data))[0]

for cx in range(101):
    for cy in range(101):
        H = ah + abs(ax-cx) + abs(ay-cy)
        if all(max(H-abs(d[0]-cx)-abs(d[1]-cy),0)==d[2] for d in data):
            print(cx, cy, H)
            exit()
Buggy code:
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
x1, y1, h1 = XYH[0]
#print(x1, y1, h1)

for Cx in range(101):
  for Cy in range(101):
    H = h1 + abs(x1-Cx)+ abs(y1-Cy)
    for x, y, h in XYH[1:]:
      #print(Cx, Cy, H)
      if h == max(H - abs(x-Cx) - abs(y-Cy), 0):
        print(Cx, Cy, H)
        exit()


Fixed code:
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
#print(XYH)

for x1, y1, h1 in XYH:
    if h1 > 0:
        for Cx in range(101):
            for Cy in range(101):
                H = h1 + abs(x1 - Cx) + abs(y1 - Cy)
                # print(Cx, Cy, H)
                if all(h == max(H - abs(x - Cx) - abs(y - Cy), 0) for x, y, h in XYH):
                  print(Cx, Cy, H)
                  exit()
Buggy code:
def main():
    n = int(input())
    xs, ys, hs = list(), list(), list()
    for i in range(n):
        x, y, h = map(int, input().split())
        xs.append(x)
        ys.append(y)
        hs.append(h)

    for cx in range(101):
        for cy in range(101):
            Hs = set()
            Hs_ub = set()
            for x, y, h in zip(xs, ys, hs):
                H_cand = h + abs(x - cx) + abs(y - cy)
                if h == 0:
                    Hs_ub.add(H_cand)
                else:
                    Hs.add(H_cand)
            # accept No.9, reject 10 - 15
            Hs_rm = set()
            for H in Hs:
                if all([H <= H_ub for H_ub in Hs_ub]):
                    continue
                else:
                    Hs_rm.add(H)
            Hs = Hs - Hs_rm

            Hs = {H for H in Hs if H >= 1}
            if len(Hs) != 0:
                H = Hs.pop()
                print(cx, cy, H)
                return


if __name__ == "__main__":
    main()

Fixed code:
def main():
    n = int(input())
    xs, ys, hs = list(), list(), list()
    for i in range(n):
        x, y, h = map(int, input().split())
        xs.append(x)
        ys.append(y)
        hs.append(h)

    for cx in range(101):
        for cy in range(101):
            # In this case,
            # multiple candidates of H & 
            Hs = set()
            Hs_ub = set()
            for x, y, h in zip(xs, ys, hs):
                H_cand = h + abs(x - cx) + abs(y - cy)
                if h == 0:
                    Hs_ub.add(H_cand)
                else:
                    Hs.add(H_cand)

            if len(Hs) != 1:
                continue
            
            # accept No.9, reject 10 - 15
            Hs_rm = set()
            for H in Hs:
                if all([H <= H_ub for H_ub in Hs_ub]):
                    continue
                else:
                    Hs_rm.add(H)
            Hs = Hs - Hs_rm

            Hs = {H for H in Hs if H >= 1}
            if len(Hs) == 1:
                H = Hs.pop()
                print(cx, cy, H)
                return


if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
for i in range(101):
  for j in range(101):
    pH = ph+abs(px-i)+abs(py-j)
    for l in ls:
      h, x, y = l
      u = max(pH - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,pH)
      flag = True
      break
  if flag:
    break
print(*ans)

Fixed code:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)
Buggy code:
n=int(input())
l=[]
for i in range(n):
  l.append(reversed(list(map(int,input().split()))))
l=sorted(l)
for i in range(101):
  for j in range(101):
    b=True
    h=abs(i-l[-1][2])+abs(j-l[-1][1])+l[-1][0]
    for i in range(n-1):
      if max(h-abs(i-l[-2-i][2])-abs(j-l[-2-i][1]),0)!=l[-2-i][0]:
        b=False
    if b:
      print(i,j,h)
      break
      
    
           

Fixed code:
n=int(input())
l=[]
l1=[]
for i in range(n):
  l1=list(map(int,input().split()))
  l1=l1[::-1]
  l.append(l1)      
l=sorted(l)
for i in range(101):
  for j in range(101):
    b=True
    h=abs(i-l[-1][2])+abs(j-l[-1][1])+l[-1][0]
    for k in range(n-1):
      if max(h-abs(i-l[-2-k][2])-abs(j-l[-2-k][1]),0)!=l[-2-k][0]:
        b=False
    if b:
      print(i,j,h)
      break
Buggy code:
N = int(input())

in_list = []
x0, y0, h0 = 0, 0, 0
for i in range(N):
    xyh = list(map(int, input().split()))
    if xyh[2] != 0:
        in_list.append(xyh)
        x0, y0, h0 = xyh[0], xyh[1], xyh[2]


for x1 in range(0, 101):
    for y1 in range(0, 101):
        for xyh in in_list:
            x, y, h = xyh[0], xyh[1], xyh[2]
            H = h + abs(x0-x1) + abs(y0-y1)
            if h != max(H-abs(x-x1)-abs(y-y1), 0):
                break
        else:
            print(x1, y1, H)



Fixed code:
N = int(input())

in_list = []
x0, y0, h0 = 0, 0, 0
for i in range(N):
    xyh = list(map(int, input().split()))
    in_list.append(xyh)

for i in range(N):
    if in_list[i][2]:
        x0, y0, h0 = in_list[i]

for Cx in range(0, 101):
    for Cy in range(0, 101):
        for xyh in in_list:
            x, y, h = xyh[0], xyh[1], xyh[2]
            H = h0 + abs(x0-Cx) + abs(y0-Cy)
            if h != max(H-abs(x-Cx)-abs(y-Cy), 0):
                break
        else:
            print(Cx, Cy, H)
Buggy code:
import itertools

n = int(input())
x = []
y = []
h = []
for i in range(n):
    X, Y, H = map(int, input().split())
    x.append(X)
    y.append(Y)
    h.append(H)
for cx, cy in itertools.product(range(101), range(101)):
    H = []
    for i in range(n):
        if h[i] == 0:
            continue
        H.append(h[i] + abs(x[i] - cx) + abs(y[i] - cy))
    if len(set(H)) == 1 and H[0] >= 1:
        for j in range(n + 1):
            if i == n:
                break
            if max(H[0] - abs(x[j] - cx) - abs(y[j] - cy), 0) != h[j]:
                break
        if n == 1:
            break
print("{} {} {}".format(cx, cy, H[0]))


Fixed code:
import itertools

n = int(input())
x = []
y = []
h = []
for i in range(n):
    X, Y, H = map(int, input().split())
    x.append(X)
    y.append(Y)
    h.append(H)
for cx, cy in itertools.product(range(101), range(101)):
    H = []
    for i in range(n):
        if h[i] == 0:
            continue
        H.append(h[i] + abs(x[i] - cx) + abs(y[i] - cy))
    if len(set(H)) == 1 and H[0] >= 1:
        for j in range(n + 1):
            if j == n:
                break
            if max(H[0] - abs(x[j] - cx) - abs(y[j] - cy), 0) != h[j]:
                break
        if j == n:
            break
print("{} {} {}".format(cx, cy, H[0]))
Buggy code:
N = int(input())

A=[]
for i in range(N):
    a, b, c = map(int, input().split())
    A.append([a, b, c])

A.sort(key=lambda x:-x[2])

for x in range(0, 101):
    for y in range(0, 101):
        H = A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        Flag = True
        for i in range(1, N):
            if A[i][2] > 0:
                    if H != A[i][2]+abs(A[i][0]-x)+abs(A[i][1]-y):
                        Flag = False
                        break
            else:
                if H > abs(A[i][0]-x)+abs(A[i][1]-y):
                    Flag = False
                    break
        if Flag == True:
            print(x, y, h)

Fixed code:
N = int(input())

A=[]
for i in range(N):
    a, b, c = map(int, input().split())
    A.append([a, b, c])

A.sort(key=lambda x:-x[2])

for x in range(0, 101):
    for y in range(0, 101):
        H = A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        Flag = True
        for i in range(1, N):
            if A[i][2] > 0:
                    if H != A[i][2]+abs(A[i][0]-x)+abs(A[i][1]-y):
                        Flag = False
                        break
            else:
                if H > abs(A[i][0]-x)+abs(A[i][1]-y):
                    Flag = False
                    break
        if Flag == True:
            print(x, y, H)
Buggy code:
n=int(input())
x=[]
y=[]
h=[]
for i in range(n):
    a,b,c=map(int,input().split())
    x.append(a)
    y.append(b)
    h.append(c)
    if c>0:
        g=i

for i in range(101):
    for j in range(101):
        t=h[g]+abs(x[0]-i)+abs(y[0]-j)
        f=1
        for k in range(0,n):
            if h[k]==max(0,t-abs(x[k]-i)-abs(y[k]-j)):
                f+=1
        if f==n:
            print(i,j,t)
            exit()
        


Fixed code:
n=int(input())
x=[]
y=[]
h=[]
for i in range(n):
    a,b,c=map(int,input().split())
    x.append(a)
    y.append(b)
    h.append(c)
    if c>0:
        g=i

for i in range(101):
    for j in range(101):
        t=h[g]+abs(x[g]-i)+abs(y[g]-j)
        f=0
        for k in range(0,n):
            if h[k]==max(0,t-abs(x[k]-i)-abs(y[k]-j)):
                f+=1
        if f==n:
            print(i,j,t)
            exit()
Buggy code:
from itertools import product


def solve(string):
    n, *xyh = map(int, string.split())
    xyh = sorted([(x, y, h) for x, y, h in zip(xyh[::3], xyh[1::3], xyh[2::3])],
                 key=lambda x: x[-1], reverse=True)
    for i, j in product(range(101), range(101)):
        h = abs(xyh[0][0] - i) + abs(xyh[0][1] - j) + xyh[0][2]
        check = [_h == max(h - abs(_x - i) - abs(_y - j), 0) for _x, _y, _h in xyh[1:]]
        if all(check):
            return "{} {} {}".format(i, j, h+1)


if __name__ == '__main__':
    n = int(input())
    print(solve("{}\n".format(n) + '\n'.join([input() for _ in range(n)])))


Fixed code:
from itertools import product


def solve(string):
    n, *xyh = map(int, string.split())
    xyh = sorted([(x, y, h) for x, y, h in zip(xyh[::3], xyh[1::3], xyh[2::3])],
                 key=lambda x: x[-1], reverse=True)
    for i, j in product(range(101), range(101)):
        h = abs(xyh[0][0] - i) + abs(xyh[0][1] - j) + xyh[0][2]
        check = [_h == max(h - abs(_x - i) - abs(_y - j), 0) for _x, _y, _h in xyh[1:]]
        if all(check):
            return "{} {} {}".format(i, j, h)


if __name__ == '__main__':
    n = int(input())
    print(solve("{}\n".format(n) + '\n'.join([input() for _ in range(n)])))