Problem:


Score : 400 points

Problem Statement

You are given integers N and M.

Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

N \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.

Sample Input 1

3 14

Sample Output 1

2

Consider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.

Sample Input 2

10 123

Sample Output 2

3

Sample Input 3

100000 1000000000

Sample Output 3

10000



Sample input:
3 14


Sample output:
2

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
range_kouyaku = int(math.floor(math.sqrt(m)))

kouyaku = 1
for i in reversed(range(min(range_kouyaku,kouyaku_max))):
    if (m % (i + 1) == 0):
        kouyaku = i + 1
        break
if n==1:
    kouyaku = m

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
range_kouyaku = int(math.floor(math.sqrt(m)))

kouyaku = 1
if n==1:
    kouyaku = m
else:
    for i in reversed(range(min(range_kouyaku-1,kouyaku_max))):
        if (m % (i + 1) == 0):
            kouyaku = i + 1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
range_kouyaku = int(math.sqrt(m))

kouyaku = 1
if n==1:
    kouyaku = m
else:
    for i in reversed(range(min(range_kouyaku-1,kouyaku_max))):
        if (m % (i + 1) == 0):
            kouyaku = i + 1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
range_kouyaku = int(math.sqrt(m))

kouyaku = 1
if n==1:
    kouyaku = m
else:
    for i in reversed(range(max(range_kouyaku,kouyaku_max))):
        if (m % (i + 1) == 0):
            kouyaku = i + 1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
range_kouyaku = int(math.sqrt(m))

kouyaku = 1
if n==1:
    kouyaku = m
else:
    for i in reversed(range(min(range_kouyaku,kouyaku_max))):
        if (m % (i + 1) == 0):
            kouyaku = i + 1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
kouyaku_max = m // n
kouyaku = 1
if n==1:
    kouyaku = m
else:
    for i in reversed(range(min(int(math.sqrt(m)), kouyaku_max))):
        if (m % (i + 1) == 0):
            kouyaku = i + 1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int,input().split())
if n ==1:
    kouyaku = m
else:
    kouyaku_max = min(m//n, int(math.sqrt(m))+1)
    kouyaku = 1
    for i in reversed(range(kouyaku_max)):
        if(m%(i+1) == 0):
            kouyaku = i+1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int,input().split())
if n ==1:
    kouyaku = m
else:

    kouyaku_max = min(m//n, int(math.sqrt(m)))
    kouyaku = 1
    for i in reversed(range(kouyaku_max)):
        if(m%(i+1) == 0):
            kouyaku = i+1
            break

print('{}'.format(kouyaku))

Submission status: Wrong Answer

Solution 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
if(i**2>M):
    i=N-1
    while(i>=2):
        if(M%i==0):
            gcd=i
            break
        i-=1
else:
    gcd=M//i


print(gcd)

Submission status: Wrong Answer

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


gcd=1
while(i**2 <=M):
    if(M%i==0):
        break
    i+=1
if(i**2>M):
    i=N-1
    while(i>=2):
        if(M%i==0):
            gcd=i
            break
        i-=1
else:
    gcd=M//i


print(gcd)

Submission status: Wrong Answer

Solution 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)
    i+=1
if(M%i==0):
    print(M//i)
    sys.exit(0)
i+=1

    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

Submission status: Wrong Answer

Solution 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)
i+=1

    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
if m%n>10000:
  for i in range(1,n):
    if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
      print('1')
      exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m%(m-i+1)==0:
    print(m-i+1)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

for i in range(n,m):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=10):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
    print('fbhvdcjnsk')
for i in range(1,m):
  if i==m:
    print(1)
    break
  if m%i==0 and i>=n:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=10):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(m//i) and (i==1 or m//i>n):
    print('1')
    exit()
for i in range(1,m):
  if i==m:
    print(1)
    break
  if m%i==0 and i>=n:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,m):
  if i==m:
    print(1)
    break
  if m%i==0 and i>=n:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,m//n+1):
  if i==m:
    print(1)
    break
  if m%i==0 and i>=n:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,1000)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(m//i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,m)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
print(n)

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if True:
  for i in range(1,n):
    if m%i==0 and is_prime(m//i) and m//i>n:
      print('1')
      exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if True:
  for i in range(1,n):
    if m%i==0 and is_prime(m//i) and (i==1 or m//i<n):
      print('1')
      exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if m//n>10000:
  for i in range(1,n):
    if m%i==0 and is_prime(m//i) and m//i>n:
      print('1')
      exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if m//n>100000:
  for i in range(1,n):
    for j in range(1,n):
      for k in range(1,n):
        if m%(i*j*k)==0 and (i*j*k)%n!=0 and is_prime(m//(i*j*k)) and m//(i*j*k)>n:
          print('1')
          exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if m//n>100000:
  for i in range(1,n):
    for j in range(1,n):
      for k in range(1,n):
        if m%(i*j*k)==0 and n%(i*j*k)!=0 and is_prime(m//(i*j*k)) and m//(i*j*k)>n:
          print('1')
          exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))

if n==1:
  print(m)
  exit()
if m//n>100000:
  for i in range(1,n):
    for j in range(1,n):
      for k in range(1,n):
        if m%(i*j*k)==0 and is_prime(m//(i*j*k)) and m//(i*j*k)>n:
          print('1')
          exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True


n,m=(int(i) for i in input().split(' '))
if n==1:
  print(m)
  exit()
if m>100000:
  for i in range(1,n):
    if m%i==0 and is_prime(m//i) and m//i>n:
      print('1')
      exit()
  if m%n==0 and is_prime(m//n):
    print(m//n)
    exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1

        if y != n - 1 and t & 1 == 0:
            return False

    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(m//i) and m//i<n:
    print('1')
    exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import random

def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False

    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)

        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1

        if y != n - 1 and t & 1 == 0:
            return False

    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and is_prime(m//i):
    print('1')
    exit()
for i in range(1,m//n+1)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import math
import random

def is_prime(n):
    if n == 1: return False
    if n == 2: return True

    for k in range(100):
        a = random.randint(2, n - 1)

        if gcd(n, a) != 1:
            return False

        if pow(a, n - 1, n) != 1:
            return False

    return True

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

if __name__ == '__main__':
    print(is_prime(2 ** 89 - 1))


n,m=(int(i) for i in input().split(' '))
if is_prime(m):
  print('1')
else:
  for i in range(1,m//n+1)[::-1]:
    if i==1:
      print(i)
      break
    if m%i==0 and m//i>=n:
      print(i)
      break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,m//n)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
for i in range(1,m//n):
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
def divisor(m,k):
  divisor=[]
  for i in range(1,k+1):
    if m%i==0:
      divisor.append(i)
  return divisor

n,m=(int(i) for i in input().split(' '))
for i in divisor(m,m//n)[::-1]:
  if i==1:
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
def divisor(m):
  divisor=[]
  for i in range(2,m//2+1):
    if m%i==0:
      divisor.append(i)
  divisor=[1]+divisor+[m]
  return divisor

n,m=(int(i) for i in input().split(' '))
print(divisor(m))
for i in divisor(m)[::-1]:
  if i==1:
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import math

def divisor(m):
  divisor=[]
  for i in range(2,math.floor(m**0.5)+1):
    if m%i==0:
      divisor.append(i)
  divisor=[1]+divisor+[m]
  return divisor

n,m=(int(i) for i in input().split(' '))
for i in divisor(m)[::-1]:
  if i==1:
    print(i)
    break
  if m%i==0 and m//i>=n:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
i=n
while True:
  if m%i==0 and m//i>=n:
    print(i)
    break
  else:
    i-=1

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
i=n
while True:
  if m%i==0:
    if m//i>=n:
      print(i)
    break
  else:
    i-=1

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split(' '))
i=n
while True:
  if m%i==0:
    if m//i>n:
      print(i)
    break
  else:
    i-=1

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
ans = 1
for i in range(1,int(M**(1/2))+1):
    if M % i == 0 and i*N <= M:
        ans = max(ans, i)
        
print(ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (m // n, round(m**(0.5)) + 1 ):
  if m % i == 0:
    print(max(i, m // i))
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (m // n, round(m**(0.5)) + 1 ):
  if m % i == 0:
    print(m // i)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (round(m // n), round(m**(0.5))):
  if m % i == 0:
    print(m // i)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
import math
N, M = (int(i) for i in input().split())

c = 1
for i in range(1,math.ceil(math.sqrt(M))):
    if M%i == 0 and i <= M//N:
        c = i

print(c)

Submission status: Wrong Answer

Solution code:
import math
N, M = (int(i) for i in input().split())

c = 1
for i in range(1,math.ceil(math.sqrt(M))+1):
    if M%i == 0 and i <= M//N:
        c = i

print(c)

Submission status: Wrong Answer

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

if m / n == 1:
    print(1)
if m / n == 2 and m % n != 0:
    print(1)
if m / n == 3 and m % n != 0:
    if n % 2 == 0:
        print(2)
    else:
        print(1)
else:
    for i in range(n, m + 1):
        if m % i == 0:
            print(int(m / i))
            break

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if m % 2 == 0 and n > (m + 3) // 3:
  print(2)
for i in range (n, (m + 3) // 2):
  if m % i == 0:
    print(m // i)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (n, (m + 1) // 2):
  if m % i == 0:
    print(m // i)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (n, m + 1):
  if m % i == 0:
    print(m / i)
    break

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range (n, m + 1):
  if m % i == 0:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())

    y = []
    for i in range(1, M + 1):
        if i ** 2 > M:
            break

        if M % i == 0:
            if M / N >= i:
                y.append(i)

    print(max(y))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
num = 0
for i in range(1, int(M ** 0.5) + 2):
    if M % i == 0 and i * N <= M:
        num = max(i, num)
    elif M % i == 0 and (M // i) * N <= M:
        num = max(M // i, num)
print(num)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
num = 0
for i in range(1, int(M ** 0.5) + 1):
    if M % i == 0 and i * N <= M:
        num = max(i, num)
    elif M % i == 0 and (M // i) * N <= M:
        num = max(M // i, num)
print(num)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
num = 0
for i in range(2, int(M ** 0.5) + 1):
    if M % i == 0 and i * N <= M:
        num = max(i, num)
    elif M % i == 0 and (M // i) * N <= M:
        num = max(M // i, num)
print(num)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
#lはmの約数でm>=ln
if m%n==0:
    print(m//n)
    exit()
for i in range(m//n+2,0,-1):
    if  m%i==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
#lはmの約数でm>=ln
if m%n==0:
    print(m//n)
    exit()
for i in range(m//n+2,1,-1):
    if m%i==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
#lはmの約数でm>=ln
for i in range(m//n+1,1,-1):
    if m%i==0:
        print(i)
        exit()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
max=1
for i in range(1,int(math.sqrt(M))+2):
    if M%i==0 and i>=N:
        max=M/i
        break
    if M%i==0 and M/i>=N:
        max=i
print(max)

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
max=1
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0 and i>=N:
        max=M/i
        break
    if M%i==0 and M/i>=N:
        max=i
print(max)

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,input().split())
max=1
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0 and (M/i)>=N:
        max=i
print(max)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 1
i = 1
while i * i <= M and i * N <= M:
    if M % i == 0:
        ans = i
    i += 1
if N == 1:
    ans = M
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 1
i = 1
while i * i <= M and i * N <= M:
    if M % i == 0:
        ans = i
    i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
for i in range(int(m**0.5)+1,0,-1):
  if m % i == 0 and m // i >= n:
    print(i) 
    break

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
l = m//n
p = [ i for i in range(l,1,-1) if l % i == 0 ]
for i in p:
  if m % i == 0 and m // i >= n:
    print(i) 
    break

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if N == 1:
    ans = M
else:
    ans = 1
    for x in range(2, int(M**0.5)+1):
        if M % x == 0:
            if (M // x) >= N:
                ans = max(ans, x)
            elif x >= N:
                ans = max(ans, M // x)
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 1
for x in range(2, int(M**0.5)+1):
    if M % x == 0:
        if (M // x) >= N:
            ans = max(ans, x)
        elif x >= N:
            ans = max(ans, M // x)
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 0
for x in range(2, int(M**0.5)+1):
    if M % x == 0:
        if (M // x) >= N:
            ans = max(ans, x)
        elif x >= N:
            ans = max(ans, M // x)
print(ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
for gcd in range(2,M // N):
 if M % gcd == 0:
  print(gcd)
  break

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
gcd = M // N
i = 2
div = []
while i < gcd:
    if M % i == 0:
        div.append(i)
    i = i + 1
div.sort(reverse=True)
gcd_tmp = 0
for gcd in div:
  tmp = M - gcd
  if tmp % gcd == 0:
   gcd_tmp = gcd
   break
print(gcd_tmp)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
gcd = M // (N+1)
gcd_tmp = 0
while gcd > 0:
 if M % gcd == 0:
  tmp = M - gcd
  if tmp % gcd == 0:
   gcd_tmp = gcd
   break
 gcd = gcd - 1
print(gcd_tmp)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
gcd = M // N
gcd_tmp = 0
while int(gcd/2) > 0:
 tmp = M - gcd
 if tmp % gcd == 0:
  gcd_tmp = gcd
  break
 gcd = gcd - 1
print(gcd_tmp)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
# for p in get_prime(m):
for p in range(1, min(int(math.sqrt(m)), m // n) + 1):
    if m % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
# for p in get_prime(m):
for p in range(1, min(n, m // n) + 2):
    if m % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
gcd = M // N
div = []
for i in range(2,gcd+1):
    if M % i == 0:
        div.append(i)
div.sort(reverse=True)
gcd_tmp = 0
for gcd in div:
 tmp = M - gcd
 if tmp % gcd == 0:
  gcd_tmp = gcd
  break
print(gcd_tmp)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
# for p in get_prime(m):
for p in range(1, min(n, m // n) + 1):
    if m % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
# for p in get_prime(m):
for p in range(1, min(n, m // n) + 1):
    if (m - p) % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
# for p in get_prime(m):
for p in range(1, n+1):
    if (m - p) % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
import math


def get_prime(num):
    upper = int(math.sqrt(num)) + 1
    checks = [True for _ in range(upper + 1)]
    primes = []
    for i in range(2, len(checks)):
        if checks[i]:
            primes.append(i)
            for j in range(i, len(checks), i):
                checks[j] = False
    return primes


n, m = map(int, input().split(" "))
answer = 1
for p in get_prime(m):
    if (m - p) % p == 0:
        answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
gcd = 1
gcd_tmp = 0
while gcd < M:
 tmp = M - gcd
 if tmp % gcd == 0 and gcd * N <= M:
  gcd_tmp = gcd
 gcd = gcd + 1
print(gcd_tmp)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
great=0;
for num in range(1,N+1):
    remain=M%num
    if remain==0:
        great=num        

print(great)