Problem: In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.   The pyramid had _center coordinates_ (C_X, C_Y) and _height_ H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).  Aoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:    * C_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.    * Additionally, he obtained N pieces of information. The i-th of them is: "the altitude of point (x_i, y_i) is h_i."   This was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.

Submission attempts (in order):
if __name__ == "__main__":
  n = int(input())
  x,y,z = [0]*n,[0]*n,[0]*n
  
  count = 0
  xyh = [[],[],[]]
  
  for i in range(n):
    x[i],y[i],z[i] = map(int,input().split())
    #if z[i] != 0 and count < 3:
    if z[i] != 0:
      xyh[count].append(x[i])
      xyh[count].append(y[i])
      xyh[count].append(z[i])
      
      count += 1
  
  x,y,h = 0,0,0
  pass_ = 0
  #print(count)
  for i in range(101):
    for j in range(101): 
      h = abs(i-xyh[0][0])+abs(j-xyh[0][1]) + xyh[0][2]
      for k in range(count):
        if h - abs(i-xyh[k][0])-abs(j-xyh[k][1]) - xyh[k][2] == 0:
          if k == count -1:
            print(i,j,h)
            exit(0)
        else:
          break
      
      
       
  #print(x,y,h)


if __name__ == "__main__":
  n = int(input())
  x,y,z = [0]*n,[0]*n,[0]*n
  
  count = 0
  xyh = [[],[],[]]
  
  for i in range(n):
    x[i],y[i],z[i] = map(int,input().split())
    if z[i] != 0 and count < 3:
      xyh[count].append(x[i])
      xyh[count].append(y[i])
      xyh[count].append(z[i])
      
      count += 1
  
  x,y,h = 0,0,0
  pass_ = 0
  for i in range(101):
    for j in range(101): 
      h = abs(i-xyh[0][0])+abs(j-xyh[0][1]) + xyh[0][2]
      if count == 3:
        if h - abs(i-xyh[1][0])-abs(j-xyh[1][1]) - xyh[1][2] == 0 and h - abs(i-xyh[2][0])-abs(j-xyh[2][1]) - xyh[2][2] == 0:
          pass_ = 1
          x,y = i,j
          break
      
      if count == 2:
        if h - abs(i-xyh[1][0])-abs(j-xyh[1][1]) - xyh[1][2] == 0 :
          pass_ = 1
          x,y = i,j
          break
	  if count == 1:
        pass_ = 1
    if pass_ == 1:
      break 
  print(x,y,h)


if __name__ == "__main__":
  n = int(input())
  x,y,z = [0]*n,[0]*n,[0]*n
  
  count = 0
  xyh = [[],[],[]]
  
  for i in range(n):
    x[i],y[i],z[i] = map(int,input().split())
    #if z[i] != 0 and count < 3:
    if z[i] != 0:
      xyh[count].append(x[i])
      xyh[count].append(y[i])
      xyh[count].append(z[i])
      
      count += 1
  
  x,y,h = 0,0,0
  pass_ = 0
  #print(count)
  for i in range(101):
    for j in range(101): 
      h = abs(i-xyh[0][0])+abs(j-xyh[0][1]) + xyh[0][2]
      for k in range(count):
        if h - abs(i-xyh[k][0])-abs(j-xyh[k][1]) - xyh[k][2] == 0:
          if k == count -1:
            print(i,j,h)
            exit(0)
        else:
          break
      
      
       
  #print(x,y,h)


if __name__ == "__main__":
  n = int(input())
  x,y,z = [0]*n,[0]*n,[0]*n
  
  count = 0
  xyh = [[],[],[]]
  
  for i in range(n):
    x[i],y[i],z[i] = map(int,input().split())
    #if z[i] != 0 and count < 3:
    if z[i] != 0:
      xyh[count].append(x[i])
      xyh[count].append(y[i])
      xyh[count].append(z[i])
      
      count += 1
  
  x,y,h = 0,0,0
  pass_ = 0
  #print(count)
  for i in range(101):
    for j in range(101): 
      h = abs(i-xyh[0][0])+abs(j-xyh[0][1]) + xyh[0][2]
      for k in range(count):
        if h - abs(i-xyh[k][0])-abs(j-xyh[k][1]) - xyh[k][2] == 0:
          if k == count -1:
            print(i,j,h)
            exit(0)
        else:
          break

#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
xyh = [input() for _ in range(n)]

for x_ in range(101):
    for y_ in range(101):
        cur_h = 0 
        for i in range(n):
            x = int(xyh[i].split()[0])
            y = int(xyh[i].split()[1])
            h = int(xyh[i].split()[2])
            h_ = h + (abs(x_ - x) + abs(y_ - y))
            if cur_h == 0 and h > 0:
                cur_h = h_  
            else:
                if h > 0:
                    if cur_h != h_: break
                elif cur_h -(abs(x_ - x) + abs(y_ - y)) > 0: break
        for i in range(n):
            x = int(xyh[i].split()[0])
            y = int(xyh[i].split()[1])
            h = int(xyh[i].split()[2])
            h_ = h + (abs(x_ - x) + abs(y_ - y))
            if cur_h == 0 and h > 0:
                cur_h = h_  
            else:
                if h > 0:
                    if cur_h != h_: break
                elif cur_h -(abs(x_ - x) + abs(y_ - y)) > 0: break   
                if i == n-1: 
                    print(x_,y_,cur_h)
                    #print("hello")
                    exit(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted