input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
import math
N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, math.ceil(M / (N - 1))) if M % d == 0)
print(d)
| N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
d = max(d for d in range(1, M // N + 1) if M % d == 0)
print(d)
| p03241 |
import math
N, M = list(map(int, input().split()))
def divisors(M):
for d in range(1, math.floor(math.sqrt(M)) + 1):
if M % d == 0:
yield d
yield M // d
d = max(d for d in divisors(M) if d <= M // N)
print(d) | import math
N, M = list(map(int, input().split()))
sqrtM = math.floor(math.sqrt(M))
maxd = min(sqrtM, M // N)
d1 = max( d for d in range(1, maxd + 1) if M % d == 0)
d2 = max((M // d for d in range(N, sqrtM + 1) if M % d == 0), default=1)
print((max(d1, d2)))
| p03241 |
n,m = list(map(int,input().split()))
#素因数分解(素因数を並べたリスト)(ex:60→[2,2,3,5])
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
for _ in ra... | n,m = list(map(int,input().split()))
ls = []
for i in range(1,int(m**(1/2))+1):
if m % i == 0:
ls.append(i)
ls.append(m//i)
ls = sorted(list(set(ls)),reverse=True)
for j in ls:
if j*n <= m:
print(j)
break
| p03241 |
import itertools
N,M=list(map(int,input().split()))
def factorize(n):
fct = [] # prime factor
b, e = 2, 0 # base, exponent
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + 1, 0
if ... | import itertools
def factorize(n):
fct = [] # prime factor
b, e = 2, 0 # base, exponent
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + 1, 0
if n > 1:
fct.append((n, 1))... | p03241 |
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(1, s+1):
if M%i == 0:
ans = i
print(ans)
| N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(s, 0, -1):
if M % i == 0:
print(i)
break
| p03241 |
import fractions
N, M = list(map(int,input().split()))
MIN = 0
MAX = 10**9
while MAX - MIN > 1:
MID = (MAX+MIN)//2
if M/MID > N:
MIN = MID
else:
MAX = MID
for i in range(MAX,0,-1):
if i == 1:
print(i)
else:
if M % i == 0:
print(i)
... | N,M = list(map(int,input().split()))
MAX = int(M**(1/2))
ans = 0
for i in range(MAX,0,-1):
if M % i == 0:
j = M // i
if j >= N:
ans = max(ans,i)
if i >= N:
ans = max(ans,j)
print(ans) | p03241 |
n, m = list(map(int, input().split()))
num = []
i = 1
while i * i <= m:
if m % i == 0:
num.append(i)
if m // i != i:
num.append(m//i)
i += 1
ans = 0
for i in num:
if i <= m // n:
ans = max(ans, i)
print(ans) | import math
n, m = list(map(int, input().split()))
div = []
sqrt_m = int(math.sqrt(m))
for i in range(1, sqrt_m + 1):
if m % i == 0:
div.append(i)
div.append(m // i)
div.sort(reverse=True)
for i in div:
if m >= i * n and (m - i * n) % i == 0:
print(i)
exit() | p03241 |
n, m = list(map(int, input().split()))
div = m//n
INF = 10**18
ans = -INF
for i in range(1, div+1):
if m % i != 0:
continue
if ans < i:
ans = i
print(ans)
| n, m = list(map(int, input().split()))
div = m//n
INF = 10**18
ans = -INF
for i in reversed(list(range(1, div+1))):
if m % i != 0:
continue
if ans < i:
ans = i
break
print(ans)
| p03241 |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemge... | p03241 |
import itertools
def prime(M):
lst = []
i = 2
while M != 1:
if M % i == 0:
lst.append(i)
M = M // i
else:
i += 1
return lst
def volume(lst):
res = 1
for i in lst:
res *= int(i)
return res
N, M = list(map(int,... | import math
def prime(M):
if M == 1:
return [1]
lst = []
for i in range(1, int(math.sqrt(M)+1)):
if M % i == 0:
lst.append(i)
div = M // i
if div not in lst:
lst.append(div)
return sorted(lst)
N, M = list(map(int, in... | p03241 |
from itertools import combinations
def fact(M):
ans = []
while M > 1:
for i in range(2, M+1):
if M % i == 0:
ans.append(i)
M //=i
break
return ans
def solve(N, M):
ans = [1]
divs = fact(M)
cand = set([tuple(Xs)
... |
def solve(N, M):
ans = [1]
for D in range(2, M//N + 1):
if M >= N * D and M % D == 0:
ans.append(D)
return max(ans)
if __name__ == "__main__":
l = input().split(" ")
N, M = int(l[0]), int(l[1])
print((solve(N, M)))
| p03241 |
N, M = list(map(int, input().split()))
ceil = M / N
tmp = 1
mx = 0
while ceil >= tmp:
if (M - tmp * (N - 1)) % tmp == 0:
mx = tmp
tmp += 1
print(mx)
| N, M = list(map(int, input().split()))
ceil = M // N
for i in range(1,ceil+1)[::-1]:
tmp = M - i * (N - 1)
if tmp > 0 and tmp % i == 0:
print(i)
break
| p03241 |
import math
N, M = list(map(int, input().split()))
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
if M % i == 0 and M // i >= N:
mx = max(mx, i)
if M % i == 0 and i >= N:
mx = max(mx, M//i)
print(mx) | import math
N, M = list(map(int, input().split()))
mx = 0
for i in range(1, math.floor(math.sqrt(M))+1):
if M % i == 0:
if M // i >= N:
mx = max(mx, i)
if i >= N:
mx = max(mx, M//i)
print(mx) | p03241 |
N, M = list(map(int, input().split()))
mx = 0
for i in range(1, int(M**0.5)+1):
if M % i == 0:
if M // i >= N:
mx = max(mx, i)
if i >= N:
mx = max(mx, M//i)
print(mx)
| def make_divisors(div, n):
divisors = []
mx = 0
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if n // i >= div:
mx = max(mx, i)
if i != n // i:
divisors.append(n//i)
if i >= div:
... | p03241 |
N, M = list(map(int, input().split()))
tmp = M // N
ansMax = 0
for i in range(1, tmp + 1):
ansTmp = M - ((N - 1) * i)
if ansTmp % i == 0:
ansMax = i
print(ansMax) | N, M = list(map(int, input().split()))
tmp = M // N
ansMax = 0
y = []
for i in range(1, (int(M ** (0.5)) + 1)):
if M % i == 0:
y.append(i)
if i != M // i:
y.append(M // i)
y.sort()
for i in y:
if i <= tmp:
ansMax = i
else:
break
print(ansMax) | p03241 |
def main():
N, M = (int(i) for i in input().split())
def trial_division(n):
divs = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divs.append(i)
if i != n//i:
divs.append(n//i)
divs.sort(reverse=True)
... | def main():
def trial_division(n):
divs = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divs.append(i)
if i != n//i:
divs.append(n//i)
divs.sort(reverse=True)
return divs
N, M = (int(i) for i in inp... | p03241 |
import math
(N, M) = list(map(int, input().split()))
TMPM = M
MAX_SQRT = int(math.sqrt(M))
prime_flag = [True] * (MAX_SQRT+1)
primes = []
prime_flag[0] = False
prime_flag[1] = False
for i in range(2, MAX_SQRT+1):
mul = 2
while True:
p = i * mul
if p > MAX_SQRT:
bre... | import math
(N, M) = list(map(int, input().split()))
MAX_SQRT = int(math.sqrt(M))
prime_flag = [True] * (MAX_SQRT+1)
prime_dic = {}
prime_flag[0] = False
prime_flag[1] = False
for i in range(2, MAX_SQRT+1):
mul = 2
while True:
p = i * mul
if p > MAX_SQRT:
break
... | p03241 |
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
N,M=rl()
if M%N==0:
print(M//N)
else:
x = M//N
ans = 1
for i in range(x,0,-1):
if M%i != 0:
co... | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
N,M=rl()
if M%N==0:
print(M//N)
else:
x = M//N
ans = 1
for i in range(x,0,-1):
if M%i != 0:
co... | p03241 |
N, M = list(map(int, input().split()))
if N == 1:
print(M)
elif M % 2 == 1:
if M // N % 2 == 0:
if M % (M//N) == 0:
if M / (M//N) >= N:
print((M//N))
else:
for i in range(M//N - 1, 0, -2):
if M % i == 0:
... | N, M = list(map(int, input().split()))
if N == 1:
print(M)
else:
for i in range(max(int(M ** 0.5), M // N), 0, -1):
if M % i == 0:
if M / i >= N:
print(i)
break
| p03241 |
# -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
for i in range(1, M // 2 + 1):
if M % i == 0 and i >= N:
print((M // i))
exit()
print((1))
| # -*- coding: utf-8 -*-
import bisect
N, M = list(map(int, input().split()))
y = [1, M]
for i in range(2, int(M ** 0.5) + 1):
if M % i == 0:
y.append(i)
y.append(M // i)
y.sort()
print((M // y[bisect.bisect_left(y, N)]))
| p03241 |
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] = [int(i)... | [n,m] = [int(i) for i in input().split()]
if n == 1:
print(m)
else:
ans = -1
#a1は高々この値
a1_max = m // n
for i in range(a1_max,0,-1):
if (m - i) % i == 0 and (m - i)//i >= (n-1):
ans = max(ans,i)
print(ans)
| p03241 |
n,m=list(map(int,input().split()))
f1=[]
f2=[]
for i1 in range(1,int(m**0.5)+1):
if m%i1==0:
i2=m//i1
if i1>=n:
ans=i2
break
elif i2==n:
ans=i1
break
elif i2<n:
ans=f1[-1]
break
f1+=[i1]
... | n,m=list(map(int,input().split()))
for i1 in range(1,int(m**0.5)+1):
if m%i1==0:
i2=m//i1
if i1>=n:
ans=i2
break
elif i2==n:
ans=i1
break
elif i2<n:
ans=pre_i1
break
pre_i1=i1
else:
ans... | p03241 |
N,M = list(map(int,input().split()))
# 約数列挙
def enum_div(N):
ret = []
i = 1
while True:
if i**2 > N:
break
if N % i == 0:
ret.append(i)
if i**2 != N:
ret.append(N / i)
i += 1
return ret
ans = 0
for i in enum_d... | N,M = list(map(int,input().split()))
# 約数列挙
def enum_div(N):
ret = []
for i in range(1,int(N**0.5)+1):
if N % i == 0:
ret.append(i)
if i**2 != N:
ret.append(N // i)
i += 1
return ret
ans = 0
for i in enum_div(M):
if i >= N:
... | p03241 |
n,m=list(map(int,input().split()));print((next(v for v in range(m//n,-1,-1)if m%v<1))) | n,m=list(map(int,input().split()));print((next(v for v in range(m//n,-1,-1)if m%v==0))) | p03241 |
n,m=list(map(int,input().split()));print((next(v for v in range(m//n,-1,-1)if m%v==0))) | n,m=list(map(int,input().split()));print((next(v for v in range(m//n+1)[::-1]if m%v<1))) | p03241 |
from collections import deque
N, M = list(map(int, input().split()))
divisor = deque([])
for i in range(2, M + 1) :
if M % i == 0 :
divisor.append(i)
if i * N > M :
break
while divisor :
div = divisor.pop()
if M // div >= N :
print(div)
break
else :
... | N, M = list(map(int, input().split()))
def divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort(reverse=True)
return divisors
div = divisors(M)
f... | p03241 |
import sys
import collections
from math import ceil
ma = lambda : list(map(int,input().split()))
ni = lambda : int(eval(input()))
n,m = ma()
gcd = 1
for d in range(1,m//n+1):
q,r = divmod(m,d)
if r == 0 and q>=n:gcd = d
print(gcd)
| import sys
import collections
from math import ceil
ma = lambda : list(map(int,input().split()))
ni = lambda : int(eval(input()))
def divisor(n):
d = []
for i in range(1,int(n**0.5)+1):
if n%i == 0:
d.append(i)
if i != n//i:
d.append(n//i)
#d.sort(... | p03241 |
N,M = list(map(int,input().split()))
tmp = M//N
ans = 0
for i in range(1,tmp+1):
if M%i==0:
ans = i
print(ans) | N,M = list(map(int,input().split()))
tmp = M//N
ans = 0
for i in range(tmp,-1,-1):
if M%i==0:
ans = i
break
print(ans) | p03241 |
import sys
input = sys.stdin.readline
from math import sqrt
from bisect import bisect_right
def main():
n, m = list(map(int, input().strip().split()))
M = int(sqrt(m))
l = []
for i in range(1, M+1):
if m % i == 0:
l.append(i)
l.append(m // i)
l.sort()
k = m//n
ind = bisect_right(l, k)
#... | import sys
input = sys.stdin.readline
from math import sqrt
from bisect import bisect_right
def main():
n, m = list(map(int, input().strip().split()))
M = int(sqrt(m))
ans = 1
for i in range(1, M+1):
if m % i == 0:
if i*n <= m:
ans = max(ans, i)
if m//i * n <= m:
ans = max(ans, m//i)
... | p03241 |
n,m=list(map(int,input().split()))
for i in range(n,m+1):
if m%i==0:
print((m//i))
exit()
| n,m=list(map(int,input().split()))
for i in range(n,10**8):
if m%i==0:
print((m//i))
exit()
print((1))
| p03241 |
N, M = list(map(int, input().split()))
def factorize(n):
if n == 1:
return [1]
i, factors = 2, []
while i * i <= n:
while n % i == 0:
n //= i
factors.append(i)
i += 1
if n > 1:
factors.append(n)
return factors
factors = f... | from collections import Counter
N, M = list(map(int, input().split()))
def factorize(n):
if n == 1:
return [1]
i, factors = 2, []
while i * i <= n:
while n % i == 0:
n //= i
factors.append(i)
i += 1
if n > 1:
factors.append(n)
... | p03241 |
from collections import Counter
N, M = list(map(int, input().split()))
def factorize(n):
if n == 1:
return [1]
i, factors = 2, []
while i * i <= n:
while n % i == 0:
n //= i
factors.append(i)
i += 1
if n > 1:
factors.append(n)
... | N, M = list(map(int, input().split()))
def make_divisors(n):
i, divisors = 1, []
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
i += 1
return divisors
ans = 0
for x in make_divisors(M):
... | p03241 |
N, M = list(map(int, input().split()))
def make_divisor_list(num, N):
if num < 1:
return 0
elif num == 1:
return 1
else:
max_num = 1
for i in range(2, num // N + 1):
if num % i == 0:
# 割り切れる=約数
if num / i >= N:
... | N, M = list(map(int, input().split()))
def make_divisor_list(num, N):
if num < 1:
return 0
elif num == 1:
return 1
else:
max_num = 1
for i in reversed(list(range(2, num // N + 1))):
if num % i == 0:
# 割り切れる=約数
if num ... | p03241 |
N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
exit() | def main():
N, M = list(map(int, input().split()))
for i in range(M // N, 0, -1):
if M % i == 0:
print(i)
break
if __name__ == '__main__':
main() | p03241 |
n, m = list(map(int, input().split()))
def divisor(num):
opside = num
i = 2
div = [1, opside]
while i <= opside:
if num % i == 0:
opside = num // i
if i == opside:
div.append(i)
elif opside <= i:
break
... | n, m = list(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... | p03241 |
N,M=list(map(int,input().split()))
ans=0
for i in range(1,M//N+1):
if M%i==0:
ans=max(ans,i)
print(ans) | N,M=list(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=0
table=make_divisors(M)... | p03241 |
import math
N, M = [int(i) for i in input().split()]
for i in range(math.ceil(M/N), 0, -1):
if M % i == 0:
print(i)
break
| import math
N, M = [int(i) for i in input().split()]
for i in range(M//N, 0, -1):
if M % i == 0:
print(i)
break
| p03241 |
n,m=list(map(int,input().split()))
a=m//n
ans=1
for i in range(1,a+1):
if m%i==0:
ans=max(ans,i)
print(ans)
| import sys
n,m=list(map(int,input().split()))
a=m//n
ans=1
if m%n==0:
print((int(m//n)))
sys.exit()
for i in range(1,a+1):
if m%i==0:
ans=max(ans,i)
print(ans)
| p03241 |
import sys
#+++++
def main():
n,m = list(map(int, input().split()))
if n == 1:
return m
ret = 0
for i in range(1,m):
a = m // i
b = m % i
if b == 0 and n*i <= m:
ret = i
if n*i > m:
return ret
if ret == 1 and i*i > m:
return 1
print(ret)
#+++++
i... | import sys
import math
#+++++
def main():
n,m = list(map(int, input().split()))
if m % n ==0:
return m // n
ll=1
for i in range(1, int(math.sqrt(m))+1):
#pa((i,ll))
if m % i == 0:
if i >= n:
ll=max(ll, m // i)
if m // i >= n:
ll=max(ll, i)
return ll
#+++++
... | p03241 |
def make_divisors(n,m):
divisors = []
for i in range(1, (m//n)+1):
if m % i == 0:
divisors.append(i)
if i != m // i and m//i<=m//n:
divisors.append(m//i)
return divisors
n,m=list(map(int,input().split()))
print((max(make_divisors(n,m))))
| def make_divisors(n,m):
divisors = []
for i in range(1,min(int(m**(1/2))+1,int(m//n)+1)):
if m % i == 0:
divisors.append(i)
if i != m // i and m//i<=m//n:
divisors.append(m//i)
return divisors
n,m=list(map(int,input().split()))
print((max(make_divisors(n,m)))... | p03241 |
def make_divisors(n,m):
divisors = []
for i in range(1,min(int(m**(1/2))+1,int(m//n)+1)):
if m % i == 0:
divisors.append(i)
if i != m // i and m//i<=m//n:
divisors.append(m//i)
return divisors
n,m=list(map(int,input().split()))
print((max(make_divisors(n,m)))... | n,m=list(map(int,input().split()))
def yak1(n,m):
l=[]
for i in range(1,min(int((m)**(1/2))+1,(m//n)+1)):
if m%i==0:
l.append(i)
if m//i!=i and m//i<=m//n:
l.append(m//i)
return l
print((max(yak1(n,m))))
| p03241 |
import bisect
n, m = list(map(int, input().split()))
fct = []
fct2 = []
sq = int(m**(1/2))
if sq + 1 ==m:
sq += 1
for f in range(1, sq + 1):
if m%f == 0:
fct.append(f)
fct2.append(m//f)
if fct2[-1] == fct[-1]:
fct2.pop()
fct2.reverse()
fct += fct2
k = m//n
ind = bis... | import bisect
n,m = list(map(int, input().split( )))
t = m//n
fct_sup = int(m**(1/2)) + 1
fct = []
fct2 = []
for f in range(1,fct_sup+1):
if m%f == 0:
fct.append(f)
fct2.append(m//f)
if fct[-1] == fct2[-1]:
fct.pop()
fct2.reverse()
fct += fct2
i = bisect.bisect_right(fct,t)
... | p03241 |
n, m = list(map(int, input().split()))
d = m//n+1
for x in range(d)[::-1]:
if m%x==0:
break
print(x) | N, M = list(map(int, input().split(" ")))
def solv(N, M):
d = M//N
for i in range(d+1)[::-1]:
if M%i == 0:
return i
print((solv(N, M))) | p03241 |
import sys
from io import StringIO
import unittest
import os
# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)
# 実装を行う関数
def resolve(test_def_name=""):
n, m = list(map(int, input().split()))
ans = []
for i in range(1, m // n + 1):
if (m - i * n) % i == 0:
... | import sys
from io import StringIO
import unittest
import os
# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)
# 実装を行う関数
def resolve(test_def_name=""):
n, m = list(map(int, input().split()))
for i in reversed(list(range(1, m // n + 1))):
if (m - i * n) % i == 0:
... | p03241 |
N,M = list(map(int,input().split()))
if M % N == 0: print((M//N))
else:
for i in range(N,M//2+1):
if M % i == 0:
print((M//i))
break
else:
print((1))
| N,M = list(map(int,input().split()))
if M % N == 0: print((M//N))
elif M//N > 100000:
for i in range(N,M//2+1):
if M % i == 0:
print((M//i))
break
else:
print((1))
else:
m = M//N
for i in range(2,m)[::-1]:
if M % i == 0:
print... | p03241 |
N, M = list(map(int, input().split()))
x = M//N
max = 1
for i in range(1, x+1):
mod = M - (N-1)*i
if mod%i == 0:
if max < i:
max = i
print(max) | N, M = list(map(int, input().split()))
x = M//N
max = 1
for i in range(x, 0, -1):
mod = M - (N-1)*i
if mod%i == 0:
max = i
break
print(max) | p03241 |
N,M = list(map(int,input().split()))
div = 1
for i in range(2,M//N+1):
if M%i==0:
div = i
print(div)
| N,M = list(map(int,input().split()))
div = 1
for i in range(2,M//N+1)[::-1]:
if M%i==0:
div = i
break
print(div)
| p03241 |
n, m = list(map(int, input().split()))
lstDiv = []
k = 1
while k * k <= m:
div, r = divmod(m, k)
if r == 0:
lstDiv.append(k)
lstDiv.append(div)
k += 1
lstDiv = sorted(lstDiv, reverse=True)
for div in lstDiv:
if div * n <= m:
print(div)
break | from bisect import bisect_left
n, m = list(map(int, input().split()))
st = set()
i = 1
while i * i <= m:
if m % i == 0:
st.add(i)
st.add(m // i)
i += 1
divs = tuple(sorted(st))
i = bisect_left(divs, n)
print((m // divs[i]))
| p03241 |
from bisect import bisect_left
n, m = list(map(int, input().split()))
st = set()
i = 1
while i * i <= m:
if m % i == 0:
st.add(i)
st.add(m // i)
i += 1
divs = tuple(sorted(st))
i = bisect_left(divs, n)
print((m // divs[i]))
| def main():
N, M = list(map(int, input().split()))
st = {1, M}
d = 2
while d * d <= M:
if M % d == 0:
st.add(d)
st.add(M // d)
d += 1
ans = 1
for d in st:
if d >= N:
e = M // d
ans = max(ans, e)
print(a... | p03241 |
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): re... | import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return... | p03241 |
from math import sqrt
N, M = list(map(int, input().split()))
ans = max(M // i if M // i <= M / N else i for i in range(1, int(sqrt(M)) + 1) if M % i == 0 and i <= M / N)
print(ans) | N, M = list(map(int, input().split()))
# Mの約数dのうち、 dN <= M を満たす最大のdが解
ans = max(
(
M // d if (M // d) * N <= M else
d if d * N <= M else
1
)
for d in range(1, int(M**0.5) + 10)
if M % d == 0
)
print(ans)
| p03241 |
#!/mnt/c/Users/moiki/bash/env/bin/python
N, M = list(map(int, input().split()))
# N splited by number of M
import math
plist = [2]
for i in range(3, int(1e5+1)):
ok = True
for j in plist:
if j > math.sqrt(i):
break
elif i % j == 0:
ok = False
... | #!/mnt/c/Users/moiki/bash/env/bin/python
N, M = list(map(int, input().split()))
# N splited by number of M
import math
plist = [2]
for i in range(3, int(1e5+1)):
ok = True
for j in plist:
if j > math.sqrt(i):
break
elif i % j == 0:
ok = False
... | p03241 |
N,M = list(map(int,input().split()))
for gcd in range(M // N,0,-1):
if M % gcd == 0:
print(gcd)
break | def calc():
N,M = list(map(int,input().split()))
for gcd in range(M // N,0,-1):
if M % gcd == 0:
break
return(gcd)
print((calc())) | p03241 |
def calc():
N,M = list(map(int,input().split()))
gcd = M // N
while gcd > 0:
tmp = M - gcd
if tmp % gcd == 0:
break
gcd = gcd - 1
return(gcd)
print((calc())) | def calc():
N,M = list(map(int,input().split()))
for gcd in range(M // N,0,-1):
if M % gcd == 0:
break
return(gcd)
print((calc())) | p03241 |
N, M = list(map(int,input().split()))
d = int(M/N)
def solve():
i = 0
while True:
if M%(N+i+1) == 0:
print((int(M/(N+i+1))))
break
i += 1
if M%N == 0:
print(d)
else:
solve() | N, M = list(map(int,input().split()))
d = int(M/N)
def solve():
ans = 1
for i in range(M//N+1, 0, -1):
if M % i == 0:
if (M // i) >= N:
print(i)
break
# i = 0
# while True:
# if M%(N+i+1) == 0:
# print(int(M/(N+i+1)))
# break
# i... | p03241 |
N, M = list(map(int,input().split()))
d = int(M/N)
def solve():
# ans = 1
# for i in range(M//N+1, 0, -1):
# if M % i == 0:
# if (M // i) >= N:
# print(i)
# break
for i in range(d):
if M%(d-i) == 0:
print((d-i))
break
... | N, M = list(map(int,input().split()))
d = int(M/N)
def solve():
# ans = 1
# for i in range(M//N+1, 0, -1):
# if M % i == 0:
# if (M // i) >= N:
# print(i)
# break
for i in range(d+1,0,-1):
if M%i == 0:
print(i)
break
#... | p03241 |
def divisor(n):
i = 1
res = []
while i*i <= n:
if n%i == 0:
res.append(i)
if n//i not in res:
res.append(n//i)
i += 1
res.sort()
return res
def main():
n, m = list(map(int, input().split()))
md = divisor(m)
ans = 0
... | def divisor(n):
i = 1
res = []
for i in range(1, int(n**.5) + 1):
if n%i == 0:
res.append(i)
if n//i not in res:
res.append(n//i)
res.sort()
return res
def main():
n, m = list(map(int, input().split()))
md = divisor(m)
ans = ... | p03241 |
def divisor(n):
i = 1
res = []
for i in range(1, int(n**.5) + 1):
if n%i == 0:
res.append(i)
if n//i not in res:
res.append(n//i)
res.sort()
return res
def main():
n, m = list(map(int, input().split()))
md = divisor(m)
ans = ... | def divisor(n):
i = 1
res = []
for i in range(1, int(n**.5) + 1):
if n%i == 0:
res.append(i)
if n//i not in res:
res.append(n//i)
res.sort(reverse=True)
return res
def main():
n, m = list(map(int, input().split()))
md = divisor(m)... | p03241 |
N, M = list(map(int, input().split()))
print((max(d for d in range(1, M // N + 1) if M % d == 0)))
| N, M = list(map(int, input().split()))
print((next(d for d in reversed(list(range(M // N + 1))) if M % d == 0))) | p03241 |
def divisors(N):
res = []
i = 1
while i * i <= N:
q, r = divmod(N, i)
if r == 0:
res.append(i)
if i != q:
res.append(q)
i += 1
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M)... | def divisors(N):
res = []
i = 1
while i * i <= N:
q, r = N // i, N % i
if r == 0:
res.append(i)
if i != q:
res.append(q)
i += 1
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M... | p03241 |
def divisors(N):
res = []
i = 1
while i * i <= N:
q, r = N // i, N % i
if r == 0:
res.append(i)
if i != q:
res.append(q)
i += 1
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M... | def divisors(N):
res = []
i = 1
while i * i <= N:
if N % i == 0:
res.append(i)
q = N // i
if i != q:
res.append(q)
i += 1
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) ... | p03241 |
def divisors(N):
res = []
i = 1
while i * i <= N:
if N % i == 0:
res.append(i)
if i * i != N:
res.append(N // i)
i += 1
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) if d * N <= M))... | def divisors(N):
res = []
i = 1
while i * i < N:
if N % i == 0:
res.append(i)
res.append(N // i)
i += 1
if i * i == N and N % i == 0:
res.append(i)
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in di... | p03241 |
def divisors(N):
res = []
i = 1
while i * i < N:
if N % i == 0:
res += [i, N // i]
i += 1
if N % i == 0:
res.append(i)
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) if d * N <= M)))
| def divisors(N):
res = []
i = 1
for i in range(1, int(N ** 0.5)):
if N % i == 0:
res += [i, N // i]
if N % i == 0:
res.append(i)
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) if d * N <= M)))
| p03241 |
def divisors(N):
i = 1
U = int(N ** 0.5)
res = []
for i in range(1, U):
if N % i == 0:
res += [i, N // i]
if N % i == 0:
res.append(i)
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) if d * N <= M)))
| def divisors(N):
U = int(N ** 0.5)
res = []
for i in range(1, U):
if N % i == 0:
res += [i, N // i]
if N % U == 0:
res.append(U)
res.sort()
return res
N, M = list(map(int, input().split()))
print((max(d for d in divisors(M) if d * N <= M)))
| p03241 |
n,m = list(map(int,input().split(" ")))
for i in range(0,m-n+1):
if m%(n+i) == 0:
print((int(m/(n+i))))
break | n,m = list(map(int,input().split(" ")))
i_m = m
import math
root_m = int(math.sqrt(m))
m_s = []
for i in range(2,root_m+1):
while m%i == 0:
m_s.append(i)
m = int(m/i)
if m == 1:
break
if m ==1:
break
if m_s == []:
if n == 1:
print(i_m)... | p03241 |
N,T = list(map(int,input().split()))
d = int(T / N)
if T % N == 0:
print (d)
else:
for i in range(d+1,0,-1):
if T % i ==0:
print(i)
break
| N,T = list(map(int,input().split()))
d = int(T / N)
def ans():
for i in range(d+1,0,-1):
if T % i ==0:
print(i)
break
if T % N == 0:
print (d)
else:
ans() | p03241 |
import math
n,m = list(map(int,input().split()))
flag = False
for i in range(2,int(math.sqrt(m)+1)):
if m % i == 0:
flag = True
break
if flag == True:
for i in range(int(m/n),0,-1):
if m % i == 0:
print(i)
break
else:
print((1)) | n,m = list(map(int,input().split()))
def yakusuu(n,m):
for i in range(int(m/n),0,-1):
if m % i == 0:
print(i)
break
yakusuu(n,m)
| p03241 |
N, M = list(map(int, input().split()))
tmp=0
if N==1:
print(M)
tmp=1
else:
for i in range(M-N):
k = i + N
if M % k == 0:
print((int(M/k)))
tmp=1
break
if tmp==0:
print((1)) | N, M = list(map(int, input().split()))
tmp=0
if N==1:
print(M)
tmp=1
else:
for i in range(int(M**0.8)+1):
k = i + N
if M % k == 0:
print((int(M/k)))
tmp=1
break
if tmp==0:
print((1))
| p03241 |
N, M = list(map(int, input().split()))
D = []
d = 1
while M >= N * d:
if M % d == 0:
D.append(d)
d += 1
print((max(D))) | N, M = list(map(int, input().split()))
def divisible(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 = divisible(M)
div = [d for d in div if d <= M / N]
print((max(div))) | p03241 |
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readl... | p03241 |
N,M = list(map(int,input().strip().split()))
ans = 1
i = 0
while M//2 >= N+i:
if M%(N+i) == 0:
ans = M//(N+i)
break
else:
i += 1
print(ans) | import math
N,M = list(map(int,input().strip().split()))
ans = 1
i = 0
def is_prime(num):
if num < 2:
return False
if num == 2 or num == 3 or num == 5:
return True
if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
return False
prime = 7
step = 4
num_sqrt... | p03241 |
INFTY = 10**5
P = [1 for _ in range(INFTY)]
P[0]=0
P[1]=0
for i in range(2,int(INFTY**0.5)+1):
for j in range(i*i,INFTY,i):
P[j] = 0
Q = []
for i in range(INFTY):
if P[i]==1:
Q.append(i)
N,M = list(map(int,input().split()))
y = 1
for q in Q:
if M%q==0:
y = 0
b... | N,M = list(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) | p03241 |
N,M = list(map(int,input().split()))
if N==1:
nmax=M
else:
nmax = 1
for i in range(2,int(M**0.5)+1):
if M%i==0 and M//i>=N:
nmax = max(nmax,i)
if M%i==0 and i>=N:
nmax = max(nmax,M//i)
print(nmax) | N,M = list(map(int,input().split()))
amax = 1
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if b>=N:
amax = max(amax,a)
a,b = b,a
if b>=N:
amax = max(amax,a)
print(amax) | p03241 |
N,M = list(map(int,input().split()))
amax = 1
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if b>=N:
amax = max(amax,a)
a,b = b,a
if b>=N:
amax = max(amax,a)
print(amax) | N,M = list(map(int,input().split()))
g = 0
for i in range(1,int(M**0.5)+1):
if M%i==0:
a = i
b = M//i
if a>=N:
g = max(g,b)
if b>=N:
g = max(g,a)
print(g) | p03241 |
N, M = list(map(int, input().split()))
re = 1
for i in range(1, M // N + 1):
if M % i == 0:
a = M // i
if a >= N:
re = i
else:
break
print(re) | def factorize(n):
fct = []
b, e = 2, 0
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + 1, 0
if n > 1:
fct.append((n, 1))
return fct
def divisorize(fct):
b, e... | p03241 |
n, m = list(map(int, input().split()))
def solve():
res = 1
for i in range(1, m//n+1):
if m % i == 0:
if (m // i) >= n:
res = max(res, i)
print(res)
solve()
| n, m = list(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()
| p03241 |
n, m = list(map(int, input().split()))
for i in range(m//n, 0, -1):
if m%i==0:
break
print(i) | def solve():
n, m = list(map(int, input().split()))
for i in range(m//n, 0, -1):
if m%i==0:
break
print(i)
if __name__=='__main__':
solve() | p03241 |
n,m = list(map(int,input().split()))
ans = 0
tmp = 1
while True:
num = m - tmp*(n-1)
if num < tmp:
break
elif num % tmp == 0:
ans = tmp
tmp += 1
print(ans) | n,m = list(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
ans = 1
lst = make_divisors(m)
lst.sort()
for d in lst:
... | p03241 |
N, M = list(map(int, input().split()))
i = 1
lis = []
while M//i>=N and i<=M**0.5:
if M % i == 0:
lis.append(i)
i += 1
for l in lis[::-1]:
ans = M//l
if M//ans>=N:
lis.append(ans)
print((lis[-1])) | def divisor(n):
cd = []
i = 1
while i*i <= n:
if n%i==0:
cd.append(i)
if i != n//i:
cd.append(n//i)
i += 1
return cd
N, M = list(map(int, input().split()))
cd = divisor(M)
cd.sort(reverse=True)
for c in cd:
if M//c>=N:
print(c)
break | p03241 |
n,m = list(map(int,input().split()))
ans = 1
for i in range(1,m//n+1):
rest = m - (i * (n - 1))
if rest % i == 0:
ans = i
print(ans) | import sys
n,m = list(map(int,input().split()))
ans = 1
for i in range(m//n,0,-1):
rest = m - (i * (n - 1))
if rest % i == 0:
print(i)
sys.exit()
| p03241 |
n,m=list(map(int,input().split()))
for i in range(m//n+1)[::-1]:
if m%i==0:
print(i)
exit()
| def f():
n,m=list(map(int,input().split()))
for i in range(m//n+1)[::-1]:
if m%i==0:return i
print((f())) | p03241 |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def is_prime(n):
if n == 1:
return False
for i in range(2,int(n**0.5)+1):
if n % i == 0:
return False
return True
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def is_prime(n):
if n == 1:
return False
for i in range(2,int(n**0.5)+1):
if n % i == 0:
return False
return True
... | p03241 |
import math
N, M = [int(i) for i in input().split()]
ans = 1
for i in range(N, M):
if M % i == 0:
ans = M / i
break
print((int(ans))) | import math
N, M = [int(i) for i in input().split()]
ans = 1
sosu = True if M % 2 == 1 else False
if M % 2 == 1:
sqrt = int(math.ceil(math.sqrt(M)))
for i in range(3, sqrt, 2):
if M % i == 0:
sosu = False
break
if sosu == False:
for i in range(N, M):
... | p03241 |
import itertools
n,m=list(map(int,input().split()))
mv=m
l=[]
for i in range(2,int(m**0.5)+1):
while m%i==0:
l.append(i)
m//=i
if m>1:l.append(m)
elif m==1 and l is None:l.append(1)
comb=set()
for i in range(len(l)+1):
for x in itertools.combinations(l,i):
comb.add(x)
ans=1
for i in comb:
... | n,m=list(map(int,input().split()))
divis=[]
for i in range(1,int(m**0.5)+1):
if m%i==0:
divis.append(i)
if i!=m//i:
divis.append(m//i)
ans=1
for i in divis:
if i<=m//n:
ans=max(ans,i)
print(ans) | p03241 |
from collections import Counter
def factorization(n):
arr = Counter()
temp = n
for i in range(2, int(-(-n**0.5 // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
arr[i] = cnt
if temp... | from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
def factorization(n):
arr = Counter()
temp = n
for i in range(2, int(-(-n**0.5 // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //... | p03241 |
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
def factorization(n):
arr = Counter()
temp = n
for i in range(2, int(-(-n**0.5 // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //... | from math import sqrt
N, M = list(map(int, input().split()))
ans = 1
for i in range(1, int(sqrt(M)) + 1):
if M % i == 0:
j = M // i
if M / N >= j:
ans = max(ans, j)
elif M / N >= i:
ans = max(ans, i)
print(ans)
| p03241 |
import sys
input= sys.stdin.readline
N,M = list(map(int,input().split()))
g=max(M//N,M**0.5)#最大公約数になる可能性のある最大値
for i in range(M-N+1):
if M%(N+i)==0:
print((M//(N+i)))
exit() | import sys
input= sys.stdin.readline
N,M = list(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() | p03241 |
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) | N,M = list(map(int,input().split()))
d = set()
m = 1
while m*m <= M:
if M%m==0:
d.add(m)
d.add(M//m)
m += 1
ans = 1
for n in d:
m = M//n
if m >= N:
ans = max(ans,n)
print(ans) | p03241 |
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]]
... | 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 = list(map(int, input().split()))
ans = 1
div = make_divis... | p03241 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from bisect import bisect
def inpl(): return list(map(int, input().split()))
def primes(N):
sieve = [True]*(N+1)
sieve[:2] = [False, False]
for i in range(4, N+1, 2):
sieve[i] = False
for i in range(3, N+1, 2):
if ... | # -*- coding: utf-8 -*-
from math import sqrt, ceil
def inpl(): return list(map(int, input().split()))
N, M = inpl()
ans = 1
for i in range(1, ceil(sqrt(M))+1):
if M%i != 0:
continue
d = M // i
if M >= N*i:
ans = max(i, ans)
if M >= N*d:
ans = max(d, ans)
print(a... | p03241 |
from math import *
def main():
N, M = list(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([i for i in divisor_set if special_value >= i]))))
... | from math import *
def main():
N, M = list(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 e... | p03241 |
from math import *
N, M = list(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)))) | from math import *
def main():
N, M = list(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 e... | p03241 |
import math
n, m = list(map(int, input().split()))
for i in range(1, math.floor(m/n) + 1):
if m % i == 0:
ans = i
print(ans) | import math
n, m = list(map(int, input().split()))
for i in range(math.floor(m/n), 0, -1):
if m % i == 0:
ans = i
break
print(ans)
| p03241 |
N,M = list(map(int, input().split()))
li = []
for i in range(1, M + 1):
if i * i > M:
break
if M % i == 0:
li.append(i)
li.append(M // i)
ans = 1
li.sort(reverse=True)
for i in li:
if N * i <= M:
ans = i
break
print(ans)
| # D. Partition
# https://atcoder.jp/contests/abc112/tasks/abc112_d
# 約数列挙
def make_divisors(n):
lower_divisors = []
upper_divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.appen... | p03241 |
from collections import Counter
n, m = list(map(int, input().split()))
def factorize(m):
c = Counter()
t = 2
while t**2 <= m:
if m % t:
t += 1
continue
while not m%t:
c[t] += 1
m //= t
if m > 1:
c[m] += 1
return ... | from math import sqrt
n, m = list(map(int, input().split()))
ans = 1
for i in range(int(sqrt(m))):
if m%(i+1)==0:
if n <= m//(i+1) : ans= max(ans, i+1)
if n <= i+1 : ans = max(ans,m//(i+1))
print(ans) | p03241 |
N, M = [int(_) for _ in input().split()]
def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
result = 1
a = 1
while True:
b = M - (a * (N - 1))
if b < 1:
break
# print(a, b)
x = gcd(a, b)
result = max(result, x)
a += ... | import math
N, M = [int(_) for _ in input().split()]
sr = int(math.sqrt(M))
result = 1
for i in range(sr, 0, -1):
if M % i == 0:
r = i
if M >= N * r:
result = max(r, result)
r = M // i
if i >= N:
result = max(r, result)
print(result) | p03241 |
import sys
def main():
N, M = list(map(int, input().split()))
s = M // N # 答えはs以下
m = M % N
for i in range(s, 0, -1):
if m % s == 0:
print(s)
sys.exit()
else:
s -= 1
m += N
main()
| import sys
def main():
N, M = list(map(int, input().split()))
s = M // N # 答えはs以下
m = M % N
for i in range(s, 0, -1):
if m % i == 0:
print(i)
sys.exit()
else:
m += N
main()
| p03241 |
import sys
# input = sys.stdin.buffer.readline
def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getlist():
return list(map(int, input().split()))
import math
import heapq
import fractions
from collections import defaultdict, Counter, deque
MOD = 10**9... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left, bisect_right
import heapq
impo... | p03241 |
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:
... | 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:
... | p03241 |
N, M = list(map(int, input().split(" ")))
flg = 0
for i in range(N, M+1):
if M % i == 0:
print((M//i))
flg = 1
break
if i**2 > M:
break
if flg == 0:
for i in range(M//N, 0, -1):
if M % i == 0:
print (i)
break | def primeFactor(N):
i = 2
ret = {}
n = N
if n < 0:
ret[-1] = 1
n = -n
if n == 0:
ret[0] = 1
while i**2 <= n:
k = 0
while n % i == 0:
n //= i
k += 1
ret[i] = k
i += 1
if n > 1:
ret[n] ... | p03241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.