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

data = sorted(data, key=lambda x: x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        flag = True
        H = data[0][2] + abs(data[0][0]-cx) + abs(data[0][1]-cy)

        for i in range(N):
            if data[i][2] == max(H - abs(data[i][0]-cx) - abs(data[i][1]-cy), 0):
                flag = True
            else:
                flag = False

        if flag:
            print(cx, cy, H)
            exit()


N = int(input())
data = []

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

data = sorted(data, key=lambda x: x[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        flag = True
        H = data[0][2] + abs(data[0][0]-cx) + abs(data[0][1]-cy)
        for i in range(1, len(data)):
            if not max(H - abs(data[i][0]-cx) - abs(data[i][1]-cy), 0) == data[i][2]:
                flag = False
                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):
#coding:utf-8
import numpy as np
import collections
N = int(input())
arr = []
for n in range(N):
    arr.append(list(map(int,input().split())))
arr = np.array(arr)
x_min  = arr[:,0].min()
x_max = arr[:,0].max()
y_min = arr[:,1].min()
y_max =  arr[:,1].max()
mx = arr[:,2].max()
s = max(dx,dy)+1
for k in range(mx+100,mx-1,-1):
    for i in range(x_min,x_max+1):
        for j in range(y_min,y_max+1):
            for x,y,h in arr:
                h_ = max(k-abs(i-x)-abs(j-y),0)
                if h_ != h:
                    break
            else:
                print (i,j,k)
                exit()


#coding:utf-8
import numpy as np
import collections
N = int(input())
arr = []
for n in range(N):
    arr.append(list(map(int,input().split())))
arr = np.array(arr)
#
# N = 2
# arr = np.array([[100 ,100 ,100]])
print (arr[:,1:].min(),arr[:,1:].max()+200)
for i in range(101):
    for j in range(101):
        for k in range(arr[:,1:].min(),arr[:,1:].max()+200):
            flag = True
            for ls in arr:
                flag*=flag*(k-abs(i-ls[0])-abs(j-ls[1])==ls[2])
            if flag:
                print (i,j,k)
                exit()


#coding:utf-8
import numpy as np
import collections
N = int(input())
arr = []
for n in range(N):
    arr.append(list(map(int,input().split())))
narr = np.array(arr)
x_min  = narr[:,0].min()
x_max = narr[:,0].max()
y_min = narr[:,1].min()
y_max =  narr[:,1].max()
mx = narr[:,2].max()
for k in range(mx+100,mx-1,-1):
    for i in range(x_min,x_max+1):
        for j in range(y_min,y_max+1):
            for x,y,h in arr:
                h_ = max(k-abs(i-x)-abs(j-y),0)
                if h_ != h:
                    break
            else:
                print (i,j,k)
                exit()


Verdicts: 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):
import sys
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)
x1 = X[0]
y1 = Y[0]
h1 = H[0]
for Cx in range(101):
    for Cy in range(101):
        h = h1 + abs(x1-Cx) + abs(y1-Cy)
        i = 1
        while i < N and H[i] == max(h - abs(X[i]-Cx) + abs(Y[i]-Cy), 0):
            i += 1
        if i == N:
            print(Cx, Cy, h)
            sys.exit()

N = int(input())
X = []
Y = []
H = []
for i in range(N):
    x, y, h = map(int, input().split())
    if h == 0:
        X.append(x)
        Y.append(y)
        H.append(h)
    else:
        X.insert(0, x)
        Y.insert(0, y)
        H.insert(0, h)
x1 = X[0]
y1 = Y[0]
h1 = H[0]
for Cx in range(min(X), max(X) + 1):
    for Cy in range(min(Y), max(Y) + 1):
        h = h1 + abs(x1-Cx) + abs(y1-Cy)
        i = 1
        while i < N and H[i] == max(h - abs(X[i]-Cx) - abs(Y[i]-Cy), 0):
            i += 1
        if i == N:
            print(Cx, Cy, 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):
N = int(input())

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

print(li)

for y in range(101):
    for x in range(101):
        hp = []
        for i in range(N):
            if li[i][2] != 0:
                hp.append(li[i][2]+abs(li[i][0]-x)+abs(li[i][1]-y))
        if max(hp) == min(hp):
            break
    else:
        continue
    break


print(x,y,hp[0])


N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
for x in range(101):
    for y in range(101):
        b = True
        for i in range(N):
            if xyh[i][2] != 0:
                H = abs(xyh[i][0]-x) + abs(xyh[i][1]-y) + xyh[i][2]
                break
        for j in range(N):
            if xyh[j][2] != max(H - abs(xyh[j][0]-x) - abs(xyh[j][1]-y), 0):
                b = False
                break
        if b:
            break
    if b:
        break
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):
n = int(input())

lis = []

for i in range(n):
    array = list(map(int, input().split()))
    lis.append(array)

ans_list = []

for i in range(101):
    for j in range(101):
        h = abs(i-lis[0][0]) + abs(j-lis[0][1]) + lis[0][2]
        flag = True
        for k in range(1, n):
            dist = abs(i - lis[k][0]) + abs(j - lis[k][1])
            if h - dist == lis[k][2]:
                continue
            else:
                flag = False
                break
        if flag is True:
            ans_list.append([i, j, h])

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

for i in ans_list[0]:
    print(i, end=' ')



n = int(input())

lis = []

for i in range(n):
    array = list(map(int, input().split()))
    lis.append(array)

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

for i in range(101):
    for j in range(101):
        h = abs(i-lis[0][0]) + abs(j-lis[0][1]) + lis[0][2]
        flag = True
        for k in range(1, n):
            dist = abs(i - lis[k][0]) + abs(j - lis[k][1])
            if h - dist == lis[k][2]:
                continue
            elif h - dist <= 0 and lis[k][2] == 0:
                continue
            else:
                flag = False
                break
        if flag is True:
            print(i, j, 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 f(n, x):
    if n >= 0: return n//x+1
    else: return 0

a,b,x = map(int, input().split())
print(f(b,x)-f(a-1,x))


N = int(input())
lis = []
lstipt = []
cnt = 0
h = 0
while h == 0:
    x, y, h = map(int, input().split())
    if h == 0:
        lstipt.append([x,y,h])
    cnt += 1

for Cx in range(101):
    for Cy in range(101):
        Ph = abs(x-Cx) + abs(y-Cy) + h
        lis.append([Cx,Cy,Ph])

for _ in range(N-cnt):
    x, y, h = map(int, input().split())
    newlis = []
    if h == 0: 
        for l in lis:
            if abs(x-l[0]) + abs(y-l[1]) + h >= l[2]:
                newlis.append(l)
    else:
        for l in lis:
            if abs(x-l[0]) + abs(y-l[1]) + h == l[2]:
                newlis.append(l)
    lis = newlis

for ipt in lstipt:
    x, y, h = ipt[0], ipt[1], ipt[2]
    newlis = []
    if h == 0: 
        for l in lis:
            if abs(x-l[0]) + abs(y-l[1]) + h >= l[2]:
                newlis.append(l)
    else:
        for l in lis:
            if abs(x-l[0]) + abs(y-l[1]) + h == l[2]:
                newlis.append(l)
    lis = newlis

print(" ".join(map(str,lis[0])))



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

n=int(input())
P=[]
for i in range(n):
    x,y,h=map(int,input().split())
    P.append([h,x,y])
P=list(reversed(sorted(P)))
print(P)

for x in range(101):
    for y in range(101):
        flag=0
        H=P[0][0]+abs(P[0][1]-x)+abs(P[0][2]-y)
        for p in P:
            ph=p[0]
            px=p[1]
            py=p[2]
            if ph==0:
                if H-abs(px-x)-abs(py-y)>0:
                    flag=1
                    break
            else:
                if H-abs(px-x)-abs(py-y)!=ph:
                    flag=1
                    break
        if flag==1:
            continue
        else:
            print(x,y,H)
            sys.exit()

import sys

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

for x in range(101):
    for y in range(101):
        flag=0
        H=P[0][0]+abs(P[0][1]-x)+abs(P[0][2]-y)
        for p in P:
            ph=p[0]
            px=p[1]
            py=p[2]
            if ph==0:
                if H-abs(px-x)-abs(py-y)>0:
                    flag=1
                    break
            else:
                if H-abs(px-x)-abs(py-y)!=ph:
                    flag=1
                    break
        if flag==1:
            continue
        else:
            print(x,y,H)
            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):


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

n=getint()

values=[getints() for _ in range(n)]

check = []
for h in values:
    if h[2] > 0:
        check = h
        break

check_x, check_y, check_h = check

for cx in range(101):
    for cy in range(101):
        H = check_h + abs(check_x - cx) + abs(check_y - cy)
        ok = True
        for x,y,h in values:
            h_prime = max(0, H - abs(x-cx) - abs(y-cy))
            if h_prime != h:
                ok = False
                break
        if ok:
            print(cx,cy,h)
            sys.exit(0)




import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

n=getint()

values=[getints() for _ in range(n)]

check = []
for h in values:
    if h[2] > 0:
        check = h
        break

check_x, check_y, check_h = check

for cx in range(101):
    for cy in range(101):
        H = check_h + abs(check_x - cx) + abs(check_y - cy)
        ok = True
        for x,y,h in values:
            h_prime = max(0, H - abs(x-cx) - abs(y-cy))
            if h_prime != h:
                ok = False
                break
        if ok:
            print(cx,cy,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):
n = int(input())
lst = []
for _ in range(n):
  x, y, h = map(int, input().split())
  if h:
  lst.append(x, y, h)
if len(lst) == 1:
  print(*lst)
  quit()
for cx in range(101):
  for cy in range(101):
    a = True
    preh = abs(lst[0][0] - cx) + abs(lst[0][1] - cy) +lst[0][2]
    for x, y, h in lst[1:]:
      H = abs(x - cx) + abs(y - cy) + h
      if H != preh:
        a = False
        break
    if a:
      print(cx, cy, H)
      quit()
    

n = int(input())
lst = []
for _ in range(n):
  x, y, h = map(int, input().split())
  if h != 0:
    lst.append([x, y, h])
if len(lst) == 1:
  print(*lst[0])
  quit()
for cx in range(101):
  for cy in range(101):
    a = True
    preh = abs(lst[0][0] - cx) + abs(lst[0][1] - cy) +lst[0][2]
    for x, y, h in lst[1:]:
      H = abs(x - cx) + abs(y - cy) + h
      if H != preh:
        a = False
        break
    if a:
      print(cx, cy, 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):
import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
  if xyh[i][2] != 0:
    cnt += 1
if cnt == 1:
  for i in range(n):
    if xyh[i][2] != 0:
      print(" ".join(list(map(str, xyh[i]))))
      sys.exit()
for i in range(101):
  for j in range(101):
    x = []
    for k in range(n):
      if xyh[k][2] != 0:
        x.append(abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2])
    print(x)
    if len(set(x)) == 1:
      print(i, j, x[0])

import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
  if xyh[i][2] != 0:
    cnt += 1
if cnt == 1:
  for i in range(n):
    if xyh[i][2] != 0:
      print(" ".join(list(map(str, xyh[i]))))
      sys.exit()
for i in range(101):
  for j in range(101):
    x = []
    for k in range(n):
      if xyh[k][2] != 0:
        x.append(abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2])
    if len(set(x)) == 1:
      print(i, j, x[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())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)

use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break

print(lists)
print(use)


for i in range(0,101):
    for j in range(0,101):
        height=use[2]+abs(i-use[0])+abs(j-use[1])   
        cnt=0
        ok=True
        for inn in lists:
            if inn[2]==0:
                if height>abs(i-use[0])+abs(j-use[1]):
                    ok=False

            if inn[2]>0:
                if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                    ok=False

        if ok:
            ans=[i,j,height]
            print(*ans)
            break

n=int(input())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)
print(lists)
use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break
        
        
ok=True
while ok:
    for i in range(0,101):
        for j in range(0,101):
            height=use[2]+abs(i-use[0])+abs(j-use[1])
            cnt=0
            for inn in lists:
                
                if inn[2]==0:
                    if height>abs(i-use[0])+abs(j-use[1]):
                        continue
                    else:
                        cnt+=1
                elif inn[2]>0:
                    if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                        continue
                    else:
                        cnt+=1
            if cnt==n:
                ok=False
ans=[i,j,height]
print(*ans)

n=int(input())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)

use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break

for i in range(0,101):
    for j in range(0,101):
        height=use[2]+abs(i-use[0])+abs(j-use[1])   
        ok=True
        for inn in lists:
            if inn[2]==0:
                if height>abs(i-inn[0])+abs(j-inn[1]):
                    ok=False
            if inn[2]>0:
                if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                    ok=False
        if ok:
            ans=[i,j,height]
            print(*ans)
            break
        else:
            continue


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, *XYH = map(int, open(0).read().split())
X, Y, H = XYH[::3], XYH[1::3], XYH[2::3]
A = []
for cx, cy in product(range(101), repeat=2):
    B = set()
    C = set()
    for x, y, h in zip(X, Y, H):
        s = h + abs(x-cx) + abs(y-cy)
        if h == 0:
            B.add(s)
        else:
            C.add(s)
    if len(C) == 1:
        A.append((cx, cy, C.pop()))
print(*A.pop())

n, *XYH = map(int, open(0).read().split())
X, Y, H = XYH[::3], XYH[1::3], XYH[2::3]
A = []
for cx, cy in product(range(101), repeat=2):
    B = set()
    C = set()
    for x, y, h in zip(X, Y, H):
        s = h + abs(x-cx) + abs(y-cy)
        if h == 0:
            B.add(s)
        else:
            C.add(s)
    if len(C) == 1:
        h = C.pop()
        if all(h <= b for b in B):
            A.append((cx, cy, h))
print(*A.pop())

n, *XYH = map(int, open(0).read().split())
for cx, cy in product(range(101), repeat=2):
    B, C = set(), set()
    for x, y, h in zip(XYH[::3], XYH[1::3], XYH[2::3]):
        s = h + abs(x-cx) + abs(y-cy)
        if h:
            C.add(s)
        else:
            B.add(s)
    if len(C) == 1:
        h = C.pop()
        if all(h <= b for b in B):
            print(cx, cy, h)
            exit()

from itertools import product
n, *XYH = map(int, open(0).read().split())
for cx, cy in product(range(101), repeat=2):
    B, C = set(), set()
    for x, y, h in zip(XYH[::3], XYH[1::3], XYH[2::3]):
        s = h + abs(x-cx) + abs(y-cy)
        if h:
            C.add(s)
        else:
            B.add(s)
    if len(C) == 1:
        h = C.pop()
        if all(h <= b for b in B):
            print(cx, cy, h)
            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):
# -*- coding: utf-8 -*-

N = int(input())

x0, y0, h0 = map(int, input().split())
for i in range(1,N):
  xi, yi, hi = map(int, input().split())
  if xi-x0 == abs(xi-x0):
    hx = hi + (100 -xi)
  else:
    hx = hi +xi

  if yi-y0 == abs(yi-y0):
    hy = hx + (100 -yi)
  else:
    hy = hx +yi

print(hy)

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

N = int(input())

x0, y0, h0 = map(int, input().split())
for i in range(1,N):
  xi, yi, hi = map(int, input().split())
  if xi-x0 == abs(xi-x0):
    hx = hi + xi
  else:
    hx = hi + (100 -xi)

  if yi-y0 == abs(yi-y0):
    hy = hx + yi
  else:
    hy = hx + (100- yi)

print(hy)

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

N = int(input())

x0, y0, h0 = map(int, input().split())
for i in range(N):
  xi, yi, hi = map(int, input().split())
  if xi-x0 == abs(xi-x0):
    hx = hi + (100 -xi)
  else:
    hx = hi +xi

  if yi-y0 == abs(yi-y0):
    hy = hx + (100 -yi)
  else:
    hy = hx +yi

print(hy)

N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort(key=lambda l:-l[2])
 
for cx in range(101):
  for cy in range(101):
    ch = None
    for x, y, h in arr:
      t = h + abs(cx-x) + abs(cy-y)
      if h > 0:
        if ch is not None and t != ch:
          break
        ch = t
      else:
        if t < ch:
          break
    else:
      print(cx, cy, ch)
      exit()

Verdicts: Wrong Answer

Wrong Answer

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())
z = [list(map(int,input().split())) for _ in range(n)]

def set_height(i,x,y):
	ans = z[i][2] + abs(z[i][0] - x) + abs(z[i][1] - y)
	return ans


answer = 0
for j in range(0,101):
	for k in range(0,101):
		answer=set_height(0,j,k)
		flag = 1
		for l in range(1,n):
			if answer!= set_height(l,j,k):
				flag = 0
				break
		if flag == 1 && answer <= 10**9:
			test = map(str,(j,k,answer))
			print(" ".join(test))


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


def set_height(i,x,y):
	ans = z[i][2] + abs(z[i][0] - x) + abs(z[i][1] - y)
	return ans


answer = 0
for j in range(0,101):
	for k in range(0,101):
		flag = 1
		for l in range(0,n):
			if z[l][2] != 0:
				answer = set_height(l,j,k)
				break

		for l in range(0,n):
			if z[l][2] == 0:
				if answer > set_height(l,j,k):	
					flag = 0
					break
			else:
				if answer != set_height(l,j,k):
					flag = 0
					break
		if flag == 1 and answer > 0 :
			test = map(str,(j,k,answer))
			print(" ".join(test))


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 math import *

N = int(input())
all_input_list = [list(map(int, input().split())) for i in range(N)]
x_y_h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    flag = 1
    for cy in range(101):
        H = x_y_h[2] + abs(cx - x_y_h[0]) + abs(cy - x_y_h[1])
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                flag = 0
                break
        if (flag == 1):
            print("%s %s %s" % (cx, cy, H))
            break
    if (flag == 1):
        break

from math import *
import sys

N = int(input())
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = sorted(all_input_list, key=lambda x: x[2])[-1]
for cx in range(101):
    for cy in range(101):
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                break
        else:
            print("%s %s %s" % (cx, cy, 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):
n = int(input())
 

zahyo = [list(map(int,input().split())) for i in range(n)] 
 
for cx in range(101):
  for cy in range(101):
    flag =0
    for i in range(n):
      if zahyo[i][2]>0:
        H0 = abs(cx-zahyo[i][0])+abs(cy-zahyo[i][1])+zahyo[i][2]
        break
    for i in range(n):
      if zahyo[i][2] != max(0, H0-abs(cx-zahyo[i][0])+abs(cy-zahyo[i][1])):  
        flag=1
        break
    if flag==0:
      print(cx,cy,H0)
      exit()

n = int(input())
 

zahyo = [list(map(int,input().split())) for i in range(n)] 
 
for cx in range(101):
  for cy in range(101):
    flag =0
    for i in range(n):
      if zahyo[i][2]>0:
        H0 = abs(cx-zahyo[i][0])+abs(cy-zahyo[i][1])+zahyo[i][2]
        break
    for i in range(n):
      if zahyo[i][2] != max(0, H0-abs(cx-zahyo[i][0])-abs(cy-zahyo[i][1])):  
        flag=1
        break
    if flag==0:
      print(cx,cy,H0)
      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):
import sys

input = sys.stdin.readline

N = int(input())

xn = [0] * N
yn = [0] * N
hn = [0] * N

for i in range(N):
    xi, yi, hi = map(int, input().split())
    xn[i] = xi
    yn[i] = yi
    hn[i] = hi

for Cx in range(101):
    for Cy in range(101):
        flg = True
        for i in range(N):
            if 0 < hn[i]:
                h = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]
                if flg:
                    H = h
                    flg = False
                else:
                    if (H != h):
                        flg = True
                        break

            if flg:
                continue

            for i in range(N):
                if 0 == hn[i]:
                    h = abs(xn[i] - Cx) + abs(yn[i] - Cy)
                    if h < H:
                        flg = True
                        break

            if flg:
                continue

            print(Cx, Cy, h)
            break
        if not flg:
            break


def main():
    N = int(input())
    xn = []
    yn = []
    hn = []
    for i in range(N):
        xi, yi, hi = map(int, input().split())
        xn.append(xi)
        yn.append(yi)
        hn.append(hi)
    for Cx in range(101):
        for Cy in range(101):
            last = None
            flg = True
            for i in range(N):
                if 0 == hn[i]:
                    continue
                H = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]
                if H < 1:
                    flg = False
                    break
                if last:
                    if H != last:
                        flg = False
                        break
                last = H
            if not flg:
                continue
            for i in range(N):
                if 0 == hn[i]:
                    h = abs(xn[i] - Cx) + abs(yn[i] - Cy)
                    if h < H:
                        flg = False
                        break
            if not flg:
                continue
            print(Cx, Cy, H)
            return


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 = list(0 for i in range(N))
y = list(0 for i in range(N))
h = list(0 for i in range(N))
for i in range(N):
    x[i],y[i],h[i] = (int(i) for i in input().split())

H=-1

for cx in range(101):
    for cy in range(101):
        for i in range(N):
            tmp = h[i]+abs(x[i]-cx)+abs(y[i]-cy)
            if H == -1:
                H = tmp
            elif H != tmp:
                H = -2
            if H == -2:
                break
        if H == -2:
            continue
        for i in range(N):
            if h[i] == 0:
                dist = abs(x[i]-cx)+abs(y[i]-cy)
                if H > dist:
                    H = -2
                    break
        if H == -2:
            continue
        print(cx,cy,H)
        break
    break


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


for cx in range(101): 
    for cy in range(101):
        H = -1
        for i in range(N):
            tmp = h[i]+abs(x[i]-cx)+abs(y[i]-cy)
            if H == -1:
                H = tmp
            elif H != tmp:
                H = -2
            if H == -2:
                break
        if H == -2:
            continue
        for i in range(N):
            if h[i] == 0:
                dist = abs(x[i]-cx)+abs(y[i]-cy)
                if H > dist:
                    H = -2
                    break
        if H == -2:
            continue
        print(cx,cy,H)
        break
    break


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


for cx in range(101): 
    for cy in range(101):
        H = -1
        for i in range(N):
            if h[i] > 0:
                tmp = h[i]+abs(x[i]-cx)+abs(y[i]-cy)
                if H == -1:
                    H = tmp
                elif H != tmp:
                    H = -2
                    break
        if H == -2:
            continue
        for i in range(N):
            if h[i] == 0:
                dist = abs(x[i]-cx)+abs(y[i]-cy)
                if H > dist:
                    H = -2
                    break
        if H == -2:
            continue
        print(cx,cy,H)
        

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

def calc(XYH):
    tmp = 0
    res = [0,0,0]
    for tarx in range(101):
        for tary in range(101):
            xyh = XYH[0]
            tarh = xyh[2] + abs(xyh[0] - tarx) + abs(xyh[1] - tary)
            if all(h==max(h - abs(tarx - x) - abs(tary - y), 0) for x, y, h in XYH):
                print(" ".join(x,y,h))
                return
    
calc(XYH)

N = int(input())
XYH = []
for i in range(N):
    tmp = list(map(int, input().split()))
    if tmp[2] != 0:
        xyh = tmp
    XYH.append(tmp)

def calc(XYH, xyh):
    for tarx in range(101):
        for tary in range(101):
            tarh = xyh[2] + abs(xyh[0] - tarx) + abs(xyh[1] - tary)
            if all(h==max(tarh - abs(tarx - x) - abs(tary - y), 0) for x, y, h in XYH):
                return list(map(str, [tarx, tary, tarh]))
    
print(" ".join(calc(XYH, xyh)))

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() -> None:
    N = int(input())
    pos = [[int(i) for i in input().split()] for _ in range(N)]
    
    x, y, h = pos.pop()
    for CX in range(101):
        for CY in range(101):
            H = h + abs(x - CX) + abs(y - CY)
            if all(posh == max(H - abs(posx - CX) - abs(posy - CY), 0) for posx, posy, posh in pos) and H > 0:
                print('{x} {y} {h} '.format(x=CX, y=CY, h=H))
                exit()


if __name__ == '__main__':
    main()


def main() -> None:
    N = int(input())
    pos = [[int(i) for i in input().split()] for _ in range(N)]
    
    x, y, h = pos.pop()
    for CX in range(101):
        for CY in range(101):
            H = h + abs(x - CX) + abs(y - CY)
            if all(posh == max(H - abs(posx - CX) - abs(posy - CY), 0) for posx, posy, posh in pos):
                print('{x} {y} {h} '.format(x=CX, y=CY, h=H))
                break


if __name__ == '__main__':
    main()


def main() -> None:
    N = int(input())
    pos = [[int(i) for i in input().split()] for _ in range(N)]
    
    x, y, h = pos.pop()
    for CX in range(101):
        for CY in range(101):
            H = h + abs(x - CX) + abs(y - CY)
            if all(posh == max(H - abs(posx - CX) - abs(posy - CY), 0) for posx, posy, posh in pos):
                print('{x} {y} {h} '.format(x=CX, y=CY, h=H))
                exit()


if __name__ == '__main__':
    main()


def main() -> None:
    N = int(input())
    pos = [[int(i) for i in input().split()] for _ in range(N)]
    pos = sorted(pos, key=lambda x: x[2], reverse=True)
    x, y, h = pos[0]
    for CX in range(101):
        for CY in range(101):
            H = h + abs(x - CX) + abs(y - CY)
            if all(posh == max(H - abs(posx - CX) - abs(posy - CY), 0) for posx, posy, posh in pos):
                print('{x} {y} {h}'.format(x=CX, y=CY, h=H))
                exit()


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

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):
import numpy as np
def kouho(x, y, h):
    if h:
        return np.abs(np.arange(101) - x)[:, np.newaxis]  + np.abs(np.arange(101) - y) [np.newaxis] + h

n = int(input())
arrs = []
arrs0 = [np.ones((101, 101), dtype=np.int)*1000000000]
for _ in range(n):
  x, y, h = map(int, input().split())
  if h:
    arrs.append(kouho(x, y, h))
  else:
    arr0.append(kouho(x, y, h))
    
arrs = np.array(arrs)
arrs0 = np.array(arrs0)
for i in range(101):
  for j in range(101):
    if np.all(arrs[:,i,j]==arrs[0,i,j]) and (arrs[0,i,j] <= arrs0[:,i,j].min()):
      print(i, j, arrs[0, i, j])
      break

def ni(): 
    return int(input())
def li():
    return map(int, input().split())

xyh = [tuple(li()) for _ in range(ni())]
xmax, ymax, hmax = max(xyh, key=lambda _: _[-1])

for x_cent in range(101):
    for y_cent in range(101):
        h_cent = hmax + abs(xmax-x_cent) + abs(ymax-y_cent)
        
        for x, y, h in xyh:
            if h != max(0, h_cent - abs(x-x_cent) - abs(y-y_cent)):
                break
        else:
            print(x_cent, y_cent, h_cent)

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

xyhs = [list(map(int, input().split())) for _ in range(n)]
xyhs.sort(key=lambda i: i[2], reverse=True)

print(xyhs)

for cx in range(101):
    for cy in range(101):
        x, y, h = xyhs[0]
        ch = h + abs(cy - y) + abs(cx - x)

        if all([h == max(ch - abs(cy - y) - abs(cx - x), 0) for x, y, h in xyhs[1:]]):
            print(cx, cy, ch)
            exit()


n = int(input())

xyhs = [list(map(int, input().split())) for _ in range(n)]
xyhs.sort(key=lambda i: i[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        x, y, h = xyhs[0]
        ch = h + abs(cy - y) + abs(cx - x)

        if all([h == max(ch - abs(cy - y) - abs(cx - x), 0) for x, y, h in xyhs[1:]]):
            print(cx, cy, ch)
            exit()


Verdicts: Wrong Answer

Accepted