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

def calcH(cx, cy, x, y, h):
  if h > 0:
  	return h - abs(x-cx) + abs(y-cy)
  else:
    return h - abs(x-cs) + abs(y-cy) <= 0

cols = []
for line in sys.stdin:
  col = line.strip().split(' ')
  col = [int(c) for c in col]
  cols.append(col)

cols = cols[1:]
for cx,cy in itertools.product(list(range(101)), list(range(101))):
  H = None
  flag = True
  for x,y,h in cols:
    now_H = calcH(cx, cy, x, y, h)
    if H is False:
      flag = False
      break
    if H is None:
      H = now_H
    else:
      if not H == now_H:
        flag = False
        break
  if flag:
    print(cx,cy,H)
        

import sys
import itertools

cols = []
for line in sys.stdin:
  col = line.strip().split(' ')
  col = [int(c) for c in col]
  cols.append(col)

def calcH(cx, cy, x, y, h):
  if h > 0:
  	return h + abs(x-cx) + abs(y-cy)
  else:
    return h - abs(x-cs) - abs(y-cy) <= 0

cols = cols[1:]
for cx,cy in itertools.product(list(range(101)), list(range(101))):
  H = None
  flag = True
  for x,y,h in cols:
    now_H = calcH(cx, cy, x, y, h)
    if not H:
      flag = False
      break
    if H is None:
      H = now_H
    else:
      if not H == now_H:
        flag = False
        break
  if flag:
    print(cx,cy,H)


import sys
import itertools

cols = []
for line in sys.stdin:
  col = line.strip().split(' ')
  col = [int(c) for c in col]
  cols.append(col)

cols = cols[1:]
for cx,cy in itertools.product(list(range(101)), list(range(101))):
  H, H_max, flag = None, None, True
  for x,y,h in cols:
    if h <= 0:
      tmp_H_max = abs(x-cx) + abs(y-cy)
      if tmp_H_max < 1:
        flag = False
        break
      else:
        H_max = min(H_max, tmp_H_max) if H_max else tmp_H_max
      if H and H_max < H:
        flag = False
        break
    else:
      tmp_H = h + abs(x-cx) + abs(y-cy)
      if not H:
        H = tmp_H
      elif H and H != tmp_H:
        flag = False
        break
      if H_max and H_max < tmp_H:
        flag = False
        break
  if flag:
    print(cx,cy,H)


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):
#C
N = int(input())
XYH = [list(map(int,input().split())) for i in range(N)]

CX = 0
CY = 0
flag = 0
for CX in range(101):
    for CY in range(101):
        H = 0
        hmax = 0
        for i in range(N):
            x,y,h = XYH[i]
            if H == 0:
                if h != 0:
                    H = abs(CX-x)+abs(CY-y)+h
                    if H > hmax:
                        H = 0
                        break
                else:
                    hmax = max(hmax,abs(CX-x)+abs(CY-y)+h)
            else:
                if h != 0:
                    if H != abs(CX-x)+abs(CY-y)+h:
                        H = 0
                        break
                else:
                    if H > abs(CX-x)+abs(CY-y)+h:
                        H = 0
                        break
        if H >= 1:
            print(CX,CY,H)
            flag = 1
            break
    if flag == 1:
        break
            



#C
N = int(input())
XYH = [list(map(int,input().split())) for i in range(N)]

CX = 0
CY = 0
flag = 0
for CX in range(101):
    for CY in range(101):
        H = 0
        hmax = -1
        for i in range(N):
            x,y,h = XYH[i]
            if H == 0:
                if h != 0:
                    H = abs(CX-x)+abs(CY-y)+h
                    if H > hmax and hmax >= 0:
                        H = 0
                        break
                else:
                    hmax = max(hmax,abs(CX-x)+abs(CY-y)+h)
            else:
                if h != 0:
                    if H != abs(CX-x)+abs(CY-y)+h:
                        H = 0
                        break
                else:
                    if H > abs(CX-x)+abs(CY-y)+h:
                        H = 0
                        break
        if H >= 1:
            print(CX,CY,H)
            flag = 1
            break
    if flag == 1:
        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 i in range(N):
    x_, y_, h_ = map(int, input().split())
    x.append(x_)
    y.append(y_)
    h.append(h_)

for i in range(0,101):
    for j in range(0,101):
        for hn in h:
            if hn > 0:
                tmph = hn + abs(i-x[n]) + abs(j-y[n])
                break
        count = 0
        for n in range(N):
            count += 1
            if h[n] != max(tmph - abs(i-x[n]) - abs(j-y[n]), 0):
                break
            if count == N:
                print(str(i) + ' ' + str(j) + ' ' + str(tmph))


N = int(input())

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

for i in range(0,101):
    for j in range(0,101):
        for n, hn in enumerate(h):
            if hn > 0:
                tmph = hn + abs(i-x[n]) + abs(j-y[n])
                break
        count = 0
        for n in range(N):
            count += 1
            if h[n] != max(tmph - abs(i-x[n]) - abs(j-y[n]), 0):
                break
            if count == N:
                print(str(i) + ' ' + str(j) + ' ' + str(tmph))


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())
xyz = []
for i in range(N):
    xyz.append(list(map(int, input().split())))
H = 0
h = 0
flag = False
maxz = xyz[0][2]
maxy = xyz[0][1]
maxx = xyz[0][0]
for k in range(N):
    if xyz[k][2] > maxz:
        maxz = xyz[k][2]
        maxx = xyz[k][0]
        maxy = xyz[k][1]
for i in range(101):
    for j in range(101):
        H = maxz + abs(maxx-i) + abs(maxy-j)
        for k in xyz:
            h = H -abs(k[0]-i)-abs(k[1]-j)
            if h < 0:
                h = 0
            if h == k[2]:
                continue
            else:
                break
        if H != 0:
                flag = True
                print("{} {} {}".format(i, j, H))
                break
    if flag:
        break


N = int(input())
xyz = []
for i in range(N):
    xyz.append(list(map(int, input().split())))
H = 0
h = 0
flag = False
maxz = xyz[0][2]
maxy = xyz[0][1]
maxx = xyz[0][0]
for k in range(N):
    if xyz[k][2] > maxz:
        maxz = xyz[k][2]
        maxx = xyz[k][0]
        maxy = xyz[k][1]
for i in range(101):
    for j in range(101):
        H = maxz + abs(maxx-i) + abs(maxy-j)
        for k in xyz:
            h = H -abs(k[0]-i)-abs(k[1]-j)
            if h < 0:
                h = 0
            if h == k[2]:
                continue
            else:
                break
        else:
            if H != 0:
                flag = True
                print("{} {} {}".format(i, j, H))
                break
    if 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 numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,0],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    unsetflg = True
    for i,(x,y,h) in enumerate(data):
        if unsetflg and h>=1:
            H = abs(x-C_x)+abs(y-C_y)+h
            unsetflg = False
        else
            if h>=1 and H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break
    
            
            


import numpy as np
# N = int(input())


#     data[i] = np.array(input().split())

data = np.array([[2,3,5],[2,1,5],[1,2,5],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    unsetflg = True
    for i,(x,y,h) in enumerate(data):
        if unsetflg
        	if h>0:
            	H = abs(x-C_x)+abs(y-C_y)+h
            	unsetflg = False
        elif h>0:
            if H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break
          

import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,0],[2,1,0],[1,2,0],[3,2,5]])

if len(np.where(data[:,2]!=0)[0]) == 1:
    C_x, C_y, H = map(int,data[np.where(data[:,2]!=0)[0][0]])
    print(C_x, C_y, H)
else:
    for n in range(10201):
        C_x = n // 101
        C_y = n % 101
        correctflg = True
        unsetflg = True
        for x,y,h in data:
            if unsetflg:
                if h >= 1:
                    H = abs(x-C_x)+abs(y-C_y)+h
                    unsetflg = False
            else:
                if h >= 1 and H != abs(x-C_x)+abs(y-C_y)+h:
                    correctflg = False
                    break 
        if correctflg:
            print(C_x,C_y,int(H))
            break
        
            
            


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())
zahyo = [tuple(map(int, input().split())) for _ in range(N)]
print(zahyo[0])
if N == 1:
    print("{} {} {}".format(*zahyo[0]))
    exit()
for cx in range(101):
    for cy in range(101):
        height_set = set([hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in zahyo if hi > 0])
        if len(height_set) == 1:
            print(cx, cy, max(height_set))
            exit()

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

for cx in range(101):
    for cy in range(101):
        height_set = set(hi + abs(xi-cx) + abs(yi-cy) for xi, yi, hi in zahyo if hi > 0)
        if len(height_set) == 1:
            H = max(height_set)
            if all(set(hi == max(H - abs(xi-cx) - abs(yi-cy), 0) for xi, yi, hi in zahyo if hi == 0)):
                print(cx, cy, max(height_set))
                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())
points = [list(map(int, input().split())) for i in range(N)]


def main(N, points):
    points.sort(key=lambda x: x[2], reverse=True)
    for x in range(101):
        for y in range(101):
            
            H = -1
            for point in points:
                h = abs(point[0] - x) + abs(point[1] - y) + point[2]
                if point[2] > 0:
                    if H == -1:
                        H = h
                    elif H != h:
                        H = -1
                        break
                else:
                    if H > h:
                        H = -1
                        break
            if H > 0:
                print(x, y, h)
                return

N = int(input())
points = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: -x[2])

for cx in range(101):
    for cy in range(101):
        
        H = -1
        for point in points:

            if point[2] > 0:
                h = abs(point[0] - cx) + abs(point[1] - cy) + point[2]
                if H == -1:
                    H = h
                elif H != h:
                    H = -2
                    break
            else:
                if H > abs(point[0] - cx) + abs(point[1] - cy) + point[2]:
                    H = -2
                    break
        if H > 0:
            print(cx, cy, 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,m=map(int,input().split())
yaku=set()
for i in range(1,m):
    yaku.add(m//i)
import copy
yakuc=copy.copy(yaku)
for i in yakuc:
    if i<n:
        yaku.remove(i)
yakul=list(yaku)
p=yakul[0]
print(m//p)


n=int(input())
xyh=[]
for i in range(n):
    xyh.append(list(map(int,input().split())))
x0=xyh[0][0]
y0=xyh[0][1]
h0=xyh[0][2]
count=0
while h0==0:
    count+=1
    x0=xyh[count][0]
    y0=xyh[count][1]
    h0=xyh[count][2]
for x in range(101):
    for y in range(101):
        h=h0+abs(x-x0)+abs(y-y0)
        for i in range(n):
            if max(0,h-abs(x-xyh[i][0])-abs(y-xyh[i][1]))!=xyh[i][2]:
                break
            if i==n-1:
                print(x,y,h)
                quit()

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):
    xi,yi,hi=map(int,input().split())
    x.append(xi)
    y.append(yi)
    h.append(hi)

hmax=h[0]
xhmax=x[0]
yhmax=y[0]
ihmax=0

for i in range(n):
    if hmax<h[i]:
        hmax=h[i]
        xhmax=x[i]
        yhmax=y[i]
        ihmax=i
    
for cx in range(101):
    for cy in range(101):
        hh=hmax+abs(xhmax,cx)+abs(yhmax,cy)
        yesno="yes"
        for i in range(n):
            if h[i]!=max(hh-abs(x[i],cx)-abs(y[i],cy),0):
                yesno="no"
                break
        if yesno=="yes":
            print(cx,cy,hh)



cc=0
if cc==0:
    n=int(input())
    xyh=[[0]*3 for i in range(n)]
    for i in range(n):
        xyh[i]=list(map(int,input().split()))
        if xyh[i][2]>=1:
            px=xyh[i][0]
            py=xyh[i][1]
            ph=xyh[i][2]
else:
    n=4
    px=3
    py=2
    ph=5
    xyh=[[0]*3 for i in range(n)]
    xyh[0]=[2,3,5]
    xyh[1]=[2,1,5]
    xyh[2]=[1,2,5]
    xyh[3]=[3,2,5]
        
yn=""
for cx in range(102):
    for cy in range(102):
        h=ph+abs(px-cx)+abs(py-cy)
        yn=""
        for i in range(n):
            if xyh[i][2]!=max(0,h-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy)):
                yn="No"
                break
        if yn=="No":

            continue
        else:

            yn="Yes"
            break

    if yn=="Yes":
        break
    
print(cx,cy,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):
# coding: utf-8


def main():
    n = int(input())

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

    for coordinate in coordinates:
        if coordinate[2] > 0:
            xx = coordinate[0][0]
            yy = coordinate[0][1]
            hh = coordinate[0][2]
            break

    for px in range(101):
        for py in range(101):
            ph = hh + abs(xx - px) + abs(yy - py)

            if ph <= 0:
                continue

            suit = True
            for coordinate in coordinates:
                if coordinate[2] != ph - abs(coordinate[0] - px) - abs(coordinate[1] - py):
                    suit = False
                    break

            if suit == True:
                print(px, py, ph)
                return


if __name__ == '__main__':
    main()


# coding: utf-8


def main():
    n = int(input())

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

    for coordinate in coordinates:
        if coordinate[2] > 0:
            xx = coordinate[0]
            yy = coordinate[1]
            hh = coordinate[2]
            break

    for px in range(101):
        for py in range(101):
            ph = hh + abs(xx - px) + abs(yy - py)

            suit = True
            for x, y, h in coordinates:
                if h != max(ph - abs(x - px) - abs(y - py), 0):
                    suit = False
                    break

            if suit == True:
                print(px, py, ph)
                return


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):
def main():
    n = int(input())
    x = []
    y = []
    h = []
    for i in range(n):
        xx, yy, zz = map(int, input().split())
        x.append(xx)
        y.append(yy)
        h.append(zz)
    for i in range(n):
        if h[i] != 0:
            idx = i
    for xx in range(101):
        for yy in range(101):
            H = h[idx] + abs(xx - x[idx]) + abs(yy - y[idx])
            if xx == 2 and yy == 2:
                print(H)
            flag = True
            for i in range(n):
                if h[i] != max(H - abs(xx - x[i]) - abs(yy - y[i]), 0):
                    flag = False
                    break
            if flag:
                print(xx, yy, H)
                return

    
if __name__ == '__main__':
    main()


def main():
    n = int(input())
    x = []
    y = []
    h = []
    for i in range(n):
        xx, yy, zz = map(int, input().split())
        x.append(xx)
        y.append(yy)
        h.append(zz)
    for i in range(n):
        if h[i] != 0:
            idx = i
    for xx in range(101):
        for yy in range(101):
            H = h[idx] + abs(xx - x[idx]) + abs(yy - y[idx])
            flag = True
            for i in range(n):
                if h[i] != max(H - abs(xx - x[i]) - abs(yy - y[i]), 0):
                    flag = False
                    break
            if flag:
                print(xx, yy, H)
                return

    
if __name__ == '__main__':
    main()


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())
l = []
for i in range(N):
    a = list(map(int, input().split()))
    if a[2] > 0:
      l.append(a)

for i in range(len(l)-1):
    ans = []
    for cx in range(101):
        for cy in range(101):
          if l[i][2] + abs(l[i][0] - cx) + abs(l[i][1] - cy) == l[i+1][2] + abs(l[i+1][0] - cx) + abs(l[i+1][1] - cy):
            if i == 0:
              ans.append([cx, cy])
            else:
              if [cx, cy] in ansn:
                ans.append([cx, cy])
    ansn = ans[:]
    if len(ans) == 1:
        break
print(ans[0][0], ans[0][1], l[0][2] + abs(l[0][0] - ans[0][0]) + abs(l[0][1] - ans[0][1]) if len(ans) == 1 else l[0][0], l[0][1], l[0][2])

#coding: utf-8
N = int(input())
l = []
for i in range(N):
    a = list(map(int, input().split()))
    if a[2] > 0:
      l.append(a)

for i in range(len(l)-1):
    ans = []
    for cx in range(101):
        for cy in range(101):
          if l[i][2] + abs(l[i][0] - cx) + abs(l[i][1] - cy) == l[i+1][2] + abs(l[i+1][0] - cx) + abs(l[i+1][1] - cy):
            if i == 0:
              ans.append([cx, cy])
            else:
              if [cx, cy] in ansn:
                ans.append([cx, cy])
    ansn = ans[:]
    if len(ans) == 1:
        break
print(ans[0][0], ans[0][1], l[0][2] + abs(l[0][0] - ans[0][0]) + abs(l[0][1] - ans[0][1]) if len(ans) == 1)

# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))

info.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            # if x < 0 or y < 0 or h <= 0:
            #     continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)


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):
import collections

n = int(input())

x = [0]*n
y = [0]*n
h = [0]*n
H = [0]*n

for i in range(n):
  x[i], y[i], h[i] = map(int, input().split())
  
for cx in range(101):
  for cy in range(101):
    for i in range(n):
      H[i] = max(h[i] + abs(x[i]-cx) + abs(y[i]-cy), 0)
    c = collections.Counter(H)
    if len(c) == 1 && H[0] >= max(h):
      print(cx, cy, H[0])
      exit()

N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=lambda val: val[2])
 
for cx in range(101):
    for cy in range(101):
        check = True
        H = xyh[-1][2] + abs(xyh[-1][0] - cx) + abs(xyh[-1][1] - cy)
        for x in xyh[:-1]:
            if x[2] != max(H - abs(x[0] - cx) - abs(x[1] - cy), 0):
                check = False
                break
        if check:
            print(cx, cy, 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())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(max(h + abs(x-X) + abs(y-Y)), 0)
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

a.sort(key = lambda x: x[2], reverse=True)

for X,Y,H0 in H:
    this_sum = []
    H1 = a[0][2] + abs(X-a[0][0]) + abs(Y-a[0][1])
    for x,y,h in a:
        if h == max(H1 - abs(x-X) - abs(y-Y), 0):
            continue
        else:
            break
    else:
        print(" ".join(list(map(str, [X, Y, H1]))))

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 main():
    n = int(input())
    xs, ys, hs = list(), list(), list()
    for i in range(n):
        x, y, h = map(int, input().split())
        xs.append(x)
        ys.append(y)
        hs.append(h)

    for cx in range(101):
        for cy in range(101):
            Hs = set()
            Hs_ub = set()
            for x, y, h in zip(xs, ys, hs):
                H_cand = h + abs(x - cx) + abs(y - cy)
                if h == 0:
                    Hs_ub.add(H_cand)
                else:
                    Hs.add(H_cand)
            
            Hs_rm = set()
            for H in Hs:
                if all([H <= H_ub for H_ub in Hs_ub]):
                    continue
                else:
                    Hs_rm.add(H)
            Hs = Hs - Hs_rm

            Hs = {H for H in Hs if H >= 1}
            if len(Hs) != 0:
                H = Hs.pop()
                print(cx, cy, H)
                return


if __name__ == "__main__":
    main()

def main():
    n = int(input())
    xs, ys, hs = list(), list(), list()
    for i in range(n):
        x, y, h = map(int, input().split())
        xs.append(x)
        ys.append(y)
        hs.append(h)

    for cx in range(101):
        for cy in range(101):
            # In this case,
            # multiple candidates of H & 
            Hs = set()
            Hs_ub = set()
            for x, y, h in zip(xs, ys, hs):
                H_cand = h + abs(x - cx) + abs(y - cy)
                if h == 0:
                    Hs_ub.add(H_cand)
                else:
                    Hs.add(H_cand)

            if len(Hs) != 1:
                continue
            
            
            Hs_rm = set()
            for H in Hs:
                if all([H <= H_ub for H_ub in Hs_ub]):
                    continue
                else:
                    Hs_rm.add(H)
            Hs = Hs - Hs_rm

            Hs = {H for H in Hs if H >= 1}
            if len(Hs) == 1:
                H = Hs.pop()
                print(cx, cy, H)
                return


if __name__ == "__main__":
    main()
    

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 = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] <= 0:
		continue
	std = i
	break
# print(X[std], Y[std])
for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(cx-X[std]) + abs(cy-Y[std])
		flag = True
		for i in range(N):
			if min(0, ch - abs(cx-X[i]) - abs(cy-Y[i])) != H[i]:
				flag = False
				# break
			print(ch, cx, cy, X[i], Y[i], ch - abs(cx-X[i]) - abs(cy-Y[i]), H[i])
		if flag:
			print(cx, cy, ch)
			exit()

N = int(input())
X, Y, H = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] <= 0:
		continue
	std = i
	break
# print(X[std], Y[std])
for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(cx-X[std]) + abs(cy-Y[std])
		flag = True
		for i in range(N):
			if max(0, ch - abs(cx-X[i]) - abs(cy-Y[i])) != H[i]:
				flag = False
				# break
			print(ch, cx, cy, X[i], Y[i], ch - abs(cx-X[i]) - abs(cy-Y[i]), H[i])
		if flag:
			print(cx, cy, ch)
			exit()

			

N = int(input())
X, Y, H = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] <= 0:
		continue
	std = i
	break
# print(X[std], Y[std])
for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(cx-X[std]) + abs(cy-Y[std])
		flag = True
		for i in range(N):
			if max(0, ch - abs(cx-X[i]) - abs(cy-Y[i])) != H[i]:
				flag = False
				# break
			# print(ch, cx, cy, X[i], Y[i], ch - abs(cx-X[i]) - abs(cy-Y[i]), H[i])
		if flag:
			print(cx, cy, ch)
			exit()

Verdicts: Wrong Answer

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())
a=[]

x,y,k=-1,-1,-1
n=-1
for o in range(n):
    a.append(list(map(int,input().split())))
    if a[o][2] != 0:
        n=o
for i in range(101):
    for j in range(101):
        h=a[o][2]+abs(a[o][0]-i)+abs(a[o][1]-j)
        d=True

        for l in range(n):
            if a[l][2] > 0 and h != a[l][2]+abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            if a[l][2]==0 and h>abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            
        if d:
            x,y,k=i,j,h
            print(x,y,k)
            exit()



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

x,y,k=-1,-1,-1
n=-1
for _ in range(n):
    a.append(list(map(int,input().split())))
    if a[_][2] != 0:
        n=i
for i in range(101):
    for j in range(101):
        h=a[0][2]+abs(a[0][0]-i)+abs(a[0][1]-j)
        d=True

        for l in range(n):
            if a[l][2] > 0 and h != a[l][2]+abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            if a[l][2]==0 and h>abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            
        if d:
            x,y,k=i,j,h
            print(x,y,k)
            exit()



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

x,y,k=-1,-1,-1
n=-1
for o in range(n):
    a.append(list(map(int,input().split())))
    if a[o][2] != 0:
        n=o
for i in range(101):
    for j in range(101):
        h=a[n][2]+abs(a[n][0]-i)+abs(a[n][1]-j)
        d=True

        for l in range(n):
            if a[l][2] > 0 and h != a[l][2]+abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            if a[l][2]==0 and h>abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            
        if d:
            x,y,k=i,j,h
            print(x,y,k)
            exit()



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

x,y,k=-1,-1,-1
t=-1
for o in range(n):
    a.append(list(map(int,input().split())))
    if a[o][2] != 0:
        t=o
for i in range(101):
    for j in range(101):
        h=a[t][2]+abs(a[t][0]-i)+abs(a[t][1]-j)
        d=True

        for l in range(n):
            if a[l][2] > 0 and h != a[l][2]+abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            if a[l][2]==0 and h>abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            
        if d:
            x,y,k=i,j,h
            print(x,y,k)
            exit()



Verdicts: Runtime Error

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):
def divisors(N):
    U = int(N ** 0.5)
    res = [i for i in range(1, U) if N % i == 0]
    if N % U == 0:
        res.append(U)
    res += [N // r for r in reversed(res)]
    return res

N, M = map(int, input().split())
print(max(d for d in divisors(M) if d * N <= M))


def main():
    N = int(input())
    L = [tuple(map(int, input().split())) for _ in range(N)]
    xx, yy, hh = next(l for l in L if l[2] >= 1)
    for Cx in range(101):
        for Cy in range(101):
            H = hh + abs(xx - Cx) + abs(yy - Cy)
            for x, y, h in L:
                if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
                    break
            else:
                print(Cx, Cy, H)
                quit()

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

info = []
for i in range(n):
    pre = list(map(int,input().split(" ")))
    info.append(pre)
    
end = 0
if n >=3:
    for x in range(101):
        for y in range(101):
            H = info[0][2] + abs(x-info[0][0]) + abs(y-info[0][1])
            if H <= 10**9
                for i in range(1,n):
                    if info[i][2] != H - abs(x-info[i][0]) - abs(y- info[i][1]):
                        break
                else:
                    print(x,y,H)
                    end = 1
                
                if end == 1:
                    break
            if end == 1:
                break
elif n ==2:
    info = sorted(info, key = lambda x:x[2])
    if info[0][0] > info[1][0]:
        h = info[1][2] + info[1][0]
        x = 0
    else:
        h = info[1][2] + 100- info[1][0]
        x = 100
    if info[0][1] > info[1][1]:
        h += info[1][1]
        y = 0
    else:
        h += 100 - info[1][1]
        y =100
    ans = list(map(str,(x,y,h)))
    print(" ".join(ans))

n = int(input())

info = []
for i in range(n):
    pre = list(map(int,input().split(" ")))
    info.append(pre)

info = sorted(info,key = lambda x: x[2])
end = 0

for x in range(101):
    for y in range(101):
        H = info[n-1][2] + abs(x-info[n-1][0]) + abs(y-info[n-1][1])
        for i in range(n-1):
            if info[i][2] != max(0,H - abs(x-info[i][0]) - abs(y- info[i][1])):
                break
        else:
            print(x,y,H)
            end = 1
            
        if end == 1:
            break
    if end == 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):
#!/usr/bin/python3
# -*- coding: utf-8 -*-

n = int(input())
data = [[int(j) for j in input().split()] for i in range(n)]
data.sort(key=lambda x: x[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        x0, y0, h0 = data[0][0], data[0][1], data[0][2]
        h = h0 + abs(x0 - cx) + abs(y0 - cy)
        for i in range(1, n):
            xi, yi, hi = data[i][0], data[i][1], data[i][2]
            if hi == 0:
                continue
            if hi != max(h - abs(xi - cx) + abs(yi - cy), 0):
                break
        else:
            print(cx, cy, h)
            exit()


n = int(input())
data = [[int(j) for j in input().split()] for i in range(n)]
data.sort(key=lambda x: x[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        x0, y0, h0 = data[0][0], data[0][1], data[0][2]
        h = h0 + abs(x0 - cx) + abs(y0 - cy)
        for i in range(1, n):
            xi, yi, hi = data[i][0], data[i][1], data[i][2]
            if hi == 0 and h < abs(xi - cx) + abs(yi - cy):
                continue
            if h != hi + abs(xi - cx) + abs(yi - cy):
                break
        else:
            print(cx, cy, 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 = list(range(n))
y = list(range(n))
h = list(range(n))

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

flag=0
i = 0
while(flag==0 and i < 101):
  j = 0
  while(flag==0 and j < 101):
    ans_h = 0
    for k in range(n):
      if h[k] == 0 and ans_h-abs(i-x[k])-abs(j-y[k]) < 0:
        if k == n-1:
          ans_x = i
          ans_y = j
          flag=1
          break
      	else:
          continue
      if ans_h == 0:
        ans_h = abs(i-x[k])+abs(j-y[k])+h[k]
      elif abs(i-x[k])+abs(j-y[k])+h[k] != ans_h:
        break
      if k == n-1:
        ans_x = i
        ans_y = j
        flag=1
        break
    j+=1
  i+=1

print(ans_x, ans_y, ans_h)

n = int(input())
x = list(range(n))
y = list(range(n))
h = list(range(n))

for i in range(n):
  x[i], y[i], h[i] = map(int, input().split())
  if h[i] != 0:
    X = x[i]
    Y = y[i]
    H = h[i]

flag=0
i = 0
while(flag==0 and i < 101):
  j = 0
  while(flag==0 and j < 101):
    ans_h = abs(i-X)+abs(j-Y)+H
    for k in range(n):
      h_ = max(ans_h-abs(i-x[k])-abs(j-y[k]), 0)
      if h_ != h[k]:
        break
      if k == n-1:
        ans_x = i
        ans_y = j
        flag=1
        break
    j+=1
  i+=1

print(ans_x, ans_y, ans_h)

Verdicts: Runtime Error

Accepted