Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())

for i in range(2, S):
    if S % i != 0:
        x = i
        break

res = [S]*K + [x]*(N-K)
print(" ".join(map(str, res)))

Fixed submission:
N, K, S = map(int, input().split())

x = 10**9
for i in range(2, S):
    if S % i != 0:
        x = i
        break

res = [S]*K + [x]*(N-K)
print(" ".join(map(str, res)))
Buggy python submission (verdict: Runtime Error):
S, T = map(int, input().split())
print(T+S)

Fixed submission:
S, T = input().split()
print(T+S)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mod = 10**9+7

cnt = [0]*60
bt = [0]*60

for a in A:
    for i in range(60):
        cnt[i] += (a>>i)&1

for i in range(60):
    x = cnt[i]
    bt[i] += x*(N-x)%mod

ans = 0
for i in range(60):
    ans += bt[i]*2**i
    ans %= mod

print(ans)

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

mod = 10**9+7

cnt = [0]*60
bt = [0]*60

for a in A:
    for i in range(60):
        cnt[i] += (a>>i)&1

ans = 0
for i in range(60):
    x = cnt[i]
    y = x*(N-x)%mod
    ans += y*2**i
    ans %= mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(map(int, list(input())))

def f(a):
    i = 0
    for j in range(N):
        if S[j] == a[i]:
            i += 1
            if i > 2:
                return True
    return False

res = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            if f((i, j, k)):
                res += 1

print(res)

Fixed submission:
N = int(input())
S = list(map(int, list(input())))

def f(a):
    i = 0
    for j in range(N):
        if S[j] == a[i]:
            i += 1
            if i > 2:
                return True
    return False

res = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            if f((i, j, k)):
                res += 1

print(res)
Buggy python submission (verdict: Runtime Error):
N = input()
print((N-1)//2)

Fixed submission:
N = int(input())
print((N-1)//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ress = []

for i in range(1, int(N**0.5)):
    if N % i == 0:
        ress.append(i+N//i)

print(min(ress)-2)

Fixed submission:
N = int(input())

ress = []

for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        ress.append(i+N//i)

print(min(ress)-2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

L.sort()
L.reverse()

res = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        x = L[i] - L[j]
        for k in range(j+1, N):
            if L[k] <= x:
                break
            res += 1

print(res)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split()))

L.sort()

res = 0

for i in range(N-1, 1, -1):
    for j in range(i-1, 0, -1):
        x = L[i] - L[j]
        idx = bisect.bisect_right(L, x)
        res += max(j-idx, 0)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

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

x = gcd(A, B)
res = 1
if x != 1:
    i = 2
    while i <= x:
        if x % i == 0:
            res += 1
            x /= i
            while x % i == 0:
                x /= i
        i += 1

print(res)

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

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

x = gcd(A, B)

res = 1
temp = x
for i in range(2, int(-(-x**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        res += 1

if temp!=1:
    res += 1

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

res = []
for i in range(2, min(A, B)+1):
    if A % i == 0:
        if B % i == 0:
            res.append(i)

i = 0
while i < len(res)-1:
    j = i + 1
    while j < len(res):
        if res[j] % res[i] == 0:
            res.pop(j)
        else:
            j += 1
        
    i += 1

print(len(res)+1)

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

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

x = gcd(A, B)

res = 1
temp = x
for i in range(2, int(-(-x**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        res += 1

if temp!=1:
    res += 1

print(res)
Buggy python submission (verdict: Runtime Error):
import heapq
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

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

x = 0
res = 0

hq = []
heapq.heapify(hq)

for i in range(M):
    for j in range(x, N):
        if AB[j][0] > i+1:
            x = j
            break
        heapq.heappush(hq, AB[j][1]*-1)
    else:
        x = N
    
    print(hq)
    if hq:
        res += heapq.heappop(hq)*-1

print(res)


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

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

x = 0
res = 0

hq = []
heapq.heapify(hq)

for i in range(M):
    for j in range(x, N):
        if AB[j][0] > i+1:
            x = j
            break
        heapq.heappush(hq, AB[j][1]*-1)
    else:
        x = N
    
    if hq:
        res += heapq.heappop(hq)*-1

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB = sorted(AB, key=lambda x: x[0])
AB = sorted(AB, key=lambda x: x[1])
AB.reverse()

res = 0

f = [True]*M
for a, b in AB:
    if a > M:
        continue
    for i in range(a-1, M):
        if f[i]:
            f[i] = False
            res += b
            break

print(res)


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

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

x = 0
res = 0

hq = []
heapq.heapify(hq)

for i in range(M):
    for j in range(x, N):
        if AB[j][0] > i+1:
            x = j
            break
        heapq.heappush(hq, AB[j][1]*-1)
    else:
        x = N
    
    if hq:
        res += heapq.heappop(hq)*-1

print(res)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)


Fixed submission:
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    if i <= N-K:
        print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)
    else:
        print(0)

Buggy python submission (verdict: Runtime Error):
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return (f(n)%WARU) // ((f(r)*f(n-r))%WARU)


for i in range(K):
    print((nCr(K-1, i) * nCr(N-K+1, i+1))%WARU)


Fixed submission:
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    if i <= N-K:
        print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)
    else:
        print(0)

Buggy python submission (verdict: Runtime Error):
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)


Fixed submission:
from math import factorial as f
N, K = map(int,input().split())

WARU = 10**9+7

def nCr(n, r):
    return f(n)//(f(r)*f(n-r))


for i in range(K):
    if i <= N-K:
        print((nCr(K-1, i) * nCr(N-K+1, i+1)) % WARU)
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int,input().split())

E = C*D / math.gcd(C, D)

Anum = A-1 - (int((A-1)/C) + int((A-1)/D) - int((A-1)/E))
Bnum = B - (int(B/C) + int(B/D) - int(B/E))

print(Bnum - Anum)

Fixed submission:
A, B, C, D = map(int,input().split())

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

lcm = int(C*D / gcd(C, D))

def func(x):
    return x - int(x//C) - int(x//D) + int(x//lcm)

print(func(B) - func(A-1))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]

b = [0]*(N+1)
b[0] = 1

if 1 not in a:
    b[1] = 1

for i in range(2,N+1):
    if i not in a:
        for j in range(1,3):
            if b[i-j] != 0:
                b[i]+= b[i-j]

print(b[N]%1000000007)

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

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]

print(b[N]%1000000007)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]

b = [0]*N

if 1 not in a:
    b[0] = 1

if 2 not in a:
    if b[0] == 1:
        b[1] = 2
    else:
        b[1] = 1

for i in range(2,N):
    if i+1 not in a:
        if b[i-2] != 0:
            b[i]+= b[i-2]
        if b[i-1] != 0:
            b[i]+= b[i-1]

print(b[N-1]%1000000007)

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

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]

print(b[N]%1000000007)

Buggy python submission (verdict: Runtime Error):
N, M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]

b = [0]*N

if 1 not in a:
    b[0] = 1

if 2 not in a:
    if b[0] == 1:
        b[1] = 2
    else:
        b[1] = 1

for i in range(2,N):
    if i+1 not in a:
        if b[i-2] != 0:
            b[i]+= b[i-2]
        if b[i-1] != 0:
            b[i]+= b[i-1]
print(b)
print(b[N-1]%1000000007)

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

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]

print(b[N]%1000000007)
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int,input().split()))

Nmin = 1
Nmax = N

for i in range(M):
    L, R = list(map(int,input().split()))
    Nmin = max(L,Nmin)
    Nmax = min(R,Nmax)

print(max(Nmax-Nmin+1),0)

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

Nmin = 1
Nmax = N

for i in range(M):
    L, R = list(map(int,input().split()))
    Nmin = max(L,Nmin)
    Nmax = min(R,Nmax)

print(max(Nmax-Nmin+1,0))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int,input().split()))

LR = []

for i in range(M):
    LR.append(list(map(int,input().split())))

cnt = 0

for i in range(1,N+1):
    for lr in LR:
        if i < lr[0] or i > lr[1]:
            break
    else:
        cnt += 1

print(cnt)
    

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

Nmin = 1
Nmax = N

for i in range(M):
    L, R = list(map(int,input().split()))
    Nmin = max(L,Nmin)
    Nmax = min(R,Nmax)

print(max(Nmax-Nmin+1,0))
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = list(map(int,input().split()))

cnt = 0

for r in range(int(N/R)+1):
    for g in range(int(N/G)+1):
        for b in range(int(N/B)+1):
            if R*r + G*g + B*b == N:
                cnt += 1

print(cnt)

Fixed submission:
R,G,B,N = list(map(int,input().split()))

cnt = 0
sum = 0

for r in range(int(N/R)+1):
    sum = R*r
    for g in range(3001):
        if sum + G*g > N:
            break
        if (N-sum-(G*g))%B == 0:
            cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

sum = 0

b = 0
for i in range(1,N):
    N2 = int(N/i)
    if int(N/(N2-1)) != i:
        b += 1
        if b > 1000000:
            break
    else:
        if N%(N2-1) == i:
            sum += N2-1

print(sum)

Fixed submission:
N = int(input())

ans = 0
if N > 3:
    ans += N-1

for i in range(2, int(N**0.5)+1):
    if N%i == 0:
        a = i-1
        if N//a == N%a:
            ans += a
        a = N//i-1
        if N//a == N%a:
            ans += a

print(ans)
Buggy python submission (verdict: Runtime Error):
import copy

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

result = 0

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_list(nums):
    x = gcd(nums[0],nums[1])
    for i in range(2,len(nums)):
        x = gcd(nums[i],x)
    return x

for i in range(N):
    a = copy.deepcopy(A)
    del a[i]
    result = max(gcd_list(a),result)

print(result)

Fixed submission:
from fractions import gcd

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

gcdl = [1]*N
gcdl[0] = A[0]

gcdr = [1]*N
gcdr[-1] = A[-1]

for i in range(1, N):
    gcdl[i] = gcd(gcdl[i-1], A[i])
    gcdr[N-i-1] = gcd(gcdr[N-i], A[N-i-1])

res = max(gcdl[N-2], gcdr[1])

for i in range(1, N-1):
    res = max(gcd(gcdl[i-1], gcdr[i+1]), res)

print(res)

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

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

result = 0

def gcd_list(nums):
    x = math.gcd(nums[0],nums[1])
    for i in range(2,len(nums)):
        x = math.gcd(nums[i],x)
    return x

for i in range(N):
    a = copy.deepcopy(A)
    del a[i]
    result = max(gcd_list(a),result)

print(result)

Fixed submission:
from fractions import gcd

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

gcdl = [1]*N
gcdl[0] = A[0]

gcdr = [1]*N
gcdr[-1] = A[-1]

for i in range(1, N):
    gcdl[i] = gcd(gcdl[i-1], A[i])
    gcdr[N-i-1] = gcd(gcdr[N-i], A[N-i-1])

res = max(gcdl[N-2], gcdr[1])

for i in range(1, N-1):
    res = max(gcd(gcdl[i-1], gcdr[i+1]), res)

print(res)
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 0
now = 0
for i in S:
  if i in "ACGT":
    now += 1
  else:
    ans = max(now)
    now = 0
print(ans)

Fixed submission:
S = input()
ans = 0
now = 0
for i in S:
  if i in "ACGT":
    now += 1
  else:
    ans = max(ans,now)
    now = 0
ans = max(ans,now)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = list(map(int,input().split()))
S = input()
lr = []
for i in range(Q):
  lr.append(list(map(int,input().split())))

for i in lr:
  print(S[i[0]-1:i[1]].count("AC"))

Fixed submission:
N, Q = map(int, input().split())
S = input()
x = [0]*N
cnt = 0
for i in range(1, N):
    if S[i-1:i+1] == "AC":
        cnt += 1
    x[i] = cnt

lr = []
for _ in range(Q):
    lr.append(map(int, input().split()))

for l, r in lr:
    print(x[r-1]-x[l-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
b = list(map(int, input().split()))

b_order = [-1]*N

def f():
    
    for i in range(N,0,-1):
        i_order = N - (i - b[i-1])

        while b_order[i_order - 1] != -1:
            i_order -= 1
            if i_order < 0:
                print(-1)
                return

        b_order[i_order - 1] = b[i-1]

    for i in b_order:
        print(i)

f()

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

res = []
for i in range(N):
    for j in range(N-i-1, -1, -1):
        if B[j] == j+1:
            res.append(j+1)
            B = B[:j]+B[j+1:]
            break
    else:
        break

if len(res) == N:
    res.reverse()
    for r in res:
        print(r)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N,M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB = sorted(AB)

n = 0
result = 0

while True:
    if AB[n][1] <= M:
        result += AB[n][0] * AB[n][1]
        M -= AB[n][1]
        n += 1
    else:
        result += AB[n][0] * M
        break

print(result)

Fixed submission:
N,M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB = sorted(AB)

n = 0
result = 0

while M > 0:
    if AB[n][1] <= M:
        result += AB[n][0] * AB[n][1]
        M -= AB[n][1]
        n += 1
    else:
        result += AB[n][0] * M
        break

print(result)

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB = sorted(AB)

n = 0
result = 0

while True:
    if AB[n][1] <= M:
        result += AB[n][0] * AB[n][1]
        M -= AB[n][1]
        n += 1
    else:
        result += AB[n][0] * M
        break

print(result)

Fixed submission:
N,M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB = sorted(AB)

n = 0
result = 0

while M > 0:
    if AB[n][1] <= M:
        result += AB[n][0] * AB[n][1]
        M -= AB[n][1]
        n += 1
    else:
        result += AB[n][0] * M
        break

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
A,B = list(map(int, input().split()))

result = 0

for i in range(A,B+1):
    result = result ^ i

print(result)

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

range = B - (A - 1)

result = 0

if A % 2 == 1:
    range -= 1
    result = A

if B % 2 == 0:
    range -= 1
    result ^= B


if range % 4 != 0:
    result ^= 1

print(result)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
if (N-1)//(K-1) >= 2:
  print("YES")
else:
  print("NO")

Fixed submission:
N, K = map(int, input().split())
if (N-1) >= (K-1)*2:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = list(int, input().split())
N.sort()
print(N[0]*N[1]//2)


Fixed submission:
N = list(map(int, input().split()))
N.sort()
print(N[0]*N[1]//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
h.append(0)

res = 0
while True:
    for i in range(N):
        if h[i] > 0:
            l = i
            break
    for j in range(i+1, N+1):
        if h[j] == 0:
            r = j
            break
    
    x = min(h[l:r])
    for i in range(l, r):
        h[i] -= x
    res += x

    if max(h) == 0:
        break

print(res)


Fixed submission:
N = int(input())
h = list(map(int, input().split()))
h.append(0)

res = 0
while True:
    if max(h) == 0:
        break
    for i in range(N):
        if h[i] > 0:
            l = i
            break
    for j in range(i+1, N+1):
        if h[j] == 0:
            r = j
            break
    
    x = min(h[l:r])
    for i in range(l, r):
        h[i] -= x
    res += x

print(res)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
ABC = [list(map(int,input().split())) for i in range(N)]

dp = [0]*(N+1)

for i in range(1,N+1):
    dp[i] = [max([dp[i-1][k]+ABC[i-1][j] for k in range(3) if j != k]) for j in range(3)]

print(max(dp[N]))

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
ABC = [list(map(int,input().split())) for i in range(N)]

dp = [[0]*3 for i in range(N+1)]

for i in range(1,N+1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i][j] = max(dp[i-1][k]+ABC[i-1][j],dp[i][j])

print(max(dp[N]))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
wv = [list(map(int,input().split())) for i in range(N)]

wv.sort()
wv.reverse()

dp = [[0]*(W+1) for i in range(N+1)]

for i, x in enumerate(wv,1):
    w = x[0]
    v = x[1]
    for j in range(w,W+1):
        dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)
        
print(dp[N][W])

Fixed submission:
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int,input().split())

n = (N+1)*max(v)

inf = 10**14

dp = [[inf]*n for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    dp[i+1][0] = 0
    for j in range(n-2,0,-1):
        dp[i+1][j] = min(dp[i+1][j+1], dp[i][j], dp[i][j-v[i]]+w[i])

ans = 0
for i in range(n):
    if dp[N][i] <= W:
        ans = i
    else:
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')
Buggy python submission (verdict: Runtime Error):
if input() == "1":
    print("Hello World")
else:
    print(int(input()+int(input())))

Fixed submission:
if input() == "1":
    print("Hello World")
else:
    print(int(input())+int(input()))
Buggy python submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

for Cx in range(101):
    for Cy in range(101):
        for i in range(N):
            if xyh[i][2] >= 1:
                H = xyh[0][2] + abs(Cx-xyh[0][0]) + abs(Cy-xyh[0][1])
                break
        for i in range(N):
            if xyh[i][2] != max(H-abs(xyh[i][0]-Cx)-abs(xyh[i][1]-Cy), 0):
                break
        else:
            res = [str(Cx), str(Cy), str(H)]

print(" ".join(res))

Fixed submission:
N = int(input())
x = []
y = []
h = []
for i in range(N):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)
    if c >= 1:
        xt = a
        yt = b
        ht = c

for Cx in range(101):
    for Cy in range(101):
        H = max(ht + abs(Cx - xt) + abs(Cy - yt), 0)
        for i in range(N):
            Z = max(H - abs(Cx - x[i]) - abs(Cy - y[i]), 0)
            if h[i] != Z:
                break
        else:
            res = [str(Cx), str(Cy), str(H)]

print(" ".join(res))

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

for Cx in range(101):
    for Cy in range(101):
        H = xyh[0][2] + abs(Cx-xyh[0][0]) + abs(Cy-xyh[0][1])
        for i in range(1, N):
            if xyh[i][2] != max(H-abs(xyh[i][0]-Cx)-abs(xyh[i][1]-Cy), 0):
                break
        else:
            res = [str(Cx), str(Cy), str(H)]

print(" ".join(res))

Fixed submission:
N = int(input())
x = []
y = []
h = []
for i in range(N):
    a, b, c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)
    if c >= 1:
        xt = a
        yt = b
        ht = c

for Cx in range(101):
    for Cy in range(101):
        H = max(ht + abs(Cx - xt) + abs(Cy - yt), 0)
        for i in range(N):
            Z = max(H - abs(Cx - x[i]) - abs(Cy - y[i]), 0)
            if h[i] != Z:
                break
        else:
            res = [str(Cx), str(Cy), str(H)]

print(" ".join(res))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

for i in range(M//N+1)[::-1]:
    if M % i == 0:
        print(i)
        break
else:
    print(1)

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

for i in range(M//N+1)[::-1]:
    if M % i == 0:
        print(i)
        break
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

i = 0
while True:
    if S[i] != "1":
        print(S[i])
        break
    if i == K:
        print(S[i])
        break
    i += 1

Fixed submission:
S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != "1":
        break

if K > i:
    print(S[i])
else:
    print(1)