Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n,x,y=map(int,input().split())
g = [[i-1,i+1] for i in range(1,n-1)]
g.insert(0,[1])
g.append([n-2])
g[x-1].append(y-1)
g[y-1].append(x-1)
dist = []


def bfs(i):
    d = [float("inf")]*n
    
    que = deque([])
    que.append(i)
    d[i] = 0

    while que:
        idx = que.popleft()
        l = g[idx]
        
        for j in l:
            if d[j] == float("inf"):
                d[j] = d[idx] + 1
                que.append(j)
            elif d[j] > d[idx] + 1:
                d[j] = d[idx] + 1
                que.append(j)
    
    dist.extend(d)

for i in range(n):
    bfs(i)

dist.sort()
for i in range(1,n):
    print(dist.count(i)//2)


Fixed submission:
n,x,y=map(int, input().split())
ans=[0]*n

for i in range(1,n):
	for j in range(i+1,n+1):
		a = min(j-i, abs(x-i)+1+abs(y-j))
		ans[a-1] += 1
		
for i in range(n-1):
	print(ans[i])
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
mas=[[0]*w for _ in range(h)]
cnt=0
for i in range(h):
    if i%2==0:
        for j in range(w)[::2]:
            cnt += 1
    else:
        for j in range(1,w)[::2]:
            cnt += 1
print(cnt)
            

Fixed submission:
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
else:
    print(-(-(h*w)//2))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

while len(deque) > 0:
    s, s_num = deque.popleft()
    for i in range(a_num, s_num + 2):
        s_nxt = s + chr(i)
        s_num = max(s_num, i)
        if len(s_nxt) == n:
            ans.append(s_nxt)
        else:
            deque.appendleft((s_nxt, s_num))

ans.sort()
print(" ".join(ans))

Fixed submission:
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

if n > 1:
    while len(deque) > 0:
        s, s_num = deque.popleft()
        for i in range(a_num, s_num + 2):
            s_nxt = s + chr(i)
            s_num = max(s_num, i)
            if len(s_nxt) == n:
                ans.append(s_nxt)
            else:
                deque.appendleft((s_nxt, s_num))

    ans.sort()
    print(" ".join(ans))

else:
    print("a")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

while len(deque) > 0:
    s, s_num = deque.popleft()
    for i in range(a_num, s_num + 2):
        s_nxt = s + chr(i)
        s_num = max(s_num, i)
        if len(s_nxt) == n:
            ans.append(s_nxt)
        else:
            deque.appendleft((s_nxt, s_num))

ans.sort()
for a in ans:
    print(a)

Fixed submission:
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

if n > 1:
    while len(deque) > 0:
        s, s_num = deque.popleft()
        for i in range(a_num, s_num + 2):
            s_nxt = s + chr(i)
            s_num = max(s_num, i)
            if len(s_nxt) == n:
                ans.append(s_nxt)
            else:
                deque.appendleft((s_nxt, s_num))

    ans.sort()
    print(" ".join(ans))

else:
    print("a")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
hanten=0

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if (f+hanten)%2==0:
            s = s + c
        else:
            s = c + s     

if hanten%2==0:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
hanten=0
s_1 = ""
s_2 = ""

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if (f+hanten)%2==0:
            s_2 += c
        else:
            s_1 = c + s_1     

if hanten%2==0:
    print(s_1 + s + s_2)
else:
    s_3 = s_1 + s + s_2
    print(s_3[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
hanten=0

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if f==1:
            if hanten%2==0:
                s = c + s
            else:
                s = s + c
        else:
            if hanten%2==0:
                s = s + c
            else:
                s = c + s
        

if hanten%2==0:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
hanten=0
s_1 = ""
s_2 = ""

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if (f+hanten)%2==0:
            s_2 += c
        else:
            s_1 = c + s_1     

if hanten%2==0:
    print(s_1 + s + s_2)
else:
    s_3 = s_1 + s + s_2
    print(s_3[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
hanten=0

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if f==1:
            if hanten%2==0:
                s = c + s
            else:
                s = s + c
        else:
            if hanten%2==0:
                s = s + c
            else:
                s = c + s
        

if hanten%2==0:
    print(s)
else:
    s2=""
    for i in range(len(s)):
        s2 += s[-(i+1)]
    print(s2)

                


Fixed submission:
s=input()
q=int(input())
hanten=0
s_1 = ""
s_2 = ""

for i in range(q):
    s1=input()
    if len(s1)==1:
        hanten+=1
    else:
        a,f,c=s1.split()
        f=int(f)
        if (f+hanten)%2==0:
            s_2 += c
        else:
            s_1 = c + s_1     

if hanten%2==0:
    print(s_1 + s + s_2)
else:
    s_3 = s_1 + s + s_2
    print(s_3[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[input() for _ in range(n)]
S_set = set(S)
setl = sorted(S_set)
cnt=0
ans=[]

for s in S_set:
    cnt1 = S.count(s)
    if cnt < cnt1:
        ans.clear()
        ans.append(s)
        cnt = cnt1
    elif cnt == cnt1:
        ans.append(s)

ans.sort()

for a in ans:
    print(a)

Fixed submission:
n=int(input())

cnt={}
ans=[]

for i in range(n):
    s=input()
    if s in cnt.keys():
        cnt[s] += 1
    else:
        cnt[s] = 1

m=max(cnt.values())
key = sorted(cnt.keys())

for a in key:
    if cnt[a] == m:
        print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[input() for _ in range(n)]
S_set = set(S)
setl = sorted(S_set)
cnt={}

for s in S_set:
    cnt[s] = S.count(s)

m=max(cnt.values())
L=[]

for a in setl:
    if cnt[a] == m:
        print(a)


Fixed submission:
n=int(input())

cnt={}
ans=[]

for i in range(n):
    s=input()
    if s in cnt.keys():
        cnt[s] += 1
    else:
        cnt[s] = 1

m=max(cnt.values())
key = sorted(cnt.keys())

for a in key:
    if cnt[a] == m:
        print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=[input() for _ in range(n)]
S_set = set(S)
cnt={}

for s in S_set:
    cnt[s] = S.count(s)

m=max(cnt.values())
L=[]

for a in cnt.keys():
    if cnt[a] == m:
        L.append(a)
L.sort()
for i in range(len(L)):
    print(L[i])


Fixed submission:
n=int(input())

cnt={}
ans=[]

for i in range(n):
    s=input()
    if s in cnt.keys():
        cnt[s] += 1
    else:
        cnt[s] = 1

m=max(cnt.values())
key = sorted(cnt.keys())

for a in key:
    if cnt[a] == m:
        print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
idx = 0
s=sum(p[:k])
e=0

for i in range(1,n-k+1):
    if p[i-1] < p[i+k-1]:
        s1 = sum(p[i:i+k])
        if s1 > s:
            idx = i
            s = s1


l = [(1 + p1)*(p1//2 + 0.5*(p1%2))/p1 for p1 in p[idx:idx+k]]

print(sum(l))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[sum(p[:k])]

for i in range(n-k):
    l1=l[i] - p[i] + p[i+k]
    l.append(l1)

print((max(l)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
idx = 0
s=0
e=0

for i in range(n-k+1):
    s1 = sum(p[i:i+k])
    if s1 > s:
        idx = i
        s = s1

l = [(1 + p1)*(p1//2 + 0.5*(p1%2))/p1 for p1 in p[idx:idx+k]]

print(sum(l))


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[sum(p[:k])]

for i in range(n-k):
    l1=l[i] - p[i] + p[i+k]
    l.append(l1)

print((max(l)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=tuple(map(int,input().split()))
idx = 0
s=0
e=0

for i in range(n-k+1):
    s1 = sum(p[i:i+k])
    if s1 > s:
        idx = i
        s = s1

for i in range(idx,idx+k):
    p1 = p[i]
    e1 = (1 + p1)*(p1//2 + 0.5*(p1%2))/p1
    e += e1

print(e)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[sum(p[:k])]

for i in range(n-k):
    l1=l[i] - p[i] + p[i+k]
    l.append(l1)

print((max(l)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
idx = 0
s=0
e=0

for i in range(n-k+1):
    s1 = sum(p[i:i+k])
    if s1 > s:
        idx = i
        s = s1

for i in range(idx,idx+k):
    p1 = p[i]
    e1 = (1 + p1)*(p1//2 + 0.5*(p1%2))/p1
    e += e1

print(e)


Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[sum(p[:k])]

for i in range(n-k):
    l1=l[i] - p[i] + p[i+k]
    l.append(l1)

print((max(l)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
idx = 0
s=0
e=0

for i in range(n-k+1):
    if sum(p[i:i+k]) > s:
        idx = i
        s = sum(p[i:i+k])

for i in range(idx,idx+k):
    e1 = (1 + p[i])*(p[i]//2 + 0.5*(p[i]%2))/p[i]
    e += e1

print(e)
    

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[sum(p[:k])]

for i in range(n-k):
    l1=l[i] - p[i] + p[i+k]
    l.append(l1)

print((max(l)+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
for i in range(k):
    a=h.index(max(h))
    h[a]=0
print(sum(h))


Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()

if k<n:
    print(sum(h[:n-k]))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int,input().split()))
cnt=1
for i in range(1,n):
    if p[i]<=min(p[:i]):
        cnt+=1
print(cnt)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=1
a=p[0]
for i in range(1,n):
    if p[i] <= a:
        a = p[i]
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(1 if n==1 else 0.5+int(input())%2/10)

Fixed submission:
n=int(input())
print((n-n//2)/n)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    print(a.index(i+1)+1)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l = []
for i in range(n):
    l.append((a[i], i+1)) 
c = sorted(l)
for i in range(n):
    print(c[i][1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
c=""
for i in range(n):
    c += " " + str(a.index(i+1)+1)
print(c[1:])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l = []
for i in range(n):
    l.append((a[i], i+1)) 
c = sorted(l)
for i in range(n):
    print(c[i][1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=0
c=[0]*n
for i in range(n):
    c[i] = str(a.index(i+1)+1)
print(" ".join(c))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l = []
for i in range(n):
    l.append((a[i], i+1)) 
c = sorted(l)
for i in range(n):
    print(c[i][1])
Buggy python submission (verdict: Runtime Error):
n=input()
L=[9,0,900,0,90000]
ans=0
for i in range(len(n)-1):
    ans+=L[i]
if len(n)%2!=0:ans+=int(n)-int("9"*(len(n)-1))
print(ans)

Fixed submission:
n=input()
L=[9,0,900,0,90000]
ans=0
if len(n)==1:ans=int(n)
else:
    for i in range(len(n)-1):
        ans+=L[i]
    if len(n)%2!=0:ans+=int(n)-int("9"*max(0,len(n)-1))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().splut());print((a+b)//2 if (a+b)%2==0 else "IMPOSSIBLE)
"

Fixed submission:
a,b=map(int,input().split());print((a+b)//2 if (a+b)%2==0 else "IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
b = []
for i in range(n):
    b = sorted(a.copy(), reverse=True)
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a.copy(), reverse=True)
for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
def max_cont(n,a_l):
    for i in range(n):
        b = a_l.copy()
        b[i] = 0
        print(max(b))

n = int(input())
a = [int(input()) for _ in range(n)]
b = []
max_cont(n,a)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a.copy(), reverse=True)
for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
b = []
for i in range(n):
    b = a.copy()
    b[i] = 0
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a.copy(), reverse=True)
for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
b = []
for i in range(n):
    b = a.copy()
    b.pop(i)
    print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a.copy(), reverse=True)
for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])
Buggy python submission (verdict: Time Limit Exceeded):
L,R=map(int,input().split())
ans=2019
if L-R>=2018:print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            a = (i*j)%2019
            if a < ans:ans=a
print(ans)



Fixed submission:
L,R=map(int,input().split())
ans=2019
if R-L>=2018:ans=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            a = (i*j)%2019
            if a < ans:ans=a
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())

c_m = b//c - (-(-a//c)) +1
d_m = b//d  - (-(-a//d)) + 1
cd = c*d//math.gcd(c,d)
cd_m = b//(cd) - (-(-a//(cd))) + 1

print(b-a+1 -(c_m + (d_m -cd_m)*(d%c != 0)))

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

a,b,c,d = map(int,input().split())

c_m = b//c - (-(-a//c)) +1
d_m = b//d  - (-(-a//d)) + 1
cd = lcm(c,d)
cd_m = b//(cd) - (-(-a//(cd))) + 1

print(b-a+1 -(c_m + (d_m -cd_m)*(d%c != 0)))
Buggy python submission (verdict: Runtime Error):
print(0 if eval(input().replace(" ","/"))<1 else 10)

Fixed submission:
print(0 if eval(input().replace(" ","-"))<0 else 10)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))

Fixed submission:
n,m=map(int,input().split())
A={int(input()) for _ in range(m)}
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
L=deque([1,1])
if 1 in A:L[1]=0
for i in range(2,n+1):
    if i in A:
        L.append(0)
    else:
        L.append(L[i-2]+L[i-1])
print(L[n]%(10**9 + 7))

Fixed submission:
n,m=map(int,input().split())
A={int(input()) for _ in range(m)}
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
L=[1,1]
if 1 in A:L[1]=0
for i in range(2,n+1):
    if i in A:
        L.append(0)
    else:
        L.append(L[i-2]+L[i-1])
print(L[n]%(10**9 + 7))

Fixed submission:
n,m=map(int,input().split())
A={int(input()) for _ in range(m)}
dp=[1]+[0]*(n+1)
for i in range(n):
    if i in A:
        continue
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
print(dp[n]%(10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
lr = [list(map(int,input().split())) for _ in range(m)]
s = {i:0 for i in range(1,n+1)}
cnt = 0
for i in range(m):
    for j in range(lr[i][0],lr[i][1]+1):
        s[j] += 1
for v in s.values():
    if v == m:cnt += 1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i],r[i] = map(int,input().split())
print(max(min(r) - max(l) + 1, 0))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n

for i in range(1,n):
    dp[i] = min([dp[j] + abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
print(dp[n-1])


Fixed submission:
def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[0]*n

    for i in range(1,n):
        dp[i] = min([dp[j] + abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n

for i in range(1,n):
    cost=[]
    for j in range(max(0,i-k), i):
        cost.append(dp[j] + abs(h[i]-h[j]))
    dp[i] = min(cost)
print(dp[n-1])


Fixed submission:
def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[0]*n

    for i in range(1,n):
        dp[i] = min([dp[j] + abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n

for i in range(1,n):
    cost=float("inf")
    for j in range(max(0,i-k), i):
        cost = min(cost, dp[j] + abs(h[i]-h[j]))
    dp[i] = cost
print(dp[n-1])


Fixed submission:
def main():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[0]*n

    for i in range(1,n):
        dp[i] = min([dp[j] + abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
    print(dp[n-1])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)

Fixed submission:
if int(input())==1:
    print("Hello World")
else:
    print(int(input())+int(input()))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=0

if m%n==0:
    ans=m//n
else:
    for i in range(1,m//n +1)[::-1]:
        if m%i == 0:
            ans = i
            break
print(ans)

Fixed submission:
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=0

if m%n==0:
    ans=m//n
else:
    for i in range(1,m//n +1)[::-1]:
        if m%i == 0 and m/i >= n:
            ans = i
            break
print(ans)

Fixed submission:
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=0

if n==1:
	ans=m
else:
	for i in range(1,m//n +1):
		if m%i == 0 and m/i >= n:
			ans = max(ans, i)
print(ans)

Fixed submission:
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=0
for i in range(1,m//n +1):
	if m%i == 0 and m/i >= n:
		ans = max(ans, i)
print(ans)

Fixed submission:
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = a[0::2]
b1 = sorted(b, key=lambda x: b.count(x))
c = a[1::2]
c1 = sorted(c, key=lambda x: c.count(x))

if b == c:
    print(n//2)
else:
    print(n - b1.count(b1[-1]) - c1.count(c1[-1]))

Fixed submission:
n = int(input())
v = list(map(int,input().split()))
v1 = sorted(v[0::2])
v2 = sorted(v[1::2])
s1 = set(v1)
s2 = set(v2)

## 偶数項・奇数項ごとに最大数および次点の値を保持
eve = [[0,0]]
odd = [[0,0]]
cnt_eve = 1
cnt_odd = 1

for i in range(1,n//2):
    ## 偶数
    if v1[i] == v1[i-1]:
        cnt_eve += 1
    else:
        eve.append([cnt_eve, v1[i-1]])
        cnt_eve = 1
    if v2[i] == v2[i-1]:
        cnt_odd += 1
    else:
        odd.append([cnt_odd, v2[i-1]])
        cnt_odd = 1
    if i == n//2 - 1:
        eve.append([cnt_eve, v1[i]])
        odd.append([cnt_odd, v2[i]])


eve.sort(key=lambda x: x[0], reverse=True)
odd.sort(key=lambda x: x[0], reverse=True)

if eve[0][1] != odd[0][1]:
    ans = n - eve[0][0] - odd[0][0]
    print(ans)
else:
    ans = n - max(eve[0][0] + odd[1][0], eve[1][0] + odd[0][0])
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=input()
ans = 1
for i in range(len(S)):
    if S.count(S[i]) != T.count(T[i]):
        ans = 0
        break
print("Yes" if ans == 1 else "No")

Fixed submission:
s=input()
t=input()
dict_s = {}
dict_t = {}
ans = 0

for i in range(len(s)):
    s1 = s[i]
    if s1 in dict_s.keys():
        dict_s[s1] += 1
    else:
        dict_s[s1] = 1

for i in range(len(t)):
    t1 = t[i]
    if t1 in dict_t.keys():
        dict_t[t1] += 1
    else:
        dict_t[t1] = 1

for i in range(len(s)):
    if dict_s[s[i]] != dict_t[t[i]]:
        ans = 1
        break

print("Yes" if ans==0 else "No")