ZhenlongDai/ACPR huggingface dataset:
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
g=1
for i in range(1,int(M**(1/2))):
  if M%i==0:
    if i>=N:
      g=M/i
      print(g)
      exit()
    elif i<=M/N:
      g=i
print(g)

Failing test case input:
011100 1001111011

Expected output:
79033


Actual output:
79033.0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
g=1
for i in range(1,int(M**(1/2))+1):
  if M%i==0:
    if i>=N:
      g=M/i
      print(int(g))
      exit()
    elif i<=M/N:
      g=i
print(int(g))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

x=math.floor(math.sqrt(m))

y=math.floor(m/n)

ans=1
for i in range(1,x+1):
  if(m % i==0):
    if i <= y:
      ans=max(ans,i)
    if m/i <= y:
      ans=max(ans,m/i)
print(ans)


Failing test case input:
2 324

Expected output:
162


Actual output:
162.0


Fixed submission (verdict: Accepted):
import math

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

x=int(math.sqrt(m))

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

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
011000 1111111001

Expected output:
95563


Actual output:
21593


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ans = 1
x = 1
while x * x <= M:
    if M % x == 0:
        if x >= N:
            ans = max(ans, M
        if M
            ans = max(ans, x)
    x += 1
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
a = list(map(int,input().split()))

b = a[1]

c = []

for i in range(1,int(math.sqrt(a[1]))):
    if a[1] % i == 0 and i <= b:
        c.append(i)
c.reverse()
for i in c:
    if a[1] % i == 0:
        print(i)
        break

Failing test case input:
111100 1111111111

Expected output:
9091


Actual output:
11111


Fixed submission (verdict: Accepted):
import math
a = list(map(int,input().split()))

b = a[1]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] 
            c.append(a[1] 
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


		
def main():
	n,m = map(int, input().split())
	if n == 1:
		return m
	
	ret = 0
	for i in range(1, m):
		a = m 
		b = m % i
		if b == 0 and n*i < m:
			ret = i
			
		if n*i > m:
			return ret
			
	print(ret)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Failing test case input:
100000 1000000000

Expected output:
10000

Actual output:
8000


Fixed submission (verdict: Accepted):
import sys
import math




		
def main():
	n,m = map(int, input().split())
	if m % n ==0:
		return m 
		
	ll=1
	for i in range(1, int(math.sqrt(m))+1):
		
		if m % i == 0:
			if i >= n:
				ll=max(ll, m 
			if m 
				ll=max(ll, i)
	return ll
				


isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ans = 1
for i in range(1, M + 1):
  if i * i > M:
    break
  if M % i == 0 and i > ans and M / i >= N:
    ans = i
  if M % i == 0 and M / i > ans and i >= N:
    ans = M / i
print(ans)

Failing test case input:
011100 1011111011

Expected output:
86813


Actual output:
86813.0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ans = 1
for i in range(1, M + 1):
  if i * i > M:
    break
  if M % i == 0 and i > ans and M / i >= N:
    ans = i
  if M % i == 0 and M / i > ans and i >= N:
    ans = int(M / i)
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = [int(item) for item in input().split()]

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

Failing test case input:
011000 1111111001

Expected output:
95563


Actual output:
21593


Fixed submission (verdict: Accepted):
import math
n, m = [int(item) for item in input().split()]

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

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
g=1
for i in range(1,int(M**(1/2))+1):
  if M%i==0:
    if i>=N:
      g=M/i
      print(g)
      exit()
    elif i<=M/N:
      g=i
print(int(g))

Failing test case input:
010000 1010000000

Expected output:
101000


Actual output:
101000.0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
g=1
for i in range(1,int(M**(1/2))+1):
  if M%i==0:
    if i>=N:
      g=M/i
      print(int(g))
      exit()
    elif i<=M/N:
      g=i
print(int(g))
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
        break
if m >N:
    for i in range(N, m):
        if M % i == 0:
            x = M 
            break
if x == 0:
    for i in reversed(range(1,m+1)):
        if M % i == 0:
            x = i
            break
print(x)

Failing test case input:
100101 1110110010

Expected output:
11069


Actual output:
33207


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
        break
if m >N:
    for i in range(N, m):
        if M % i == 0:
            x = M 
            break
if x == 0:
    for i in reversed(range(1, M 
        if M % i == 0:
            x = i
            break
print(x)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, M):
        if i > math.floor(pow(M,0.7)):
            print(ans)
            exit()
        if M % i == 0:
            if M / i < N:
                print(ans)
                exit()
            else:
                ans = i

Failing test case input:
000100 1010000101

Expected output:
10000001


Actual output:
909091


Fixed submission (verdict: Accepted):
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
                A.append(i)
            if M/i <= M
                A.append(int(M/i))
    A.sort()
    print(A[-1])

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
001111 1011111101

Expected output:
910091


Actual output:
19591


Fixed submission (verdict: Accepted):
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=int(M/i)
        break
    if M%i==0 and M/i>=N:
        max=i
print(max)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

q = int(math.sqrt(m))+10
li = [0 for i in range(10**5)]

for i in range(1,q):
    if (m%i) == 0:
        li[i] = 1
        
ans = 1
for i in range(1,q):
    if (li[i]==1) and (i*n<m):
        ans = i

print(ans)
    

Failing test case input:
000001 1010011101

Expected output:
1010011101


Actual output:
18183


Fixed submission (verdict: Accepted):
import math

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

q = int(math.sqrt(m))+1
li = [0 for i in range(10**6)]

for i in range(1,q):
    if (m%i) == 0:
        li[i] = 1
        
ans = 1
for i in range(1,q):
    if (li[i]==1) and (i*n<=m):
        ans = max(i,ans)
        
    if (li[i]==1) and (m*n<=m*i):
        ans = max((m/i),ans)
    

print(int(ans))
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = list(map(int, input().split(' ')))
p = []
for ct in range(2, 100000):
    if M % ct == 0:
        p.append(ct)
p.append(M)















ans = 1
for t in p:
    if M / N >= t:
        ans = t
print(ans)

Failing test case input:
000100 1010000101

Expected output:
10000001


Actual output:
1111


Fixed submission (verdict: Accepted):
N, M = list(map(int, input().split(' ')))
p = []
for ct in range(2, 10000000):
    if M % ct == 0:
        p.append(ct)
        p.append(M
p.append(M)




 


 







ans = 1
for t in sorted(p):
    if M / N >= t:
        ans = t
print(ans)

Problem: p03241
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, M = map(int, input().split())
for i in range(N):
    if M % (N-i) == 0:
        print(N-i)
        quit()

Failing test case input:
101100 1000110000

Expected output:
9805


Actual output:
100011


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
if M % N == 0:
    print(M 
    quit()
for i in range(M
    if M % (M
        print(M
        quit()

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  
  mx=1
  for i in range(2,int(math.sqrt(b))+100):
    if b%i==0:
      if i*a<=b:
        mx=i
  return mx


print(main())


Failing test case input:
001010 1000100000

Expected output:
912500


Actual output:
29200


Fixed submission (verdict: Accepted):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

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

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

def main():
  n,m=LI()

  if n==1:
    return m

  a=0
  for i in range(1,int(math.sqrt(m))+1):
    if m%i==0:
      if m>=i*n:
        a=max(a,i)
      if m>=m
        a=max(a,m

  return a


print(main())

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
a=M
x=0
for i in reversed(range(2,a+1)):
    if M%i==0:
        x=i
        break
print(x)


Failing test case input:
5 123

Expected output:
3


Actual output:
123


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
a=M
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M
            x=M
            break
print(x)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ans = 1
if N == 1:
    print(M)
else:
    for n in range(2, int(M ** 0.5) + 1):
        X = M - (n * N)
        if X % n == 0 and X >= 0:
            ans = n
    print(ans)


Failing test case input:
001010 1000110000

Expected output:
980500


Actual output:
31450


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ans = 1
if N == 1:
    print(M)
else:
    for n in range(2, int(M ** 0.5) + 1):
        if M % n == 0 and M / N >= n:
            ans = max(ans, n)
            if M 
                ans = max(ans, M 
    print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
100000 1000000000

Expected output:
10000

Actual output:
[1, 1000000000, 2, 500000000, 4, 250000000, 5, 200000000, 8, 125000000, 10, 100000000, 16, 62500000, 20, 50000000, 25, 40000000, 32, 31250000, 40, 25000000, 50, 20000000, 64, 15625000, 80, 12500000, 100, 10000000, 125, 8000000, 128, 7812500, 160, 6250000, 200, 5000000, 250, 4000000, 256, 3906250, 320, 3125000, 400, 2500000, 500, 2000000, 512, 1953125, 625, 1600000, 640, 1562500, 800, 1250000, 1000, 1000000, 1250, 800000, 1280, 781250, 1600, 625000, 2000, 500000, 2500, 400000, 2560, 390625, 3125, 320000, 3200, 312500, 4000, 250000, 5000, 200000, 6250, 160000, 6400, 156250, 8000, 125000, 10000, 100000, 12500, 80000, 12800, 78125, 15625, 64000, 16000, 62500, 20000, 50000, 25000, 40000, 31250, 32000]
10000


Fixed submission (verdict: Accepted):
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
                A.append(i)
            if M/i <= M
                A.append(int(M/i))
    A.sort()
    print(A[-1])

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = (list)(map(int, input().split()))

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

print(ans)


Failing test case input:
011100 1100110010

Expected output:
88826


Actual output:
24770


Fixed submission (verdict: Accepted):
n, m = (list)(map(int, input().split()))

upper = m
ans = 0
for i in range(1, upper+1):
    if m % i == 0:
        ans = i
        if (m 
            ans = m 
            break

print(ans)
Problem: p03241
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import sqrt
n, m = map(int, input().split())
ans = 0
for i in range(1, int(sqrt(m)+1)):
    if m % i == 0 and i <= m / n:
        ans = i

print(ans)


Failing test case input:
2 324

Expected output:
162


Actual output:
18


Fixed submission (verdict: Accepted):
from math import sqrt
n, m = map(int, input().split())
ans = 1
for i in range(1, int(sqrt(m) + 2)):
    if m % i == 0:
        if i <= m / n:
            ans = max(ans, i)
        if m 
            ans = max(ans, m 
            
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = [int(item) for item in input().split()]

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

Failing test case input:
2 324

Expected output:
162


Actual output:
18


Fixed submission (verdict: Accepted):
import math
n, m = [int(item) for item in input().split()]

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

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288




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

ans = 0
for i in range(1, int(math.sqrt(M) + 100)):

    if (M - i*N) % i == 0 and M >= i*N:
        ans = i



print(int(ans))

Failing test case input:
001000 1000110000

Expected output:
1000110


Actual output:
31450


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288




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

ans = 0
for i in range(1, int(math.sqrt(M))+1):

    if M < i*N:
        break

    if M % i == 0:
        if M >= (M
            ans = M
            break

        ans = i



print(int(ans))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import math

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

b = M

l = []
for i in range(1,int(math.sqrt(M))+1):
    if M % i == 0:
        l.append(i)
        l.append(M/i)

ans = 1
for l_ in l:
    if l_ <= b:
        ans = max(ans,l_)

print(ans)

Failing test case input:
001000 1000000010

Expected output:
170


Actual output:
1000000010.0


Fixed submission (verdict: Accepted):
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m 
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, M = map(int, input().split())
ans = 1
for d in range(1, int(M**0.5)+1):
    if M % d == 0 and d <= M / N:
        ans = max(ans, d)
print(ans)

Failing test case input:
001111 1011111101

Expected output:
910091


Actual output:
19591


Fixed submission (verdict: Accepted):

N, M = map(int, input().split())
ans = 1
for d in range(1, int(M**0.5)+1):
    if M % d == 0 and d <= M / N:
        ans = max(ans, d)
        if M 
            ans = max(ans, M
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,M = map(int,input().split())
a = []
for i in range(math.floor(M**0.5)):
    if M%(i+1) == 0:
        a.append(i+1)
for i in range(len(a)-1,-1,-1):
    a.append(int(M/a[i]))
tmp = 0
for i in a:
    if i > M/N:
        print(tmp)
        break
    else:
        tmp = i

Failing test case input:
000001 1110110010

Expected output:
1110110010


Actual output:

Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
a = []
for i in range(1,int(M**0.5)+1):
    if M%i == 0:
        a.append(i)
        a.append(int(M/i))
a.sort(reverse = True)
for i in a:
    if i <= M/N:
        print(i)
        break

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, M = list(map(int, input().split()))
if N == 1:
  print(M)
  exit()
X = int(math.sqrt(M))+1
for i in range(N, X):
  if M % i == 0:
      print(int(M/i))
      exit()
for i in range(N, 0, -1):
  if M % i == 0:
      print(i)
      exit()
print(1)

Failing test case input:
111100 1111111111

Expected output:
9091


Actual output:
100001


Fixed submission (verdict: Accepted):
import math
N, M = list(map(int, input().split()))
if N == 1:
  print(M)
  exit()
X = int(math.sqrt(M))+1
for i in range(N, X):
  if M % i == 0:
      print(int(M/i))
      exit()
X = int(M / N)
for i in range(X, 0, -1):
  if M % i == 0:
      print(i)
      exit()
print(1)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())

if n==1:
  print(m)
else:
  a=int(m**0.5)

  for i in range(a+1,0,-1):
    if m%i==0 and i*n<=m:
      print(i)
      break

Failing test case input:
001010 1000110000

Expected output:
980500


Actual output:
31450


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())

ans=0

if n==1:
  print(m)
else:
  a=int(m**0.5)

  for i in range(1,a):
    if m%i==0:
      if i*n<=m:
        ans=max(ans,i)
      if (m
        ans=max(ans,m
  print(ans)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import math

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

b = M

l = []
for i in range(1,int(math.sqrt(M))+1):
    if M % i == 0:
        l.append(i)
        l.append(M/i)

ans = 1
for l_ in l:
    if l_*N <= M:
        ans = max(ans,l_)

print(ans)

Failing test case input:
010001 1010101101

Expected output:
43733


Actual output:
43733.0


Fixed submission (verdict: Accepted):
from math import sqrt
 
n, m = map(int, input().split())
l = []
for i in range(1, int(sqrt(m)) + 1):
	if m % i == 0:
		l.append(i)
		l.append(m 
 
ans = 1
for d in l:
	if d * n <= m:
		ans = max(ans, d)
 
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288




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

ans = 0
for i in range(1, int(math.sqrt(M))+1):

    if M < i*N:
        break

    if M % i == 0:
        ans = i



print(int(ans))

Failing test case input:
000001 1110110010

Expected output:
1110110010


Actual output:
33207


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(4100000)
import math
import fractions
import bisect

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288




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

ans = 0
for i in range(1, int(math.sqrt(M))+1):

    if M < i*N:
        break

    if M % i == 0:
        if M >= (M
            ans = M
            break

        ans = i



print(int(ans))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, m = map(int, input().split())
    if n == 1:
        print(m)
        return
    i = 1
    ans = 1
    while i*i <= m:
        if m % i != 0:
            i += 1
            continue
        a = i
        if m / i >= n:
            ans = max(ans, i)
        if m / (m / i) >= n:
            ans = max(ans, i)
        i += 1
    print(ans)
    
if __name__ == '__main__':
    main()


Failing test case input:
000101 1110110010

Expected output:
332070


Actual output:
33207


Fixed submission (verdict: Accepted):
def main():
    n, m = map(int, input().split())
    if n == 1:
        print(m)
        return
    i = 1
    ans = 1
    while i*i <= m:
        if m % i != 0:
            i += 1
            continue
        a = i
        if m 
            ans = max(ans, i)
        if m 
            ans = max(ans, m 
        i += 1
    print(ans)
    
if __name__ == '__main__':
    main()
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math

N, M = [int(s) for s in input().strip().split()]

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

max_gcd = -1
ROOT_M = int(math.sqrt(M))

for d in range(1, ROOT_M):
    if d > M/N:
        break

    if M % d == 0:
        max_gcd = d

print(max_gcd)


Failing test case input:
011100 1100110011

Expected output:
69307


Actual output:
29703


Fixed submission (verdict: Accepted):

import math

N, M = [int(s) for s in input().strip().split()]

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

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M

divisors.sort()
MAX_VAL = int(M/N)
for d in divisors:
    if d > MAX_VAL:
        break
    max_gcd = d

print(max_gcd)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

ans = 1

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

import math
for i in range(int(math.sqrt(M)), 0, -1):
    if M % i == 0 and i * N <= M:
        ans = i
        break

print(ans)


Failing test case input:
010001 1111111011

Expected output:
58923


Actual output:
19641


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

ans = 1

import math

l = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0 and i * N <= M:
        l.append(i)
        if M 
            l.append(M 

print(max(l))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())

ans=0

for i in range(1,10**5):
    if M<N*i:
        break
    elif M%i==0:
        if M>=N*i:
            ans=i
print(ans)

Failing test case input:
001110 1011001001

Expected output:
211109


Actual output:
90991


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
ans=0
for i in range(1,10**5):
    if M%i==0:
        a=max(M
        b=min(M
        if M
            ans=a
        if M
            ans=b
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
        break
for i in range(N, m):
    if M % i == 0:
        x = M 
        break
if x == 0:
    for i in reversed(range(1,m+1)):
        if M % i == 0:
            x = i
            break
print(x)

Failing test case input:
100100 1010101101

Expected output:
7699


Actual output:
23097


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
x = 0
m = 0
for i in range(10**5):
    if i**2 < M <= (i+1)**2:
        m = i+1
        break
if m >N:
    for i in range(N, m):
        if M % i == 0:
            x = M 
            break
if x == 0:
    for i in reversed(range(1, M 
        if M % i == 0:
            x = i
            break
print(x)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,M = map(int,input().split())

sq = math.sqrt(M)
sq = math.floor(sq)

for i in range(1,sq+2):
  if M % i == 0:
    if i <= math.floor(M/N):
      ans = i
    
print(int(ans))


Failing test case input:
000001 1110110010

Expected output:
1110110010


Actual output:
33207


Fixed submission (verdict: Accepted):
import math
N,M = map(int,input().split())

sq = math.sqrt(M)
sq = math.floor(sq)


ans = 1
for i in range(1,sq+2):
  if M % i == 0:
    if i * N <= M:
      ans = max(i,ans)
    if M / i * N <= M:
      ans = max(M 
if N == 1:
  print(int(M))
else:
  print(int(ans))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math
Input = sys.stdin.readline
 
N, M = map(int, Input().split())
 
for i in range(int(math.sqrt(M))+1, 0, -1):
    if M % i == 0:
        if M >= N*i:
            print(i)
            sys.exit()

Failing test case input:
001110 1001101101

Expected output:
333367


Actual output:
3003


Fixed submission (verdict: Accepted):
import sys
import math
Input = sys.stdin.readline
 
N, M = map(int, Input().split())
D = []
 
for i in range(int(math.sqrt(M)), 0, -1):
    if M % i == 0:
      D.append(i)
      D.append(M 

D.sort(reverse=True)
for d in D:
    if M >= N*d:
        print(d)
        break

Problem: p03241
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from copy import *
n,m=map(int,input().split())
t=deepcopy(n)
while True:
    if m%t==0:
        if t*n<=m:
            print(t)
            exit()
        else:
            t-=1
    else:
        t-=1

Failing test case input:
000001 1010011101

Expected output:
1010011101


Actual output:
1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
t=int(m/n)
while True:
    if m%t==0:
        if t*n<=m:
            print(t)
            exit()
        else:
            t-=1
    else:
        t-=1

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

ans = 1
import math
for i in range(1, int(math.sqrt(M))):
    if N * i > M:
        break
    if M % i == 0:
        ans = i

print(ans)


Failing test case input:
010100 1110110010

Expected output:
100290


Actual output:
33207


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

ans = 1

import math

l = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0 and i * N <= M:
        l.append(i)
        if M 
            l.append(M 

print(max(l))
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

q = int(math.sqrt(m))+1
li = [0 for i in range(10**5)]

for i in range(1,q):
    if (m%i) == 0:
        li[i] = 1
        
ans = 1
for i in range(1,q):
    if (li[i]==1) and (i*n<m):
        ans = i

print(ans)
    

Failing test case input:
000100 1010000101

Expected output:
10000001


Actual output:
1111


Fixed submission (verdict: Accepted):
import math

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

q = int(math.sqrt(m))+1
li = [0 for i in range(10**6)]

for i in range(1,q):
    if (m%i) == 0:
        li[i] = 1
        
ans = 1
for i in range(1,q):
    if (li[i]==1) and (i*n<=m):
        ans = max(i,ans)
        
    if (li[i]==1) and (m*n<=m*i):
        ans = max((m/i),ans)
    

print(int(ans))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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:
            k = b
        if reg >= a:
            k = a
print(int(k))

Failing test case input:
001010 1000100000

Expected output:
912500


Actual output:
34250


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

Problem: p03241
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
import sys
MOD = 1000000007

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

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

ans = 1
for i in range(1, int(math.sqrt(m))):
    if i > m/n:
        break
    if m % i == 0:
        ans = i

print(ans)


Failing test case input:
010001 1010011101

Expected output:
55547


Actual output:
18183


Fixed submission (verdict: Accepted):
import math
import sys
MOD = 1000000007

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

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

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

print(int(ans))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math 
N,M=map(int,input().split())
a=M
ans=0
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0:
        if i<=a and i>ans:ans=i
        if M%i<=a and M%i>ans:ans=M%i
print(ans)

Failing test case input:
100000 1000000000

Expected output:
10000

Actual output:
31250


Fixed submission (verdict: Accepted):
import math 
N,M=map(int,input().split())
a=M
ans=0
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0:
        if i<=a and i>ans:ans=i
        if M
print(ans)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

x=math.floor(math.sqrt(m))

y=math.floor(m/n)

ans=1
for i in range(1,x+1):
  if i <= y:
    if(m % i==0):
      ans=i
  else:
    break    
print(ans)


Failing test case input:
000101 1110110010

Expected output:
332070


Actual output:
33207


Fixed submission (verdict: Accepted):
import math

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

x=int(math.sqrt(m))

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

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

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

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

def main():
  n,m=LI()

  a=0
  for i in range(2,int(math.sqrt(m))+1):
    if m%i==0 and i*n<=m:
      a=i

  return a


print(main())


Failing test case input:
001000 1000110000

Expected output:
1000110


Actual output:
31450


Fixed submission (verdict: Accepted):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

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

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

def main():
  n,m=LI()

  if n==1:
    return m

  a=0
  for i in range(1,int(math.sqrt(m))+1):
    if m%i==0:
      if m>=i*n:
        a=max(a,i)
      if m>=m
        a=max(a,m

  return a


print(main())

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)



Failing test case input:
101100 1010100000

Expected output:
9750


Actual output:

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




for i in s:
	if m%(i)==0 and m
		x=max(x,i)
print(x)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = [int(item) for item in input().split()]

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

Failing test case input:
010101 1110111010

Expected output:
105745


Actual output:
26245


Fixed submission (verdict: Accepted):
import math
n, m = [int(item) for item in input().split()]

ans = 0
for i in range(1, int(math.sqrt(m))+1):
  if m%i == 0:
    if m >= i*n:
      ans = max(ans, i)
    if i>= n:
      ans = max(ans, m
    
print(ans)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M =[int(i)for i in input().split()]
l=[1]
for i in range(2,int(M**0.5+1)):
    if M%i==0:
        if M/i >= N:
            l.append(i)
        if i >= N:
            l.append(M/i)
print(max(l))

Failing test case input:
011100 1100110010

Expected output:
88826


Actual output:
88826.0


Fixed submission (verdict: Accepted):
N,M =[int(i)for i in input().split()]
l=[]
for i in range(1,int(M**0.5+2)):
    if M%i==0:
        if M/i >= N:
            l.append(i)
        if i >= N:
            l.append(M/i)
print(int(max(l)))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt, ceil

def prime_factorization(n):
    l = [n]
    for i in range(1, ceil(sqrt(n))+1):
        if not n % i:
            l.append(i)
    return l

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

p = list(set(prime_factorization(M)))

ans = 1
for i in p:
    if (M / i) >= N:
        ans = max(i, ans)
print(ans)


Failing test case input:
010000 1010000000

Expected output:
101000


Actual output:
31250


Fixed submission (verdict: Accepted):
from math import sqrt, ceil

def factorization(n):
    l = [n]
    for i in range(1,ceil(sqrt(n))+1):
        if not n % i:
            l.append(i)
            l.append(n
    return l
N, M = map(int, input().split())

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

f = factorization(M)
ans = 1
for i in f:
    if (M / i) >= N:
        ans = max(i, ans)
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, M):
        if i > math.floor(pow(M,0.6)):
            print(ans)
            exit()
        if M % i == 0:
            if M / i < N:
                print(ans)
                exit()
            else:
                ans = i

Failing test case input:
001111 1011111101

Expected output:
910091


Actual output:
179881


Fixed submission (verdict: Accepted):
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
                A.append(i)
            if M/i <= M
                A.append(int(M/i))
    A.sort()
    print(A[-1])

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

ans = 1
import math
for i in range(1, int(math.sqrt(M)) + 1):
    if N * i > M:
        break
    if M % i == 0:
        ans = i

print(ans)


Failing test case input:
010001 1111111011

Expected output:
58923


Actual output:
19641


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

ans = 1

import math

l = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0 and i * N <= M:
        l.append(i)
        if M 
            l.append(M 

print(max(l))
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

x=int(math.sqrt(m))

ans=1
for i in range(1,x+1):
  if m%i==0:
    if i*n<=m:
      ans=max(ans,i)
    if (m/i)*n<=m:
      ans=max(ans,m/i)
print(ans)




Failing test case input:
001110 1011001001

Expected output:
211109


Actual output:
211109.0


Fixed submission (verdict: Accepted):
import math

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

x=int(math.sqrt(m))

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

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N,M = map(int,input().split())
A = []

if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, math.floor(pow(M,0.55))):
        if (M % i == 0):
            A.append(i)
    for j in range(len(A)):
        A.append(int(M/A[j]))
    for k in range(len(A)):
        if A[-1-k] <= M/N:
            print(A[-1-k])
            exit()

Failing test case input:
001000 1000110000

Expected output:
1000110


Actual output:
11766


Fixed submission (verdict: Accepted):
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
                A.append(i)
            if M/i <= M
                A.append(int(M/i))
    A.sort()
    print(A[-1])

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r

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

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

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

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

Failing test case input:
000100 1010000101

Expected output:
10000001


Actual output:
1111


Fixed submission (verdict: Accepted):
import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r

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

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

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

if __name__ == '__main__':
    ans = main()
    print(ans)
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n,m=map(int,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=1
while i<=m/i:
    if m%i:
        i=i+1
    else:
        j=m/i
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i=i+1
ans.sort()
print(ans[len(ans)-1])

Failing test case input:
001110 1011001101

Expected output:
531267


Actual output:
531267.0


Fixed submission (verdict: Accepted):
import sys
n,m=map(int,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=int(1)
while i<=m/i:
    if m%i!=0:
        i+=1
    elif m%i==0:
        j=int(m/i)
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i+=1
ans.sort()
print(ans[len(ans)-1])

Problem: p03241
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

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


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

d = divisor(M)
g = M / N
d = [x for x in d if x <= g]
print(max(d))


Failing test case input:
011100 1100110011

Expected output:
69307


Actual output:
69307.0


Fixed submission (verdict: Accepted):

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


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

d = divisor(M)
g = int(M / N)
d = [x for x in d if x <= g]
print(max(d))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = list(map(int, input().split()))
for i in range(int(M**0.5)+100, 0, -1):
  if M % i == 0 and M >= i * N:
    print(i)
    exit()

Failing test case input:
001100 0011101001

Expected output:
6557


Actual output:
1693


Fixed submission (verdict: Accepted):
N, M = list(map(int, input().split()))

print(max([j for i in range(int(M**0.5), 0, -1) for j in [i, int(M/i)] if M % j == 0 and M / N >= j]))

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

if N == 1:
    print(M)
else:
    ans = 1
    for i in range(1, M):
        if i > math.floor(pow(M,0.5)):
            print(ans)
            exit()
        if M % i == 0:
            if M / i < N:
                print(ans)
                exit()
            else:
                ans = i

Failing test case input:
011100 1011111011

Expected output:
86813


Actual output:
11647


Fixed submission (verdict: Accepted):
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
                A.append(i)
            if M/i <= M
                A.append(int(M/i))
    A.sort()
    print(A[-1])
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import bisect
N, M = map(int, input().split())
ls = []
for i in range(2, int(M**(1/2))+1):
    if M%i == 0:
        ls.append(i)
cur = 1
for x in ls:
    if x > N:
        print(cur)
        sys.exit()
    cur = x
print(cur)

Failing test case input:
001110 1011101101

Expected output:
32251


Actual output:
293


Fixed submission (verdict: Accepted):
import sys
N, M = map(int, input().split())
ls = []
for i in range(2, int(M**(1/2))+1):
    if M%i == 0:
        ls.append(i)
if N == 1:
    print(M)
    sys.exit()
ans = 1
for x in ls:
    if x >= N:
        ans = max(ans, M
        continue
    if M
        ans = max(ans, x)
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, m = map(int, input().split())
    d = [1]
    for i in range(2, int(m ** 0.5) + 1):
        if m % i == 0:
            d.append(i)

    v = m / n
    ans = max(i for i in d if i <= v)
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
010101 1110111010

Expected output:
105745


Actual output:
26245


Fixed submission (verdict: Accepted):
def main():
    n, m = map(int, input().split())
    for i in range(int(m / n), 0, -1):
        if m % i == 0:
            print(i)
            break


if __name__ == '__main__':
    main()

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  
  mx=1
  for i in range(2,int(math.sqrt(b)+2)):
    if b%i==0:
      if i*a<=b:
        mx=i
      else:
        return mx
  return mx


print(main())


Failing test case input:
011100 1110110010

Expected output:
66414


Actual output:
33207


Fixed submission (verdict: Accepted):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

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

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

def main():
  n,m=LI()

  if n==1:
    return m

  a=0
  for i in range(1,int(math.sqrt(m))+1):
    if m%i==0:
      if m>=i*n:
        a=max(a,i)
      if m>=m
        a=max(a,m

  return a


print(main())
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt, ceil

def factorization(n):
    l = [n]
    for i in range(1, ceil(sqrt(n))+2):
        if not n % i:
            l.append(i)
    return l

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

if N == 1:
    print(M)
else:    
    f = factorization(M)
    print(max([i for i in f if i <= M/N]))

Failing test case input:
001110 1001101101

Expected output:
333367


Actual output:
3003


Fixed submission (verdict: Accepted):
from math import sqrt, ceil

def factorization(n):
    l = [n]
    for i in range(1,ceil(sqrt(n))+1):
        if not n % i:
            l.append(i)
            l.append(n
    return l
N, M = map(int, input().split())

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

f = factorization(M)
ans = 1
for i in f:
    if (M / i) >= N:
        ans = max(i, ans)
print(ans)

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
	n, m = map(int, input().split())

	total = m
	current_max = 1
	for i in range(1, total+1):
		if i * i > m:
			break
		if m % i == 0:
			current_max = i

	print(current_max)


if __name__ == '__main__':
    main()

Failing test case input:
101000 1000000000

Expected output:
8000


Actual output:
31250


Fixed submission (verdict: Accepted):
def main():
	n, m = map(int, input().split())

	total = m
	answer = 1
	for i in range(1, total+1):
		if i * i > m:
			break

		if m % i == 0:
			answer = max(i, answer)
			if i >= n:
				answer = max(m

	print(answer)


if __name__ == '__main__':
    main()

Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  
  mx=1
  for i in range(2,int(math.sqrt(b))+100):
    if b%i==0:
      if i*a<=b:
        mx=i
      else:
        return mx
  return mx


print(main())


Failing test case input:
000001 1010011101

Expected output:
1010011101


Actual output:
18183


Fixed submission (verdict: Accepted):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

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

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

def main():
  n,m=LI()

  if n==1:
    return m

  a=0
  for i in range(1,int(math.sqrt(m))+1):
    if m%i==0:
      if m>=i*n:
        a=max(a,i)
      if m>=m
        a=max(a,m

  return a


print(main())