TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,t = map(int, input().split())
li =[]
for i in range(n):
    li.append(list(map(int, input().split())))
print(li)

a =[]
for i in range(n):
    if li[i][1] <= t:
        a.append(i)
print(a)
b = []
for i in a:
    b.append(li[i][0])
print(b)
if b:
    print(min(b))
else:
    print("TLE")


n,t = map(int, input().split())
li =[]
for i in range(n):
    li.append(list(map(int, input().split())))
#print(li)

a =[]
for i in range(n):
    if li[i][1] <= t:
        a.append(i)
#print(a)
b = []
for i in a:
    b.append(li[i][0])
#print(b)
if b:
    print(min(b))
else:
    print("TLE")


Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N, T = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
Y = [X[i] if X[i][1]<=T for i in range(N)]
print(Y)

N, T = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
Y = [x for x in X if x[1]<=T]
Z = [y[0] for y in Y]
print("TLE" if Y==[] else min(Z))

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,t = int(input().split())
m = 10000
for i in range(n):
    c,d = int(input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

n,t = [x for x in int(input())]
m = 10000
for i in range(n):
    c,d = [x for x in int(input())]
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N, T = map(int, input().split())
c, t = list(map(int, input().split()))
ans = 1001
for i in range(N):
    if T > t and c < ans:
        ans = c

if ans == 1000:
    print("TLE")
else:
    print(ans)

N, T = map(int, input().split())
c, t = map(int, input().split())
ans = 1001
for i in range(N):
    if T > t and c < ans:
        ans = c

if ans == 1000:
    print("TLE")
else:
    print(ans)

N, T = map(int, input().split())
c, t = list(map(int, input().split()))
ans = 1000
i = 0
for i in range(N):
    if T > t and c < ans:
        ans = c

if ans == 1000:
    print("TLE")
else:
    print(ans)

N, T = map(int, input().split())
c, t = list(map(int, input().split()))
ans = 1001
i = 0
for i in range(N):
    if T > t and c < ans:
        ans = c

if ans == 1000:
    print("TLE")
else:
    print(ans)

N, T = map(int, input().split())
i = 0
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if T >= t and c < ans:
        ans = c

if ans == 1001:
    print("TLE")
else:
    print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
I=lambda:map(int,input())
n,k=I()
s=1001
for i in range(n):
  a,b=I()
  if b<=k:
    s=min(s,a)
if s==1001:
  print('TLE')
else:
  print(s)

I=lambda:map(int,input().split())
n,k=I()
s=1001
for i in range(n):
  a,b=I()
  if b<=k:
    s=min(s,a)
if s==1001:
  print('TLE')
else:
  print(s)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,t=[int(s)for s in input().split()]
cost=[]
for _ in range(n):
  c,ti=[int(s)for s in input().split()]
  if ti<t:cost.append(c)
if len(cost)==0:print("TLE")
else:
  cs=cost.sorted()
  print(cs[0])

n,t=[int(s)for s in input().split()]
cost=[]
for _ in range(n):
  c,ti=[int(s)for s in input().split()]
  if ti<=t:cost.append(c)
if len(cost)==0:print("TLE")
else:
  cs=sorted(cost)
  print(cs[0])

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,a=map(int,input().split())
ans=100000000
for i in range(n):
  c,t=map(int,input().split())
  if t<=a:
    ans=min(ans,c)
if ans=100000000
  print('TLE')
else:
  print(ans)


n,a=map(int,input().split())
ans=100000000
for i in range(n):
  c,t=map(int,input().split())
  if t<=a:
    ans=min(ans,c)
if ans==100000000:
  print('TLE')
else:
  print(ans)


Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
def main():
    line = input()
    n, T = [int(x) for x in line.split()]
    lista_tempos = []
    lista_custos = []
    for i in range(n):
        line = input()
        c, t = [int(x) for x in line.split()]
        if t <= T:
            lista_tempos.append(t)
            lista_custos.append(c)
    if lista_tempos:
        print(min(lista_custos))
    else:
        print('TLE')

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

x=[]

for i in range(n):
    c,t=map(int, input().split())
    if t<=T:
        x.append((i+1,c))
        
x.sort(key=lambda tup: tup[1])
if len(x)!=0:
    print(x[0][0])
else:
    print('TLE')

P,D=input().split()
c=0
for i in range (int(D)):
    dp,b=input().split()
    if int(P)<int(dp) :
        break
    else :
        P=int(P)+int(b)
        c+=1
if c==int(D) :
    print ("YES")
else :
    print ("NO")

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



c, aux=[], []
for i in range(N):
	x, y=map(int, input().split())
	
	if(y<=T):
		aux=[[int(x), int(y)]]	
		c.extend(aux)
			

if (len(c)==0):
	print("TLE")
else:
	aux=min(c)
	print(aux[0])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

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

ans = 10000

for i in range(n):
    cost,time = map(int,input().split())
    
    if time <= lim and cost < ans:
        ans = cost

if ans != 10000:
    print("TLE")
else:
    print(ans)

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

ans = 10000

for i in range(n):
    cost,time = map(int,input().split())
    
    if time <= lim and cost < ans:
        ans = cost

if ans == 10000:
    print("TLE")
else:
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n, t = map(int, input().split())
l = [input().split() for i in range(n)]
l.sort()
exist = False

for i in l:
  if int(i[1]) < t:
    print(i[0])
    exist = True
    break
if !(exist):
  print("TLE")

n, t = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
l.sort()
exist = False

for i in l:
  if int(i[1]) <= t:
    print(i[0])
    exist = True
    break
if not exist:
  print("TLE")

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N=int(input())
T=int(input())
check=1
ansc=1001

for i in range(N):
    c=int(input())
    t=int(input())

    if t<T and c<ansc:
        ansc=c
        T=t
        check=0

if check==0:
    print(ansc)
else:
    print('TLE')

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

C=[]

for i in range(N):
    c,t=map(int,input().split())

    if t<=T:
        C.append(c)

if not C:
    print('TLE')
else:
    print(min(C))

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):

n,t =  (int(x) for x in input().split())

A = []
for i in range(n):
    c,ti  =  (int(x) for x in input().split())
    A.append([c,ti])

B = []
for i in A:
    if A[1] < t:
        B.append(i)

if len(B):
    B.sort(key=lambda x: x[0])
    print(B[0])
else:
    print("TLE")

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

n,t =  (int(x) for x in input().split())

A = []
for i in range(n):
    c,ti  =  (int(x) for x in input().split())
    A.append([c,ti])

A.sort(key=lambda x: x[1])

if A[0][1] > t:
    print("TLE")
else:
    min = A[0][0]
    for i in A:
        if i[1] > t:
            break
        
        if min > i[0]:
            min = i[0]
        
    print(min)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
NT = list(map(int, input().split()))
N = NT[0]
T = NT[1]
l = []
for i in range(N):
    l.append(list(map(int, input().split())))

lf = list(filter(lambda x: x[1] <= T, l))

if(len(lf) == 0):
    print('TLE')
else:
    ls = sorted(lf, key=lambda x: x[0])
    print(l.index(ls[0]) + 1)

NT = list(map(int, input().split()))
N = NT[0]
T = NT[1]
l = []
for i in range(N):
    l.append(list(map(int, input().split())))

lf = list(filter(lambda x: x[1] <= T, l))

if(len(lf) == 0):
    print('TLE')
else:
    ls = sorted(lf, key=lambda x: x[0])
    print(ls[0][0])

Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T = int(x) for x in input().split()
C = 2000
for i in range(N):
  c,t = int(x) for x in input().split()
  if t <= T:
    C = min(c,C)
    
if C == 2000:
  print("TLE")
else: print(C)


N,T = int(input().split())
C = 2000
for i in range(N):
  c,t = int(input().split())
  if t <= T:
    C = min(c,C)
    
if C == 2000:
  print("TLE")
else: print(C)

N,T = (int(x) for x in input().split())
C = 2000
for i in range(N):
  c,t = (int(x) for x in input().split())
  if t <= T:
    C = min(c,C)
    
if C == 2000:
  print("TLE")
else: print(C)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T=map(int,input().split())
ls=[int(input()) for _ in range(N)]
ans='TLE'
for c,t in ls:
  if t <= T:
    ans = min(ans,c)
    
print(ans)

N,T=map(int,input().split())
ls=[int(input()) for _ in range(N)]
ans=10**18
for i in ls:
  if i[0] <= T:
    ans = min(ans,i[1])
if ans < 10**18:
  print(ans)
else:
  print('TLE')


N,T=map(int,input().split())
ls=[int(input()) for _ in range(N)]
ans=10**18
for i in ls:
  if i[1] <= T:
    ans = min(ans,i[0])
if ans < 10**18:
  print(ans)
else:
  print('TLE')


N,T=map(int,input().split())
ls=[int(input()) for _ in range(N)]
ans=10**18
for c,t in ls:
  if t <= T:
    ans = min(ans,c)
if ans < 10**18:
  print(ans)
else:
  print('TLE')

N,T=map(int,input().split())
ls=[list(map(int,input().split())) for _ in range(N)]
ans=10**18
for i in ls:
  if i[1] <= T:
    ans = min(ans,i[0])
if ans < 10**18:
  print(ans)
else:
  print('TLE')


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n, T = map(int, input.split())
res = 2000
for _ in range(n):
  c, t = map(int, input.split())
  if t > T: continue
  res = min(res, c)
if res == 2000:
  print('TLE')
else:
  print(res)

n, T = map(int, input().split())
res = 2000
for _ in range(n):
  c, t = map(int, input().split())
  if t > T: continue
  res = min(res, c)
if res == 2000:
  print('TLE')
else:
  print(res)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T = map(int,input().split())
ci = []
ti = []
for i in range(N):
  c, t = input().split()
  ci.append(int(c))
  ti.append(int(t))

#print(ci,ti)

lowest=1000

for i in range(N):
  if ti[i]<=T and ci[i]<=lowest:
    lowest=ci[i]
if max(ti)>T:
  print('TLE')
else:
  print(lowest)
  

N,T = map(int,input().split())
ci = []
ti = []
for i in range(N):
  c, t = input().split()
  ci.append(int(c))
  ti.append(int(t))

#print(ci,ti)

lowest=1000

if min(ti)>T:
  print('TLE')
else:
  for i in range(N):
    if ti[i]<=T and ci[i]<=lowest:
      lowest=ci[i]
  print(lowest)
  

Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,K=[int(s) for s in input().split()]
m=10000
n=10000
for i in range(N):
  a,b=[int(s) for s in input().split()]
  if b<K:
    n=min([n,a])
if m==10000:
  print("TLE")
else:
  print(a)
    

N,K=[int(s) for s in input().split()]
n=10000
for i in range(N):
  a,b=[int(s) for s in input().split()]
  if b<=K:
    n=min([n,a])
if n==10000:
  print("TLE")
else:
  print(n)
    


Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_no = 0
ans_cost = t

for i in range(n):
    a,b = map(int,input().split())
    if b<ans_cost:
        ans_no = a

if ans_no = 0:
    print("TLE")
else print(ans_no)

# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_cost = float('inf')
ans_time = t

for i in range(n):
    a,b = map(int,input().split())
    if b=ans_time:
        if a<ans_cost:
            ans_cost = a


if ans_cost == float('inf'):
    print("TLE")
else:
     print(ans_cost)

# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_cost = 10000
ans_time = t

for i in range(n):
    a,b = map(int,input().split())
    if b<=ans_time:
        if a<ans_cost:
            ans_cost = a


if ans_cost == 10000:
    print("TLE")
else:
     print(ans_cost)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N, T = map(int, input().split())
ans = 'TLE'
cost = float('inf')

for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans = min(ans, c)

print(ans)

N, T = map(int, input().split())
ans = float('inf')
cost = float('inf')

for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans = min(ans, c)

if ans < float('inf'):
  print(ans)
else:
  print('TLE')


Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T = map(int,input().split())
a= [map(int,input().split()) for i in range(N)]
b = []
for i in range(N):
    b.append(a[i][0])
L = sorted(b)
i = 0
while i < N:
    if L[i] < T:
        print(L[i])
        break
    else:
        i = i+1
        continue
if i == N:
    print("TLE")

N,T = map(int,input().split())
for i in range(N):
  c,t = list(map(int,input()))
a = 1000
for i in range(N):
  if t <= T:
    a = min(a,c)
if a = 1000:
  print("TLE")
else:
  print(a)

N,T = map(int,input().split())
for i in range(N):
  dic  = {int(input()):int(input())}
a = sorted(dic.get())
for i in range(N):
  if dic[a[i]] <= T:
    print(a[i])
  else:
    continue

N,T = map(int,input().split())
c,t = [map(int,input()) for i in range(N)]
a = 1000
for i in range(N):
  if t <= T:
    a = min(a,c)
if a = 1000:
  print("TLE")
else:
  print(a)

N,T = map(int,input().split())
dic = {}
for i in range(N):
    dic[int(input())] = int(input())
L = sorted(dic.dict_keys)
for i in range(N):
    if dic[i] <T:
        print(L[i])
        break
print("TLE")

N,T = map(int,input().split())
for i in range(N):
  c,t = map(int,input())
a = 1000
for i in range(N):
  if t <= T:
    a = min(a,c)
if a = 1000:
  print("TLE")
else:
  print(a)

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

ct = [list(map(int,input().split())) for i in range(N)]

c = []
t = []

for i in range(N):
    c.append(ct[i][0])
    t.append(ct[i][1])

minc = 10000

for i in range(len(c)):
    if t[i] <= T and c[i] < minc:
        minc = c[i]

if minc == 10000:
    print("TLE")
else:
    print(minc)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,T = map(int, input())
ans = 1000
for i in range(n):
  c,t = map(int, input())
  if t <= T:
    ans = min(ans, c)
print(ans)

n,T = map(int, input().split())
ans = 1001
for i in range(n):
  c,t = map(int, input().split())
  if t <= T:
    ans = min(ans, c)

if ans == 1001:
  print("TLE")
else:
  print(ans)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T = map(int,input().split())
c,t = [list(map(int,input.split())) for i in N]
min_c = 1000
hantei = 0
ans = 0
for i in N:
  tmp = 0
  if t[i] <= T:
    tmp = 1
    hantei += 1
  if tmp == 1:
    if c[i] < min_c:
      min_c = c[i]
      ans = i+1
print ans if hantei>0 else 'TLE'  

N,T = map(int,input().split())
c,t = [list(map(int,input.split())) for i in N]
min_c = 1000
hantei = 0
ans = 0
for i in N:
  tmp = 0
  if t[i] <= T:
    tmp = 1
    hantei += 1
  if tmp == 1:
    if c[i] < min_c:
      min_c = c[i]
      ans = i+1
print(ans)    

N,T = map(int,input().split())
c = []
for i in range(N):
  ci,ti = map(int,input().split())
  c.append([ci,ti])

c.sort(key=lambda x:x[0])
for i in range(N):
  if c[i][1] <= T:
    print( c[i][0])
    exit()
print('TLE')

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for _ in range(n)]
mc=100000
for i in range(n):
    if ct[i][1]<=t:
        if ct[i][0]<mc:
            mc=ct[i][0]
if mi==-1:
    print("TLE")
else:
    print(mc)

n,t=map(int,input().split())
ct=[list(map(int,input().split())) for _ in range(n)]
mc=100000
for i in range(n):
    if ct[i][1]<=t:
        if ct[i][0]<mc:
            mc=ct[i][0]
if mc==100000:
    print("TLE")
else:
    print(mc)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n, T = map(int, input().split())
a = 1001
for i in range(n):
  c, t = map(int, input().split())
  if t < T:
    a = min(a.c)
if a == 1001:
  print("TLE")
else:
  print(a)

n, T = map(int, input().split())
a = 1001
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        a = min(a,c)
if a == 1001:
    print("TLE")
else:
    print(a)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,T=map(int,input().strip().split())
arr=[]
for _ in range(n):
    c,t=map(int,input().strip().split())
    arr.append((c,t))
arr=sorted(arr,key=lambda x:x[0])
flag=True
for a,b in arr:
    if b<=T:
        print(a)
        break
    else:
        flag=False 
if flag==False:
    print('TLE')
    


n,T=map(int,input().strip().split())
arr=[]
for _ in range(n):
    c,t=map(int,input().strip().split())
    arr.append((c,t))
arr=sorted(arr,key=lambda x:x[0])
flag=True
for a,b in arr:
    if b<=T:
        flag=True
        print(a)
        break
    else:
        flag=False 
if flag==False:
    print('TLE')
    


Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T=map(int,input().split())
li = [list(map(int,input().split())) for i in range(N)]
t_cost=[T - li[i][1] for i in range(N)]
if(all(x < 0 for x in t_cost)):
  print('TLE')
else:
  t_cost_1=[]
  for i in range(N):
    if(t_cost[i]>=0):
      t_cost_1.append(i)
    else:
  print(min([li[t_cost_1[i]][0] for i in range(len(t_cost_1))]))

N, T = map(int, input().split())
result = 1001
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        result = min(result, c)

if (result == 1001):
    print('TLE') 
else:
    print(result)

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T=map(int,input().split())
m=1001
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        m=min(m,c)
if m==1001:
    print('TLE')

N,T=map(int,input().split())
m=1001
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        m=min(m,c)
    
if m==1001:
    print('TLE')
else:
    print(m)
    
        

Verdicts: Wrong Answer

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n,t = map(int, input().split())
l = []
for _ in range(n):
  i, c = map(int, input().split())
  if not c => j:
    l.append([c, j])
l.sort(key=lambda x: x[1])
print(l[0][0])

N,T = map(int, input().split())
l = []
for i in range(N):
  c, t = map(int, input().split())
  if not t > T:
    l.append([i+1, c])
if l == []:
    print('TLE'); exit()
l.sort(key=lambda x: x[1])
print(l[0][1])

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0][0])


N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0])


Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
from sys import stdin
import bisect

n,t = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li2 = []
for i in range(n):
    if li[i][0] <= t:
        li2.append(li[i][0])

li2.sort()

print(li2[0])

from sys import stdin
import bisect

n,t = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li2 = []
for i in range(n):
    if li[i][1] <= t:
        li2.append(li[i][0])
if len(li2) == 0:
    print("TLE")
    exit()
li2.sort()
print(li2[0])

Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
N, T = map(int, input().split())
ans = 1000000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
    ans = min(ans, c)
print(ans if ans < T else "TLE")


N, T = map(int, input().split())
ans = 1000000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print("TLE" if ans == 1000000 else ans)


Verdicts: Runtime Error

Accepted
Problem: When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.  You, the smartwatch, has found N routes to his home.  If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.  Find the smallest cost of a route that takes not longer than time T.

Submission attempts (in order):
n = int(input())
h = list(map(int, input().split()))
ans = 1

for i in range(1, n):
    if max(h[:i]) <= h[i]:
        ans += 1

print(ans)

n, t = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]
ans = []

for i in ct:
    if i[1] <= t:
        ans.append(i)

if not ans:
    print('TLE')
else:
    ans.sort(key=lambda x: x[0])
    print(ans[0][0])

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
from math import sqrt, ceil
import sys

N, M = map(int, input().split())
rootM = max(ceil(sqrt(M)), M//N)

for m in reversed(range(1, rootM+1)):
    if M % m == 0:
        print(m)
        if M // m >= N:
            print(m)
            sys.exit()

from math import sqrt, floor
 
N, M = map(int,input().split())
 
rootM = floor(sqrt(M))
l = []
for i in range(1, rootM +1):
    if M % i == 0:
        l.append(i)
        l.append(M//i)
        
ans = 1
for li in l:
    ans = max(ans, li) if li <= M // N else ans
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N ,M = map(int,input().split())
ans = 0
for i in range(1,int(M**(1/2)+1)):
    if M % i == 0:
        ans = max(ans,i)
        ans = max(ans,M//i)
print(ans)

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


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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
from fractions import gcd


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


if __name__ == '__main__':
    main()



def main():
    n, m = map(int, input().split())
    f = [1, m]
    i = 2
    while i * i <= m:
        if m % i == 0:
            f.append(i)
            if m != i * i:
                f.append(m // i)
        i += 1
    f.sort()
    answer = 0
    for ff in f:
        if n <= ff:
            answer = m // ff
            break
    print(answer)


if __name__ == '__main__':
    main()



Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

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

while cand > 0:
    print(cand)
    if M % cand == 0:
        #print(cand)
        exit()
    cand -= 1

def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) ):
        if n % i == 0:
            divisors.append(i)
            if i != 1 and i * i != n:
                divisors.append(n//i)
    return sorted(divisors, reverse=reverse)

divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)

for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

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

def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) ):
        if n % i == 0:
            divisors.append(i)
            if i != 1 and i * i != n:
                divisors.append(n//i)
    return sorted(divisors, reverse=reverse)


divisors = enum_divisors(M, reverse=True)
print()
divisors = filter(lambda x: x <= M//N, divisors)

cand = M // N

for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = list(filter(lambda x: x <= M//N, divisors))

print(divisors[0])

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import bisect
import sys
N, M = map(int, input().split())
ls = []
for i in range(1, int(M**(1/2))+1):
    if M%i == 0:
        ls.append(i)
ans = []
for x in ls:
    ans.append(x)
    ans.append(M//x)
print(ans[bisect.bisect_left(ans, N)])

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)
ans = 1
for x in ls:
    if M//x <= N:
        ans = max(ans, x)
print(ans)

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//x)
        continue
    if M//x >= N:
        ans = max(ans, x)
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import  math
lis = []

N,M = [int(i) for i in input().split()]
M_ = M
i = 2
for i in range(1,int(math.sqrt(M))):
    if M % i == 0:
        lis.append(i)
        lis.append(M//i)

lis.sort()
ret = 0
for i in lis:
    if i > N:
        break
    ret = i

print(M_//ret )



lis = []

N,M = [int(i) for i in input().split()]
M_ = M
i = 2

while True:
    if M % i == 0:
        M = M // i
        lis.append(i)
    elif M == 1:
        break
    else:
        i += 1
ans = M_

for n in range(2**len(lis)):
    m = bin(n)[-1:1:-1]
    ret = 1
    for l in range(len(m)):
        if int(m[l]):
            ret *= lis[l]
            if  ret >= N:
                break
    if ret >= N and N <=ans:
        ans = ret

print(M_//ans)



lis = []

N,M = [int(i) for i in input().split()]
M_ = M
i = 2

while True:
    if M % i == 0:
        M = M // i
        lis.append(i)
    elif M == 1:
        break
    else:
        i += 1
ans = M_

print(lis)
for n in range(2**len(lis)):
    m = bin(n)[-1:1:-1]
    ret = 1
   # print(m)
    for l in range(len(m)):
        if int(m[l]):
            ret *= lis[l]
           # print(lis[l])
            if  ret > N:
                break
    if ret >= N:
        #print(ret)
        ans = min(ans,ret)

print(M_//ans)

import  math
lis = []

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

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


lis.sort()
for i in lis:
    if i >= N:
        break

print(M//i3 )



lis = []

N,M = [int(i) for i in input().split()]
M_ = M
i = 2

while True:
    if M % i == 0:
        M = M // i
        lis.append(i)
    elif M == 1:
        break
    else:
        i += 1
ans = M_
ret = 1
for n in range(2**len(lis)):
    m = bin(n)[-1:1:-1]
    ret = 1
    for l in range(len(m)):
        if int(m[l]):
            ret *= lis[l]
            if  ret >= N:
                break
    if ret <=ans:
        ans = ret

print(M_//ans)


import  math
lis = []

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

for i in range(1,int(math.sqrt(M))):
    if M % i == 0:
        lis.append(i)


ret = 0
for i in lis:

    ret = i
    if i >= N:
        break

print(M//ret )


import  math
lis = []

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

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


lis.sort()
i =1
for i in lis:
    if i >= N:
        break

print(M//i )


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

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

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

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

i = 1
ans = 1
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      elif m // i >= n:
        ans = max(ans(ans, i))
        
  i += 1
  
  
print(ans)

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n,m = map(int, input().split())
  
if m % n == 0:
  print(m//n)
  exit()
  
elif is_prime(m):
  print(1)
  
else:
  i = 1
  ans = 0
  while i * i  <= m:
    if (m - i * n) % i == 0:
      ans = i
      break
    i += 1

  print(ans)

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

i = 1
ans = 0
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      else m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

import math

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

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

ans = 1
for i in reversed(range(1, int(M ** 0.5)+1)):
    
    rest = M - (i * N)
    if (i+rest) % i == 0:
        ans = i
        
print(ans)


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

i = 1
ans = 0
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      else m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

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

i = 1
ans = 1
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      elif m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

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

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



pn = 2
is_prime = True
while pn*pn <= M:
    if M % pn == 0:
        
        is_prime = False
        break
    pn += 1


if is_prime == False:
    ans = 1
    for i in reversed(range(1, (M**0.5)+1)):
        
        rest = M - (i * N)
        if (i+rest) % i == 0:
            ans = i
            break
else:
    if N == 1:
        ans = M
    else:
        ans = 1

print(ans)  

import math

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

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

ans = 1
for i in range(1, math.ceil(M ** 0.5)):
    if M % i == 0:
        if i*N <= M:
            ans = max(ans, i)
        if (M//i)*N <= M:
           ans = max(ans, M//i) 


print(ans)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Time Limit Exceeded

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import sys

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

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

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 // i)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import sys
n,m=map(long,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])

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

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N, M = map(int, input().split())
d = []
for i in range(M, 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()


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//i)
d.sort()
for i in range(1,len(d)+1):
	if d[-i] <= M//N:
		print(d[-i])
		exit()


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

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

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//i)
    
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
def make_divisors(n):
    lower_divisors,upper_divisors=[],[]
    i=1
    while i*i<=n:
        if n%i=0:
            lower_divisors.append(i)
            if i!=n//i:
                upper_divisors.append(n//i)
        i+=1
    return lower_divisors+upper_divisors[::-1]
n,m=map(int,input().split())
array=make_divisors(m)
array.reverse()
for ele in array:
    if m//ele>=n:
        print(ele)
        exit()
        

def cd_generator(num):
    i=1
    lower=[]
    upper=[]
    while i*i<=num:
        if num%i==0:
            lower.append(i)
            if num!=i*i:
                upper.append(num//i)
        i+=1
    return reversed(lower+upper[::-1])
n,m=map(int,input().split())

for ele in cd_generator(m):
    if m/ele>=n:
        print(ele)
        exit()


Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

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

an = m //n
while an*n != m:
  an = m//n
  n = 1 + (m-1)*an
  
print(an)


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

an = m //n
while an*n != m:
  an = m//n
  n = 1 + (m-1)//an
  
print(an)


Verdicts: Time Limit Exceeded

Accepted