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

if M % N == 0:
    print(M//N)
    exit()


# そもそも素数だとだめなので、素数判定
pn = 2
is_prime = True
while pn*pn <= M:
    if M % pn == 0:
        #その数字以外のある数字で割り切れるので素数ではない
        is_prime = False
        break
    pn += 1


if is_prime == False:
    ans = 1
    for i in reversed(range(1, (M**0.5)+1)):
        # 最大公約数がiとする
        rest = M - (i * N)
        if (i+rest) % i == 0:
            ans = i
            break
else:
    if N == 1:
        ans = M
    else:
        ans = 1

print(ans)  

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

if M % N == 0:
    print(M//N)
    exit()


# そもそも素数だとだめなので、素数判定
pn = 2
is_prime = True
while pn*pn <= M:
    if M % pn == 0:
        #その数字以外のある数字で割り切れるので素数ではない
        is_prime = False
        break
    pn += 1


if is_prime == False:
    ans = 1
    for i in reversed(range(1, (M//N)+1)):
        # 最大公約数がiとする
        rest = M - (i * N)
        if (i+rest) % i == 0:
            ans = i
            break
else:
    if N == 1:
        ans = M
    else:
        ans = 1

print(ans)  

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

if M % N == 0:
    print(M//N)
    exit()

ans = 1
for i in reversed(range(1, (M//N)+1)):
    # 最大公約数がiとする
    rest = M - (i * N)
    if (i+rest) % i == 0:
        ans = i
        break
print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split()) 

i = 1
ans = 1
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      elif m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

Fixed submission:
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 python submission (verdict: Runtime Error):
n,m = map(int, input().split()) 

i = 1
ans = 0
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      else m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

Fixed submission:
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 python submission (verdict: Runtime Error):
n,m = map(int, input().split()) 

i = 1
ans = 0
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      else m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif is_prime(m):
  print(1)
  
else:
  i = m // n
  ans = 0
  while i  >= 1:
    if (m - i * n) % i == 0:
      ans = i
      break
    i -= 1

  print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif is_prime(m):
  print(1)
  
else:
  i = 1
  ans = 0
  while i  <= m // n:
    if (m - i * n) % i == 0:
      ans = i
    i += 1

  print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif is_prime(m):
  print(1)
  
else:
  ans = 0
  for i in range(1, m//n+1):
    tmp = m - i * n
    if tmp % i == 0 and ans < i:
      ans = i
    i += 1
  print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif is_prime(m):
  print(1)
  
else:
  i = 1
  ans = 0
  while i  <= m // n:
    tmp = m - i * n
    if tmp % i == 0 and ans < i:
      ans = i
    i += 1

  print(ans)

Fixed submission:
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 python submission (verdict: Time Limit Exceeded):
def isPrimeNumber(num):
  pn = 2 #素数は2から
  while pn * pn <= num: #√numまで調べる
    if num % pn == 0:
      return False
    pn += 1
  return True

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif isPrimeNumber(m):
  print(1)
  
else:
  i = 1
  ans = 0
  while i  <= m // n:
    tmp = m - i * n
    if tmp % i == 0 and ans < i:
      ans = i
    i += 1

  print(ans)

Fixed submission:
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)