Buggy python submission (verdict: Runtime Error):
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            h = 0
            same = True
            for p in points:
                h_p = abs(x - p[0]) + abs(y - p[1]) + p[2]
                if h != 0 and h != h_p:
                    same = False
                    break
                elif h == 0:
                    h = h_p
            if same:
                return x, y, h

ans = (0,0,0)
ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Fixed submission:
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))
points.sort(key=lambda x:x[2], reverse=True)


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            p = points[0]
            h = abs(x - p[0]) + abs(y - p[1]) + p[2]
            same = True
            for i in range(1, len(points)):
                p = points[i]
                h_p = max(0, h - abs(x - p[0]) - abs(y - p[1]))
                if h_p != p[2]:
                    same = False
                    break
            if same:
                return x, y, h
    return -1,-1,-1


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            h = 0
            same = True
            for p in points:
                h_p = abs(x - p[0]) + abs(y - p[1]) + p[2]
                if h != 0 and h != h_p:
                    same = False
                    break
                elif h == 0:
                    h = h_p
            if same:
                return x, y, h


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Fixed submission:
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))
points.sort(key=lambda x:x[2], reverse=True)


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            p = points[0]
            h = abs(x - p[0]) + abs(y - p[1]) + p[2]
            same = True
            for i in range(1, len(points)):
                p = points[i]
                h_p = max(0, h - abs(x - p[0]) - abs(y - p[1]))
                if h_p != p[2]:
                    same = False
                    break
            if same:
                return x, y, h
    return -1,-1,-1


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
points = []
ans = [0,0,0]
for i in range(n):
  x,y,h = map(int,input().split())
  points.append((x,y,h))

def f(points):
  for x in range(0,101):
    for y in range(0,101):
      h = 0
      same = True
      for p in points:
        h_p = abs(x-p[0]) + ans(y-p[1]) + p[2]
        if h != 0 and h != h_p:
          same = False
          break
        elif h == 0:
          h = h_p
      if same:
        return x,y,h
      
ans = f(points)
print("{} {} {}", format(ans[0], ans[1], ans([2])))

Fixed submission:
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))
points.sort(key=lambda x:x[2], reverse=True)


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            p = points[0]
            h = abs(x - p[0]) + abs(y - p[1]) + p[2]
            same = True
            for i in range(1, len(points)):
                p = points[i]
                h_p = max(0, h - abs(x - p[0]) - abs(y - p[1]))
                if h_p != p[2]:
                    same = False
                    break
            if same:
                return x, y, h
    return -1,-1,-1


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))