Problem:


Score: 300 points

Problem Statement

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.  

Constraints

N is an integer between 1 and 100 (inclusive).

x_i and y_i are integers between 0 and 100 (inclusive).

h_i is an integer between 0 and 10^9 (inclusive).

The N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.

The center coordinates and the height of the pyramid can be uniquely identified.

Input

Input is given from Standard Input in the following format:  

N
x_1 y_1 h_1
x_2 y_2 h_2
x_3 y_3 h_3
:
x_N y_N h_N

Output

Print values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.  

Sample Input 1

4
2 3 5
2 1 5
1 2 5
3 2 5

Sample Output 1

2 2 6

In this case, the center coordinates and the height can be identified as (2, 2) and 6.  

Sample Input 2

2
0 0 100
1 1 98

Sample Output 2

0 0 100

In this case, the center coordinates and the height can be identified as (0, 0) and 100.

Note that C_X and C_Y are known to be integers between 0 and 100.

Sample Input 3

3
99 1 191
100 1 192
99 0 192

Sample Output 3

100 0 193

In this case, the center coordinates and the height can be identified as (100, 0) and 193.  



Sample input:
4
2 3 5
2 1 5
1 2 5
3 2 5


Sample output:
2 2 6

Submission status: Runtime Error

Solution code:
n = int(input())
if n == 1:
    x, y, h = map(int, input().split())
    print(x, y, h)
    exit()
for _ in range(n):
    s = [list(map(int, input().split())) for _ in range(n)]
    for i in range(101):
        for j in range(101):
            h = -1
            ok = 1
            for t in s:
                if h == -1:
                    h = abs(t[0] - i) + abs(t[1] - j) + t[2]
                else:
                    h0 = abs(t[0] - i) + abs(t[1] - j) + t[2]
                    if h == h0:
                        ok += 1
            if ok == n:
                print(i, j, h)
                exit()

Submission status: Runtime Error

Solution code:
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

for _ in range(0,n):
    if ab[_][2] !=0:
        x = ab[_][0]
        y = ab[_][1]
        h = ab[_][2]

for i in range(101):
    for j in range(101):
        f = True
        l = abs(i-x)+abs(i-y)+h
        for k in range(0,n):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            if max(l-abs(i-dx)-abs(j-dy),0) ==dh:
                pass
            else:
                f = False
                break
        if f:
            ansx =i
            ansy =j
            ansr = l
            break
print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
 
for i in range(101):
    for j in range(101):
        res = []
        zero = []
        f = True
        for k in range(0,n):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            if dh ==0:
                zero.append([dx,dy])
            else:
                res.append(abs(i-dx)+abs(j-dy)+dh)
        if len(set(res)) == 1:
            for l in zero:
                if res[0] - (abs(i-l[0])+abs(f-l[1])) <=0:
                    pass
                else:
                    f = False
            if f == True:
                ansx =i
                ansy =j
                ansr = res[0]

print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
 
for i in range(101):
    for j in range(101):
        res = []
        zero = []
        f = True
        for k in range(0,n):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            if dh ==0:
                zero.append([dx,dy])
            else:
                res.append(abs(i-dx)+abs(j-dy)+dh)
        if len(set(res)) == 1:
            for l in zero:
                if res[0] - (abs(i-l[0])+abs(f-l[1])) <=0:
                    pass
                else:
                    f = False
                    break
            if f:
                ansx =i
                ansy =j
                ansr = res[0]

print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())

ab = [list(map(int, input().split())) for _ in range(n)]

for i in range(101):
    for j in range(101):
        res = [abs(i-ab[0][0])+abs(j-ab[0][1])+ab[0][2]]
        f = False
        for k in range(1,n):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            res.append(abs(i-dx)+abs(j-dy)+dh)
        if len(set(res)) == 1:
            ansx =i
            ansy =j
            ansr = res[0]
            break
        
print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())
x,y,h = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(n-1)]

for i in range(101):
    for j in range(101):
        res = [abs(i-x)+abs(j-y)+h]
        f = False
        for k in range(n-1):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            res.append(abs(i-dx)+abs(j-dy)+dh)
        if len(set(res)) == 1:
            ansx =i
            ansy =j
            ansr = res[0]
            break
        
print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())
x,y,h = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(n-1)]

for i in range(101):
    for j in range(101):
        res = abs(i-x)+abs(j-y)+h
        f = False
        for k in range(n-1):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            ress = abs(i-dx)+abs(j-dy)+dh
            if res == ress:
                pass
            else:
                f = True
        if f ==False:
            ansx =i
            ansy =j
            ansr = res
            break
print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())

x,y,h = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(n-1)]

for i in range(101):
    for j in range(101):
        res = abs(i-x)+abs(j-y)+h
        f = False
        for k in range(n-1):
            dx = ab[k][0]
            dy = ab[k][1]
            dh = ab[k][2]
            ress = abs(i-dx)+abs(j-dy)+dh
            if res == ress:
                pass
            else:
                f = True
                break
        if f ==False:
            ansx =i
            ansy =j
            ansr = res
            break
print(str(ansx)+" "+str(ansy)+" "+str(ansr))

Submission status: Runtime Error

Solution code:
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]))

for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        # print(cx, cy, ch)
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
            break
    if flg:
        break
print(*ans)

Submission status: Runtime Error

Solution code:
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]))

for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        # print(cx, cy, ch)
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
            # break
    if flg:
        break
print(*ans)

Submission status: Runtime Error

Solution code:
N=int(input())
L=[list(map(int,input().split())) for _ in range(N)]

for x in range(101):
    for y in range(101):
        cond=True
        H=abs(x-L[0][0])+abs(y-L[0][1])+L[0][2]
        if H<=0:
            cond=False
            continue
        for i in range(1,N):
            if H!=L[i][2]+abs(x-L[i][0])+abs(y-L[i][1]):
                cond=False
                break
        if cond:
            ans=[x,y,H]

print(ans[0],ans[1],ans[2])

Submission status: Runtime Error

Solution code:
import sys
from itertools import product
input = sys.stdin.readline
xyh = []
xyh0 = []
N=int(input())
for _ in range(N):
    tmp1, tmp2, tmp3 = map(int, input().split())
    if tmp3 > 0:
        xyh.append((tmp1, tmp2, tmp3))
    else:
        xyh0.append((tmp1, tmp2, tmp3))
ans = None
for cx, cy in product(range(101), repeat=2):
    H = None
    H_lower = 1
    is_ok = 1
    for x, y, h in xyh:
        if H is None:
            H = abs(x-cx)+abs(y-cy)+h
        else:
            if H != abs(x-cx)+abs(y-cy)+h:
                is_ok = 0
                break
    if not is_ok or H is None:
        continue
    for x, y, h in xyh0:
        H_lower = max(H_lower, abs(x-cx)+abs(y-cy))
    if H < H_lower:
        continue
    ans = (cx, cy, H)
    break
        
print(*ans)

Submission status: Runtime Error

Solution code:
"""
ABC112C Diff:
"""
import sys
from itertools import product
input = sys.stdin.readline
xyh = []
xyh0 = []
N=int(input())
for _ in range(N):
    tmp1, tmp2, tmp3 = map(int, input().split())
    if tmp3 > 0:
        xyh.append((tmp1, tmp2, tmp3))
    else:
        xyh0.append((tmp1, tmp2, tmp3))
ans = None
for cx, cy in product(range(101), repeat=2):
    H = None
    H_lower = 1
    is_ok = 1
    for x, y, h in xyh:
        if H is None:
            H = abs(x-cx)+abs(y-cy)+h
        else:
            if H != abs(x-cx)+abs(y-cy)+h:
                is_ok = 0
                break
    if not is_ok:
        continue
    for x, y, h in xyh0:
        H_lower = max(H_lower, abs(x-cx)+abs(y-cy))
    if H < H_lower:
        continue
    ans = (cx, cy, H)
    break
        
print(*ans)

Submission status: Runtime Error

Solution code:
# Date [ 2020-08-24 21:23:20 ]
# Problem [ test.py ]
# Author Koki_tkg

import sys
# import math
# import bisect
import numpy as np
# from decimal import Decimal
import numba as nb
from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

@njit(cache=True)
def solve(info):
    for Cx in range(101):
        for Cy in range(101):
            height = abs(Cx - info[0][0]) + abs(Cy - info[0][1]) + info[0][2]
            flag = True
            for i in range(1, len(info) - 1):
                x, y, h = info[i][0], info[i][1], info[i][2]
                val = max(height - abs(Cx - x) - abs(Cy - y), 0)
                if h == val:
                    continue
                else:
                    flag = False
                    break
            if flag:
                return Cx, Cy, height

def Main():
    n = read_int()
    info = np.empty((n, 3), dtype=np.int64)
    for i in range(n):
        info[i][0], info[i][1], info[i][2] = read_ints()
    print(*solve(info))

if __name__ == '__main__':
    Main()

Submission status: Runtime Error

Solution code:
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      if h[k]>0:
        alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ans=True
      for k in range(n):
        if h[k]==0:
          if alist[0]<(h[k]+abs(x[k]-i)+abs(y[k]-j)):
            ans=False
      if ans:
        ansx=i
        ansy=j
        ansh=alist[0]
print(ansx,ansy,ansh)

Submission status: Runtime Error

Solution code:
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      if h[k]>0:
        alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ans=True
      for k in range(n):
        if h[k]==0:
          if alist[0]>(h[k]+abs(x[k]-i)+abs(y[k]-j)):
            ans=False
      if ans:
        ansx=i
        ansy=j
        ansh=alist[0]
print(ansx,ansy,ansh)

Submission status: Runtime Error

Solution code:
n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int, input().split())
for i in range(101):
  for j in range(101):
    alist=[0]*n
    for k in range(n):
      alist[k]=(h[k]+abs(x[k]-i)+abs(y[k]-j))
    if len(set(alist))==1:
      ansx=i
      ansy=j
      ansh=alist[0]
print(ansx,ansy,ansh)

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
flag=True
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if flag and pira[2] == 0 and ansh==-1 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      
      elif flag and pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        flag=False
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and ansh-abs(cx-pira[0])-abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
flag=True
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if flag = True and pira[2] == 0 and ansh==-1 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      
      elif flag = True and pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        flag=False
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and ansh-abs(cx-pira[0])-abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] == 0 and ansh=-1 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      
      elif pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and ansh-abs(cx-pira[0])-abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] == 0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])==0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      
      elif pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
flag=True
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    flag=True
    for pira in xyh:
      
      if (flag or ansh == -1) and pira[2] > 0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        flag=False
        
      elif (flag or ansh == -1) and pira[2] == 0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        
      elif pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      elif pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
ansh=-1
ans=[]
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      elif pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
      elif pira[2]==0 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])>=0:
        ans=[]
        break
print(*ans[0])

Submission status: Runtime Error

Solution code:
n=int(input())
xxx=[list(map(int,input().split())) for i in range(n)]
xxx.sort(key=x[2])

for cx in range(101):
  for cy in range(101):
      H=xxx[-1][2]+abs(cx-xxx[-1][0])+abs(cy-xxx[-1][1])
      judge=True
      for i in range(n):
        if max(abs(cx-xxx[i][0])+abs(cy-xxx[i][1])+xxx[i][2],0)!=H:
          judge=False
        
      if judge==True:
        print(cx,cy,H)
        exit()

Submission status: Runtime Error

Solution code:
n=int(input())
x=[list(map(int,input().split())) for i in range(n)]
xx=[]
for i in range(n):
  xx.append(x[i][2])

for cx in range(101):
  for cy in range(101):
    for H in range(max(1,min(xx)),max(xx)+200)

    judge=True
    for i in range(n):
      if max(abs(cx-x[i][0])+abs(cy-x[i][1])+x[i][2],0)!=H:
        judge=False
        
    if judge==True:
      print(cx,cy,H)
      exit()

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int,input().split()))

for cx in range(0,100):
  for cy in range(0,100):
    H=abs(cx-x[0][0])+abs(cy-x[0][1])+x[0][2]
    judge=True
    for in range(1,n):
      if abs(cx-x[i][0])+abs(cy-x[i][1])+x[i][2]!=H:
        judge=False
        
    if judge==True:
      print(cx,cy,H)
      exit()

Submission status: Runtime Error

Solution code:
n=int(input())
x=list(map(int,input().split()))

for cx in range(0,100):
  for cy in range(0,100):
    H=abs(cx-x[0][0])+abs(cy-x[0][1])+x[0][2]
    judge=True
    for in range(1,n):
      if abs(cx-x[i][0])+abs(cy-x[i][1])+x[i][2]!=H:
        judge=False
        
    if judge=True:
      print(cx,cy,H)
      exit()

Submission status: Runtime Error

Solution code:
from copy import *
n,m=map(int,input().split())
t=int(m/n)
while True:
    if m%t==0:
        if t*n<=m:
            print(t)
            exit()
        else:
            t-=1
    else:
        t-=1

Submission status: Runtime Error

Solution code:
n=int(input())
z=[]
for i in range(n):
     z.append(list(map(int,input().split())))
for cx in range(101):
    for cy in range(101):
        ans=set()
        for i in range(n):
            x,y,h=z[i][0],z[i][1],z[i][2]
            if h!=0:
                tmp=h+abs(x-cx)+abs(y-cy)
                ans.add(tmp)
        if len(ans)==1:
            for i in range(n):
                x,y,h=z[i][0],z[i][1],z[i][2]
                if h==0:
                    if ans[0]-abs(x-cx)-abs(y-cy)>=0:
                        break
            print(cx,cy,*ans)
            exit()

Submission status: Runtime Error

Solution code:
import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1 and h!=0:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            sys.exit()
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                sys.exit()
print(0,0,0)

Submission status: Runtime Error

Solution code:
import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1 and h!=0:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])

Submission status: Runtime Error

Solution code:
import sys
p=0
n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            p+=1
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                P+=1
if p>=2:
    print(l)

Submission status: Runtime Error

Solution code:
import sys
p=0
n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            p+=1
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                P+=1
if P>=2:
    print(l)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)

check = False
    
for i in range(500):
    for j in range(500):
        b = 0
        while b < n:
            if b == 0:
                h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                b +=1
            else:
                de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]),0)
                if de == a[b][2]:
                    b+=1
                else:
                    break
        if b == n:
            ans = str(i) + ' ' + str(j) + ' ' +str(h)
            check = True
        if check:
            break
    if check:
        break
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
if n == 1:
    print(str(a[0][0]) + ' ' + str(a[0][1]) + ' ' + str(a[0][2])) 
else:    
    check = False
    for i in range(101):
        for j in range(101):
            h = []
            for k in range(n):
                c = abs(i - a[k][0]) + abs(j -a[k][1]) + a[k][2]
                h.append(c)
            count = h.count(h[0])
            if len(h) == count:
                ans = str(i) + ' ' + str(j) + ' ' +str(h[0])
                check = True
            if check:
                break
        if check:
            break
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
if n == 1:
    print(str(a[0][0]) + ' ' + str(a[0][1]) + ' ' + str(a[0][2])) 
else:    
    check = False
    for i in range(101):
        for j in range(101):
            b = 0
            while b < n:
                if b == 0:
                    h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                    b +=1
                else:
                    de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]),0)
                    if de == a[b][2]:
                        b+=1
                    else:
                        break
            if b == n:
                ans = str(i) + ' ' + str(j) + ' ' +str(h)
                check = True
            if check:
                break
        if check:
            break
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
if n == 1:
    print(str(a[0][0]) + ' ' + str(a[0][1]) + ' ' + str(a[0][2])) 
else:    
    check = False
    for i in range(101):
        for j in range(101):
            b = 0
            while b < n-1:
                if b == 0:
                    h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                    b +=1
                else:
                    de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]),0)
                    if de == a[b][2]:
                        b+=1
                    else:
                        break
            if b == n-1:
                ans = str(i) + ' ' + str(j) + ' ' +str(h)
                check = True
            if check:
                break
        if check:
            break
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    _ = list(map(int, input().split()))
    a.append(_)
check = False
for i in range(101):
    for j in range(101):
        b = 0
        while b < n-1:
            if b == 0:
                h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
                b +=1
            else:
                de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]),0)
                if de == a[b][2]:
                    b+=1
                else:
                    break
        if b == n-1:
            ans = str(i) + ' ' + str(j) + ' ' +str(h)
            check = True
        if check:
            break
    if check:
        break
print(ans)