qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import math
n, k = map(int,input().split())
a = list(map(int, input().split()))

asum = sum(a)
gcdmax = int(math.sqrt(asum))
li = [i for i in range(2,gcdmax+1)]
for i in range(gcdmax,0,-1):
    if asum%i==0:
        li.append(asum//i)


ans = 1
print(li)

for i in li:
    b = [a[ii] % i for ii in range(n)]
    b.sort()
#     print(i,b)
    l = 0
    r = 0
    x = 0
    y = n-1
    while x<=y:
        if r>=l:
            l += b[x]
            x += 1
        else:
            r += i - b[y]
            y -= 1
#         print(l,r)
    if max(l,r) <= k and (l-r)%i==0 :
        ans = i

print(ans)

Fixed code:
import math
n, k = map(int,input().split())
a = list(map(int, input().split()))

asum = sum(a)
gcdmax = int(math.sqrt(asum))
li = []
for i in range(2,gcdmax+1):
    if asum%i==0:
        li.append(i)
for i in range(gcdmax,0,-1):
    if asum%i==0:
        li.append(asum//i)


ans = 1
# print(li)

for i in li:
    b = [a[ii] % i for ii in range(n)]
    b.sort()
#     print(i,b)
    l = 0
    r = 0
    x = 0
    y = n-1
    while x<=y:
        if r>=l:
            l += b[x]
            x += 1
        else:
            r += i - b[y]
            y -= 1
#         print(l,r)
    if max(l,r) <= k and (l-r)%i==0 :
        ans = i

print(ans)
Buggy code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

input1 = input()
input2 = input()

N = int(input1.split()[0])
K = int(input1.split()[1])

nums = [int(s) for s in input2.split()]

divs = make_divisors(sum(nums))

possible = []

for i in divs:
    nord = [s%i for s in nums]
    nord.sort()
    mt_size = sum(nord) // i
    moves = sum(nord[0:N-1-mt_size])
    if moves <= K:
        possible.append(i)

print(int(max(possible)))

Fixed code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

input1 = input()
input2 = input()

N = int(input1.split()[0])
K = int(input1.split()[1])

nums = [int(s) for s in input2.split()]

divs = make_divisors(sum(nums))

possible = []

for i in divs:
    nord = [s%i for s in nums]
    nord.sort()
    mt_size = sum(nord) // i
    moves = sum(nord[0:N-mt_size])
    if moves <= K:
        possible.append(i)

print(int(max(possible)))
Buggy code:
def input():
  return sys.stdin.readline()[:-1]

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  divisors.sort(reverse=True)
  return divisors

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

sumA = sum(A)
kouho = make_divisors(sumA)

for i in kouho:
  if sumA%i != 0:
    continue
  r = [0]*N
  for j in range(N):
    r[j] = A[j]%i
  sumr = sum(r)
  if sumr%i != 0:
    continue
  r.sort(reverse=True)
  num = 0
  for k in range(sumr//i):
    num += i-r[k]
  if num <= K:
    print(i)
    exit()

Fixed code:
import sys

def input():
  return sys.stdin.readline()[:-1]

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  divisors.sort(reverse=True)
  return divisors

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

sumA = sum(A)
kouho = make_divisors(sumA)

for i in kouho:
  if sumA%i != 0:
    continue
  r = [0]*N
  for j in range(N):
    r[j] = A[j]%i
  sumr = sum(r)
  if sumr%i != 0:
    continue
  r.sort(reverse=True)
  num = 0
  for k in range(sumr//i):
    num += i-r[k]
  if num <= K:
    print(i)
    exit()
Buggy code:
N,K=map(int,input().split())
AL=list(map(int,input().split()))
summ=0
for i in range(N):
  summ+=AL[i]
candidate=set()
for i in range(1,int(summ**0.5)+1):
  if summ%i==0:
    candidate.add(i)
    candidate.add(summ/i)
ans=0
for x in candidate:
  need=0
  r=[0]*N
  for i in range(N):
    r[i]=AL[i]%x
  sorted(r)
  rsum=0
  lsum=0
  for i in range(N):
    rsum=rsum+r[i]
  rindex=int(rsum/x)
  lindex=N-int(rsum/x)
  for i in range(0,lindex):
    need+=r[i]
  if need<=K:
    ans=max(ans,x)
print(int(ans))

Fixed code:
N,K=map(int,input().split())
AL=list(map(int,input().split()))
summ=0
for i in range(N):
  summ+=AL[i]
candidate=set()
for i in range(1,int(summ**0.5)+1):
  if summ%i==0:
    candidate.add(i)
    candidate.add(summ/i)
ans=0
for x in candidate:
  need=0
  r=[0]*N
  for i in range(N):
    r[i]=AL[i]%x
  r.sort()
  rsum=0
  for i in range(N):
    rsum=rsum+r[i]
  rindex=int(rsum/x)
  lindex=N-int(rsum/x)
  for i in range(lindex):
    need+=r[i]
  if need<=K:
    ans=max(ans,x)
print(int(ans))
Buggy code:
import math

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

candidates = []
sumA = sum(A)

i = 1
while i <= math.sqrt(sum(A)):
    if sumA % i == 0:
        candidates.append(i)
        candidates.append(int(sumA / i))
    i += 1
    
candidates = sorted(candidates, reverse = True)
end = 0
# candidates loop
for i in range(len(candidates)):
    if end:
        break
    # A loop
    for j in range(len(A)):
        A[j] %= candidates[i]
    left = sum(A)
    right = 0
    need = max(left, right)
    for l in range(len(A) - 1, -1, -1):
        left -= A[l]
        right += candidates[i] - A[l]
        need = min(need, max(left, right))
    if need <= K:
        print(candidates[i])
        end = 1

Fixed code:
import math

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

candidates = []
sumA = sum(A)

i = 1
while i <= math.sqrt(sumA):
    if sumA % i == 0:
        candidates.append(i)
        candidates.append(int(sumA / i))
    i += 1
    
candidates = sorted(candidates, reverse = True)
end = 0
# candidates loop
for i in range(len(candidates)):
    if end:
        break
    # A loop
    T = [0] * len(A)
    for j in range(len(A)):
        T[j] = A[j] % candidates[i]
    T = sorted(T)
    left = sum(T)
    right = 0
    need = max(left, right)
    for l in range(len(T) - 1, -1, -1):
        left -= T[l]
        right += candidates[i] - T[l]
        need = min(need, max(left, right))
    if need <= K:
        print(candidates[i])
        end = 1
Buggy code:
import sys
# input = sys.stdin.readline

def main():
  n, k = map(int, input().split())
  alist = list(map(int, input().split()))
  suma = sum(alist)
  i = 1
  yaku = []
  while i*i<=suma:
    if suma % i == 0:
      yaku.append(i)
      if suma//i != i:
        yaku.append(suma//i)
    i += 1

  for d in sorted(yaku, key=lambda x: -x):
    rem = [a%d for a in alist]
    rem = list(sorted(rem))
    sumr = sum(rem)
    kc = 0
    for _r in rem:
      kc += _r
      sumr -= d-_r
      if max(kc, sumr) < k:
        print(d)
        sys.exit(0)


if __name__ == '__main__':
  main()


Fixed code:
import sys
# input = sys.stdin.readline

def main():
  n, k = map(int, input().split())
  alist = list(map(int, input().split()))
  suma = sum(alist)
  i = 1
  yaku = []
  while i*i<=suma:
    if suma % i == 0:
      yaku.append(i)
      if suma//i != i:
        yaku.append(suma//i)
    i += 1

  for d in sorted(yaku, key=lambda x: -x):
    rem = [a%d for a in alist]
    rem = list(sorted(rem))
    sumr = d*len(rem) - sum(rem)
    kc = 0
    for _r in rem:
      kc += _r
      sumr = sumr - (d-_r)
      if max(kc, sumr) <= k:
        print(d)
        sys.exit(0)


if __name__ == '__main__':
  main()
Buggy code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

sumA = sum(A)
divisors = []
for i in range(1, sumA + 1):
    if i * i > sumA:
        break
    if sumA % i != 0:
        continue
    divisors.append(i)
    if sumA // i != i:
        divisors.append(sumA // i)

divisors.sort(reverse=True)

ans = 0
for d in divisors:
    costs = [a % d for a in A]
    costs.sort()
    plus = sum(costs)
    minus = 0
    for j in range(N):
        if plus == minus:
            break
        else:
            plus -= costs[j]
            minus += d - costs[j]

    if plus <= K:
        print(d)
        break


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

sumA = sum(A)
divisors = []
for i in range(1, sumA + 1):
    if i * i > sumA:
        break
    if sumA % i != 0:
        continue
    divisors.append(i)
    if sumA // i != i:
        divisors.append(sumA // i)

divisors.sort(reverse=True)

ans = 0
for d in divisors:
    costs = [a % d for a in A]
    costs.sort()
    if sum(costs[:N - sum(costs) // d]) <= K:
        print(d)
        break
Buggy code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N,K = map(int,input().split())
A = list(map(int,input().split()))
D = sum(A)
D = make_divisors(D)[::-1]

for d in D:
    a = []
    for i in range(N):
        a.append(A[i]%d)
    k = 0
    M = max(a)
    while k <= K and M != 0:
        i = 0
        j = 0
        m = d
        M = 0
        for l in range(N):
            if 0 < a[l] < m:
                m = a[l]
                i = l
        for l in range(N-1,-1,-1)
            if a[l] > M:
                M = a[l]
                j = l
        if m == d:
            break
        if m <= d-M:
            a[i] = 0
            a[j] += m
            a[j] %= d
            k += m
        else:
            a[i] -= d-M
            a[i] %= d
            a[j] = 0
            k += d-M
    if k <= K:
        break

print(d)

Fixed code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N,K = map(int,input().split())
A = list(map(int,input().split()))
D = sum(A)
D = make_divisors(D)[::-1]

for d in D:
    a = []
    for i in range(N):
        a.append(A[i]%d)
    k = 0
    M = max(a)
    while k <= K and M != 0:
        i = 0
        j = 0
        m = d
        M = 0
        for l in range(N):
            if 0 < a[l] < m:
                m = a[l]
                i = l
        for l in range(N-1,-1,-1):
            if a[l] > M:
                M = a[l]
                j = l
        if m == d:
            break
        if m <= d-M:
            a[i] = 0
            a[j] += m
            a[j] %= d
            k += m
        else:
            a[i] -= d-M
            a[i] %= d
            a[j] = 0
            k += d-M
    if k <= K:
        break

print(d)
Buggy code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

nums = A[:]

sum_n = sum(nums)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

divisors = sorted(list(make_divisors(sum_n)), reverse=True)
#print('DIV', divisors)


for d in divisors:
    mod_nums = list(map(lambda x: x%d, nums[:]))
    mod_nums = sorted(mod_nums)
    #print(mod_nums)
    x = 10**10
    for i in range(1, len(mod_nums)-1):
        if sum(mod_nums[:i]) == sum(list(map(lambda x: d-x, mod_nums[i:]))):
            x = sum(mod_nums[:i])
            break
    #print(d, x)
    if x <= K:
        ans = d
        break
            
        
        



print(ans)

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

nums = A[:]

sum_n = sum(nums)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

divisors = sorted(list(make_divisors(sum_n)), reverse=True)
#print('DIV', divisors)


for d in divisors:
    mod_nums = list(map(lambda x: x%d, nums[:]))
    mod_nums = sorted(mod_nums)
    #print(mod_nums)
    x = 10**10
    for i in range(0, len(mod_nums)+1):
        if sum(mod_nums[:i]) == sum(list(map(lambda x: d-x, mod_nums[i:]))):
            x = sum(mod_nums[:i])
            break
    #print(d, x)
    if x <= K:
        ans = d
        break
            
print(ans)
Buggy code:
from math import sqrt
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
div = []
for i in range(1, int(sqrt(s)+1)):
	if s%i == 0:
		if i*i != s:
			div.append(s//i)
		div.append(i)
div.sort(reverse=True)
#print(div)

for d in div:
	b = [x for x in a if x%d != 0]
	if not b:
		print(d)
		break
	b.sort(key=lambda x: x%d)
	y, z = 0, d*len(b)-sum(b)
	res = 10**30
	for x in b:
		y += x
		z -= d-x
		res = min(res, max(y, z))
	if res <= k:
		print(d)
		break

Fixed code:
from math import sqrt
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
div = []
for i in range(1, int(sqrt(s)+1)):
	if s%i == 0:
		if i*i != s:
			div.append(s//i)
		div.append(i)
div.sort(reverse=True)
#print(div)

for d in div:
	b = [x%d for x in a if x%d != 0]
	if not b:
		print(d)
		break
	b.sort(key=lambda x: x%d)
	y, z = 0, d*len(b)-sum(b)
	res = 10**30
	for x in b:
		y += x
		z -= d-x
		res = min(res, max(y, z))
	if res <= k:
		print(d)
		break
Buggy code:
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter, deque
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
#input = sys.stdin.readline
from collections import Counter
def inpl(): return list(map(int, input().split()))

N, K = inpl()
A = inpl()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

D = sorted(make_divisors(sum(A)))

ans = 1
g0 = itemgetter(0)

for d in D:
    x = 0
    X = []
    for i in range(N):
        X.append(A[i]%d)

    X = sorted(X)
    l = 0
    r = N-1
    while l < N and X[l] == 0:
        l += 1
    while l < N and (not (X[l] == 0 or X[l] == d)):
        m = min(X[l], d - X[r])
        x += m
        X[l] -= m
        X[r] += m
        if X[l] == 0:
            l += 1
        if X[r] == d:
            r -= 1
    if d <= K:
        ans = max(ans, d)

print(ans)

Fixed code:
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter, deque
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
#input = sys.stdin.readline
from collections import Counter
def inpl(): return list(map(int, input().split()))

N, K = inpl()
A = inpl()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

D = sorted(make_divisors(sum(A)))

ans = 1
g0 = itemgetter(0)

for d in D:
    x = 0
    X = []
    for i in range(N):
        X.append(A[i]%d)

    X = sorted(X)
    l = 0
    r = N-1
    while l < N and X[l] == 0:
        l += 1
    while l < N and (not (X[l] == 0 or X[l] == d)):
        m = min(X[l], d - X[r])
        x += m
        X[l] -= m
        X[r] += m
        if X[l] == 0:
            l += 1
        if X[r] == d:
            r -= 1
    if x <= K:
        ans = max(ans, d)

print(ans)
Buggy code:
import sys
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
l = []

def check(b) :
    r1 = [x % b for x in a]
    r1.sort()
    s1 = sum(r1)
    
    mn = 1e9
    s2 = 0
    for i in range(n):
        s2 += r1[i]
        mn = min(max(s2, (n-1-i)*b - (s1-s2)), mn)
        
    if mn <= k :
        print(int(b))
        sys.exit(0)
        

for p in range(1,int((s+1)**0.5+1)) :
    if s % p != 0:
        continue
    b = s // p
    l.append(p)
    l.append(b)
l.reverse()

for b in l:
    check(b)
        
    


Fixed code:
# E

import sys

n, k = map(int, input().split())

a = list(map(int, input().split()))

s = sum(a)

l = []

def check(b) :
    r1 = [x % b for x in a]
    r1.sort()
    s1 = sum(r1)
    
    mn = 1e9
    s2 = 0
    for i in range(n):
        s2 += r1[i]
        mn = min(max(s2, (n-1-i)*b - (s1-s2)), mn)
        
    if mn <= k :
        print(int(b))
        sys.exit(0)
        

for p in range(1,int((s+1)**0.5+1)) :
    if s % p != 0:
        continue
    b = s // p
    l.append(b)
    check(b)
    
l.reverse()

for p in l:
    b = s // p
    check(b)
Buggy code:
A,B = [int(n) for n in input().split()]
print((A+B)/2 if (A+B)/2%2==0 else "IMPOSSIBLE")

Fixed code:
A, B = [int(n) for n in input().split()]
print('IMPOSSIBLE' if (A+B)%2 else (A+B)//2)
Buggy code:
a,b = map(int, input().split())
if a % 2 == b % 2:
  print((a + b // 2))
else:
  print('IMPOSSIBLE')

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

if (a+b)%2 == 0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')
Buggy code:
A, B = map(int, input().split())

if (B - A) % 2 == 0:
    print((B-A)//2)
else:
    print("IMPOSSIBLE")


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

if (B - A) % 2 == 0:
    print(A + (B-A)//2)
else:
    print("IMPOSSIBLE")
Buggy code:
a,b = map(int,input().split())
if (b-a)%2==0:
    print((b-(b-a)/2))
else:
    print("IMPOSSIBLE")

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

if a == b:
    print(0)
elif (b-a) % 2 == 0:
    print((b+a)//2)
else:
    print('IMPOSSIBLE')
Buggy code:
import math 
a,b=(int(x) for x in input().split())
print(a)
print(b)
if(a%2 != b%2):
    print("IMPOSSIBLE")
else:
    k=int (a+b)/2
    print(math.floor(k))

Fixed code:
import math 
a,b=(int(x) for x in input().split())
if(a%2 != b%2):
    print("IMPOSSIBLE")
else:
    k=int (a+b)/2
    print(math.floor(k))
Buggy code:
def main():
    import sys
    input = sys.stdin.readline

    AB = input().split(" ")
    A = int(AB[0])
    B = int(AB[1])
    if (A + B) % 2 == 1:
        res = 'IMPOSSIBLE'
    elif:
        res = int((A + B) / 2)
    print(res)

if __name__ == '__main__':
    main()

Fixed code:
def main():
    import sys
    input = sys.stdin.readline

    AB = input().split(" ")
    A = int(AB[0])
    B = int(AB[1])
    if (A + B) % 2 == 1:
        res = 'IMPOSSIBLE'
    else:
        res = int((A + B) / 2)
    print(res)

if __name__ == '__main__':
    main()
Buggy code:
a, b = map(int, input().split())

if a+b % 2 == 0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
  

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

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

k = a + b

if k % 2 == 0:
    print(int(k / 2))

else:
    print('IMPOSSIBLE')
Buggy code:
t = sum(map(int, input())
if t % 2 == 0:
    print(t//2)
else:
    print("IMPOSSIBLE")

Fixed code:
t = sum(map(int, input().split()))
if t % 2 == 0:
        print(t//2)
else:
        print("IMPOSSIBLE")
Buggy code:
a, b = map(int, input().split())

if a == b or ((a + b) % 2) == 1:
    print('IMPOSSIBLE')

else:
    print((a + b) / 2)


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

if ((a + b) % 2) == 1:
    print('IMPOSSIBLE')

else:
    print((a + b) // 2)
Buggy code:
A,B = map(int , input().split())

if (A + B % 2 == 0):
  print( A + B / 2 )
else:
  print("IMPOSSIBLE")
  

Fixed code:
A, B = map(int , input().split())
 
if ( (A + B) % 2 == 0 ):
  K = int((A+B)/2)
  print(K)
else:
  print("IMPOSSIBLE")
Buggy code:
a, b = map(int, input("").split())
c = (a + b) / 2
print(c if c.is_integer() else "IMPOSSIBLE")

Fixed code:
a, b = map(int, input("").split())
c = (a + b) / 2
print(int(c) if c.is_integer() else "IMPOSSIBLE")
Buggy code:
a, b = map(int, input().split())

if ((a + b) % 2) == 1:
    print('IMPOSSIBLE')

else:
    print((a + b) / 2)

Fixed code:
a, b = map(int, input().split())
if (a+b)%2 == 0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")
Buggy code:
import sys
import math
import bisect

def main():
    a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        k = abs(a - b) // 2
        print(k)
    else:
        print('IMPOSSIBLE')
    
if __name__ == "__main__":
    main()


Fixed code:
import sys
import math
import bisect

def main():
    a, b = map(int, input().split())
    if abs(a - b) % 2 == 0:
        k = (a + b) // 2
        print(k)
    else:
        print('IMPOSSIBLE')
    
if __name__ == "__main__":
    main()
Buggy code:
a,b = map(int, input().split())
if (a+b)%2==0:
  print((a+b)%2)
else:
  print("IMPOSSIBLE")

Fixed code:
a,b = map(int, input().split())
if a == b:
  print(0)
elif (a+b)%2==0:
  print(int((a+b)/2))
else:
  print("IMPOSSIBLE")
Buggy code:
a,b=map(int,input().split())
if (a+b)%2==1:
    print('IMPOSSIBLE')
else:
    print((a+b)/2)

Fixed code:
a,b=map(int,input().split())
if (a+b)%2==1:
    print('IMPOSSIBLE')
else:
    print((a+b)//2)
Buggy code:
a,b=map(int,input());print('IMPOSSIBLE' if (b-a)%2!=0 else int((a+b)/2))

Fixed code:
a,b=map(int,input().split());print('IMPOSSIBLE' if (b-a)%2!=0 else int((a+b)/2))
Buggy code:
a,b = (int(x) for x in input().split())


if (a-b)%2 == 1:
  print("IMPOSSIBLE")

else:
  print((a+b)/2)


Fixed code:
a,b = (int(x) for x in input().split())


if (a-b)%2 == 1:
  print("IMPOSSIBLE")

else:
  print(int((a+b)/2))
Buggy code:
a,b=map(int,input().split())
if a+b%2==0:
  print((a+b)/2)
else:
  print('IMPOSSIBLE')

Fixed code:
a,b=map(int,input().split())
ans='IMPOSSIBLE'
if (a+b)%2==0:print((a+b)//2)
else:print(ans)
Buggy code:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 = 0:
  print( (a + b) / 2 )
else:
  print('IMPOSSIBLE')


Fixed code:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 == 0:
  print( int((a + b) / 2 ))
else:
  print('IMPOSSIBLE')
Buggy code:
import sys

n1, n2 = [int(i) for i in input().split()]

if (n1 % 2) != (n2 % 2):
    sys.exit("IMPOSSIBLE")

r1 = int((n1 + n2) / 2)
print(r1)

Fixed code:
import sys

n1, n2 = [int(i) for i in input().split()]

if (n1 % 2) != (n2 % 2):
    print("IMPOSSIBLE")
    sys.exit()

r1 = int((n1 + n2) / 2)
print(r1)
Buggy code:
A,B=map(int,input().split())
if A+B % 2 !=0:
    print("IMPOSSIBLE")
else:print((A+B)//2)

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

if (A+B)%2==0:
  print(int((A+B)/2))
else:
  print("IMPOSSIBLE")
Buggy code:
A,B = map(int,input().split())
C = (A+B)/2
if C.is_integer() == True:
  print(C)
else:
  print("IMPOSSIBLE")

Fixed code:
A,B = map(int,input().split())
C = (A+B)/2
if C.is_integer() == True:
  print(int(C))
else:
  print("IMPOSSIBLE")
Buggy code:
a,b = map(int,input().split())
if (a-b)%2 == 0:
    print((a+b)/2)
else:
    print("IMPOSSIBLE")

Fixed code:
a,b = map(int,input().split())
if (a-b)%2 == 0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")
Buggy code:
p,q = input().split()
a,b = (int(p),int(q))
if a == b:
    print('IMPOSSIBLE')
elif (a+b) % 2 == 0:
    print((a+b)/2)
else:
    print('IMPOSSIBLE')
    

Fixed code:
p,q = input().split()
a,b = (int(p),int(q))
if a == b:
    print('IMPOSSIBLE')
elif (a+b) % 2 == 0:
    print(int((a+b)/2))
else:
    print('IMPOSSIBLE')
Buggy code:
A,B= map(int, input().split())
print((A+B)/2 if (A+B)%2==0 else 'IMPOSSIBLE')

Fixed code:
A,B= map(int, input().split())
print((A+B)//2 if (A+B)%2==0 else 'IMPOSSIBLE')
Buggy code:
c,d = map(int,input().split())

if (c+d)%2 == 0:
    print(c+d)//2
else:
    print('IMPOSSIBLE')

Fixed code:
c,d = map(int,input().split())

if (c+d)%2 == 0:
    print((c+d)//2)
else:
    print('IMPOSSIBLE')
Buggy code:
A , B = (int(x) for x in input().split())
k = (B + A) / 2
K = (B + A) % 2
if K == 0:
    print(k)
else:
    print("IMPOSSIBLE")

Fixed code:
A , B = (int(x) for x in input().split())
k = (B + A) / 2
K = (B + A) % 2
if K == 0:
    print(int(k))
else:
    print("IMPOSSIBLE")