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: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                if H < 0:
                    H = 0
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            # if (0 <= X <= 100) and (0 <= Y <= 100) and (0 <= H <= 10 * 9):
            if 0 <= X and X <= 100 and 0 <= Y and Y <= 100 and 1 <= H and H <= 10 ** 9:
                print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                if H < 0:
                    H = 0
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            # if (0 <= X <= 100) and (0 <= Y <= 100) and (0 <= H <= 10 * 9):
            if 0 <= X and X <= 100 and 0 <= Y and Y <= 100 and 0 <= H and H <= 10 ** 9:
                print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            # if (0 <= X <= 100) and (0 <= Y <= 100) and (0 <= H <= 10 * 9):
            if 0 <= X and X <= 100 and 0 <= Y and Y <= 100 and 0 <= H and H <= 10 ** 9:
                print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            if 0 <= X <= 100 and 0 <= Y <= 100 and 0 <= H <= 10 * 9:
                print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            if X <= 100 and Y <= 100:
                print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)
    print(pairs)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            print(X, Y, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
                continue
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        for k in zero:
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height < abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        if ok:
            print(i, j, height)

Submission status: Wrong Answer

Solution code:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
                continue
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
                continue
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
        for k in zero:
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
                continue
            if height < abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
        if ok:
            print(i, j, height)

Submission status: Wrong Answer

Solution code:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
                continue
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
        for k in zero:
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
                continue
            if height < abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
        if ok:
            print(i, j, height)

Submission status: Wrong Answer

Solution code:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
                continue
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
        if ok:
            print(i, j, height)

Submission status: Wrong Answer

Solution code:
n=int(input())
list=[]
for i in range(n):
    x,y,h=map(int,input().split())
    list.append([x,y,h])
    if h>0:
        a=[x,y,h]
for i in range(101):
    for j in range(101):
        H=a[2]+abs(x-i)+abs(y-j)
        count=0
        for k in range(n):
            if list[k][2] ==max(H-abs(list[k][0]-i)-abs(list[k][1]-j),0):
                count +=1
        if count==n:
            print(i,j,H)
            exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
list=[]
for i in range(n):
    x,y,h=map(int,input().split())
    list.append([x,y,h])
    if h>0:
        a=[x,y,h]
for i in range(101):
    for j in range(101):
        H=a[2]+abs(x-i)+abs(y-j)
        count=0
        for k in range(n):
            if list[k][2] ==max(H-abs(list[k][0]-i)-abs(list[k][1]-j),0):
                count +=1
        if count==n:
            print(i,j,H)

Submission status: Wrong Answer

Solution code:
n = int(input())

info = [[int(x) for x in input().split()] for _ in range(n)]

def height(point, info):
    cx, cy = point[0], point[1]
    ch = None
    theo_max = float('inf')
    for i,p in enumerate(info):
        x, y, h= p[0], p[1], p[2]
        tmp = abs(cx-x) + abs(cy-y) + h
        if h == 0:
            theo_max = min(theo_max, tmp)
        else:
            if not ch:
                ch = tmp
                if theo_max < ch:
                    return None
                    break
            else:
                if ch != tmp:
                    return None
                    break
                if theo_max < ch:
                    return None
                    break
    return ch

t = None
ans = None
for x in range(101):
    if t:
        break
    for y in range(101):
        if t:
            break
        point = (x,y)
        t = height(point, info)
        if t :
            ans = [x,y,t]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())

info = [[int(x) for x in input().split()] for _ in range(n)]

def height(point, info):
    cx, cy = point[0], point[1]
    ch = None
    theo_max = float('inf')
    for i,p in enumerate(info):
        x, y, h= p[0], p[1], p[2]
        tmp = abs(cx-x) + abs(cy-y) + h
        if h == 0:
            theo_max = min(theo_max, tmp)
        else:
            if not ch:
                ch = tmp
                if theo_max < ch:
                    return None
                    break
            else:
                if ch != tmp:
                    return None
                    break
                if theo_max < ch:
                    return None
                    break
    if not ch:
        return theo_max
    else:
        return ch

t = None
ans = None
for x in range(101):
    if t:
        break
    for y in range(101):
        if t:
            break
        point = (x,y)
        t = height(point, info)
        if t :
            ans = [x,y,t]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
def GetHigh(x, y, h, Cx, Cy):
    N = len(x)
    K = [0 for i in range(N)]
    TorF = True
    for i in range(N):
        K[i] = abs(x[i]-Cx) + abs(y[i]-Cy) + h[i]
    for i in range(N-1):
        TorF = (K[i]==K[i+1])*TorF
    if(TorF):
        print(Cx, end=" ")
        print(Cy, end=" ")
        print(K[0])



    

N = int(input())
x = []
y = []
h = []
for i in range(N):
    data = input().split()
    data = [int(n) for n in data]
    x.append(data[0])
    y.append(data[1])
    h.append(data[2])

for i in range(101):
    for j in range(101):
        GetHigh(x, y, h, i, j)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    p = [list(map(int, input().split())) for _ in range(N)]
    x0, y0, h0 = p[0]
    for cx in range(101):
        for cy in range(101):
            H = h0 + abs(x0 - cx) + abs(y0 - cy)
            for x, y, h in p:
                if h != max(H - abs(x - cx) - abs(y - cy), 0):
                    break
            else:
                print(cx, cy, H)
                exit(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    p = [list(map(int, input().split())) for _ in range(N)]
    for cx in range(0, 101):
        for cy in range(0, 101):
            x, y, h = p[0]
            H = h + abs(x - cx) + abs(y - cy)
            for x, y, h in p:
                if h != max(H - abs(x - cx) - abs(y - cy), 0):
                    break
            else:
                print(cx, cy, H)
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    p = []
    for _ in range(N):
        x, y, h = map(int, input().split())
        p.append((x, y, h))
    for cx in range(0, 101):
        for cy in range(0, 101):
            x, y, h = p[0]
            H = max(h + abs(x - cx) + abs(y - cy), 0)
            for x, y, h in p[1:]:
                if h != max(H - abs(x - cx) - abs(y - cy), 0):
                    break
            else:
                print(cx, cy, H)
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    p = []
    for _ in range(N):
        x, y, h = map(int, input().split())
        p.append((x, y, h))
    for cx in range(0, 101):
        for cy in range(0, 101):
            x, y, h = p[0]
            H = max(h + abs(x - cx) + abs(y - cy), 0)
            found = True
            for x, y, h in p[1:]:
                if h != max(H - abs(x - cx) - abs(y - cy), 0):
                    found = False
                    break
            if found:
                print(cx, cy, H)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    p = []
    for _ in range(N):
        x, y, h = map(int, input().split())
        p.append((x, y, h))
    for cx in range(0, 101):
        for cy in range(0, 101):
            x, y, h = p[0]
            m = max(h + abs(x - cx) + abs(y - cy), 0)
            found = True
            for x, y, h in p[1:]:
                if m != max(h + abs(x - cx) + abs(y - cy), 0):
                    found = False
                    break
            if found:
                print(cx, cy, m)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      result = []
      for index in range(N):
         result_H = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result_H-abs(x[index]- i)-abs(y[index]-j) > 0:
            result.append(result_H)
      tmp = result[0]
      if all(tmp==num for num in result) == True:
         check = []
         for check_index in range(N):
            check.append(h[check_index]- (tmp - abs(x[check_index]- i) - abs(y[check_index]-j)))
         if all(z <= 0 for z in check) == True:
            print(i,' ',j,' ',tmp)
            break
   else:
      continue
   break

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      result = []
      for index in range(N):
         result_H = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result_H-abs(x[index]- i)-abs(y[index]-j) > 0:
            result.append(result_H)
      tmp = result[0]
      if all(tmp==num for num in result) == True:
         check = []
         for check_index in range(N):
            check.append(h[check_index]- (tmp - abs(x[check_index]- i) - abs(y[check_index]-j)))
         print(check)
         if all(z <= 0 for z in check) == True:
            print(i,' ',j,' ',tmp)
            break
   else:
      continue
   break

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      result = []
      for index in range(N):
         result_H = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result_H-abs(x[index]- i)-abs(y[index]-j) > 0:
            result.append(result_H)
      tmp = result[0]
      if all(tmp==num for num in result) == True:
         print(i,' ',j,' ',tmp)
         break
   else:
      continue
   break

Submission status: Wrong Answer

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

for X in range(101):
    for Y in range(101):
        for j in range(n-1):
            if abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2] == abs(X - arr[j+1][0])+abs(Y -arr[j+1][1])+arr[j+1][2]:
                flg.append(1)
            else:
                flg.append(0)
        if 0 not in flg :
            print('{} {} {}'.format(X,Y,abs(X - arr[0][0])+abs(Y -arr[0][1])+arr[0][2]))
        flg=[]

Submission status: Wrong Answer

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

for X in range(101):
    for Y in range(101):
        for j in range(n-1):
            if abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2] == abs(X - arr[j+1][0])+abs(Y -arr[j+1][1])+arr[j+1][2]:
                flg.append(1)
            else:
                flg.append(0)
        if 0 not in flg :
            print('{} {} {}'.format(X,Y,abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2]))
        flg=[]

Submission status: Wrong Answer

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

for X in range(101):
    for Y in range(101):
        for j in range(n-1):
            
            h0 = abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2]
            h1 = abs(X - arr[j+1][0])+abs(Y -arr[j+1][1])+arr[j+1][2]
            
            if h0 == h1:
                flg.append(1)
            else:
                flg.append(0)
        if 0 not in flg :
            print('{} {} {}'.format(X,Y,h1))
            break
        flg=[]

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
result = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      for index in range(N):
         result[index] = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result[index]-abs(x[index]- i)-abs(y[index]-j) < 0:
            result[index] = 0
      tmp = result[0]
      if all(tmp==num for num in result) == True:
         break
   else:
      continue
   break
print(i,' ',j,' ',tmp)

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
result = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      for index in range(N):
         result[index] = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result[index] < 0:
            result[index] = 0
      tmp = result[0]
      if all(tmp==num for num in result) == True:
         break
   else:
      continue
   break
print(i,' ',j,' ',tmp)

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
result = [0] * N
for index in range(N):
    x[index],y[index],h[index] = map(int,input().split())
for i in range(101):
   for j in range(101):
      for index in range(N):
         result[index] = h[index]+ abs(x[index]- i)+abs(y[index]-j)
         if result[index] < 0:
            result[index] = 0
      tmp = result[0]
      if all(tmp for num in result) == True:
         break
print(i,' ',j,' ',tmp)

Submission status: Wrong Answer

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

for Y in range(101):
    for X in range(101):
        for j in range(n-1):
            
            h0 = abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2]
            h1 = abs(X - arr[j+1][0])+abs(Y -arr[j+1][1])+arr[j+1][2]
            
            if h0 == h1:
                flg.append(1)
            else:
                flg.append(0)
        if 0 not in flg :
            print('{} {} {}'.format(X,Y,h1))
            break
        flg=[]

Submission status: Wrong Answer

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

for Y in range(101):
    for X in range(101):
        for j in range(n-1):
            
            h0 = abs(X - arr[j][0])+abs(Y -arr[j][1])+arr[j][2]
            h1 =abs(X - arr[j+1][0])+abs(Y -arr[j+1][1])+arr[j+1][2]
            
            if h0 == h1:
                flg.append(1)
            else:
                flg.append(0)
        if 0 not in flg :
            print('{} {} {}'.format(X,Y,h0))
        flg=[]

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))
    # if (h != 0):
    # list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    # list.append((x, y, h))
    if (h != 0):
        list.append((x, y, h))


from functools import reduce

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = list[-1][2] + abs(X - list[-1][0]) + abs(Y - list[-1][1])
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
                break
        if b == True:
            print(X, Y, H)
            sys.exit(0)

Submission status: Wrong Answer

Solution code:
N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    # list.append((x, y, h))
    if (h != 0):
        list.append((x, y, h))


from functools import reduce

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = list[-1][2] + abs(X - list[-1][0]) + abs(Y - list[-1][1])
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
                break
        if b == True:
            print(X, Y, H)
            exit

Submission status: Wrong Answer

Solution code:
N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    # list.append((x, y, h))
    if (h != 0):
        list.append((x, y, h))


from functools import reduce

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = list[0][2] + abs(X - list[0][0]) + abs(Y - list[0][1])
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
                break
        if b == True:
            print(X, Y, H)
            exit

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
e = [[int(_) for _ in input().split()] for _ in range(n)]

for xi, yi, hi in e:
    if hi > 0:
        xp = xi
        yp = yi
        hp = hi
        break

for cx, cy in itertools.product(range(101), range(101)):
    ch = abs(cx - xp) + abs(cy - yp) + hp
    flag = True
    for xi, yi, hi in e:
        flag = flag and max(ch - abs(cx - xi) - abs(cy - yi), 0) == 0
    if flag:
        print("%d %d %d" % (cx, cy, ch))

Submission status: Wrong Answer

Solution code:
N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))


from functools import reduce

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = list[0][2] + abs(X - list[0][0]) + abs(Y - list[0][1])
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
                break
        if b == True:
            print(X, Y, H)
            exit

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
e = [[int(_) for _ in input().split()] for _ in range(n)]

for xi, yi, hi in e:
    if hi > 0:
        xp = xi
        yp = yi
        hp = hi
        break

for cx, cy in itertools.product(range(101), range(101)):
    ch = abs(cx - xp) + abs(cy - yp) + hp
    flag = True
    for xi, yi, hi in e:
        flag = flag and abs(cx - xi)+abs(cy - yi) + hi <= ch
    if flag:
        print("%d %d %d" % (cx, cy, ch))

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
e = [[int(_) for _ in input().split()] for _ in range(n)]

for xi, yi, hi in e:
    if hi > 0:
        xp = xi
        yp = yi
        hp = hi
        break

for cx, cy in itertools.product(range(101), range(101)):
    ch = abs(cx - xp) + abs(cy - yp) + hp
    flag = True
    for xi, yi, hi in e:
        flag = flag and abs(cx - xi)+abs(cy - yi) + hi == ch
    if flag:
        print("%d %d %d" % (cx, cy, ch))

Submission status: Wrong Answer

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

for cx in range(101):
    for cy in range(101):
        try_H = 0
        for x, y, h in x_y_h:
            if h > 0:
                try_H = h + abs(x - cx) + abs(y - cy)
                break

        not_found = False
        for x, y, h in x_y_h:
            if h <= 0:
                continue
            tmp_H = h + abs(x - cx) + abs(y - cy)
            if tmp_H != try_H:
                not_found = True
                break
        if not_found:
            continue
        print(cx, cy, try_H)
        exit()

Submission status: Wrong Answer

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

for cx in range(101):
    for cy in range(101):
        try_H = 0
        for x, y, h in x_y_h:
            if h > 0:
                try_H = h + abs(x - cx) + abs(y - cy)
                break

        not_found = False
        for x, y, h in x_y_h:
            tmp_H = h + abs(x - cx) + abs(y - cy)
            if tmp_H != try_H:
                not_found = True
                break
        if not_found:
            continue
        print(cx, cy, try_H)
        exit()

Submission status: Wrong Answer

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


for cx in range(101):
    for cy in range(101):
        flag=1
        tmp=abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
        for i in range(1,N):
            if xyh[i][2]==0 and abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)<tmp:
                flag=0
                break
            if tmp!=abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)+xyh[i][2] and xyh[i][2]!=0:
                flag=0
                break
        if flag:
            print(cx, cy, tmp)
            exit(0)

Submission status: Wrong Answer

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

for Cx in range(101):
    for Cy in range(101):
        not_found = False
        try_H = None
        for x, y, h in x_y_h:
            if h <= 0:
                continue
            tmp_H = h + abs(x - Cx) + abs(y - Cy)
            if try_H is None:
                try_H = tmp_H
            elif tmp_H != try_H:
                not_found = True
                break
        if not_found:
            continue
        print(Cx, Cy, try_H)
        exit()

Submission status: Wrong Answer

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

for Cx in range(101):
    for Cy in range(101):
        not_found = False
        try_H = None
        for x, y, h in x_y_h:
            tmp_H = h + abs(x - Cx) + abs(y - Cy)
            if try_H is None:
                try_H = tmp_H
            elif tmp_H != try_H:
                not_found = True
                break
        if not_found:
            continue
        print(Cx, Cy, try_H)
        exit()

Submission status: Wrong Answer

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


for cx in range(101):
    for cy in range(101):
        flag=1
        tmp=abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
        for i in range(1,N):
            if xyh[i][2]==0 and abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)<tmp:
                flag=0
                break
            if tmp!=abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)+xyh[i][2] and xyh[i][2]!=0:
                flag=0
                break
        if flag:
            print(cx, cy, tmp)
            exit(0)