qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#!/usr/bin/env python3

n, m = list(map(int, input().split()))

ans = 1
num = int(m**0.5)+1

for i in range(1, num):
    if m % i != 0:
        continue
    j = m//i
    if i >= n:
        ans = max(ans, j)
    # if j >= n:
    #     ans = max(ans, i)
print(ans)


Fixed code:
#!/usr/bin/env python3

n, m = list(map(int, input().split()))

ans = 1
num = int(m**0.5)+1

for i in range(1, num):
    if m % i != 0:
        continue
    j = m//i
    if i >= n:
        ans = max(ans, j)
    if j >= n:
        ans = max(ans, i)
print(ans)
Buggy code:
n,m=map(int,input().split())
ans=1
for i in range(1,m**0.5+1):
  if m%i==0:
    if i>=n:
      ans=max(ans,m//i)
    elif m//i>=n:
      ans=max(ans,i)
print(ans)

Fixed code:
n,m=map(int,input().split())
ans=1
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    if i>=n:
      ans=max(ans,m//i)
    elif m//i>=n:
      ans=max(ans,i)
print(ans)
Buggy code:
from math import sqrt
from numba import njit
@njit
def divisors(n):
    divisors = []
    for i in range(1, int(sqrt(n))+1):
        q, r = divmod(n, i)
        if r == 0:
            divisors.append(i)
            if i != q:
                divisors.append(q)
    divisors.sort()
    return divisors

n, m = map(int, input().split())
ans = 1
for a in divisors(m)[1:-1]:
    if a*n <= m:
        ans = a
print(ans)

Fixed code:
from math import sqrt
def divisors(n):
    divisors = []
    for i in range(1, int(sqrt(n))+1):
        q, r = divmod(n, i)
        if r == 0:
            divisors.append(i)
            if i != q:
                divisors.append(q)
    divisors.sort()
    return divisors

n, m = map(int, input().split())
ans = 1
for a in divisors(m)[1:]:
    if a*n <= m:
        ans = a
print(ans)
Buggy code:
def make_divisors(n):
    lower_divisors,upper_divisors=[],[]
    i=1
    while i*i<=n:
        if n%i=0:
            lower_divisors.append(i)
            if i!=n//i:
                upper_divisors.append(n//i)
        i+=1
    return lower_divisors+upper_divisors[::-1]
n,m=map(int,input().split())
array=make_divisors(m)
array.reverse()
for ele in array:
    if m//ele>=n:
        print(ele)
        exit()
        

Fixed code:
def make_divisors(n):
    lower_divisors,upper_divisors=[],[]
    i=1
    while i*i<=n:
        if n%i==0:
            lower_divisors.append(i)
            if i!=n//i:
                upper_divisors.append(n//i)
        i+=1
    return lower_divisors+upper_divisors[::-1]
n,m=map(int,input().split())
array=make_divisors(m)
array.reverse()
for ele in array:
    if m//ele>=n:
        print(ele)
        exit()
Buggy code:
import math
n,k = map(int,input().split())
m =1
for i in range(1,k//2+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)

Fixed code:
n,k = map(int,input().split())
m =1
for i in range(k//n+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)
Buggy code:
n, m = (list)(map(int, input().split()))

upper = m//n
ans = 0
for i in reversed(range(1, upper+1)):
    if m % i == 0:
        ans = i
        if (m // i) > i and (m // i) <= upper:
            ans = m // i
            break

print(ans)


Fixed code:
n, m = (list)(map(int, input().split()))

upper = m//n
ans = 0
for i in range(1, upper+1):
    if m % i == 0:
        ans = i
        if (m // i) > i and (m // i) <= upper:
            ans = m // i
            break

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

N, M = map(int, input().split())
print(max([x for x in make_divisors(M) if x <= N]))

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, M = map(int, input().split())
print(max([x for x in make_divisors(M) if x <= M // N]))
Buggy code:
n, m = map(int, input().split())
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
div = make_divisors(n)
for i in div[::-1]:
    if i <= m / n:
        print(i)
        break

Fixed code:
n, m = map(int, input().split())
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
div = make_divisors(m)
for i in div[::-1]:
    if i <= m / n:
        print(i)
        break
Buggy code:
n,m=map(int,input().split())

num=m//n
ans=1
for i in range(int(m**0.5),2,-1):
    if m%i==0:
        Num=m//i
        if Num <= num and ans < Num:
            ans = Num

    if i<=num and ans<i:
        ans=i

print(ans)

Fixed code:
n,m=map(int,input().split())

num=m//n
ans=1
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        Num=m//i
        if Num <= num and ans < Num:
            ans = Num

        if i<=num and ans<i:
            ans=i
print(ans)
Buggy code:
from math import sqrt

N, M = map(int, input().split())
sqrtm = int(sqrt(M) + 1)
D = set()
for i in range(1, sqrtm):
    if M % i == 0:
        D.add(i)
        D.add(M // i)
ans = 0
for d in D:
    if d * N <= M:
        ans = d
print(ans)


Fixed code:
from math import sqrt

N, M = map(int, input().split())
sqrtm = int(sqrt(M) + 1)
D = set()
for i in range(1, sqrtm):
    if M % i == 0:
        D.add(i)
        D.add(M // i)
D = sorted(list(D))
ans = 0
for d in D:
    if d * N <= M:
        ans = d
print(ans)
Buggy code:
n, m = map(int, input().split())


def divisor(num):
    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


ans = 0
for i in divisor(m):
    if n <= m // i:
        ans = i
    else:
        break
print(ans)

Fixed code:
n, m = map(int, input().split())


def divisor(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


ans = 0
for i in divisor(m):
    if n <= m // i:
        ans = i
    else:
        break
print(ans)
Buggy code:
N, M = map(int, input().split())

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

for i in make_divisors(M):
    if i < M // N:
        ans = i 
print(ans)

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

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

for i in make_divisors(M):
    if i <= M // N:
        ans = i 

print(ans)
Buggy code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())

ans = 0
div1,div2 = [],[]
for m in range(1,int(M**.5)+1):
    if M%m == 0:
        div1.append(m)

for d in div1:
    if M%d == 0:
        div2.append(M//d)

for d in div1+div2:
    if d < M//N:
        ans = d

print(ans)

Fixed code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())

ans = 0
div1,div2 = [],[]
for m in range(1,int(M**.5)+1):
    if M%m == 0:
        div1.append(m)

for d in div1:
    if M%d == 0:
        div2.append(M//d)

div3 = div1+div2
div3.sort()
for d in div3:
    if d <= M//N:
        ans = d

print(ans)
Buggy code:
N, M = map(int, input().split())

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

divisors = make_divisors(M)
divisors.sort()

for idx, a in enumerate(divisors):
    # print(a)
    if M / a >= N:
        continue
    else:
        if idx-1 < 0:
            print(1)
        else:
            print(divisors[idx-1])
        break
print(divisors[-1])

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

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

divisors = make_divisors(M)
divisors.sort()

for idx, a in enumerate(divisors):
    # print(a)
    if M / a >= N:
        continue
    else:
        if idx-1 < 0:
            print(1)
            exit()
        else:
            print(divisors[idx-1])
            exit()
        break
       
print(divisors[-1])
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 , M = map(int,input().split())
divisors_list = make_divisors(M)
divisors_list.sort(reverse=True)
print(divisors_list)
for val in divisors_list:
    if val * N <= M:
        break
print(val)

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 , M = map(int,input().split())
divisors_list = make_divisors(M)
divisors_list.sort(reverse=True)
#print(divisors_list)
for val in divisors_list:
    if val * N <= M:
        break
print(val)
Buggy code:
n,m=map(int,input().split())

limit=int(m**(1/2))+1

divisors=[]
for d in range(limit):
    if m%d==0:
        divisors.append(d)
        divisors.append(m//d)
ans=1

for d in divisors:
    if n*d<=m:
        ans=d
print(ans)


Fixed code:
n,m=map(int,input().split())

limit=int(m**(1/2))+1

divisors=[]
for d in range(1,limit):
    if m%d==0:
        divisors.append(d)
        divisors.append(m//d)

divisors.sort()
ans=1

for d in divisors:
    if n*d<=m:
        ans=d
print(ans)
Buggy code:
def calc()
N,M = map(int,input().split())
for gcd in range(M // N,0,-1):
 if M % gcd == 0:
  return(gcd)

print(calc())

Fixed code:
def calc():
 N,M = map(int,input().split())
 for gcd in range(M // N,0,-1):
  if M % gcd == 0:
   break
 return(gcd)
print(calc())
Buggy code:
import math
N, M = map(int, input().split())

ans = 1
if(N < M//N):
  i = N
  while(ans == 1 and i <= math.sqrt(M)):
    if(M % i == 0):
      ans = M//i
    i += 1
else:
  i = M//N
  while(ans == 1 and i >= 1):
    if(M % i == 0):
      ans = i
    i -= 1
  
print(ans)

Fixed code:
import math
N, M = map(int, input().split())

ans = 1
if(N < M//N):
  i = N
  while(ans == 1 and i <= math.sqrt(M)):
    if(M % i == 0):
      ans = M//i
    i += 1
if(N >= M//N or ans == 1):
  i = M//N
  while(ans == 1 and i >= 1):
    if(M % i == 0):
      ans = i
    i -= 1
  
print(ans)
Buggy code:
n, m = map(int, input().split())

ans = 1
for i in range(1, int(m**0.5)+2):
  if i * n <= m:
    ans = max(ans, i)
  if (m // i) * n <= m:
    ans = max(ans, m//i)
    
print(ans)

Fixed code:
n, m = map(int, input().split())

ans = 1
for i in range(1, int(m**0.5)+2):
  if m % i == 0:
    if i * n <= m:
      ans = max(ans, i)
    if (m // i) * n <= m:
      ans = max(ans, m//i)
    
print(ans)
Buggy code:
N, M = map(int, input().split())
d = []
for i in range(M, int(M**0.5)+1,-1):
	if M%i == 0:
		d.append(i)
		d.append(M/i)
d.sort(reverse=True)
for i in range(len(d)):
	if d[i] <= M/N:
		print(d[i])
		exit()


Fixed code:
N, M = map(int, input().split())
d = []
for i in range(1, int(M**0.5)+1):
	if M%i == 0:
		d.append(i)
		d.append(M//i)
d.sort()
for i in range(1,len(d)+1):
	if d[-i] <= M//N:
		print(d[-i])
		exit()
Buggy code:
import math

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

x=0

s = []
for i in range(math.sqrt(m))
	if m%i==0:
		s.append(i)



for i in s
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)





Fixed code:
import math

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

x=0

s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		s.append(i+1)
		s.append(m//(i+1))




for i in s:
	if m%(i)==0 and m//(i)>n-1:
		x=max(x,i)
print(x)
Buggy code:
import math
N, M = list(map(int, input().split()))
if N == 1:
  print(M)
  exit()
X = int(math.sqrt(M))+1
for i in range(N, X):
  if M % i == 0:
      print(int(M/i))
      exit()
print(1)

Fixed code:
import math
N, M = list(map(int, input().split()))
if N == 1:
  print(M)
  exit()
X = int(math.sqrt(M))+1
for i in range(N, X):
  if M % i == 0:
      print(int(M/i))
      exit()
X = int(M / N)
for i in range(X, 0, -1):
  if M % i == 0:
      print(i)
      exit()
print(1)
Buggy code:
import math
import sys
MOD = 1000000007

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

if n == 1:
    print(m)
    sys.exit()

ans = 1
for i in range(1, int(math.sqrt(m))+1):
    if m % i == 0:
        j = m / i
    if i < m/n:
        ans = max(ans, i)
    if j < m/n:
        ans = max(ans, j)

print(int(ans))


Fixed code:
import math
import sys
MOD = 1000000007

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

if n == 1:
    print(m)
    sys.exit()

ans = 1
for i in range(1, int(math.sqrt(m))+1):
    if m % i == 0:
        j = m / i
        if i <= m/n:
            ans = max(ans, i)
        if j <= m/n:
            ans = max(ans, j)

print(int(ans))
Buggy code:
import sys
N,M=map(int,input().split())
i=N
if(i%2==1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    M+=1
if(M%i==0):
    print(M//i)
    sys.exit(0)
M+=1
    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

Fixed code:
import sys
N,M=map(int,input().split())
i=N


gcd=1
while(1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    if(i**2 >M):
        break
    i+=1

i=M//N
while(1):
    if(M%i==0):
        print(i)
        sys.exit(0)
    i-=1
Buggy code:
N,M = map(int, input().split())
L = []
 
for i in range(1,(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))

Fixed code:
N,M = map(int, input().split())
L = []
 
for i in range(1,int(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))
Buggy code:
¥import math
a = list(map(int,input().split()))
b = a[1]//a[0]
c = []
for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1]%i==0 and i<=b:
        if a[1] // i <= b:
            c.append(a[1]//i)
        else:
            c.append(i)
c.sort(reverse=True)
print(c[0])

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

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])
Buggy code:
n,m=map(int,input().split())

yakusuu=[]
import math
for i in range(1,int(math.sqrt(m)+1)):
  if m%i==0:
    yakusuu.append(i)
    yakusuu.append(m//i)
yakusuu.sort()
for num in yakusuu:
  if num>=n:
    print(num)
    exit()
    
    

Fixed code:
n,m=map(int,input().split())

yakusuu=[]
import math
for i in range(1,int(math.sqrt(m)+1)):
  if m%i==0:
    yakusuu.append(i)
    yakusuu.append(m//i)
yakusuu.sort()
for num in yakusuu:
  if num>=n:
    print(m//num)
    exit()
Buggy code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      x=m-i*n
      if x%i==0:
        ans=max(ans,i+x//i)

  return ans

# main()
print(main())


Fixed code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      ans=max(ans,i)
      x=m//i
      if x*n>m:
        continue
      ans=max(ans,x)

  return ans

# main()
print(main())
Buggy code:
n,m=map(int,input().split())
d=[]
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i,m//i)
d.sort(reverse=True)
for i in d:
  if i*n<=m:
    print(i)
    exit()

Fixed code:
n,m=map(int,input().split())
d=[]
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i)
    d.append(m//i)
d.sort(reverse=True)
for i in d:
  if i*n<=m:
    print(i)
    exit()
Buggy code:
n, m = map(int, input().split())
a = m // n
ans = 0

for i in range(1, a + 1):
    if m % i == 0:
      if (m // i) > i and (m // i) <= a:
            ans = m // i
            break
        
print(ans)

Fixed code:
n, m = map(int, input().split())
a = m // n
ans = 0

for i in range(1, a + 1):
    if m % i == 0:
        ans = i
        
        if (m // i) > i and (m // i) <= a:
            ans = m // i
            break
        
print(ans)
Buggy code:
import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r

def factorize(n):
    res = []
    for i in range(1, floor(sqrt(n)) + 1):
        if not n % i:
            res.append(i, n // i)
    return sorted(res)

n, m = map(int, sys.stdin.readline().split())


def main():
    res = factorize(m)
    ans = res[bi_r(res, m / n) - 1]
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

Fixed code:
import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r

def factorize(n):
    res = []
    for i in range(1, floor(sqrt(n)) + 1):
        if not n % i:
            res.append(i)
            res.append(n // i)
    return sorted(res)

n, m = map(int, sys.stdin.readline().split())

def main():
    res = factorize(m)
    ans = res[bi_r(res, m / n) - 1]
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)
Buggy code:
N,M=map(int,input().split())
d=[]
for i in range(1,int(M**0.5+1)):
  if M%i == 0:
    d.extend(i,M//i)
d=list(set(d)).sort()
for x in d:
  if x>=N:
    print(M//x)
    break


Fixed code:
N,M=map(int,input().split())
d=[]
for i in range(1,int(M**0.5+1)):
  if M%i == 0:
    d. append(i)
    d.append(M//i)
dd=list(set(d))
dd.sort()
for x in dd:
  if x>=N:
    print(M//x)
    break
Buggy code:
import math
N, M = map(int, input().split())
tmp = [1]
if N == 1:
    print(M)
else:
    for i in range(2, math.ceil(M**0.5)):
        if M % i == 0:
            tmp.append(i)
            tmp.apend(M/i)
    ans = 1
    for x in tmp:
        if m / x >= N:
            ans = max(ans, x)
    print(ans)


Fixed code:
import math
N, M = map(int, input().split())
tmp = [1]
if N == 1:
    print(M)
else:
    for i in range(2, int(math.ceil(M**0.5))):
        if M % i == 0:
            tmp.append(i)
            tmp.append(int(M/i))
    ans = 1
    for x in tmp:
        if M / x >= N:
            ans = max(ans, x)
    print(ans)
Buggy code:
def divisore(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,m=map(int,input().split())
l=divisore(m)
print(l)
for i in l:
 if m/n>=i:
  print(i)
  exit()

Fixed code:
def divisore(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,m=map(int,input().split())
l=divisore(m)
for i in l:
 if m//n>=i:
  print(i)
  exit()
Buggy code:
N,M = map(int,input().split())
k = 1
for i in range(1,int(M**0.5)+1):
    if M%i==0:
        a = i
        b = M//i
        k1 = 1
        k2 = 1
        if b>=N-1:
            k1 = a
        if a>=N-1:
            k2 = b
        k = max(k,k1,k2)
print(k)

Fixed code:
N,M = map(int,input().split())
k = 1
for i in range(1,int(M**0.5)+1):
    if M%i==0:
        a = i
        b = M//i
        k1 = 1
        k2 = 1
        if b>=N:
            k1 = a
        if a>=N:
            k2 = b
        k = max(k,k1,k2)
print(k)
Buggy code:
n,m=map(int, input().split())
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
ans = 1
for i in make_divisors:
    if i>=n:
        ans=max(ans,m//i)
print(ans)

Fixed code:
n,m=map(int, input().split())
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
ans = 1
for i in make_divisors(m):
    if i>=n:
        ans=max(ans,m//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
                
N,M = map(int, input().split())
ans = 1
DIV = make_divisors(N)
print(DIV)

for i in DIV:
    if M - i*N >= 0:
        ans = i
print(ans)

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,M = map(int, input().split())
ans = 1
DIV = make_divisors(M)
#print(DIV)

for i in DIV:
    if M - i*N >= 0:
        ans = i
print(ans)
Buggy code:
import sys

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

n, m = map(int, input().split(' '))

divisors = make_divisors(n)
for i in range(1, len(divisors)+1):
    if divisors[i*-1] * n <= m:
        print(divisors[i*-1])
        sys.exit()

Fixed code:
import sys

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

n, m = map(int, input().split(' '))

divisors = make_divisors(m)

for i in range(1, len(divisors)+1):
    if divisors[i*-1] * n <= m:
        print(divisors[i*-1])
        sys.exit()