Buggy python submission (verdict: Runtime Error):


def func():

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




    for cx in range(101):
        for cy in range(101):
            for line in data:
                if data[2] != 0:
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()



Fixed submission:


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()

Buggy python submission (verdict: Runtime Error):


def func():

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




    for cx in range(101):
        for cy in range(101):
            for line in data:
                if data[2] != 0:
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    H_max = h + abs(cx - x) + abs(cy - y)
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()



Fixed submission:


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()

Buggy python submission (verdict: Runtime Error):


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                x = line[0]
                y = line[1]
                h = line[2]
                disx = x-cx
                disy = y-cy
                h1 = h + abs(disx) + abs(disy)
                if not h1 in dict:
                    dict[h1] = 0
                else:
                    dict[h1] += 1
                if h == 0:
                    for i in range(h1):
                        if not h1 in dict:
                            dict[h1] = 0
                        else:
                            dict[h1] += 1

                for key in dict.keys():
                    if dict[key] == n-1:
                        print(cx,end=" ")
                        print(cy,end=" ")
                        print(key)
                        return 0

func()



Fixed submission:


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()

Buggy python submission (verdict: Runtime Error):


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                x = line[0]
                y = line[1]
                h = line[2]
                disx = x-cx
                disy = y-cy
                h1 = h + abs(disx) + abs(disy)
                if not h1 in dict:
                    dict[h1] = 0
                else:
                    dict[h1] += 1
                if h == 0:
                    for i in range(h1):
                        # if i == 0:
                        #     continue
                        if not h1 in dict:
                            dict[h1] = 0
                        else:
                            dict[h1] += 1

                for key in dict.keys():
                    if dict[key] == n-1:
                        print(cx,end=" ")
                        print(cy,end=" ")
                        print(key)
                        return 0

func()



Fixed submission:


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()

Buggy python submission (verdict: Runtime Error):


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                x = line[0]
                y = line[1]
                h = line[2]
                disx = x-cx
                disy = y-cy
                h1 = h + abs(disx) + abs(disy)
                if not h1 in dict:
                    dict[h1] = 0
                else:
                    dict[h1] += 1
                if h == 0:
                    for i in range(h1):
                        if i == 0:
                            continue
                        if not h1 in dict:
                            dict[h1] = 0
                        else:
                            dict[h1] += 1

                for key in dict.keys():
                    if dict[key] == n-1:
                        print(cx,end=" ")
                        print(cy,end=" ")
                        print(key)
                        return 0

func()



Fixed submission:


def func():

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

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()