Problem p03240 (python)

Fixed submission:
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    for i in range(101):
        if int(map_list[i][2]) > 0:
            x = int(map_list[i][0])
            y = int(map_list[i][1])
            h = int(map_list[i][2])
            break
        else:
            continue

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    for i in range(101):
        if map_list[i][2] > 0:
            x = int(map_list[i][0])
            y = int(map_list[i][1])
            h = int(map_list[i][2])
            break
        else:
            continue

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[0][0])
    y = int(map_list[0][1])
    h = int(map_list[0][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                xx = int(map_list[k][0])
                yy = int(map_list[k][1])
                hh = int(map_list[k][2])

                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[0][0])
    y = int(map_list[0][1])
    h = int(map_list[0][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                x = int(map_list[k][0])
                y = int(map_list[k][1])
                h = int(map_list[k][2])

                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n-1):
                x = int(map_list[k][0])
                y = int(map_list[k][1])
                h = int(map_list[k][2])

                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                x = int(map_list[k][0])
                y = int(map_list[k][1])
                h = int(map_list[k][2])

                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                xx = int(map_list[k][0])
                yy = int(map_list[k][1])
                hh = int(map_list[k][2])

                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():

    for i in range(101):
        for j in range(101):
            x = int(map_list[-1][0])
            y = int(map_list[-1][1])
            h = int(map_list[-1][2])
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
        
            for data in map_list:
                x, y, h = map(int, data)
                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())
map_list.sort(key=lambda x:x[2])

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - x) + abs(j - y) + h
        
            for data in map_list:
                x, y, h = map(int, data)
                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H
        if cont_check:
            return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - x) + abs(j - y) + h
        
            for data in map_list:
                x, y, h = map(int, data)
                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H
        if cont_check:
            return i, j, H

i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - x) + abs(j - y) + h
        
            for data in map_list:
                x, y, h = map(int, data)
                if h != max(H - abs(i - x) - abs(j - y), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H
        if cont_check:
            return i, j, H
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - x) + abs(j - y) + h
            #print('base:',i, j, H)
        
            for data in map_list:
                x, y, h = map(int, data)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if h != max(H - abs(i - x) - abs(j - y), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - x) + abs(j - y) + h
            #print('base:',i, j, H)
        
            for data in map_list:
                x, y, h = map(int, data)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if h != max(H - abs(i - x) - abs(j - y), 0):
                    cont_check = False
                    break
            if cont_check and H >= 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = map_list[-1][0]
    y = map_list[-1][1]
    h = map_list[-1][2]

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[:-1]:
                x, y, h = data
                h = max(int(h), 0)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if int(h) != max(H - abs(i - int(x)) - abs(j - int(y)), 0):
                    cont_check = False
                    break
            if cont_check and H >= 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())


def function():
    x = map_list[-1][0]
    y = map_list[-1][1]
    h = map_list[-1][2]

    for i in range(101):
        for j in range(101):
            c = 0
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[:-1]:
                x, y, h = data
                h = max(int(h), 0)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if int(h) != max(H - abs(i - int(x)) - abs(j - int(y)), 0):
                    break
                c += 1
            if c >= n - 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

found_data = False
for i in range(101):
    for j in range(101):
        c = 0
        x = map_list[0][0]
        y = map_list[0][1]
        h = map_list[0][2]
        h = max(int(h), 0)
        val = abs(i - int(x)) + abs(j - int(y)) + int(h)
        #print('base:',i, j, val)
        
        for data in map_list[1:]:
            x, y, h = data
            h = max(int(h), 0)
            #print('check:',i, j, val, abs(i - int(x)) + abs(j - int(y) + int(h)))
            if int(h) != max(H - abs(i - int(x)) - abs(j - int(y)), 0):
                break
            c += 1
        if c >= n - 1:
            found_data = True
            break
    if found_data:
        break

h = abs(i - int(x)) + abs(j - int(y)) + int(h)
print(i, j, h)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

found_data = False
def function():
    for i in range(101):
        for j in range(101):
            c = 0
            x = map_list[0][0]
            y = map_list[0][1]
            h = map_list[0][2]
            h = max(int(h), 0)
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[1:]:
                x, y, h = data
                h = max(int(h), 0)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if int(h) != max(H - abs(i - int(x)) - abs(j - int(y)), 0):
                    break
                c += 1
            if c >= n - 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

found_data = False
def function():
    for i in range(101):
        for j in range(101):
            c = 0
            x = map_list[0][0]
            y = map_list[0][1]
            h = max(int(map_list[0][2]), 0)
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[1:]:
                x, y, h = data
                h = max(int(h), 0)
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if H != abs(i - int(x)) + abs(j - int(y)) + int(h):
                    break
                c += 1
            if c >= n - 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

found_data = False
def function():
    for i in range(101):
        for j in range(101):
            c = 0
            x = map_list[0][0]
            y = map_list[0][1]
            h = map_list[0][2]
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[1:]:
                x, y, h = data
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if H != abs(i - int(x)) + abs(j - int(y)) + int(h):
                    break
                c += 1
            if c >= n - 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)