ZhenlongDai/ACPR huggingface dataset:
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
def divisor(n):
    res = []
    for i in range(1,int(math.sqrt(n))+1):
        if n % i == 0:
            res.append(i)
            if n / i != i:
                res.append(n / i)
    return res
    
N, M = map(int, input().split())
maxd = 0
for d in divisor(M):
    if M / d >= N:
        maxd = max(maxd, d)
print(maxd)



Failing test case input:
010000 1010000000

Expected output:
101000


Actual output:
101000.0


Fixed submission (verdict: Accepted):
import math
def divisor(n):
    res = []
    for i in range(1,int(math.sqrt(n))+2):
        if n % i == 0:
            res.append(i)
            if n 
                res.append(n 
    return res
    
N, M = map(int, input().split())
maxd = 0
for d in divisor(M):
    if M 
        maxd = max(maxd, d)
print(maxd)

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

Failing test case input:
101100 1000110000

Expected output:
9805


Actual output:
100011


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


def main():
    n, m = map(int, input().split())
    ans = 1
    for i in range(1, int(m**0.5)+1):
        if m % i == 0 and m >= n * i:
            ans = max(ans, i)
    print(ans)
    
if __name__ == '__main__':
    main()

Failing test case input:
2 324

Expected output:
162


Actual output:
18


Fixed submission (verdict: Accepted):


def main():
    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 m >= (m 
                ans = max(ans, m 
    print(ans)
    
if __name__ == '__main__':
    main()

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) and (i <= M/N):
            A.append(i)
    print(A[-1])

Failing test case input:
010100 1110001111

Expected output:
101863


Actual output:
10897


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()))
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(k)

Failing test case input:
011100 1100110010

Expected output:
88826


Actual output:
44413.0


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 (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 * N <= M:
      ans = i
    
print(int(ans))


Failing test case input:
011000 1111111001

Expected output:
95563


Actual output:
21593


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 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
    for k in range(len(A)):
        if A[-1-k] <= M/N:
            print(A[-1-k])
            exit()

Failing test case input:
001010 1000100000

Expected output:
912500


Actual output:
34250


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 = list(map(int, input().split(' ')))
p = []
for ct in range(2, 100000):
    if M % ct == 0:
        p.append(ct)
p.append(M)















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

Failing test case input:
010100 1110110010

Expected output:
100290


Actual output:
66414


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 (Python (3.4.3), verdict: Wrong Answer):
import math
n, m = (list)(map(int, input().split()))

ans = 0
upper = m
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:
000001 1110110010

Expected output:
1110110010


Actual output:
33207


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.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+=1
    else:
        j=m/i
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i+=1
ans.sort()
print(ans[len(ans)-1])

Failing test case input:
2 324

Expected output:
162


Actual output:
162.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 (Python (3.4.3), verdict: Wrong Answer):
N, M = list(map(int, input().split()))
for i in range(int(M**0.5)+1, 0, -1):
  if M % i == 0 and M >= i * N:
    print(i)
    exit()

Failing test case input:
010000 1010000000

Expected output:
101000


Actual output:
31250


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):
n,m=map(int,input().split())
X=[]
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        if m/i >=n:
            X.append(i)
        if i>=n:
            X.append(m/i)
            
print(max(X))

Failing test case input:
001100 0011101001

Expected output:
6557


Actual output:
6557.0


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
L = []
 
for i in range(1,int(M**0.5)+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def main():
    N, M = list(map(int, input().split(' ')))
    s = math.ceil(math.sqrt(M))
    r = M - N*s
    while True:
        if r >= 0 and r%s == 0:
            print(s)
            break
        s -= 1
        r += N



if __name__ == '__main__':
    main()

Failing test case input:
010100 1010001111

Expected output:
65751


Actual output:
21917


Fixed submission (verdict: Accepted):
import math

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



if __name__ == '__main__':
    main()

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:
			div = m 
			current = max(i, div) if div < total else i
			if current > current_max:
				current_max = current

	print(current_max)


if __name__ == '__main__':
    main()

Failing test case input:
001100 1011111001

Expected output:
268841


Actual output:
3761


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 (PyPy3 (2.4.0), verdict: Wrong Answer):
N, M = map(int,input().split())

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

for i in range(len(yakusuu) - 1, 0, -1):
    if M / yakusuu[i] >= N:
        print(yakusuu[i])
        break


Failing test case input:
101000 1100110010

Expected output:
9655


Actual output:
[1, 1100110010, 2, 550055005, 5, 220022002, 10, 110011001, 23, 47830870, 46, 23915435, 115, 9566174, 230, 4783087, 1931, 569710, 2477, 444130, 3862, 284855, 4954, 222065, 9655, 113942, 12385, 88826, 19310, 56971, 24770, 44413]
9655


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

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


for i in yakusuu:
    if M / i >= N:
        print(i)
        break
Problem: p03241
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
read = sys.stdin.read
from math import sqrt, ceil
def main():
    n, m = map(int, input().split())
    if n == 1:
        print(m)
        sys.exit()
    r = 1
    
    for i1 in range(2, m + 1):
        if m % i1 == 0:
            r = i1
        if n * i1 > m:
            break
    print(r)

if __name__ == '__main__':
    main()

Failing test case input:
100100 0010000000

Expected output:
80


Actual output:
100


Fixed submission (verdict: Accepted):

import sys
read = sys.stdin.read
from math import sqrt, ceil
def main():
    n, m = map(int, input().split())
    if n == 1:
        print(m)
        sys.exit()

    divs = []
    for i1 in range(2, ceil(sqrt(m))+1):
        if m % i1 == 0:
            divs.append(i1)
            divs.append(int(m/i1))
    divs.sort()
    r = 1
    for div in divs:
        if n * div <= m:
            r = div
        else:
            break
    print(r)

if __name__ == '__main__':
    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))+1):
        if not n % i:
            l.append(i)
    return l

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

f = factorization(M)

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


Failing test case input:
001010 1000110000

Expected output:
980500


Actual output:
31450


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


inn,inm = list(map(int,input().split()))
rootm = math.floor(math.sqrt(inm))

prea = inm
for i in range(1,rootm+1):
  if inm % i == 0:
    if inn < i:
      ans = i
      break
    if inn > inm/i:
      ans = prea
      break
    prea = inm/i
  if i == rootm:
    ans = prea
print(int(inm/ans))

Failing test case input:
001000 1000110000

Expected output:
1000110


Actual output:
980500


Fixed submission (verdict: Accepted):
import math


inn,inm = list(map(int,input().split()))
root = math.floor(math.sqrt(inm))

a = []
for i in range(1,root+1):
  if inm%i == 0:
    a.append(i)
    a.append(inm/i)
    
a.sort()
for i in a:
  if i >= inn:
    print(int(inm/i))
    break
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()
  if n==100000 and m==1000000000:
    exit()
  sm=1
  for i in range(2,int(math.sqrt(m))+1):
    _m=m-i*(n-1)
    if _m<=0:
      break
    if _m%i==0:
      sm=i

  return sm

print(main())


Failing test case input:
011100 1001111011

Expected output:
79033


Actual output:
12667


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
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:
        c.append(i)
c.reverse()
for i in c:
    if a[1] % i == 0:
        print(i)
        break


Failing test case input:
000001 1110110010

Expected output:
1110110010


Actual output:
33207


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):
n, m = map(int, input().split())
if n == 1:
  print(m)
  exit()
for divide in range(n,int(m**(1/2))+1):
  if m % divide == 0:
    print(int(m/divide))
    exit()
for divide in range(n,0,-1):
  if m % divide == 0:
    print(divide)
    exit()

Failing test case input:
100000 1010000000

Expected output:
10100


Actual output:
100000


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
if n == 1:
  print(m)
  exit()
if n < int(m**(1/2)):
  for divide in range(n,int(m**(1/2))+1):
    if m % divide == 0:
      print(int(m/divide))
      exit()
  for divide in range(n,0,-1):
    if m % divide == 0:
      print(divide)
      exit()
else:
  for divide in range(m
    if m % divide == 0:
      print(divide)
      exit()
Problem: p03241
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
i=N


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


print(gcd)

Failing test case input:
101110 1011001001

Expected output:
5149


Actual output:
90991


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


gcd=1
while(1):
    if(M%i==0):
        print(M
        sys.exit(0)
    if(i**2 >M):
        break
    i+=1

i=M
while(1):
    if(M%i==0):
        print(i)
        sys.exit(0)
    i-=1

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))):
  if m%i == 0 and i < int(m/n):
    ans = i
    
print(ans)

Failing test case input:
010001 1010011101

Expected output:
55547


Actual output:
18183


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

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

Failing test case input:
001111 1011111101

Expected output:
910091


Actual output:
96859


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
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,max(N+1, m+1))):
        if M % i == 0:
            x = i
            break
print(x)

Failing test case input:
110100 1010010000

Expected output:
7860


Actual output:
102800


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())
L = []

for i in range(1,math.floor(math.sqrt(M))+1):
    if M % i == 0:
        L.append(i)
        L.append(M / i)
L1 = [i for i in L if M / i >= N]
print(max(L1))

Failing test case input:
010001 1010101101

Expected output:
43733


Actual output:
43733.0


Fixed submission (verdict: Accepted):
import math
N,M = map(int, input().split())
L = []
 
for i in range(1,math.floor(math.sqrt(M))+1):
    if M % i == 0:
        L.append(i)
        L.append(int(M / i))
L1 = [i for i in L if M / i >= N]
print(max(L1))

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.5))+1):
        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:
011100 1110110010

Expected output:
66414


Actual output:
33430


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())
d = []
for i in range(1, int(M**0.5)+1,1):
	if M%i == 0:
		d.append(i)
		d.append(M/i)
d.sort(reverse=True)
for i in range(len(d)):
	if d[i] <= M/N:
		print(d[i])
		exit()


Failing test case input:
011000 1111111001

Expected output:
95563


Actual output:
95563.0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
d = []
for i in range(1, int(M**0.5)+1):
	if M%i == 0:
		d.append(i)
		d.append(M
d.sort()
for i in range(1,len(d)+1):
	if d[-i] <= M
		print(d[-i])
		exit()

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)

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

print(ans)

Failing test case input:
010100 1010001111

Expected output:
65751


Actual output:
21917


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 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 = i
    if M < i * N:
        break

print(n)


Failing test case input:
010100 1110110010

Expected output:
100290


Actual output:
33207


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

print(n)

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+1):
  if M % i == 0:
    if i <= math.floor(M/N):
      ans = i
    
print(int(ans))


Failing test case input:
011100 1110110010

Expected output:
66414


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):
N, M = map(int, input().split())

if N == 1:
    print(M)
else:
    d = 1
    ds = []
    while d ** 2 <= M:
        if M % d == 0:
            ds.append(d)
        d += 1
    ds.sort(reverse=True)
    for d in ds:
        if N * d <= M:
            print(d)
            break

Failing test case input:
011100 1001111011

Expected output:
79033


Actual output:
12667


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

d = 1
ds = []
while d ** 2 <= M:
    if M % d == 0:
        ds.append(d)
        ds.append(M 
    d += 1
ds.sort(reverse=True)
for d in ds:
    if N * d <= M:
        print(d)
        break

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.6))):
        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:
110100 1010010000

Expected output:
7860


Actual output:
4112


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

flag = True
yakusuu = []
for i in range(1, math.floor(math.sqrt(M))+1):
    if(M % i == 0):
        yakusuu.append(i)
yakusuu.reverse()
for i in yakusuu:
    if M / i >= N and flag == True:
        print(i)
        flag = False

Failing test case input:
010100 1110110010

Expected output:
100290


Actual output:
33207


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

flag = True
yakusuu = []
for i in range(1, math.floor(math.sqrt(M))+1):
    if(M % i == 0):
        yakusuu.append(i)
        yakusuu.append(int(M / i))
yakusuu.sort()
yakusuu.reverse()
for i in yakusuu:
    if M / i >= N and flag == True:
        print(i)
        flag = False

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

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

Failing test case input:
000001 1010001101

Expected output:
1010001101


Actual output:
1010001101.0


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

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

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

import math

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

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

print(ans)

Failing test case input:
010010 1010000000

Expected output:
100000


Actual output:
100000.0


Fixed submission (verdict: Accepted):

import math

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

ans = 0
divList = []
for i in range(1, int(math.sqrt(m)) + 1):
    if m % i == 0:
        j = m / i
        divList.append(i)
        divList.append(j)
divList = sorted(divList)
for i in divList:
    if i < n:
        continue
    ans = m / i
    break

print(int(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.5))):
        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:
5 324

Expected output:
54


Actual output:
27


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

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

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


Failing test case input:
011000 1111111001

Expected output:
95563


Actual output:
21593


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, 1, -1):
    if M % i == 0:
        if M >= N*i:
            print(i)
            sys.exit()

Failing test case input:
000001 1110110010

Expected output:
1110110010


Actual output:
33207


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 (Python (3.4.3), verdict: Wrong Answer):
import math

N, M = list(map(int, input().split()))
x = M 
Mx = []
m = math.floor(math.sqrt(M))
for i in range(1, m + 1):
	if M % i == 0:
		Mx.append(i)
ans = 1
for i in Mx:
	if i <= x:
		ans = i
	else:
		break

print(ans)

Failing test case input:
100101 1110110010

Expected output:
11069


Actual output:
33207


Fixed submission (verdict: Accepted):
import math

N, M = list(map(int, input().split()))
x = M 
Mx = []
m = math.floor(math.sqrt(M))
for i in range(1, m + 1):
	if M % i == 0:
		Mx.append(i)

y = len(Mx)

My = []
for i in range(y):
	My.append(int(M 



for i in range(y):
	Mx.append(My[i])

ans = 1
for i in Mx:
	if i <= x:
		ans = i
	else:
		break

print(ans)

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(int(m/n),a-1,-1):
    
    if m%i==0 and i*n<=m:
      print(i)
      break

Failing test case input:
011100 1011111001

Expected output:
3761


Actual output:

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 sys
import bisect
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, M: int):
    ds = [1]
    for i in range(2, int(ceil(sqrt(M)))):
        if M % i == 0:
            ds.append(i)
  
    th = M 
    return ds[bisect.bisect(ds, th)-1]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    result = solve(N, M)
    print(result)

if __name__ == '__main__':
    main()


Failing test case input:
100100 1010000000

Expected output:
10000


Actual output:
31250


Fixed submission (verdict: Accepted):

import sys
import bisect
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, M: int):
    ds = []
    for i in range(1, int(ceil(sqrt(M))) + 1):
        if M % i == 0:
            ds.append(i)
            ds.append(M 
    ds.sort()
  
    th = M 
    return ds[bisect.bisect(ds, th)-1]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    result = solve(N, M)
    print(result)

if __name__ == '__main__':
    main()

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))+2):
    if M%i==0 and i>=N:
        max=M/i
        break
    if M%i==0 and M/i>=N:
        max=i
print(max)

Failing test case input:
000001 1110111010

Expected output:
1110111010


Actual output:
1110111010.0


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):
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:
			div = m 
			current = max(i, div) if div < total and div <= n else i
			if current > current_max:
				current_max = current

	print(current_max)


if __name__ == '__main__':
    main()

Failing test case input:
001110 1011001101

Expected output:
531267


Actual output:
31251


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 (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))+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))


Failing test case input:
111110 1110110000

Expected output:
7750


Actual output:
9991


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):
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(m/i)
print(max(divisors))

Failing test case input:
000001 1010011101

Expected output:
1010011101


Actual output:
1010011101.0


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

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) % i == 0 and M >= i*N:
        ans = i



print(ans)

Failing test case input:
010100 1010001111

Expected output:
65751


Actual output:
21917


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.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
ans = 1
for i in range(1,int(m**0.5)+1):
    if i > m/n:
        break
    else:
        if m%i==0:
            ans = i
print(ans)

Failing test case input:
001010 1000100000

Expected output:
912500


Actual output:
29200


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ans = 1
for i in range(1,int(m**0.5)+1):
    if m%i: continue
    if m
    if i>=n and m
print(ans)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if i % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1
print(counter)

Failing test case input:
11
7
8
9
10
11
22
13
2
27
8
14

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
def isprime(x):
    import math
    if  x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(x):
            if x % i == 0:
                return False
            i += 2
        return True

N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    if isprime(A[i]):
        counter += 1
        
print(counter)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
def PrimeNum(a):
	x=math.sqrt(a)
	x=int(x)
	tmp=1
	if a==1:
		tmp=0
	elif a==2:
		tmp==1
	elif a>3 and a<9:
		for i in range(2,a):
			st=a%i
			if st==0:
				tmp=0
				break
	
	else:
		for i in range(2,x+1):
			st=a%i
			if st == 0:
				tmp=0
				break
	
		
	if tmp==1:print("・・")

	return tmp	
	
n=int(input())
p=[]
att=0
for i in range(n):
	p.append(int(input()))
	att+=PrimeNum(p[i])
	
print(att)



Failing test case input:
11
22
14
17
10
22
12
23
4
4
13
5

Expected output:
4


Actual output:
・・
・・
・・
・・
4


Fixed submission (verdict: Accepted):
import math
def PrimeNum(a):
	x=math.sqrt(a)
	x=int(x)
	tmp=1
	if a==1:
		tmp=0
	elif a==2:
		tmp==1
	elif a>3 and a<9:
		for i in range(2,a):
			st=a%i
			if st==0:
				tmp=0
				break
	
	else:
		for i in range(2,x+1):
			st=a%i
			if st == 0:
				tmp=0
				break
	
		
	

	return tmp	
	
n=int(input())
p=[]
att=0
for i in range(n):
	p.append(int(input()))
	att+=PrimeNum(p[i])
	
print(att)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    for i in range(2, math.ceil(n**0.5)+1):
        if n % i == 0:
            return False
    print('prime -> ', n)
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()


Failing test case input:
11
7
8
9
10
11
22
13
14
27
8
17

Expected output:
4


Actual output:
prime ->  7
prime ->  11
prime ->  13
prime ->  17
4


Fixed submission (verdict: Accepted):
import math

def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    for i in range(2, math.ceil(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def isprime(n):
    if n < 2: return 0
    elif n == 2: return 1

    if n % 2 == 0: return 0

    for i in range(3, n, 2):
        if n % i == 0 : return 0

    return 1

n = str([isprime(int(i)) for i in input().split()].count(1))
print(n)


Failing test case input:
11
7
8
9
10
11
22
13
14
27
8
17

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
def isprime(n):
    if n < 2: return 0
    elif n == 2: return 1

    if n % 2 == 0: return 0

    for i in range(3, n, 2):
        if i > n/i: return 1
        if n % i == 0 : return 0

    return 1

N = int(input())
n = [int(input()) for i in range(N)]

a = [i for i in n if isprime(i)]

print(len(a))

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
        for j in range(2, n + 1):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Failing test case input:
11
7
7
4
27
4
22
13
2
20
8
44

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
for i in range(n):
    p = int(input())
    if not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5),2):
        if not p%j:
            n -= 1
            continue
print(n)

Failing test case input:
11
39
20
9
17
11
13
33
5
16
12
17

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
for i in range(n):
    p = int(input())
    if not p%2:
        if p != 2:
            n -= 1
        continue
    for j in range(3,int(p**0.5)+1,2):
        if not p%j:
            n -= 1
            break
print(n)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x): 
      count += 1
print(count)

Failing test case input:
11
7
8
9
10
11
22
13
14
27
8
17

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):


n = int(input())

def isPrime(a):
    if a == 2:
        return True
    elif a < 2 or a & 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i < j:
            if a % i == 0:
                return False
            i += 2
    return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        primeCount += 1

print(primeCount)



Failing test case input:
11
6
4
9
27
11
22
13
2
20
8
27

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):


n = int(input())

def isPrime(a):
    
    if a == 2:
        return True
    elif a < 2 or a % 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i <= j:
            if a % i == 0:
                return False
            i += 2
        return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        
        primeCount += 1

print(primeCount)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):


n = int(input())

def isPrime(a):
    print('a = ' + str(a))
    if a == 2:
        return True
    elif a < 2 or a % 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i <= j:
            if a % i == 0:
                return False
            i += 2
        return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        print(str(a) + ' は素数')
        primeCount += 1

print(primeCount)



Failing test case input:
11
4
2
9
26
15
22
2
14
27
8
27

Expected output:
2


Actual output:
a = 4
a = 2
2 は素数
a = 9
a = 26
a = 15
a = 22
a = 2
2 は素数
a = 14
a = 27
a = 8
a = 27
2


Fixed submission (verdict: Accepted):


n = int(input())

def isPrime(a):
    
    if a == 2:
        return True
    elif a < 2 or a % 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i <= j:
            if a % i == 0:
                return False
            i += 2
        return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        
        primeCount += 1

print(primeCount)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
s = 0
for i in range(n):
    j = 2
    flag = 1
    while(j > math.sqrt(x[i])):
        if x[i] % j == 0:
            flag = 0
            break
        j += 1
    if flag == 1:
        s += 1
print(s)


Failing test case input:
11
7
8
9
10
11
22
13
2
27
8
14

Expected output:
4


Actual output:
10


Fixed submission (verdict: Accepted):
import math
def prime(x):
    if x == 2:
        return 1
    elif x < 2 or x % 2 == 0:
        return 0
    i = 3
    while(i <= math.sqrt(x)):
        if x % i == 0:
            return 0
        i += 2
    return 1

n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
s = 0
for i in range(n):
    if prime(x[i]) == 1:
        s += 1
print(s)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    for j in range(2, n + 1):
        if (x % j == 0):
            break
        else:
            count += 1
    if (x == 2):
        count += 1
print(count)

Failing test case input:
11
4
8
9
26
15
22
2
14
27
8
27

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

n = int(input())
a = [int(i) for i in input().split("\n")]

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Failing test case input:
11
7
8
9
10
11
22
13
2
20
8
14

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):

def prime(n):
    s=2
    while(s*s <= n):
        if(n%s==0):
            return False
        s+=2
    return True

n=int(input())
num=0
for i in range(n):
    x = input()
    if prime(int(x)):
        num+=1
print(num)

Failing test case input:
11
7
8
9
10
11
12
24
14
27
18
17

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):

def prime(n):
    s=3
    while(s*s <= n):
        if(n%s==0):
            return False
        s+=2
    return True

n=int(input())
num=0
for i in range(n):
    x = int(input())
    if prime(x) and x%2!=0:
        num+=1
    if x==2:
        num+=1
print(num)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
N = int(input())
ans = 0

for i in range(N):
    num = int(input())
    rt = math.ceil(math.sqrt(num))
    div = 2
    while (rt > div):
        if num % div:
            div += 1
        else:
            break
    if div == rt:
        ans += 1
print(ans)



Failing test case input:
11
7
8
9
10
11
12
17
14
15
16
17

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
import math
N = int(input())
ans = 0

for i in range(N):
    num = int(input())
    if num == 2:
        ans +=1
        continue
    rt = math.ceil(math.sqrt(num))
    div = 2
    bool = True
    while (rt >= div):
        if num % div:
            div += 1
        else:
            bool = False
            break
    if bool:
        ans += 1
print(ans)