TnT/Multi_CodeNet4Repair huggingface dataset:
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):
def high(i):
    return abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2]

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

for i in range(N):
    if xyh[i][2] != 0:
        non_zero = i
        break

for cx in range(0, 101):
    for cy in range(0, 101):
        H = high(non_zero)
        if all([H == max(high(i), H) for i in range(N)]):
            print('{} {} {}'.format(cx, cy, H))
            break

def high(i):
    return max(H - abs(x[i] - Cx) - abs(y[i] - Cy), 0)

N = int(input())
x = []
y = []
h = []
for _ in range(N):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)

for i in range(N):
    if h[i] != 0:
        non_zero = i
        break

found = False
for Cx in range(0, 101):
    for Cy in range(0, 101):
        H = h[non_zero] + abs(x[non_zero] - Cx) + abs(y[non_zero] - Cy)
        if all([h[i] == high(i) for i in range(N)]):
            print('{} {} {}'.format(Cx, Cy, H))
            found = True
            break
    if found:
        break

Verdicts: Wrong Answer

Accepted
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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
h = [list(map(int, input().split())) for _ in range(N)]
ans = [0] * 3
for i in h:
    for j in range(101):
        for k in range(101):
            tmp = i[2] + abs(i[0] - j) + abs(i[1] - k)
            tMax = max(tmp, 0)
            if tMax > 0:
                ans[0] = j
                ans[1] = k
                ans[2] = i[2] + abs(i[0] - j) + abs(i[1] - k)
                print(ans[0], ans[1], ans[2])
                sys.exit()



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
h = [list(map(int, input().split())) for _ in range(N)]
sh = sorted(h, key=lambda x: x[2], reverse=True)

ans = [0] * 3
for i in range(101):
    for j in range(101):
        ansB = True
        ansh = sh[0][2] + abs(sh[0][0] - i) + abs(sh[0][1] - j)
        for k in range(N):

            tmp = max(ansh - abs(sh[k][0] - i) - abs(sh[k][1] - j), 0)

            if tmp != sh[k][2]:
                ansB = False
                break

        if ansB:
            print(i, j, ansh)
            sys.exit()



Verdicts: Wrong Answer

Accepted
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):
N = int(input())

xyh_list = list()

for i in range(N):
    x,y,h = map(int, input().split())
    xyh_list.append((x,y,h))
    
for i in range(N):
    h = xyh_list[i][2]
    if h != 0:
        no_zero_h = i
        break
else:


break_flag = 0

for i in range(0,101):
    for j in range(0,101):
        
        x = xyh_list[no_zero_h][0]
        y = xyh_list[no_zero_h][1]
        h = xyh_list[no_zero_h][2]
        H = h + abs(x-i) + abs(y-j)
        
        if 1 <= H:
            for k in range(0,N):
                x = xyh_list[k][0]
                y = xyh_list[k][1]
                h = xyh_list[k][2]
                
                if h + abs(x-i) + abs(y-j) != H:
                    break
            else:
                print(i,j,H)
                break_flag = 1
                
        if break_flag == 1:
            break
            
    if break_flag == 1:
        break

N = int(input())

xyh_list = list()

for i in range(N):
    x,y,h = map(int, input().split())
    xyh_list.append((x,y,h))
    
for i in range(N):
    h = xyh_list[i][2]
    if h != 0:
        no_zero_h = i
        break


break_flag = 0

for i in range(0,101):
    for j in range(0,101):
        
        x = xyh_list[no_zero_h][0]
        y = xyh_list[no_zero_h][1]
        h = xyh_list[no_zero_h][2]
        H = h + abs(x-i) + abs(y-j)
        
        if 1 <= H:
            for k in range(0,N):
                x = xyh_list[k][0]
                y = xyh_list[k][1]
                h = xyh_list[k][2]
                
                if (h != 0 and h + abs(x-i) + abs(y-j) != H) or (h == 0 and H - abs(x-i) - abs(y-j) > 0):
                    break
            else:
                print(i,j,H)
                break_flag = 1
                
        if break_flag == 1:
            break
            
    if break_flag == 1:
        break

Verdicts: Runtime Error

Accepted
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):
N = int(input())
x = []
y = []
h = []
for i in range(N):
    a,b,c = [int(hoge) for hoge in input().split()]
    x.append(a)
    y.append(b)
    h.append(c)
    
cand_h = []
cx = 0
cy = 0
H = 0
done_flag = False

for i in range(101):
    for j in range(101):
        # (x, y) = (i, j)
        for k in range(N):
            if h[k] != 0:
                cand_h.append(h[k] + abs(x[k] - i) + abs(y[k] - j))
        
        if len(set(cand_h)) == 1:
            print("{} {} {}".format(i, j, cand_h[0]))
            done_flag = True
            break
    if done_flag:
        break

N = int(input())
x = []
y = []
h = []
for i in range(N):
    a,b,c = [int(hoge) for hoge in input().split()]
    x.append(a)
    y.append(b)
    h.append(c)

cx = 0
cy = 0
H = 0
done_flag = False

for i in range(101):
    for j in range(101):
        # (x, y) = (i, j)
        cand_h = []
        min_h = []

        for k in range(N):
            if h[k] != 0:
                cand_h.append(h[k] + abs(x[k] - i) + abs(y[k] - j))
            else:
                min_h.append(abs(x[k] - i) + abs(y[k] - j))
                
        min_h = min(min_h) if len(min_h) > 0 else 100000000000
    
        if len(set(cand_h)) == 1 and list(set(cand_h))[0] <= min_h:
            print("{} {} {}".format(i, j, cand_h[0]))
            done_flag = True
            break
    if done_flag:
        break

Verdicts: Wrong Answer

Accepted
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):
import sys

N = int(input())
xs = []
ys = []
hs = []
for i in range(N):
    x, y, h = map(int, input().split())
    if h > 0:
        xs.append(x)
        ys.append(y)
        hs.append(h)
n = len(xs)

for cx in range(0, 100+1):
    for cy in range(0, 100+1):
        Hs = set()
        for i in range(n):
            calcH = max(abs(xs[i]-cx) + abs(ys[i]-cy) + hs[i], 0)
            if calcH == hs[i]:
                Hs.add(calcH)
        if len(Hs) == 1:
            print(cx, cy, Hs.pop())
            sys.exit(0)


import sys



N = int(input())
xs = []
ys = []
hs = []
reference = None
for i in range(N):
    x, y, h = map(int, input().split())
    xs.append(x)
    ys.append(y)
    hs.append(h)
    
    if h > 0:
        reference = (x, y, h)

for cx in range(0, 100+1):
    for cy in range(0, 100+1):
        
        rx, ry, rh = reference
        ref_H = rh + abs(rx-cx) + abs(ry-cy)
        
        ok = True
        for i in range(N):
            calc_H = max(ref_H - abs(xs[i]-cx) - abs(ys[i]-cy), 0)
            if calc_H != hs[i]:
                ok = False
                break
        if ok:
            print(cx, cy, ref_H)
            sys.exit(0)


Verdicts: Wrong Answer

Accepted
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):
# -*- coding: utf-8 -*-

N = int(input())
X, Y, H = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    H.append(h)

for x in range(101):
    for y in range(101):
        hc = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] > 0}
        h0 = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] == 0}
        if len(hc) == 1 and max(h0) <= max(hc):
            print(x, y, list(hc)[0])
            break


# -*- coding: utf-8 -*-

N = int(input())
X, Y, H = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    H.append(h)

for x in range(101):
    for y in range(101):
        hc = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] > 0}
        h0 = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] == 0}
        if len(hc) == 1:
            if (len(h0) > 0 and min(h0) >= list(hc)[0]) or len(h0) == 0:
                print(x, y, list(hc)[0])
                break


Verdicts: Runtime Error

Accepted
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):
N = int(input())
L = [input().split() for i in range(N)]
answer = 0
center = []

for i in range(101):
  for j in range(101):
    List = []
    for l in L:
      if int(l[2]) != 0:
        List.append(int(l[2]) + abs(int(l[0]) - i) + abs(int(l[1]) - j))
      else:
        List.append(0)
    print(List)
    if len(list(set(List))) == 1:
      answer = List[0]
      center.append(i)
      center.append(j)

print(center[0], center[1], answer)

#!/usr/bin/env python3
import sys


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    X = 0
    Y = 0
    hh = 0
    for i in range(0, 101):
        for j in range(0, 101):
            H =  []
            s = 0
            for k in range(N):
                if h[k] > 0:
                    s += h[k]
                    H.append(h[k] + abs(x[k] - i) + abs(y[k] - j))
            if len(H) > 1 and len(list(set(H))) == 1:
                X, Y, hh = i, j, H[-1]
            elif len(H) == 1 and H[0] == s:
                X, Y, hh = i, j, H[0]

    print(X, Y, hh)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    h = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
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):
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
H=0
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if H==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)

N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)

Verdicts: Runtime Error

Accepted
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):
def dist(h,xi, yi, cx, cy):
    return h + abs(xi - cx) + abs(yi - cy)

N = int(input())
P = []
for i in range(N):
    h, xi, yi, = map(int, input().split())
    P.append([h, xi, yi])
P.sort(reverse = True)

for i in range(101):
    for j in range(101):
        H = dist(P[0][0], P[0][1], P[0][2],i, j)
        for p in P[1:]:
            if max(H - abs(p[1]-i)-abs(p[2]-j), 0) != p[0]:
                break
        else:
            print(i, j, H)
            break

def dist(h,xi, yi, cx, cy):
    return h + abs(xi - cx) + abs(yi - cy)

N = int(input())
P = []
for i in range(N):
    xi, yi, h= map(int, input().split())
    P.append([h, xi, yi])
P.sort(reverse = True)

for i in range(101):
    for j in range(101):
        H = dist(P[0][0], P[0][1], P[0][2],i, j)
        for p in P[1:]:
            if max(H - abs(p[1]-i)-abs(p[2]-j), 0) != p[0]:
                break
        else:
            print(i, j, H)
            break

Verdicts: Wrong Answer

Accepted
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):
n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    xyh.append(a)

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(n):
            if xyh[i][2]==0:
                if l>abs(x-xyh[i][0])+abs(y-xyh[i][1]:
                    p=1
                    break
                else:
                    continue
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()
            



n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    xyh.append(a)

from operator import itemgetter
xyh.sort(key=itemgetter(2))
xyh.reverse()

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(n):
            if xyh[i][2]==0:
                if l>abs(x-xyh[i][0])+abs(y-xyh[i][1]):
                    p=1
                    break
                else:
                    continue
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()
            



Verdicts: Runtime Error

Accepted
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):
from collections import defaultdict
if __name__ == '__main__':
    N = int(input())
    xyh = [None]*N
    for i in range(N):
        xyh[i] = list(map(int, input().split()))
    
    X = xyh[0][0]
    Y = xyh[0][1]
    H = xyh[0][2]
    height = 0
    
    for x in range(0, 101):
        for y in range(0, 101):
            flag = True
            for i in range(1, N):
                if xyh[i][2] != 0:
                    if height == 0:
                        height = xyh[i][2] + abs(xyh[i][0] - x) + abs(xyh[i][1] - y)
                    if height != xyh[i][2] + abs(xyh[i][0] - x) + abs(xyh[i][1] - y):
                        flag = False
                        break
                    
            
            if flag:
                X = x
                Y = y
                    
    H = xyh[0][2] + abs(xyh[0][0] - X) + abs(xyh[0][1] - Y)
    
    print(X, Y, H)

from collections import defaultdict
if __name__ == '__main__':
    N = int(input())
    xyh = [None]*N
    for i in range(N):
        xyh[i] = list(map(int, input().split()))
    
    H = 0
    for i in range(N):
        if xyh[i][2] >= H:
            X = xyh[i][0]
            Y = xyh[i][1]
            H = xyh[i][2]
            I = i
    
    flag = True
    for i in range(0, N):
        if xyh[i][2] != max(H - abs(xyh[i][0] - X) - abs(xyh[i][1] - Y), 0):
            flag = False
            break
    
        
    if not flag:
        for x in range(0, 101):
            for y in range(0, 101):
                flag = True
                height = 0
                for i in range(0, N):
                    if xyh[i][2] != 0:
                        if height == 0:
                            height = xyh[i][2] + abs(xyh[i][0] - x) + abs(xyh[i][1] - y)
                        if height != xyh[i][2] + abs(xyh[i][0] - x) + abs(xyh[i][1] - y):
                            flag = False
                            break
                    else:
                        if abs(xyh[i][0] - x) + abs(xyh[i][1] - y) < height:
                            flag = False
                            break
                if flag and height:
                    X = x
                    Y = y
    
    H = xyh[I][2] + abs(xyh[I][0] - X) + abs(xyh[I][1] - Y)
     
    print(X, Y, H)

Verdicts: Wrong Answer

Accepted
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):
import sys

N = int(input())

x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]

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

# N = 4

# x = [2,2,1,3]

# h = [5,5,5,5]

def dif(x,y,a,b):
    ans = int(abs(x-a) + abs(y-b))
    return(ans)


for i in range(N):
    if h[i] != 0:
        xt, yt, ht = x[i], y[i], h[i]
        break

print("xt,yt,ht = ",xt,yt,ht)

for i in range(101):
    for j in range(101): 
        print("i,j = ",i,j)


        collect = True
        top = ht + dif(i, j, xt, yt)
        print("top =",top)

        for k in range(N):
            print("trying",k,"-th info")
            h_predict = top - dif(x[k], y[k], i, j)
            print(h_predict)
            print(h[k])

            if h[k] != h_predict:
                collect = False
                break

        if collect:
            print(i,j,top)
            sys.exit()



import sys

N = int(input())

x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]

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

# N = 4

# x = [2,2,1,3]

# h = [5,5,5,5]

def dif(x,y,a,b):
    ans = int(abs(x-a) + abs(y-b))
    return(ans)


for i in range(N):
    if h[i] != 0:
        xt, yt, ht = x[i], y[i], h[i]
        break


for i in range(101):
    for j in range(101): 

        collect = True
        top = ht + dif(i, j, xt, yt)

        for k in range(N):
            h_predict = max(0, top - dif(x[k], y[k], i, j))

            if h[k] != h_predict:
                collect = False
                break

        if collect:
            print(i,j,top)
            sys.exit()



Verdicts: Wrong Answer

Accepted
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):
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 = []
grid = [[-1] * 100 for _ in range(100)]
for i in range(n):
    a, b, c = il()
    grid[a][b] = c
    l.append(list(a, b, c))
cx, cy = 0, 0
x, y = 0, 0
hoge = []
for i in range(n):
    for j in range(n):
        if i == j: continue
        if l[i][2] == l[j][2]:
            if l[i][0] == l[j][0] or l[i][1] == l[j][1]:
                hoge.append(list(i, j))
                print((l[i][0] + l[j][0]) // 2, (l[i][1] + l[j][1]) // 2, l[1][2]+1)
                exit()
a, b = hoge[0]
if l[a][0] == l[b][0]:
    if l[a][1] + l[b][1] > 100:
        print(l[a][0], 100, l[a][2]+1)
    else:
        print(l[a][0], 0, l[a][2]+1)
else:
    if l[a][0] + l[b][0] > 100:
        print(100, l[a][1], l[a][2]+1)
    else:
        print(0, l[a][1], l[a][2]+1)

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)

Verdicts: Runtime Error

Accepted
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):
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for cx in range(101):
    for cy in range(101):
        ll=[]
        flag=True
        for i in range(n):
            H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
            ll.append(H)
            if i!=0 and all(ll[j]!=ll[j-1] for j in range(1,i):
                flag=False
                break
        if flag:
            print(cx,cy,H)
            break


n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for cx in range(101):
    for cy in range(101):
        ll=[]
        flag=True
        for i in range(n):
            H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
            ll.append(H)
            if i!=0 and all(ll[j]!=ll[j-1] for j in range(i):
                flag=False
                break
        if flag:
            print(cx,cy,H)
            break


n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for cx in range(101):
    for cy in range(101):
        ll=[]
        flag=True
        for i in range(n):
            H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
            ll.append(H)
            if i!=0 and all(ll[j]!=ll[j-1] for j in range(1,i+1)):
                flag=False
                break
        if flag:
            print(cx,cy,H)
            break


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()


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
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):
n=int(input())
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    if h!=0:
        l.append([x,y,h])
l2=[]
s=l[0]
for x in range(100):
    for y in range(100):
        l2.append([h+abs(x-s[1])+abs(y-s[2]),x,y])
for i in range(len(l2)):
    h,x,y=l2[i][0],l2[i][1],l2[i][2]
    for t in l[1:]:
        if t[2]==h-abs(x-t[0])-abs(y-t[1]):
            print(1)
            continue
        else:
            l2[i]=0
            break
print(list(i for i in l2 if i!=0))

n=int(input())
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    l.append([x,y,h])
    if h!=0:
        a,b,c=x,y,h
for x in range(101):
    for y in range(101):
        h=c+abs(x-a)+abs(y-b)
        if all(r==max(h-abs(x-s)-abs(y-t),0)for s,t,r in l):
            print(x,y,h)
            exit()

Verdicts: Wrong Answer

Accepted
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):
A=abs
h,y,x=max([list(map(int,t.split()[::-1]))for t in open(0)][1:])
r=range(101)
for i in r:
 for j in r:H=h+A(x-j)+A(y-i);print(*(j,i,H)*all(u==max(H-A(s-j)-A(t-i),0)for u,t,s in p))

#!/usr/bin/env python3
a = abs
z = [list(map(int, input().split())) for _ in range(int(input()))]
z.sort(key = lambda x: x[2])
x, y, h = z[-1]
r = range(101)
for c in r:
    for d in r:
        H = h + a(c-x) + a(d-y)
        if all(u == max(H - a(s-c) - a(t-d), 0) for s, t, u in z):
            print(c, d, H)
            exit()


Verdicts: Runtime Error

Accepted
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):
n = int(input())
P = [0] * n
for i in range(n):
    P[i] = list(map(int, input().split()))
P = sorted(P, key=lambda x: x[2], reverse=True)

x, y, h = P[-1]
max_h = max(100-x, x, 100-y, y) + h

P2 = []
for i in range(101):
    for j in range(101):
        P2.append((i, j))
P2 = set(P2)
for hh in range(max_h, P[-1][2]-1, -1):
    P3 = P2.copy()
    for x, y, h in P:
        for xx, yy in P2:
            dh = hh - h
            dx = abs(xx - x)
            dy = abs(yy - y)
            if hh - dx - dy != h:
                if (xx, yy) in P3:
                    P3.remove((xx, yy))
    if len(P3) == 1:
        xx, yy = P3.pop()
        print('%d %d %d' % (xx, yy, hh))


import sys
n = int(input())
P = [0] * n
for i in range(n):
    P[i] = list(map(int, input().split()))
P = sorted(P, key=lambda x: x[2], reverse=True)

max_h = P[0][2]

for hh in range(max_h+200, max_h-1, -1):
    for cx in range(101):
        for cy in range(101):
            for x, y, h in P:
                th = max(hh-abs(cx-x)-abs(cy-y),0)
                if h == th:
                    continue
                else:
                    break
            else:
                print('%d %d %d' % (cx, cy, hh))
                sys.exit(0)


Verdicts: Wrong Answer

Accepted
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):


N = int(input())

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


for i in range(101):  # X
    for j in range(101):  # Y
        
        temp_center = [i, j]

        temp_p = p_l[0]
        temp_center_h = temp_p[2] + abs(temp_p[1] - temp_center[1]) + abs(temp_p[0] - temp_center[0])

        matched = True
        for p in p_l:
            es_height = min(temp_center_h - abs(p[1] - temp_center[1]) - abs(p[0] - temp_center[0]), 0)
            if es_height != p[2]:
                matched = False
                break

        if matched:
            print("{} {} {}".format(i, j, temp_center_h))
            exit()
        # else:
        #     print("{} {} {}, not matched".format(i, j, temp_h))




N = int(input())

p_l = [list(map(int, input().split())) for _ in range(N)]
p_l.sort(key=lambda x: -x[2])

temp_p = p_l[0]

for x in range(101):  # X
    for y in range(101):  # Y
        
        h = temp_p[2] + abs(temp_p[1] - y) + abs(temp_p[0] - x)

        if all(max(h - abs(p[1] - y) - abs(p[0] - x), 0) == p[2] for p in p_l[1:]):
            print("{} {} {}".format(x, y, h))
            exit()


Verdicts: Wrong Answer

Accepted
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):
n = (int)(input())

x = []
y = []
h = []

for _ in range(n):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)

for i in range(0, 100+1):
    for j in range(0, 100+1):
        tmp = [h[k] + abs(x[k]-i) + abs(y[k]-j) for k in range(n)]
        tmp.remove(0)
        if tmp.count(tmp[0]) == len(tmp) and len(set(tmp)) == 1:
            print(i, j, (lambda x: x if x >= 0 else 0)(tmp[0]))
            exit()


n = (int)(input())

x = []
y = []
h = []

for _ in range(n):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)

for i in range(0, 100+1):
    for j in range(0, 100+1):
        tmp = [h[k] + abs(x[k]-i) + abs(y[k]-j) for k in range(n)]
        tmp.rempe(0)
        if tmp.count(tmp[0]) == len(tmp) and len(set(tmp)) == 1:
            print(i, j, (lambda x: x if x >= 0 else 0)(tmp[0]))
            exit()


n = (int)(input())

x = []
y = []
h = []

for _ in range(n):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)

f = False
for i in range(0, 100+1):
    for j in range(0, 100+1):
        for k in range(n):
            if h[k] != 0:
                ch = h[k] + abs(i-x[k]) + abs(j-y[k])
                break
        if all(max(ch-abs(i-x[k]) - abs(j-y[k]), 0) == h[k] for k in range(n)):
            print(i, j, ch)
            exit()


Verdicts: Runtime Error

Runtime Error

Accepted
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):
n = int(input())
tmp = [int(i) for _ in range(n) for i in input().split()]

xs = tmp[0::3]
ys = tmp[1::3]
hs = tmp[2::3]

for H in range(max(hs), 10**9+1):
    for cx in range(101):
        for cy in range(101):
            for x,y,h in zip(xs,ys,hs):
                if h != max(H-abs(x-cx)-abs(y-cy),0):
                    break
            else:
                print('{} {} {}'.format(cx,cy,H))
                break

n = int(input())
tmp = [int(i) for _ in range(n) for i in input().split()]

xs = tmp[0::3]
ys = tmp[1::3]
hs = tmp[2::3]
stopflag = False

hmax = max(hs)
index = hs.index(max(hs))
xmax = xs[index]
ymax = ys[index]

for cx in range(101):
    for cy in range(101):
        H = hmax + abs(xmax-cx) + abs(ymax-cy)
        for x,y,h in zip(xs,ys,hs):
            if h != max(H-abs(x-cx)-abs(y-cy),0):
                break
        else:
            print('{} {} {}'.format(cx,cy,H))
            stopflag = True
            break
    if stopflag:
        break


Verdicts: Wrong Answer

Accepted
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):
N = int(input())
x = []
y = []
h = []
for _ in range(N):
    xx,yy,hh = map(int,input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)
cm = 100
def height(cx,x,cy,y,h):
    return(max(0,h-abs(cx-x)-abs(cy-y)))
def judge(cx,cy,hc):
    for i in range(N):
        hcand = height(cx,x[i],cy,y[i],hc) 
        if hcand < h[i]:
            return(-1)
        if hcand > h[i]:
            return(1)
    return(0)
        
    
for cx in range(cm+1):
    for cy in range(cm+1):
        left = -1
        right = 1000000001
        while right > left:
            mid = (right+left)//2
            j = judge(cx,cy,mid) 
            if j == 0:
                print(cx,cy,mid)
                exit()
            elif j == 1:
                right = mid
            else:
                left = mid

N = int(input())
x = []
y = []
h = []
for _ in range(N):
    xx,yy,hh = map(int,input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)
cm = 100
def dist(cx,cy,x,y):
    return(abs(cx-x)+abs(cy-y))
for cx in range(cm+1):
    for cy in range(cm+1):
        H = -1
        Hm = 10000000000
        contra = False
        for i in range(N):
            Hi = h[i] + dist(cx,cy,x[i],y[i])
            if h[i] == 0:
                Hm = min(Hi,Hm)
            else:
                if H == -1:
                    H = Hi
                else:
                    if H!=Hi:
                        contra = True
                        break
            if H > Hm:
                contra = True
                break
        if contra == False:
            print(cx,cy,H)                
            exit()    
                   

Verdicts: Time Limit Exceeded

Accepted
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):
n = int(input())
card = []

for i in range(n):
    x,y,h = [int(i) for i in input().split()]
    card.append([x,y,h])


 
def check(cx,cy):
    needH = -1
    for i in range(n):
        x,y,h = card[i]

        if h>0:
            global H = abs(x-cx)+abs(y-cy)+h
            if needH == -1:
                needH = H
            else:
                if needH != H:
                    return False
    
    for i in range(n):
        x,y,h = card[i]

        if h==0:
            dist = abs(x-cx)+abs(y-cy)
            if H > dist:
                return False
    else:
        return True

    
for i in range(101):
    for j in range(101):
        if check(i,j):

            print("{} {} {}".format(i,j,H))


n = int(input())
card = []

for i in range(n):
    x,y,h = [int(i) for i in input().split()]
    card.append([x,y,h])


 
def check(cx,cy):
    needH = -1
    for i in range(n):
        x,y,h = card[i]

        if h>0:
            global H
            H = abs(x-cx)+abs(y-cy)+h
            if needH == -1:
                needH = H
            else:
                if needH != H:
                    return False
    
    for i in range(n):
        x,y,h = card[i]

        if h==0:
            dist = abs(x-cx)+abs(y-cy)
            if H > dist:
                return False
    else:
        return True

    
for i in range(101):
    for j in range(101):
        if check(i,j):

            print("{} {} {}".format(i,j,H))

Verdicts: Runtime Error

Accepted