TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
import sys
import numpy as np
import fractions
input = sys.stdin.readline
M, N = [int(x) for x in input().split()]
a = N // M
b = N % M
print(fractions.gcd(a,b))


import sys
import numpy as np
import fractions
input = sys.stdin.readline
N, M  = [int(x) for x in 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 = make_divisors(M)
ans = sorted(ans)[::-1]
for i in ans:
    if i <= M/N:
        print(i)
        sys.exit()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
ans = 1
for i in range(n, m//2):
    if m % i == 0:
        ans = m//i
        break
print(ans)

import math
n, m = map(int, input().split())
ans = 1
k = m
soy = []
for i in range(2, int(math.sqrt(m))+1):
    if k % i == 0:
        are = 0
        while True:
            if k % i == 0:
                k = k // i
                are += 1
            else:
                break
        soy.append([i, are])
if k != 1:
    soy.append([k, 1])
for i in range(10-len(soy)):
    soy.append([1, 0])
for a in range(soy[0][1] + 1):
    for b in range(soy[1][1] + 1):
        for c in range(soy[2][1] + 1):
            for d in range(soy[3][1] + 1):
                for e in range(soy[4][1] + 1):
                    for f in range(soy[5][1] + 1):
                        for g in range(soy[6][1] + 1):
                            for h in range(soy[7][1] + 1):
                                for i in range(soy[8][1] + 1):
                                    for j in range(soy[9][1] + 1):
                                        t = soy[0][0]**a * soy[1][0]**b * soy[2][0]**c * soy[3][0]**d * soy[4][0]**e * soy[5][0]**f * soy[6][0]**g * soy[7][0]**h * soy[8][0]**i * soy[9][0]**j
                                        if n <= t:
                                        	ans = max(ans, m//t)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from math import sqrt
n, m = list(map(int, input().split()))
i = 1
lst = []
while i <= sqrt(m):
    if m % i == 0:
        j = m // i
        if i >= n:
            lst.append(i)
        if j >= n:
            lst.append(j)
        i += 1
print(m//min(lst))

from math import sqrt
from math import ceil
n, m = list(map(int, input().split()))
lst = range(n, ceil(sqrt(m)))
for i in lst:
    if m % i == 0:
        print(m // i)
        break
else:
    print(1)

n, m = list(map(int, input().split()))
lst = range(n, -(-m//2))
for i in lst:
    if m % i == 0:
        print(m // i)
        break
else:
    print(1)

from math import sqrt
n, m = list(map(int, input().split()))
i = 1
lst = []
while i <= sqrt(m):
    if m % i == 0:
        j = m // i
        if i >= n:
            lst.append(i)
        if j >= n:
            lst.append(j)
    i += 1
print(m//min(lst))

Verdicts: Time Limit Exceeded

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys

def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  O = [0, 1] + [0 for _ in range(int(M**0.5)+1)]
  H = 1
  for i in range(int(M**0.5)+1, 2, -1):
    while M % i == 0:
      if (M // i) < N:
        break
      else:
        M //= i
        H *= i
  print(H)

if __name__ == '__main__':
  main()

import sys

def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  H = 1
  for i in range(int(M//N), 1, -1):
    if M % i == 0:
      H = i
      break

  print(H)

if __name__ == '__main__':
  main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
s=[]
for i in range(1,int(m**2)+1):
    if m%i==0 and i=<n:
        s.append(i)
        if m/i=<n:
           s.append(m/i)
print(max(s))

n, m = list(map(int,input().split()))
def solve():
    for i in range(m//n, 0, -1):
        if m % i == 0:
			print(i)
            break
solve()

n, m = list(map(int,input().split()))
def solve():
    for i in range(m//n, 0, -1):
        if m % i == 0:
            print(i)
            break
solve()

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int,input().split())


ans=1

for i in range(1,min(M//N+100,10**5+5)):
    if M%i==0:
            ans=i
print(ans)

N,M=map(int,input().split())
ans=0
for i in range(1,10**5):
    if M%i==0:
        a=max(M//i,i)
        b=min(M//i,i)
        if M//a>=N and ans<a:
            ans=a
        if M//b>=N and ans<b:
            ans=b
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
N,T  = map(int,input().split())
 
if T % N == 0:
    print (int(T / N))
    exit()
    
for i in range(T):    
    A = math.ceil(T / N)
    print(A)
    if T % A ==0:
        print(T)
        break
    T = A

N,T  = map(int,input().split())
if T % N == 0:
    print (int(T / N))

d = int(T / N)
else:
    for i in range(d+1,0,-1):    
        if T % i ==0:
            print(i)
            break

import math
N,T  = list(map(int,input().split()))
#d = int(T / N)
m = []
def ans():
    for i in range(1,int(math.sqrt(T))):    
            if T % i ==0:
                m.append(i)
                m.append(T//i)
    print (m[-1])
if T % N == 0:
    print (int(N / T))
else:
    ans()

import math
N,T  = list(map(int,input().split()))
#d = int(T / N)
m = []

def ans():
    ans = 1
    for i in range(1,int(math.sqrt(T))):    
            if T % i ==0:
                m.append(i)
                m.append(T//i)
    for p in m:
        if p <= T // N:
            ans = max(ans,p)
    print (ans)
    
if T % N == 0:
    print (int(T / N))
else:
    ans()

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)
    return divisors

div = sorted(make_divisors(M))
while M//div[i]>=N:
    ans = div[i]
    i+=1
    
print(ans)

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)
                
    return divisors

if N==1:
    print(M)

else:
    div = sorted(make_divisors(M))
    i = 0 
    while i<=len(div) and M//div[i]>=N:
        ans = div[i]
        i+=1
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
ans = 1
for i in range(2, int(math.sqrt(m)) + 1):
    if m % i == 0 and m // i >= n:
        ans = max(i, m // i)
if n == 1:
    print(m)
else:
    print(ans)


import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
ans = 1
for i in range(2, math.ceil(math.sqrt(m)) + 1):
    if m % i == 0:
        ans = max(i, m // i)
print(ans)


import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
ans = 1
for i in range(1, int(math.sqrt(m)) + 2):
    if m % i == 0:
        if m // i >= n and i >= n:
            ans = max(ans, i, m // i)
        elif m // i >= n:
            ans = max(ans, i)
        elif i >= n:
            ans = max(ans, m // i)
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())

def solve():
    res = 1
    for i in range(2, m+1):
        if m % i == 0:
            if (m // i) >= n:
                res = max(res, i * (m // i // n))
                break
    print(res)

solve()


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

def solve():
    res = 1
    for i in range(m//n+1, 0, -1):
        if m % i == 0:
            if (m // i) >= n:
                res = i
                break
    print(res)

solve()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def factorize(M):
    fact=[]
    for i in range(2,4*10**4):
        tmp=[1]
        if M==1:
            break
        while M%i==0:
            M//=i
            tmp.append(tmp[-1]*i)
        if len(tmp)>1:
            fact.append(tmp)
    return fact

def divisor(fact,arr,i,p):
    if i == len(fact):
        arr.append(p)
        return 0
    for x in fact[i]:
        divisor(fact,arr,i+1,p*x)
    
N,M=list(map(int,input().split()))

fact = factorize(M)
arr=[]
divisor(fact,arr,0,1)
print(fact)
arr=sorted(arr)
print(arr)
ans=1
for x in arr:
    if x>M//N:
        break
    ans=x
print(ans)

def factorize(M):
    fact=[]
    for i in range(2,10**5):
        tmp=[1]
        if M==1:
            break
        while M%i==0:
            M//=i
            tmp.append(tmp[-1]*i)
        if len(tmp)>1:
            fact.append(tmp)
    if M!=1:
        fact.append([1,M])
    return fact

def divisor(fact,arr,i,p):
    if i == len(fact):
        arr.append(p)
        return 0
    for x in fact[i]:
        divisor(fact,arr,i+1,p*x)
    
N,M=list(map(int,input().split()))

fact = factorize(M)
arr=[]
divisor(fact,arr,0,1)
arr=sorted(arr)
ans=1
for x in arr:
    if x>M//N:
        break
    ans=x
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())


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

div = make_divisors(num=m)
div.sort()
ans = 0
for x in div:
    if x*n <= m:
        ans = max(ans, x)
print(ans)


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


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

div = make_divisors(num=m)

ans = 0
for x in div:
    if x*n <= m:
        ans = max(ans, x)
print(ans)


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


def make_divisors(num):
    divisors = []
    for i in range(1, m+1):
        if i * i > m:
            break
        if m % i == 0:
            divisors.append(i)
            divisors.append(m // i)
    return divisors

div = make_divisors(num=m)
div.sort()
ans = 1
for x in div:
    if x*n <= m:
        ans = x
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from fractions import*;n,m=map(int,input().split());print(gcd(m//n,m%n))

n,m=map(int,input().split())
ans=1
for i in range(1,int(m**.5)+1):
  if m%i==0:
    if i*n<=m and ans<i:
      ans=i
    if n<=i and ans<m//i:
      ans=m//i
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
def main():
    n,m = map(int,input().split())
    for i in range(n,math.ceil(math.sqrt(m))):
        if m%i==0:
            print(m//i)
            break
main()

import math
def main():
    n,m = map(int,input().split())

    start = min(m//n,math.sqrt(m))

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

main()

import math
def main():
    n,m = map(int,input().split())
    for i in range(n,math.floor(math.sqrt(m))):
        if m%i==0:
            print(m//i)
            break
main()

def main():
    n,m = map(int,input().split())

    start = m//n

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

main()

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
g = 1
for i in range(1,m):
  if m%i == 0:
    if int(m/i) >= n:
      g = int(m/i)
    else:
      break
      
print(g)
  

n,m = map(int,input().split())
g = 1
for i in range(m):
  if m%i == 0:
    if int(m/i) >= n:
      g = int(m/i)
    else:
      break
      
print(g)
  

n,m = map(int,input().split())
g = 1
def fact(k):
  a = []
  for i in range(1,int(k **(0.5))+1):
    if k%i ==0:
      a.append(i)
      a.append(int(k/i))
  b = list(set(a))
  b.sort()
  return b

g = fact(m)
for i in range(len(g)):
  if g[len(g)-i-1] <= m/n:
    print(g[len(g)-i-1])
    break
    
    
    
      

  

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from fractions import gcd
from functools import reduce
from itertools import combinations

N,M = map(int,input().split())
alist = []
for cmb in combinations([i for i in range(1,M)],N-1):
  cmb = [0] + list(cmb) + [M]
  tmp_a = sorted([cmb[i]-cmb[i-1] for i in range(1,N+1)])
  if tmp_a not in alist: alist.append(tmp_a)

ans = -float('inf')
for a in alist:
  ans = max(ans, reduce(gcd,a))
print(ans)

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

ans = -float('inf')
N,M = map(int,input().split())
for div in make_divisors(M):
  if M//div >= N: ans = max(ans, div)
print(ans)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding:utf-8 -*-



from fractions import gcd

def solve():
    N, M = list(map(int, input().split()))

    base = M//N

    if M%N == 0:
        print(base)
        return
    else:
        last = base + M%N
        ans = gcd(base, last)
        print(ans)
        return



if __name__ == "__main__":
    solve()


# -*- coding:utf-8 -*-



def solve():
    N, M = list(map(int, input().split()))

    divs = set()  

    
    n = 1
    while n*n <= M:
        if M%n == 0:
            
            divs.add(n)
            divs.add(M//n)
        n += 1

    
    ans = 0
    for d in divs:
        if d*N <= M:
            ans = max(ans, d)

    print(ans)


def solve2():
    N, M = list(map(int, input().split()))

    divs = set()

    n = 1
    while n <= M**(1/2):
        if M%n == 0:
            divs.add(n)
            divs.add(M//n)
        n += 1

    ans = 0
    for d in divs:
        if M >= d*N:
            ans = max(ans, d)
    print(ans)


if __name__ == "__main__":
    solve2()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
for i in range(m//n+1)[::-1]:
	if m%i==0:
		print(i)
        exit()


def f():
  n,m=map(int,input().split())
  for i in range(m//n+1)[::-1]:
    if m%i==0:return i
f()

N, M = map(int, input().split())

l = []
for i in range(1, int(M**0.5)+1):
    if M%i==0:
        l += [M//i]
        if M//i != i:
            l += [i]
l.sort()

for i in l:
    if i >= N:
        print(M//i)
        break

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

def main():
    N, M = list(map(int, input().split(' ')))
    s = min(math.ceil(math.sqrt(M)), M//N)
    while True:
        if M%s == 0:
            print(max(s, M//s))
            break
        s -= 1



if __name__ == '__main__':
    main()

import math

def main():
    N, M = list(map(int, input().split(' ')))
    s = min(math.ceil(math.sqrt(M)), M//N)
    ret = []
    while s > 0:
        if M%s == 0:
            a = M//s
            ret.append(a)
            ret.append(s)
        s -= 1
    print(max([s for s in ret if s <= M//N]))



if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

n, m = list(map(int, input().split()))
k = 0
for i in range(1, int(math.sqrt(m) + 1)):
    if m % i == 0 and m/k >= n:
        k = i
print(k)

import math

n, m = list(map(int, input().split()))
k = 0
for i in range(1, int(math.sqrt(m) + 1):
    if m % i == 0:
        k = i
print(k)


import math

n, m = list(map(int, input().split()))
reg = (m / n)
k = 1
for i in range(1, int(math.sqrt(m) + 1)):
    if m % i == 0:
        a = m/i
        b = i
        if reg >= b and k < b:
            k = b
        if reg >= a and k < a:
            k = a
print(int(k))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
N, M = map(int, input().split())

ans = 1
for a in range(math.sqrt(M)):
    b = int(M / a)
    if M%a != 0:
        continue
    if a * N <= M:
        ans = max(ans, a)
    if b * N <= M:
        ans = max(ans, b)

print(ans)



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

ans = 1
for a in range(1, int(math.sqrt(M))):
    b = int(M / a)
    if M%a != 0:
        continue
    if a * N <= M:
        ans = max(ans, a)
    if b * N <= M:
        ans = max(ans, b)

print(ans)



Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())  

ans = 1

if N == 1:
    print(M)
    exit()

for i in range(1000000):
    if (M >= N * i) and (M % i == 0):
        ans = i

print(ans)


N, M = map(int, input().split())  

if N == 1:
    print(M)
    exit()


primes = []
ans = 1


for i in range(1, int(M**(1/2))+1):
    if M % i == 0:
        primes.append(i)
        primes.append(M//i)


for d in primes:
    if M >= N * d:
        ans = d

print(d)


N, M = map(int, input().split())  

if N == 1:
    print(M)
    eixt()


primes = []
ans = 1


for i in range(1, int(M**(1/2))+1):
    if M % i == 0:
        primes.append(i)
        primes.append(M//i)


for d in primes:
    if M >= N * d:
        ans = d

print(d)


N, M = map(int, input().split())  

divs = []
for i in range(1, int((M)**(1/2)+1)):
    if M % i == 0:
        divs.append(i)
        divs.append(M//i)

divs.sort()

ans = 0
for d in divs:
    if M//N >= d:
        ans = d
    else:
        break

print(ans)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
n,m = map(int, input().split())
if m%n==0:
    print(m//n)
else:
    def make_divisor_list(num):
        if num < 1:
            return []
        elif num == 1:
            return [1]
        else:
            divisor_list = []
            divisor_list.append(1)
            for i in range(2, int(math.sqrt(num)) + 1):
                if num % i == 0:
                    divisor_list.append(i)
            divisor_list.append(num)

            return divisor_list
    
    listD = make_divisor_list(m)
    index =0
    while index <len(listD):
        if listD[index]>n-1:
            print(m//listD[index])
            break
        index+=1


import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

N, M=input().split(" ")
N=int(N)
M=int(M)

def get_number(M):
    result=list()
    for i in range(1,int(math.sqrt(M))):
        if M%i==0:
            result.append(i)
            result.append(int(M/i))
    result.sort()
    return(result)
    
def check_number(N,M):
    number=get_number(M)
    answer=list()
    for i in number:
        if M/i>=N:
            answer.append(i)
            
    return(answer[-1])
    
check_number(N,M)

import math
 
N, M=input().split(" ")
N=int(N)
M=int(M)
 
def get_number(M):
    result=list()
    for i in range(1,int(math.sqrt(M))):
        if M%i==0:
            result.append(i)
            result.append(int(M/i))
    result.sort()
    return(result)
    
def check_number(N,M):
    if N==1:
        return(M)
    number=get_number(M)
    answer=list()
    for i in number:
        if M/i>=N:
            answer.append(i)
            
    return(answer[-1])
    
print(check_number(N,M))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
a=0
for i in range(1,18000000):
    if m%i:continue
    if m//i>=n:a=i
print(a)

def s(n):
    return[m(t)for t in d(f(n))]
def f(n):
    l=[]
    b,e=2,0
    while b*b<=n:
        while not n%b:
            n//=b
            e+=1
        if e:
            l.append((b,e))
        b,e=b+1,0
    if n>1:
        l.append((n,1))
    return l
def d(l):
    b,e=l.pop()
    p=d(l)if l else[[]]
    v=[[(b,k)]for k in range(e+1)]
    return[s+t for s in p for t in v]
def m(l):
    a=1
    for b,e in l:
        a*=b**e
    return a
N,M=map(int,input().split())
if M<2:print(1);exit()
a=0
for i in sorted(s(M))[::-1]:
    if M//i>=N:
        a=i
        break
print(a)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input= sys.stdin.readline

N,M = map(int,input().split())
g=M//N
for i in range(g):
  if M%(N+i)==0:
    print(M//(N+i))
    exit()

N,M = map(int,input().split())
g=M//N
for i in range(g):
  if M%g==0:
    print(g)
    exit()

import sys
input= sys.sdtin.readline

N,M = map(int,input().split())
g=M//N
for i in range(g):
  if M%(g-i)==0:
    print(g-i)
    exit()

import sys
input= sys.stdin.readline

N,M = map(int,input().split())
g=M//N
for i in range(g):
  if M%(g-i)==0:
    print(g-i)
    exit()
  if M%(N+i)==0:
    print(M//(N+i))
    exit()

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

N,M = map(int,input().split())

ans = 1
for i in range(1,int(math.sqrt(M)+1)+1):
  if M % i != 0:
    continue
  B = M / i
  
  if (A * N <= M):
    ans = max(ans,A)
  if (B * N <= M):
    ans = max(ans,B)

print(ans)
  

import math
 
N,M = map(int,input().split())
 
ans = 1
for i in range(1,int(math.sqrt(M))+1+1):
  if M % i != 0:
    continue
  B = int(M / i)
  
  if (i * N <= M):
    ans = max(ans,i)
  if (B * N <= M):
    ans = max(ans,B)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
k = m//n
ans = 0
for i in range(1, int(m**0.5)+1):
  if m%i == 0:
    if i <= k:
      if i <= k:
      ans = max(ans, i)
    if m//i <= k:
      ans = max(ans, m//i)
print(ans)

n, m = map(int, input().split())
k = m//n
ans = 0
for i in range(1, int(m**0.5)+1):
  if m%i == 0:
    if i <= k:
      ans = max(ans, i)
    if m//i <= k:
      ans = max(ans, m//i)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
for i in range(n, int(m ** .5) + 1):
    if m % i == 0:
        print(m // i)
        exit()

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


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

ans = 0
for i in make_divisors(m):
    if i <= m / n:
        ans = max(ans, i)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(10**7)
p_list = set(prime_list)

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

ans = 1

for i in prime_list:
    if n * i > m:
        break
    if m % i == 0:
        num = m // i
        if num in p_list:
            ans = i
        elif num < n:
            continue
        elif num >= i * n:
            a = num // n
            ans = i * a
    else:
        continue

print(ans)

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)

for i in div:
    if i * n <= m:
        ans = i
    else:
        break

print(ans)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
N, M = map(int, input().split())
div = []
for i in range(1, M + 1):
    if i * i > M:
        break
    if M % i == 0:
        div.append(i)
    if M % i == 0 and i != M // i:
        div.append(M // i)
div.sort()
div.reverse()
print(div)
for i in div:
    if M // i >= N:
        print(i)
        break


N, M = map(int, input().split())
div = []
for i in range(1, M + 1):
    if i * i > M:
        break
    if M % i == 0:
        div.append(i)
    if M % i == 0 and i != M // i:
        div.append(M // i)
div.sort()
div.reverse()
for i in div:
    if M // i >= N:
        print(i)
        break


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M=map(int, input().split())

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

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)

    
    return divisors

D=make_divisors(M)
D=sorted(D)
ans=0
for d in D:
    if M//d>=N:
        ans=d
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,M = list(map(int,input().split()))

if N==1:
    print(M)
else:
    ans = 1
    for i in range(1,10**5):
        if i*i>M:
            break
        if M%i==0:
            j = max(i.M//i)
            if j>=N:
                ans = max(j,ans)

    print(ans)

N,M = list(map(int,input().split()))

if N==1:
    print(M)
else:
    ans = 1
    for i in range(1,10**5):
        if i*i>M:
            break
        if M%i==0:
            j = max(i,M//i)
            if j>=N:
                ans = max(j,ans)

    print(ans)

N,M = list(map(int,input().split()))

if N==1:
    print(M)
else:
    ans = 1
    for i in range(1,10**5):
        if i*i>M:
            break
        if M%i==0:
            j=0
            k=0
            if M//i>=N:
                j=i
            if i>=N:
                k=M//i
            ans = max(j,k,ans)

    print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

x=0

s = []
for i in range(math.floor(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)





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)







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)



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







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)





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)



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)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
sys.setrecursionlimit(10**10)

def search_max_gcd(M, possible):
    if possible == 1:
        return 1
    elif (M % possible) == 0:
        return possible
    else:
        return search_max_gcd(M, possible-1)

def main():
    N, M = map(int, input().split())
    first_possible = M//N
    print(search_max_gcd(M, first_possible))

main()

from math import *

def main():
    N, M = map(int, input().split())
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M//j for j in divisor_set)
    print(int(max(divisor_set, key=lambda x: x if special_value >= x else -1)))

    return

if __name__ == "__main__":
main()

from math import *

N, M = map(int, input().split())
special_value = M//N
divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
divisor_set = divisor_set.union(M//j for j in divisor_set)
print(int(max(divisor_set, key=lambda x: x if special_value >= x else -1)))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
N, M = map(int, input().split())
if N == 1:
    print(M)
    exit()

n = 0
for i in range(1, int(math.sqrt(M))+1):
    if M % i == 0:
        n = max(i, n)
    if i >= N:
        n = max(M//i, n)
    if M < i * N:
        break

print(n)


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

n = 0
for i in range(1, int(math.sqrt(M))+1):
    if M < i * N:
        break

    if M % i == 0:
        n = max(i, n)
        if i >= N:
            n = max(M//i, n)

print(n)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

n = 100000
m = 1000000000
pq_max = 0

for p in range(1, int(math.sqrt(m)) + 1):
    if m % p == 0:
        q = m // p
        
        if p >= n and q > pq_max:
            pq_max = q
            
        if q >= n and p > pq_max:
            pq_max = p
        
print(pq_max)

import math

n, m = [int(i) for i in input().split(" ")]
pq_max = 0

for p in range(1, int(math.sqrt(m)) + 1):
    if m % p == 0:
        q = m // p
        
        if p >= n and q > pq_max:
            pq_max = q
            
        if q >= n and p > pq_max:
            pq_max = p
        
print(pq_max)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
ans=1
for i in range(1,m**0.5+1):
    if m%i==0:
        if m/i>=n:
            ans=max(ans,i)
        elif i>=n:
            ans=max(ans,m//i)
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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])

¥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])

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
if n == 1:
    print(m)
    exit()


n, m = map(int, input().split())
values = []

def pfac(n):
    values = [1, n]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            values.append(i)
            values.append(n // i)
    return values


for i in pfac(m):
    if m % i == 0 and m / i >= n:
        values.append(i)
print(max(values))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, m = map(int, input().split())
for i in range(int(m/n), int(n**.5), -1):
    if not m % i:
        print(m//i)
        exit()
for i in range(int(min((m / n), n**.5)), 0, -1):
    if not m % i:
        print(i)
        break

n, m = map(int, input().split())
for i in range(-int(-m/n), -int(-n**.5), -1):
    if not m % i:
        print(m//i)
        break
for i in range(int(min((m / n), n**.5)), 0, -1):
    if not m % i:
        print(i)
        break

from math import ceil
n, m = map(int, input().split())
for i in range(n, ceil(m**.5), 1):
    if not m % i:
        print(m//i)
        exit()
for i in range(int(min((m / n), m**.5)), 0, -1):
    if not m % i:
        print(i)
        break

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
n,m=(int(i) for i in input().split())
p = min(math.sqrt(m),int(m/n))
while p>1:
    if m%p==0 and m>=n*p:
        break
    p-=1
print(p)

n,m=(int(i) for i in input().split())
p = int(m**(1/2))
divisors = []
for i in range(1,p+1):
    if m%i == 0:
        if n*i<=m:
            divisors.append(i)
        if n<=i:
            divisors.append(int(m/i))
print(max(divisors))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int, input().split())

k=[]

for i in range(m):
  if (m%i==0) and (m//i <= n):
    k.append(i)
    
print(max(k))    

    





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

k=[]

for i in range(m):
  if (m%i==0) and (m//i <= n):
    k.append(i)
    
print(max(k))    

    





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

import math

n,m=map(int,input().split())
if n==1:
        print(m)
else:
        l=[]
        for i in range(1,math.floor(m**0.5)+1):
           if m%i==0 and i<=m//n:
                l.append(i)
                if m//i<=m//n:
                        l.append(m//i)
        l.sort()
        print(l[-1])

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

N,M = map(int,input().split())
A = []
n = 0
if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, int(math.sqrt(M))):
        if (M % i == 0):
            A.append(i)
            A.append(int(M / A[2*n]))
            n += 1
    print(A)
    for k in range(len(A)):
        if A[-1-k] <= M/N:
            print(A[-1-k])
            exit()

import math

N,M = map(int,input().split())
A = []
n = 0
if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, int(math.sqrt(M))+1):
        if (M % i == 0):
            if i <= M//N:
                A.append(i)
            if M/i <= M//N:
                A.append(int(M/i))
    A.sort()
    print(A[-1])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
a = int((m**0.5)//1)
b = 0

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

n,m = map(int,input().split())
a = int((m**0.5)//1)
b = 0
if n == 1:
    print(m)
else:
    for i in range(1,a+1):
        if m % i == 0:
            if (m//i) >= n:
                b = max(b,i)
            if i >= n:
                b = max(b,m//i)

    print(b)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m=map(int,input().split())
r=m//n
for i in range(n,r):
  if m%i==0:
    print(m//i)
    break

n,m=map(int,input().split())
r=m//n
if r>=10**7:
  for i in range(n,r):
    if m%i==0:
      print(m//i)
      break
else:
  for i in range(r):
    if m%(r-i)==0 and m//(r-i)>=n:
      print(r-i)
      break

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,m = map(int,input().split())
a = m//n
di = []
for i in range(1, min(a+1,int(m**0.5)+1)):
  if m % i == 0:
    di.append(i)
    if i != m // i and a >=  m // i:
      di.append(m//i)
di.sort()
print(di,di[-1])

n,m = map(int,input().split())
a = m//n
di = []
for i in range(1, min(a+1,int(m**0.5)+1)):
  if m % i == 0:
    di.append(i)
    if i != m // i and a >=  m // i:
      di.append(m//i)
di.sort()
print(di[-1])

Verdicts: Wrong Answer

Accepted