Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if (a + b) % 2 == 0:
  print((a + b) // 2)
else:
  print("IMPOSSIBLE") 

Fixed submission:
a, b = map(int, input().split())
if (a+b) % 2 == 0:
  print((a+b) // 2)
else:
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if (a + b) % 2 == 0:
  print((a + b) // 2)
else:
  print("IMPOSSIBLE") 

Fixed submission:
a, b = map(int, input().split())
if (a+b) % 2 == 0:
  print((a+b) // 2)
else:
  print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if (a + b) % 2 == 0:
	print((a + b) // 2)
else:
	print("IMPOSSIBLE") 

Fixed submission:
a, b = map(int, input().split())
if (a+b) % 2 == 0:
  print((a+b) // 2)
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
#print(dp)
print(int(dp[n - 1][5] % MOD))

Fixed submission:
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
#print(dp)
print(int(dp[n - 1][5] % MOD))

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j]
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j]
#print(dp)
print(int(dp[n - 1][5] % MOD))

Fixed submission:
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
#print(dp)
print(int(dp[n - 1][5] % MOD))
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
n = int(input())
can = []
for i in range(n):
    row = list(map(int, input().split()))
    can.append(row)
dp = [0] * (1 << n)
dp[0] = 1
for mask in range((1 << n) - 1):
    a = bin(mask).count('1')
    for b in range(n):
        if can[a][b] and not (mask & (1 << b)):
            mask2 = mask ^ (1 << b)
            dp[mask2] = (dp[mask2] + dp[mask]) % MOD
print(dp[(1 << n) - 1])

Fixed submission:
def bitcount(i): # i < 2^32
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24

MOD = 10**9+7
n = int(input())
can = [[int(i) for i in input().split()] for j in range(n)]
dp = [0] * (1 << n)
dp[0] = 1
for mask in range((1 << n) - 1):
    #a = bin(mask).count('1')
    a = bitcount(mask)
    for b in range(n):
        if can[a][b] and not (mask & (1 << b)):
            mask2 = mask ^ (1 << b)
            dp[mask2] += dp[mask]
            if dp[mask2] >= MOD:
                dp[mask2] -= MOD
print(dp[(1 << n) - 1])
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
k = input()
d = int(input())
n = len(k)
dp = [[0] * 2 for _ in range(d)]
# dp[sum][smaller_already] - the number of ways to choose digits so far
# such that the sum of digits modulo D is 'sum' and 'smaller_already'
# says whether we already chosen some digit smaller than in K
dp[0][0] = 1
for i in range(n):
    new_dp = [[0] * 2 for _ in range(d)]
    for sums in range(d):
        for sm_already in (False, True):
            for digit in range(10):
                if digit > int(k[i]) and not sm_already:
                    break
                new_dp[(sums + digit) % d][sm_already or (digit < int(k[i]))] += dp[sums][sm_already]
    dp = new_dp
res = (dp[0][False] + dp[0][True] - 1) % MOD
print(res)

Fixed submission:
K = int(input())
D = int(input())
mod = 10**9 + 7

dp = [[[0] * D for _ in range(2)] for _ in range(len(str(K))+1)]
dp[0][0][0] = 1

for i in range(len(str(K))):
    N = int(str(K)[i])
    for j in range(2):
        for k in range(D):
            for n in range((9 if j == 1 else N) + 1):
                dp[i+1][j or n < N][(k+n%D)%D] += dp[i][j][k]%mod

print((dp[-1][0][0]+dp[-1][1][0]-1)%mod)
Buggy python submission (verdict: Runtime Error):
x, n = [int(i) for i in input().split()]
flag = [0 for i in range(101)]
if (n != 0):
    p = [int(i) for i in input().split()]

    for i in p:
        flag[i] = 1



for i in range(100):
    if flag[x-i] == 0:
        ans = x-i
        break

    if flag[x+i] == 0:
        ans = x+i
        break
    
print(ans)



Fixed submission:
x, n = [int(i) for i in input().split()]
flag = [0 for i in range(105)]
if (n != 0):
    p = [int(i) for i in input().split()]

    for i in p:
        flag[i] = 1



for i in range(100):
    if x-i >=0:
        if flag[x-i] == 0:
            ans = x-i
            break
    else:
        ans = -1
        break

    if flag[x+i] == 0:
        ans = x+i
        break
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)




Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
for i in a:
    ans *= i
    if (ans > pow(10,18)):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)




Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
for i in a:
    ans *= i
    if (ans > pow(10,18)):
        flag = True

if (flag):
    ans = -1
if 0 in a:
    ans = 0

print(ans)




Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))


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

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = [int(i) for i in input().split()]123 456
print(lcm(a, b))


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

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
import numpy as np
    
INF = float('inf')

n,A,B,C = [int(i) for i in input().split()]

l = [int(input()) for i in range(n)]

def dfs(cur, a, b, c):
    
    if cur == n:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a+l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b+l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c+l[cur]) + 10

    return min(ret0, ret1, ret2, ret3)


print(dfs(0,0,0,0))


Fixed submission:
s = input().split("/")

if (int(s[0]) <= 2019) and (int(s[1]) <= 4) and (int(s[2]) <= 30):
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce


N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)

ans = x[1]-x[0]
for i in range(2, N+1):
    ans = math.gcd(x[i]-x[i-1],ans)

print(ans)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)

ans = x[1]-x[0]
for i in range(2, N+1):
    ans = gcd(x[i]-x[i-1],ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)
dif = []
for i in range(1, N):
    dif.append(x[i]-x[i-1])

if N == 1:
    print(abs(x[0]-x[1]))
else:
    print(gcd(dif)[0])


Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)

ans = x[1]-x[0]
for i in range(2, N+1):
    ans = gcd(x[i]-x[i-1],ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
count = 0
flag = 1
while flag != 0:
    flag = 0
    for i, a in enumerate(A):
        if a % 2 == 0:
            A[i] = a/2
            count += 1
            flag = 1
            break
print(count)


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
count = 0
flag = 1
while flag != 0:
    flag = 0
    for i, a in enumerate(A):
        if a % 2 == 0:
            A[i] = a/2
            count += 1
            flag = 1
print(count)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    N = input()

    for n in range(1,3501):
        for h in range(1,3501):
            w = n * h * N / (4 * n * h - N * n - N * h)
            if isinstance(w, int) and w > 0:
                break

    print w, h, n


Fixed submission:
S = raw_input()
ac = 0
for i in S:
    if i == '1':
        ac += 1

print ac
Buggy python submission (verdict: Time Limit Exceeded):
N = input()

l = []

for i in range(N):
    x = input()
    if (x in l):
        l.remove(x)
    else:
        l.append(x)

print len(l)


Fixed submission:
N = input()

l = []

for i in range(N):
    l.append(input())

l.sort()

ptr = 0
res = 0
while ptr < N:
    cc = l[ptr]
    f = 0
    while (ptr < N and l[ptr] == cc):
        f += 1
        ptr += 1
    res += f%2

print res
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = map(int, raw_input().split())
x = a[0]
y = sum(a) - a[0]
min = abs(x - y)
for i in range (1,N-1):
    y -= a[i]
    x += a[i]
    dummy = abs(x - y)
    if min > dummy:
        min = dummy
print min


Fixed submission:
A , B = map(int, input().split())
#print(A, B)
if (A%3==0 or B%3 == 0 or (A+B) % 3 == 0):
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = list(map(int, input().split()))

ans = 1
for x in arr:
    ans *= x

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

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

ans = 1

for x in arr:
    if x == 0:
        ans = 0

if ans == 0:
    print(ans)
else:
    for x in arr:
        ans *= x
        if ans > 1000000000000000000:
            break
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))
ans = 1
flag = 1
for x in arr:
    ans *= x
    if ans > 1000000000000000000:
        flag = 0
        break
if flag:
    print(ans)
else:
    print -1



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

ans = 1

for x in arr:
    if x == 0:
        ans = 0

if ans == 0:
    print(ans)
else:
    for x in arr:
        ans *= x
        if ans > 1000000000000000000:
            break
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int,input().split())
    

d={}

cnt = 0

for i in range(M):
    l = L[i]
    r=R[i]
    
    for j in range(l,r+1):
        
        if j in d:
            d[j] += 1
        else:
            d[j] = 1
            
        if d[j] >= M:
            cnt+=1
    
print(cnt)    

Fixed submission:
N,M = map(int,input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int,input().split())
    
L.sort()
R.sort()

l= L[len(L)-1]
r = R[0]

cnt =0 

for i in range(l,r+1):
    cnt+=1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int,input().split())
    

d={}

for i in range(M):
    l = L[i]
    r=R[i]
    
    for j in range(l,r+1):
        
        if j in d:
            d[j] += 1
        else:
            d[j] = 1
    
cnt = 0
for i in d.values():
    if i >=M:
        cnt+=1
        
print(cnt)
    

Fixed submission:
N,M = map(int,input().split())
L = [0]*M
R = [0]*M

for i in range(M):
    L[i],R[i] = map(int,input().split())
    
L.sort()
R.sort()

l= L[len(L)-1]
r = R[0]

cnt =0 

for i in range(l,r+1):
    cnt+=1

print(cnt)
Buggy python submission (verdict: Runtime Error):

flg=False


for i in range(10**6):
    
    temp = A*i
    
    if temp%B==C:
        flg=True
        break
        
        
if flg==True:
    print("Yes")
else:
    print("No")

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

flg=False


for i in range(10**6):
    
    temp = A*i
    
    if temp%B==C:
        flg=True
        break
        
        
if flg==True:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())

sum = 1

for i in range(a,b+1):
    
    sum = sum*i

if sum < 0:
    print("Negative")
elif sum ==0:
    print("Zero")
else:
    print("Positive")

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

if a > 0:
    print("Positive")
elif a<=0 and b >=0:
    print("Zero")
else:
    if (b-a+1)%2==0:
        print("Positive")
    else:
        print("Negative")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = map(int,input().split())
heap.heapify(a)
for i in range(N-1):
  x = heap.heappop(a)
  y = heap.heappop(a)
  z = (x+y)/2
  heap.heappush(a,z)
answer = heap.heappop(a)
print(answer)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
for i in range(N-1):
  x = heapq.heappop(a)
  y = heapq.heappop(a)
  z = (x+y)/2
  heapq.heappush(a,z)
answer = heapq.heappop(a)
print(answer)
Buggy python submission (verdict: Runtime Error):
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
i = 0
j = 0
k = 0
while i+j+k < min(3000,X*Y*Z):
  ans = A[i]+B[j]+C[k]
  deltaA = 10**16
  deltaB = 10**16
  deltaC = 10**16
  if i+j+k == min(3000,X*Y*Z)-1:
    break
  if i+1<X:
    deltaA=A[i]-A[i+1]
  if j+1<Y:
    deltaB=B[j]-B[j+1]
  if k+1<Z:
    deltaC=C[k]-C[k+1]
  L = 10**16
  index = -1
  w = [deltaA,deltaB,deltaC]
  for mm in range(3):
    if w[i] < L:
      L = w[mm]
      index = mm
  if index==0:
    i+=1
  elif index==1:
    j+=1
  else:
    k+=1
I=i+1
J=j+1
M=k+1
answers =[]
for i in range(I):
  for j in range(J):
    for k in range(M):
      answers.append(A[i]+B[j]+C[k])
answers.sort(reverse=True)
for i in range(min(3000,X*Y*Z)):
  print(answers[i])


Fixed submission:
import heapq
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

i=j=k=0
HQ = []
heapq.heapify(HQ)
heapq.heappush(HQ,(-(A[i]+B[j]+C[k]),(i,j,k)))
alreadyAdded = set()
alreadyAdded.add((i,j,k))
for _ in range(K):
    valueNeg,index = heapq.heappop(HQ)
    print(-valueNeg)
    l,m,n = index
    nextIndex = []
    if l+1 < X:
        nextIndex.append((l+1,m,n))
    if m+1 < Y:
        nextIndex.append((l,m+1,n))
    if n+1 < Z:
        nextIndex.append((l,m,n+1))
    for l,m,n in nextIndex:
        if (l,m,n) not in alreadyAdded:
            heapq.heappush(HQ,(-(A[l]+B[m]+C[n]),(l,m,n)))
            alreadyAdded.add((l,m,n))
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
fact = [1]
invfact = [1]
for i in range(1,2*10**5 + 100):
    fact.append((fact[i-1] * i) % MOD)
    invI = pow(i,MOD-2,MOD)
    invfact.append((invfact[i-1] * invI) % MOD)

B,W = map(int,input().split())
N = B+W

pcSum = [1 for _ in range(B+W+1)]
qcSum = [1 for _ in range(B+W+1)]
def modComb(n,m):
    if m < 0 or m > n: return(0)
    ans = fact[n] * invfact[m] 
    ans %= MOD
    ans *= invfact[n-m]
    ans %= MOD
    return(ans)

for i in range(B+W-1):
    pcSum[i+1] = 2*pcSum[i] - modComb(i,B-1)
    pcSum[i+1] %= MOD
    if (i+1-W) <= B-1:
        qcSum[i+1] = 2*qcSum[i] - modComb(i,B-1) - modComb(i,i+1-W)
        qcSum[i+1] %= MOD
    else:
        qcSum[i+1] = 0

p = []
q = []
for i in range(B+W):
    coefficient = pow(2,i*(MOD-2),MOD)
    pvalue = pcSum[i] * coefficient
    pvalue %= MOD
    p.append(pvalue)
    qvalue = qcSum[i] * coefficient
    qvalue %= MOD
    q.append(qvalue)
invTwo = pow(2,MOD-2,MOD)
for i in range(N):
    answer = p[i] - invTwo * q[i]
    answer %= MOD
    print(answer)


Fixed submission:
MOD = 10**9+7
fact = [1]
invfact = [1]
for i in range(1,2*10**5 + 100):
    fact.append((fact[i-1] * i) % MOD)
    invI = pow(i,MOD-2,MOD)
    invfact.append((invfact[i-1] * invI) % MOD)

B,W = map(int,input().split())
N = B+W

pcSum = [1 for _ in range(B+W+1)]
qcSum = [1 for _ in range(B+W+1)]
def modComb(n,m):
    if m < 0 or m > n: return(0)
    ans = fact[n] * invfact[m] 
    ans %= MOD
    ans *= invfact[n-m]
    ans %= MOD
    return(ans)

for i in range(B+W-1):
    pcSum[i+1] = 2*pcSum[i] - modComb(i,B-1)
    pcSum[i+1] %= MOD
    if (i+1-W) <= B-1:
        qcSum[i+1] = 2*qcSum[i] - modComb(i,B-1) - modComb(i,i+1-W)
        qcSum[i+1] %= MOD
    else:
        qcSum[i+1] = 0

p = []
q = []
powOfTwo = []
value = 1
invTwo = pow(2,MOD-2,MOD)
for _ in range(N):
    powOfTwo.append(value)
    value *= invTwo
    value %= MOD
for i in range(B+W):
    # coefficient = pow(2,i*(MOD-2),MOD)
    coefficient = powOfTwo[i]
    pvalue = pcSum[i] * coefficient
    pvalue %= MOD
    p.append(pvalue)
    qvalue = qcSum[i] * coefficient
    qvalue %= MOD
    q.append(qvalue)
for i in range(N):
    answer = p[i] - invTwo * q[i]
    answer %= MOD
    print(answer)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
c=100,d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)


Fixed submission:
a,b,k=map(int,input().split())
c=100
d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)
Buggy python submission (verdict: Runtime Error):
s=input()
stk=0
h=0
for c in s:
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)

Fixed submission:
s=input()
stk=0
h=0
for c in s:
  x=int(c)
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from numpy.linalg import matrix_power
H,W,K=map(int,input().split())
def c(i,j):
    f=[1,1,2,3,5,8,13,21]
    a=0
    if i==j+1: a=f[j]*f[W-i-1]
    if j in (i,i+1): a=f[i]*f[W-j-1]
    return(a)
def mp(m,n,p):
    a = m%p
    if n==0:
        return(np.identity(m.diagonal().size,dtype='int32'))
    if n==1:
        return(a)
    else:
        q,r=divmod(n,2)
        x=np.matmul(a,a)%p
        if r==1:
            return(np.matmul(a,mp(x,q,p))%p)
        else:
            return(mp(x,q,p)%p)

m=mp(np.array([[c(i,j) for i in range(W)] for j in range(W)]),H,1000000007)
x=np.array([[c(i,j) for i in range(W)] for j in range(W)])
print(m[0,K-1])

          

Fixed submission:
MOD = 1000000007
H,W,K=map(int,input().split())
##Precalculation            
num = [[0 for _ in range(W)] for _ in range(W)]
for value in range(2**(W-1)):
    bit = [False for _ in range(W-1)]
    for d in range(W-1):
        bit[d] = (2**d & value) > 0
    duplicate = False
    for d in range(1,W-1):
        if bit[d] and bit[d-1]:
            duplicate = True
            break
    if duplicate:
        continue
    ##No Duplicate Assured
    for x in range(W):
        num[x][x] += 1
    for d in range(W-1):
        if bit[d]:
            num[d][d+1] += 1
            num[d+1][d] += 1
            num[d][d] -= 1
            num[d+1][d+1] -= 1
##Time to Dynamic Programming YEAHHHHHH##
dp = [[0 for _ in range(W)] for _ in range(H+1)]
dp[0][0] = 1
for h in range(1,H+1):
    for k in range(W):
        for j in range(W):
            dp[h][k] += (dp[h-1][j]*num[j][k])%MOD
            dp[h][k] %= MOD
print(dp[H][K-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = []
y = []
h = []
for _ in range(N):
    xx,yy,hh = map(int,input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)
cm = 100
def height(cx,x,cy,y,h):
    return(max(0,h-abs(cx-x)-abs(cy-y)))
def judge(cx,cy,hc):
    for i in range(N):
        hcand = height(cx,x[i],cy,y[i],hc) 
        if hcand < h[i]:
            return(-1)
        if hcand > h[i]:
            return(1)
    return(0)
        
    
for cx in range(cm+1):
    for cy in range(cm+1):
        left = -1
        right = 1000000001
        while right > left:
            mid = (right+left)//2
            j = judge(cx,cy,mid) 
            if j == 0:
                print(cx,cy,mid)
                exit()
            elif j == 1:
                right = mid
            else:
                left = mid

Fixed submission:
N = int(input())
x = []
y = []
h = []
for _ in range(N):
    xx,yy,hh = map(int,input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)
cm = 100
def dist(cx,cy,x,y):
    return(abs(cx-x)+abs(cy-y))
for cx in range(cm+1):
    for cy in range(cm+1):
        H = -1
        Hm = 10000000000
        contra = False
        for i in range(N):
            Hi = h[i] + dist(cx,cy,x[i],y[i])
            if h[i] == 0:
                Hm = min(Hi,Hm)
            else:
                if H == -1:
                    H = Hi
                else:
                    if H!=Hi:
                        contra = True
                        break
            if H > Hm:
                contra = True
                break
        if contra == False:
            print(cx,cy,H)                
            exit()