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())
s_list = []
ans = 0
zero_list = []
for _ in range(n):
    x, y, s = map(int, input().split())
    if s > 0:
        s_list.append([x, y, s])
    else:
        zero_list.append([x, y, s])
for x in range(101):
    for y in range(101):
        t = []
        for i in range(n):
            x_, y_, h = s_list[i]
            if h > 0:
                t.append(h + abs(x_ - x) + abs(y_ - y))
        if (len(set(t)) == 1):
            zero_p = max([list(t)[0] - abs(x - x_zero) - abs(y - y_zero) for (x_zero, y_zero, s_zero) in zero_list])
            if zero_p <= 0:
                ttt = h + abs(x_ - x) + abs(y_ - y)
                ans = str(x) + " " + str(y) + " " + str(ttt)
                break
print(ans)

    n = int(input())
    sols = []
    for i in range(n):
        sols.append([int(i) for i in input().split()])
    if len(sols) == 1:
        print(*sols[0])
 
    for cx in range(0, 101):
        for cy in range(0, 101):
            lastH = None
            for x, y, h in sols:
                H = h + abs(x - cx) + abs(y - cy)
                if H < 1:
                    continue
                if lastH:
                    if H != lastH:
                        break
                lastH = H
            else:
                print(cx, cy, H)
                break

n = int(input())
s_list = []
ans = 0
zero_list = []
for _ in range(n):
    x, y, s = map(int, input().split())
    if s > 0:
        s_list.append([x, y, s])
    else:
        zero_list.append([x, y, s])
for x in range(101):
    for y in range(101):
        t = []
        for i in range(len(s_list)):
            x_, y_, h = s_list[i]
            if h > 0:
                t.append(h + abs(x_ - x) + abs(y_ - y))
        if (len(set(t)) == 1):
            zero_p = max([list(t)[0] - abs(x - x_zero) - abs(y - y_zero) for (x_zero, y_zero, s_zero) in zero_list])
            if zero_p <= 0:
                ttt = h + abs(x_ - x) + abs(y_ - y)
                ans = str(x) + " " + str(y) + " " + str(ttt)
                break
print(ans)

    n = int(input())
    sols = []
    for i in range(n):
        sols.append([int(i) for i in input().split()])
    if len(sols) == 1:
        print(*sols[0])
        return
 
    for cx in range(0, 101):
        for cy in range(0, 101):
            lastH = None
            for x, y, h in sols:
                H = h + abs(x - cx) + abs(y - cy)
                if H < 1:
                    continue
                if lastH:
                    if H != lastH:
                        break
                lastH = H
            else:
                print(cx, cy, H)
                break

import collections
n = int(input())
a_list = []
for i in range(n):
    a_list.append([int(i) for i in input().split()])
if n = 1:
    print(a_list[0])
else:
    x_range = range(101)
    y_range = range(101)
    for i in x_range:
        for j in y_range:
            h_list = [abs(a[0]-i)+abs(a[1]-j)+a[2] for a in a_list]
            if (len(set(h_list)) == 1) & (h_list[0] > 0):
                print(i, j, h_list[0])
                break

n = int(input())
s_list = []
ans = 0
zero_list = []
for _ in range(n):
    x, y, s = map(int, input().split())
    if s > 0:
        s_list.append([x, y, s])
    else:
        zero_list.append([x, y, s])
for x in range(101):
    for y in range(101):
        t = []
        for i in range(len(s_list)):
            x_, y_, h = s_list[i]
            if h > 0:
                t.append(h + abs(x_ - x) + abs(y_ - y))
        if (len(set(t)) == 1):
            if len(zero_list) > 0:
                zero_p = max([list(t)[0] - abs(x - x_zero) - abs(y - y_zero) for (x_zero, y_zero, s_zero) in zero_list])
                if zero_p <= 0:
                    ttt = h + abs(x_ - x) + abs(y_ - y)
                    ans = str(x) + " " + str(y) + " " + str(ttt)
                    break
            else:
                ttt = h + abs(x_ - x) + abs(y_ - y)
                ans = str(x) + " " + str(y) + " " + str(ttt)
                break
                
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted