Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
X=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
X=int(input())
if x>=30:
  print(Yes)
else:
  print(No)

Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b%2==0:
  print(Even)
else:
  print(Odd)

Fixed submission:
a,b=map(int,input().split())

if a*b%2==0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
a=int(input("整数aを入力してください："))
b=int(input("整数bを入力してください："))
 
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b=map(int,input().split())

if a*b%2==0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
a=int(print("整数aを入力してください："))
b=int(print("整数bを入力してください："))

if (a*b)%2==0:
  print("Even")
else:
  print("Odd")


Fixed submission:
a,b=map(int,input().split())

if a*b%2==0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = [0,0,0,0]

for i in range(n):
  judge = input()
  if judge === 'AC':
    list[0] += 1
  elif judge === 'WA':
    list[1] += 1
  elif judge === 'TLE':
    list[2] += 1
  elif judge === 'RE':
    list[3] += 1

print( 'AC x {}'.format(list[0]) )
print( 'WA x {}'.format(list[1]) )
print( 'TLE x {}'.format(list[2]) )
print( 'RE x {}'.format(list[3]) )

Fixed submission:
n = int(input())
list = [0,0,0,0]

for i in range(n):
  judge = input()
  if judge == 'AC':
    list[0] += 1
  elif judge == 'WA':
    list[1] += 1
  elif judge == 'TLE':
    list[2] += 1
  elif judge == 'RE':
    list[3] += 1
    
print( 'AC x {}'.format(list[0]) )
print( 'WA x {}'.format(list[1]) )
print( 'TLE x {}'.format(list[2]) )
print( 'RE x {}'.format(list[3]) )
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
N = len(str(x))
s = 0
while N != 0: 
    s =s +( x % 10) 
    N -= 1
    x = x // 10
if s % 9 == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
x = int(input())
N = str(x)
array = list(map(int, N))
if sum(array) % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
N = len(str(x))
L = []
while N != 0: 
    L.append( x % 10 )
    N -= 1
    x = x // 10
if sum(L) % 9 == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
x = int(input())
N = str(x)
array = list(map(int, N))
if sum(array) % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
code = input()

if code == SSS:
    print(0)
elif code == SSR or SRS or RSS or RSR:
    print(1)
elif code == SRR or RRS:
    print(2)
else:
    print(3)

Fixed submission:
x, y ,z = input()
if  x == "S" and y == "S" and z == "S":
    print(0)
elif x =="S" and y=="R" and z=="R":
    print(2)
elif x=="R" and y=="R" and z=="S":
    print(2)
elif x=="R" and y=="R" and z=="R":
    print(3)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
code = input()

if code == SSS:
    print(0)
elif code == SSR or SRS or RSS or RSR:
    print(1)
elif code == SRR or RRS:
    print(2)
else:
    print(3)

Fixed submission:
x, y ,z = input()
if  x == "S" and y == "S" and z == "S":
    print(0)
elif x =="S" and y=="R" and z=="R":
    print(2)
elif x=="R" and y=="R" and z=="S":
    print(2)
elif x=="R" and y=="R" and z=="R":
    print(3)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
k = int(input())

a = [[str(i) for i in range(1,10)]]
c = 9

for i in range(10) :
    b = []
    for s in a[i] :
        if s[-1] == '0' :
            b.append(s+'0')
            b.append(s+'1')
        elif s[-1] == '9' :
            b.append(s+'8')
            b.append(s+'9')
        else :
            b.append(s+str(int(s[-1])-1))
            b.append(s+str(int(s[-1])))
            b.append(s+str(int(s[-1])+1))

        if c + len(b) > k :
            print(b[k-c-len(b)-1])
            break
    
    if c + len(b) > k :
        break
    
    a.append(b)
    c += len(b)


Fixed submission:
k = int(input())

a = [[str(i) for i in range(1,10)]]
c = 9

if k <= 12 :
    print(k)
else :
    for i in range(10) :
        b = []
        for s in a[i] :
            if s[-1] == '0' :
                b.append(s+'0')
                b.append(s+'1')
            elif s[-1] == '9' :
                b.append(s+'8')
                b.append(s+'9')
            else :
                b.append(s+str(int(s[-1])-1))
                b.append(s+str(int(s[-1])))
                b.append(s+str(int(s[-1])+1))

            if c + len(b) > k :
                print(b[k-c-len(b)-1])
                break
    
        if c + len(b) > k :
            break
    
        a.append(b)
        c += len(b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
c = 'YES'

for i in range(n-1) :
    b = a[1:]
    if a[0] in b :
        c = 'NO'
        break
    else :
        a = b.copy()
print(c)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
c = 'YES'

for i in range(n-1) :
    if a[i] == a[i+1] :
        c = 'NO'
        break
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())

hen = [[0,0]]*n
for i in range(n-1) :
    hen[i] = list(map(int,input().split()))

xlist = [0]*n
for k in range(q) :
    p,x = map(int,input().split())
    xlist[p-1] += x

y = [0]*n
for i in range(n) :
    y[i] += xlist[i]
    
    r = i
    while True :
        for j in range(n) :
            if hen[j][1] - 1 == r :
                r = hen[j][0] - 1
                y[i] += xlist[r]
                break
        if j == n-1 :
            break

c = str(y[0])
for i in range(1,n) :
    c += ' ' + str(y[i])

print(c)


Fixed submission:
n,q = map(int,input().split())

hen = [[0,0]]*(n-1)
for i in range(n-1) :
    hen[i] = list(map(int,input().split()))

xlist = [0]*n
for k in range(q) :
    p,x = map(int,input().split())
    xlist[p-1] += x

#---

hen = sorted(hen, key=lambda x:x[1])
hen = sorted(hen, key=lambda x:x[0])

for i in range(n-1) :
    xlist[hen[i][1]-1] += xlist[hen[i][0]-1]

y = xlist.copy()

c = str(y[0])
for i in range(1,n) :
    c += ' ' + str(y[i])

print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q

c = []
for j in range(n) :
  if s[j:j+2] == 'AC' :
    c.append(j)

for i in range(q) :
  l[i], r[i] = map(int,input().split())
  a = 0
  for k in c :
    if l[i]-1 <= k and k <= r[i]-2 :
      a += 1
  print(a)

Fixed submission:
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q

c = [0]
a = 0
for j in range(n) :
  if s[j:j+2] == 'AC' :
    a += 1
  c.append(a)

for i in range(q) :
  l[i], r[i] = map(int,input().split())
  print(c[r[i]-1] - c[l[i]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q
for i in range(q) :
  l[i], r[i] = map(int,input().split())
  c = [0]
  a = 0
  for j in range(n) :
    if s[j:j+2] == 'AC' :
      a += 1
    c.append(a)
  print(c[r[i]-1] - c[l[i]-1])

Fixed submission:
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q

c = [0]
a = 0
for j in range(n) :
  if s[j:j+2] == 'AC' :
    a += 1
  c.append(a)

for i in range(q) :
  l[i], r[i] = map(int,input().split())
  print(c[r[i]-1] - c[l[i]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q
for i in range(q) :
  l[i], r[i] = map(int,input().split())
  c = []
  for j in range(n) :
    if s[j:j+2] == 'AC' :
      c.append(j)

  a = 0
  for k in c :
    if l[i]-1 <= k and k <= r[i]-2 :
      a += 1
  print(a)

Fixed submission:
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q

c = [0]
a = 0
for j in range(n) :
  if s[j:j+2] == 'AC' :
    a += 1
  c.append(a)

for i in range(q) :
  l[i], r[i] = map(int,input().split())
  print(c[r[i]-1] - c[l[i]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q
for i in range(q) :
  l[i], r[i] = map(int,input().split())
  t = s[l[i]-1:r[i]]
  u = r[i] - l[i] + 1
  c = 0
  for j in range(u-1) :
    if t[j:j+2] == 'AC' :
      c += 1
  print(c)

Fixed submission:
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q

c = [0]
a = 0
for j in range(n) :
  if s[j:j+2] == 'AC' :
    a += 1
  c.append(a)

for i in range(q) :
  l[i], r[i] = map(int,input().split())
  print(c[r[i]-1] - c[l[i]-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [0]*n
b = [0]*n

for i in range(n) :
    a[i], b[i] = map(int,input().split())

a_order = a.copy()
a_order.sort()

c = m + 0
ans = 0

while c > 0 :
    a_index_now = a.index(a_order[0]) + 0
    b_now = b[a_index_now] + 0
    if c >= b_now :
        ans += a_order[0] * b_now
        c -= b_now
        a.pop(a_index_now)
        b.pop(a_index_now)
        a_order.pop(0)
    else :
        ans += a_order[0] * c
        c = 0

print(ans)

Fixed submission:
n,m = map(int,input().split())
ls = [0]*n

for i in range(n) :
    a,b = map(int,input().split())
    ls[i] = [a,b]
    
ls.sort(key=lambda x:x[0])

c = m + 0
ans = 0

while c > 0 :
    if c >= ls[0][1] :
        ans += ls[0][0] * ls[0][1]
        c -= ls[0][1]
        ls.pop(0)
    else :
        ans += ls[0][0] * c
        c = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
k = [0]*n
a = [0]*m
b = [0]*m

for i in range(n) :
    a = list(map(int,input().split()))
    for j in range(1,len(a)) :
        b[a[j]] += 1

print(a.count(n))

Fixed submission:
n,m = map(int,input().split())
k = [0]*n
a = [0]*(m+1)
b = [0]*(m+1)

for i in range(n) :
    a = list(map(int,input().split()))
    for j in range(1,len(a)) :
        b[a[j]] += 1

print(b.count(n))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split() )
c = []


for i in range(1,m+1) :

    if m//i in c :
      break

    else :
      if m%i==0 :
         c.append(i)
         c.append(m//i)

c.sort()
c.reverse()

for j in range(len(c)) :

   if c[j] <= m//n :
      print(c[j])
      break

Fixed submission:
n,m = map(int, input().split() )
c = []


for i in range(1,int(m**0.5)+1) :

   if m%i==0 :
      c.append(i)
      c.append(m//i)

c.sort()
c.reverse()

for j in range(len(c)) :

   if c[j] <= m//n :
      print(c[j])
      break
Buggy python submission (verdict: Runtime Error):
s = input()
k = input()
t = '1'

for i in range(len(s)) :
   if s[i]=='1' :
      continue
   else :
      t = s[i]
      break

print(t)

Fixed submission:
a,b = map(int, input().split() )
print((a-1)*(b-1))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math

n = int(input())
max = 1e+18
ans = 1
a = input().split()

for i in range(n):
    ans *= int(a[i])

if ans > max:
    ans = -1

print(ans)


Fixed submission:
import numpy as np
import math

n = int(input())
max = 1e+18
is_zero = False
ans = 1
a = input().split()

for i in range(n):
    if (int(a[i]) == 0):
        ans = 0
        is_zero = True
        break

if not is_zero:
    for i in range(n):
        ans *= int(a[i])
        if ans > max:
            ans = -1
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
def m():
    a, b, n = map(int, input().split())

    def calc(x):
        return int((a * x) / b) - (a * int(x / b))

    if calc(1) < calc(n // 2):
        return max([calc(i) for i in range(n // 2, n + 1)])
    else:
        return max([calc(i) for i in range(1, n // 2 + 1)])


print(m())


Fixed submission:
def m():
    a, b, n = map(int, input().split())

    def calc(x):
        return int((a * x) / b) - (a * int(x / b))

    return calc(min(n, b-1))

print(m())

Buggy python submission (verdict: Runtime Error):
import math


def m():
    a, b, n = map(int, input().split())

    def calc(x):
        return math.floor((a * x) / b) - (a * math.floor(x / b))

    if calc(1) < calc(n // 2):
        return max([calc(i) for i in range(n // 2, n + 1)])
    else:
        return max([calc(i) for i in range(1, n // 2 + 1)])


print(m())


Fixed submission:
def m():
    a, b, n = map(int, input().split())

    def calc(x):
        return int((a * x) / b) - (a * int(x / b))

    return calc(min(n, b-1))

print(m())
Buggy python submission (verdict: Time Limit Exceeded):
def m():
    N, X, Y = map(int, input().split())
    ans = [0] * (N+1)
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            p = min(abs(j - i), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
            ans[p] += 1
    for a in range(1, N):
        print(ans[a]//2)

m()


Fixed submission:
def m():
    N, X, Y = map(int, input().split())
    ans = [0] * (N+1)
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            p = min(abs(j - i), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
            ans[p] += 1
    for a in range(1, N):
        print(ans[a]//2)

m()
Buggy python submission (verdict: Runtime Error):
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {1:1}
    for i in range(2, N + 1):
        if D[i] == 0: return 0
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, False) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())


Fixed submission:
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {1:1}
    for i in range(2, N + 1):
        if D[i] == 0: return 0
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, False) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        if not tree.get(i, 0):
            return 0
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())

Buggy python submission (verdict: Runtime Error):
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {}
    for i in range(2, N + 1):
        if D[i] == 0: return 0
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, False) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())


Fixed submission:
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {1:1}
    for i in range(2, N + 1):
        if D[i] == 0: return 0
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, False) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        if not tree.get(i, 0):
            return 0
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())

Buggy python submission (verdict: Runtime Error):
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {}
    for i in range(1, N + 1):
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, 0) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())


Fixed submission:
def m():
    MOD = 998244353
    N = int(input())
    D = [0] + list(map(int, input().split()))
    if D[1] != 0:
        return 0
    tree = {1:1}
    for i in range(2, N + 1):
        if D[i] == 0: return 0
        tree[D[i] + 1] = tree[D[i] + 1] + 1 if tree.get(D[i] + 1, False) else 1

    height = len(tree.keys())+1
    cnt = 1
    for i in range(2, height):
        if not tree.get(i, 0):
            return 0
        cnt = cnt * pow(tree[i-1], tree[i]) % MOD
    return cnt


print(m())
Buggy python submission (verdict: Time Limit Exceeded):
import bisect


def m():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    while M > 0:
        tmp = A[N - 1] = A[N - 1] >> 1
        M -= 1
        i = bisect.bisect_left(A, A[N - 1])
        A.insert(i, tmp)
        A.pop()
    return sum(A)
print(m())


Fixed submission:
import queue


def m():
    N, M = map(int, input().split())
    q = queue.PriorityQueue()
    A = list(map(int, input().split()))
    ans = []
    for a in A:
        q.put(-a)
    while M > 0:
        x = -q.get()
        x = -(x >> 1)
        M -= 1
        q.put(x)
    while not q.empty(): ans.append(q.get())
    return abs(sum(ans))


print(m())
Buggy python submission (verdict: Runtime Error):
def m():
    MOD = 10 ** 9 + 7
    N, M = map(int, input().split())
    A = [int(input()) for _ in range(M)]
    dp = [0] * (N + 1)
    for a in A: dp[a] = -1
    if dp[1] != -1 and dp[2] != -1:
        dp[1] = 1
        dp[2] = 2
    elif dp[1] != -1 and dp[2] == -1:
        dp[1] = 1
    elif dp[1] == -1 and dp[2] != -1:
        dp[2] = 1
    else:
        return 0

    for i in range(3, N + 1):
        if dp[i] == -1:
            continue
        l = dp[i - 2] if dp[i - 2] != -1 else 0
        r = dp[i - 1] if dp[i - 1] != -1 else 0
        dp[i] = (l + r) % MOD
    return dp[N] % MOD


print(m())


Fixed submission:
def m():
    MOD = 10 ** 9 + 7
    N, M = map(int, input().split())
    A = [int(input()) for _ in range(M)]
    dp = [0] * (N + 1)
    for a in A: dp[a] = -1
    if N == 1:
        if dp[1] != -1:
            return 1
        else:
            return 0
    if dp[1] != -1 and dp[2] != -1:
        dp[1] = 1
        dp[2] = 2
    elif dp[1] != -1 and dp[2] == -1:
        dp[1] = 1
    elif dp[1] == -1 and dp[2] != -1:
        dp[2] = 1
    else:
        return 0

    for i in range(3, N + 1):
        if dp[i] == -1:
            continue
        l = dp[i - 2] if dp[i - 2] != -1 else 0
        r = dp[i - 1] if dp[i - 1] != -1 else 0
        dp[i] = (l + r) % MOD
    return dp[N] % MOD


print(m())
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)


def m():
    left, right = A.copy(), A.copy()
    for i in range(1, N):
        left[i] = gcd(A[i], left[i-1])

    for i in reversed(range(0, N-1)):
        right[i] = gcd(A[i], right[i+1])

    res = max(left[N-1], right[1])
    for i in range(1, N-1):
        res = max(gcd(left[i-1],right[i+1]), res)
    return res


print(m())


Fixed submission:
N = int(input())
A = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)


def m():
    left, right = A.copy(), A.copy()
    for i in range(1, N):
        left[i] = gcd(A[i], left[i-1])

    for i in reversed(range(0, N-1)):
        right[i] = gcd(A[i], right[i+1])

    res = max(left[N-2], right[1])
    for i in range(1, N-1):
        res = max(gcd(left[i-1],right[i+1]), res)
    return res


print(m())

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)


def m():
    left, right = A.copy(), A.copy()
    for i in range(1, N):
        left[i] = gcd(A[i], left[i-1])

    for i in reversed(range(0, N-1)):
        right[i] = gcd(A[i], right[i+1])

    res = max(left[N-1], right[1])
    for i in range(1, N-1):
        res = max(gcd(left[i-1],right[i+1]), res)
    return res


print(m())


Fixed submission:
N = int(input())
A = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)


def m():
    left, right = A.copy(), A.copy()
    for i in range(1, N):
        left[i] = gcd(A[i], left[i-1])

    for i in reversed(range(0, N-1)):
        right[i] = gcd(A[i], right[i+1])

    res = max(left[N-2], right[1])
    for i in range(1, N-1):
        res = max(gcd(left[i-1],right[i+1]), res)
    return res


print(m())
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    cost = [0 for _ in range(n)]
    for i in range(1, n):
        m = float('inf')
        for j in range(1, k+1):
            if (i - j) < 0:
                break
            m = min(m, cost[i-j] + abs(h[i] - h[i - j]))
        cost[i] = m
    return cost[n - 1]


print(main())


Fixed submission:
def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    cost = [0 for _ in range(n)]
    for i in range(1, n):
        m = float('inf')
        for j in range(1, k+1):
            if (i - j) < 0:
                break
            m = min(m, cost[i-j] + abs(h[i] - h[i - j]))
        cost[i] = m
    return cost[n - 1]


print(main())
Buggy python submission (verdict: Runtime Error):
N = int(input())
xyr = [list(map(int, input().split())) for _ in range(N)]


def m():
    for cx in range(0, 101):
        for cy in range(0, 101):
            hs = []
            h = 0
            for x, y, r in xyr:
                h = max(0, r + abs(x - cx) + abs(y - cy))
                hs.append(h)
            if len(set(hs)) == 1:
                return "{} {} {}".format(cx, cy, set(hs)[0])


print(m())

Fixed submission:
N = int(input())
xyr = [list(map(int, input().split())) for _ in range(N)]


def m():
    tmpx, tmpy, tmpr = 0, 0, 0
    for a,b,c in xyr:
        if c != 0:
            tmpx = a
            tmpy = b
            tmpr = c
            break

    for cx in range(0, 101):
        for cy in range(0, 101):
            h = max(0, tmpr + abs(tmpx - cx) + abs(tmpy - cy))
            f = 0
            for x, y, r in xyr:
                if not (r == max(h - abs(x - cx) - abs(y - cy), 0)):
                    f = 1
                    break
            if f == 0:
                return "{} {} {}".format(cx, cy, h)


print(m())