Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[-1]

for aa in a:
    i=bisect.bisect_left(color, aa)
    if i==0:
        color.insert(0,aa)
        #print("insert")
    else:
        color[i-1]=aa
        #print("update")
    #print(color,aa) 
print(len(color))


Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[1]
lencolor=1
for aa in a:
    aa=-1*aa
    i=bisect.bisect_right(color, aa)
    if i==lencolor:
        color.append(aa)
        lencolor+=1
        #print("insert")
    else:
        color[i]=aa
        #print("update")
    #print(color,aa) 
print(lencolor)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[-1]

for aa in a:
    i=bisect.bisect_left(color, aa)
    if i==0:
        color.insert(0,aa)
        #print("insert")
    else:
        color[i-1]=aa
        #print("update")
    #print(color,aa) 
print(len(color))


Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[1]
lencolor=1
for aa in a:
    aa=-1*aa
    i=bisect.bisect_right(color, aa)
    if i==lencolor:
        color.append(aa)
        lencolor+=1
        #print("insert")
    else:
        color[i]=aa
        #print("update")
    #print(color,aa) 
print(lencolor)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[-1]

for aa in a:
    i=bisect.bisect_left(color, aa)
    if i==0:
        color.insert(0,aa)
        #print("insert")
    else:
        color[i-1]=aa
        #print("update")
    #print(color,aa) 
print(len(color))


Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]

import bisect
#a=[0,2,3,4,67,8]
#a.sort()
#bisect.bisect_left(a, 4) #被ったら左側のindexを返す
#bisect.bisect_right(a, 4)#被ったら右側のindexを返す

color=[1]
lencolor=1
for aa in a:
    aa=-1*aa
    i=bisect.bisect_right(color, aa)
    if i==lencolor:
        color.append(aa)
        lencolor+=1
        #print("insert")
    else:
        color[i]=aa
        #print("update")
    #print(color,aa) 
print(lencolor)
Buggy python submission (verdict: Runtime Error):
s=list(int(input()))

for ss in s:
  if s.count(ss)!=2:
    print("No")
	exit()
    
print("Yes")
  


Fixed submission:
s=list(input())

for ss in s:
  if s.count(ss)!=2:
    print("No")
    exit()
    
print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())

ba=[]
for _ in range(n):
  a,b=map(int,input().split())
  ba.append(b,a)
  
ba.sort()

time=0
for item in ba:
  b=item[0]
  a=item[1]
  
  time+=b
  if time>a:
    print("No")
    exit()
print("Yes")
  

Fixed submission:
n=int(input())

ba=[]
for _ in range(n):
  a,b=map(int,input().split())
  ba.append([b,a])
  
ba.sort()

time=0
for item in ba:
  b=item[0]
  a=item[1]
  #print(a,b,time)
  
  time+=a
  if time>b:
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[]

import heapq  
heapq.heapify(a) 

for _ in range(m):
    b,c=map(int,input().split())
    for _ in range(b):
        temp=heapq.heappop(a)
        if temp<c:
            heapq.heappush(a,c)
        else:
            heapq.heappush(a,temp)
            break
#print(a)
print(sum(list(a)))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
#bc=[]

import heapq  
heapq.heapify(a) 

bc=[]
for _ in range(m):
    b,c=map(int,input().split())
    bc.append((c,b))

bc.sort(reverse=True)
for item in bc:
    b=item[1]
    c=item[0]    
    for _ in range(b):
        temp=heapq.heappop(a)
        if temp<c:
            heapq.heappush(a,c)
        else:
            heapq.heappush(a,temp)
            print(sum(list(a)))
            exit()
#print(a)
print(sum(list(a)))
Buggy python submission (verdict: Runtime Error):
n=int(input())

uvw={}
tree=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=list(map(int,input().split()))
    uvw[(u-1,v-1)]=w
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    #u<v

result=[-1]*n
#print(tree)
def DEF(x,dis):
    #print("x",x)
    global tree, uvw,result
    for nextNode in tree[x]:
        if result[nextNode]==-1:
            nextDis=dis+uvw[(min(x,nextNode),max(x,nextNode))]
            if (nextDis)%2==0:
                result[nextNode]=0
                DEF(nextNode,nextDis)
            else:
                result[nextNode]=1
                DEF(nextNode,nextDis)
result[0]=0
DEF(0,0)

for item in result:
    print(item)

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)



n=int(input())

uvw={}
tree=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=list(map(int,input().split()))
    uvw[(u-1,v-1)]=w
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    #u<v

result=[-1]*n
#print(tree)
def DEF(x,dis):
    #print("x",x)
    global tree, uvw,result
    for nextNode in tree[x]:
        if result[nextNode]==-1:
            nextDis=dis+uvw[(min(x,nextNode),max(x,nextNode))]
            if (nextDis)%2==0:
                result[nextNode]=0
                DEF(nextNode,nextDis)
            else:
                result[nextNode]=1
                DEF(nextNode,nextDis)
result[0]=0
DEF(0,0)

for item in result:
    print(item)
Buggy python submission (verdict: Runtime Error):
n=int(input())

#n=m*a+a
#n=(m+1)*a
#m>a

cnt=0
for i in range(1,int(n**(0.5))+1):
    if n%i==0:
        m=n//i-1
        if n%m==n//m:
            cnt+=m
print(cnt)
        
    


Fixed submission:
n=int(input())

#n=m*a+a
#n=(m+1)*a
#m>a

if n==1 or n==2:
    print(0)
    exit()

cnt=0
for i in range(1,int(n**(0.5))+1):
    if n%i==0:
        m=n//i-1
        if n%m==n//m:
            cnt+=m
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()

i=0
for ss in s:
  if ss=="#":
    break
  i+=1

s=s[i:]  
  
cnt=0
while s[-1]=="#":
  s=s[:-1]
  if s=="":
    print(0)
    exit()
  
print(min(s.count("."),s.count("#")))

  

Fixed submission:
n=int(input())
s=input()
s=s

ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持

result=ll+rr
for item in s:
    if item=="#":
        ll+=1
    else:
        rr-=1
    
    result=min(result,ll+rr)

print(result)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()

i=0
for ss in s:
  if ss=="#":
    break
  i+=1

s=s[i:]  
  
cnt=0
while s[-1]=="#":
  s=s[:-1]
  
print(min(s.count("."),s.count("#")))

  

Fixed submission:
n=int(input())
s=input()
s=s

ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持

result=ll+rr
for item in s:
    if item=="#":
        ll+=1
    else:
        rr-=1
    
    result=min(result,ll+rr)

print(result)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()

i=0
for ss in s:
  if ss=="#":
    break
  i+=1

s=s[i:]  
  
cnt=0
for i in range(1,n+1):  
  if s[-1*i]=="#":
    cnt+=1
  else:
    break
if cnt>0:
	s=s[:-1*cnt]
#print(s)
  
print(min(s.count("."),s.count("#")))

  

Fixed submission:
n=int(input())
s=input()
s=s

ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持

result=ll+rr
for item in s:
    if item=="#":
        ll+=1
    else:
        rr-=1
    
    result=min(result,ll+rr)

print(result)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()

i=0
for ss in s:
  if ss=="#":
    break
  i+=1

s=s[i:]  
  
cnt=0
for i in range(1,n+1):  
  if s[-1*i]=="#":
    cnt+=1
  else:
    break

s=s[:-1*cnt]
#print(s)
  
print(min(s.count("."),s.count("#")))

  

Fixed submission:
n=int(input())
s=input()
s=s

ll=0 #左側の黒い数を保持
rr=s.count(".") #右側の白い数を保持

result=ll+rr
for item in s:
    if item=="#":
        ll+=1
    else:
        rr-=1
    
    result=min(result,ll+rr)

print(result)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())


print(max(a,b)+max(max(a,b)-1),min(a,b))

Fixed submission:
a,b=map(int,input().split())


print(max(a,b)+max(max(a,b)-1,min(a,b)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(2147483647)
INF=float('inf')
MOD=10**9+7
input=sys.stdin.readline

n=int(input())
s=list(map(int,input().split()))
import copy
def DEF(ary,ary2):
    #print(ary,ary2)
    global n,s
    if len(ary2)==n:
        #print(ary)
        if ary==s:
            for item in ary2:
                print(item)
            exit()
    else:
        for i in range(len(ary)+1):
            tmp = copy.deepcopy(ary)
            tmp.insert(i,i+1)
            DEF(tmp,ary2+[i+1])

DEF([],[])
print(-1)


Fixed submission:
n=int(input())
s=list(map(int,input().split()))


result=[]

for i in range(n):
    posi=-1
    for index,ss in enumerate(s):
        if ss==index+1:
            posi=index
    if posi==-1:
        print(-1)
        exit()
    else:
        result.append(s[posi])
        s.pop(posi)

for item in result[::-1]:
    print(item)
Buggy python submission (verdict: Runtime Error):
n=int(input())
cc=[int(input()) for _ in range(n)]


c=[cc[0]]
for i in range(1,n):
    if cc[i]!=cc[i-1]:
        c.append(cc[i])

n=len(c)

right_index=[-1]*n
tmp_right_index=[-1]*n

for i in range(n):
    if tmp_right_index[c[i]]==-1:
        tmp_right_index[c[i]]=i
    else:
        right_index[i]=tmp_right_index[c[i]]
        tmp_right_index[c[i]]=i

dp=[0]*n

#print(0,c)
for i in range(n):
    if i==0:
        dp[i]=1
    else:
        if right_index[i]==-1:
            dp[i]+=dp[i-1]
        else:
            dp[i]+=dp[i-1]+dp[right_index[i]]

print(dp[-1])







    



Fixed submission:
n=int(input())
cc=[int(input()) for _ in range(n)]


c=[cc[0]]
for i in range(1,n):
    if cc[i]!=cc[i-1]:
        c.append(cc[i])

n=len(c)

right_index=[-1]*n
tmp_right_index=[-1]*(max(c)+1)

for i in range(n):
    if tmp_right_index[c[i]]==-1:
        tmp_right_index[c[i]]=i
    else:
        right_index[i]=tmp_right_index[c[i]]
        tmp_right_index[c[i]]=i

dp=[0]*n
mod=10**9+7
#print(0,c)
for i in range(n):
    if i==0:
        dp[i]=1
    else:
        if right_index[i]==-1:
            dp[i]+=dp[i-1]%mod
        else:
            dp[i]+=dp[i-1]+dp[right_index[i]]%mod

print(dp[-1]%mod)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

aa=min(a,b)
bb=min(cc,max(a,b))

print((aa*bb)//2)

Fixed submission:
a,b,c=map(int,input().split())

aa=min(a,b)
bb=min(c,max(a,b))

print((aa*bb)//2)
Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())


wv=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*(w+1) for _ in range(n)]


for i in range(n):
    for j in range(w+1):
        if i==0:
            if j>=wv[i][0]:
                dp[i][j]=wv[i][1]
        else:
            if j< wv[i][0]:
                dp[i][j]=dp[i-1][j]
            else:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-wv[i][0]]+wv[i][1])



print(max(dp[n-1][w]))


Fixed submission:
n,w=map(int,input().split())


wv=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*(w+1) for _ in range(n)]


for i in range(n):
    for j in range(w+1):
        if i==0:
            if j>=wv[i][0]:
                dp[i][j]=wv[i][1]
        else:
            if j< wv[i][0]:
                dp[i][j]=dp[i-1][j]
            else:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-wv[i][0]]+wv[i][1])



print(dp[n-1][w])

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


wv=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*(w+1) for _ in range(n)]


for i in range(n):
    for j in range(w+1):
        if i==0:
            if j>=wv[i][0]:
                dp[i][j]=wv[i][1]
        else:
            if j< wv[i][0]:
                dp[i][j]=dp[i-1][j]
            else:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-wv[i][0]]+wv[i][1])



print(max(dp[-1]))


Fixed submission:
n,w=map(int,input().split())


wv=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*(w+1) for _ in range(n)]


for i in range(n):
    for j in range(w+1):
        if i==0:
            if j>=wv[i][0]:
                dp[i][j]=wv[i][1]
        else:
            if j< wv[i][0]:
                dp[i][j]=dp[i-1][j]
            else:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-wv[i][0]]+wv[i][1])



print(dp[n-1][w])
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())


h=list(int(input()) for in range(n))
h.sort()
result=10**9

i=0
while i+k-1<n:
  result=min(result,h[i+k-1]-h[i])
  
  i+=1
  
print(result)
    

Fixed submission:
n,k=map(int,input().split())
 
 
h=list(int(input()) for _ in range(n))
h.sort()
result=10**9
 
i=0
while i+k-1<n:
  result=min(result,h[i+k-1]-h[i])
  
  i+=1
  
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

py=[]
#初期値が0の辞書

p2year = [[] for _ in range(n+1)]

for _ in range(m):
    p,y=map(int,input().split())
    py.append((p,y))
    p2year[p].append(y)


for item in range(n+1):
    p2year[item].sort()

for item in py:
    pp=item[0]
    yy=item[1]
    result=str(pp).zfill(6)+str((p2year[pp].index(yy)+1)).zfill(6)
    print(result)



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

py=[]
#初期値が0の辞書

p2year = [[] for _ in range(n+1)]

for _ in range(m):
    p,y=map(int,input().split())
    py.append((p,y))
    p2year[p].append(y)

#初期値が0の辞書
from collections import defaultdict
py2index = defaultdict(lambda: 0) 

for item in range(n+1):
    p2year[item].sort()
    for index,temp in enumerate(p2year[item]):
        py2index[(item,temp)]=index+1

for item in py:
    pp=item[0]
    yy=item[1]
    result=str(pp).zfill(6)+str((py2index[(pp,yy)])).zfill(6)
    print(result)

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

py=[]
#初期値が0の辞書
from collections import defaultdict
p2year = defaultdict(lambda: []) 

for _ in range(m):
    p,y=map(int,input().split())
    py.append((p,y))
    p2year[p].append(y)


for item in p2year.keys():
    p2year[item].sort()

for item in py:
    pp=item[0]
    yy=item[1]
    result=str(pp).zfill(6)+str((p2year[pp].index(yy)+1)).zfill(6)
    print(result)



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

py=[]
#初期値が0の辞書

p2year = [[] for _ in range(n+1)]

for _ in range(m):
    p,y=map(int,input().split())
    py.append((p,y))
    p2year[p].append(y)

#初期値が0の辞書
from collections import defaultdict
py2index = defaultdict(lambda: 0) 

for item in range(n+1):
    p2year[item].sort()
    for index,temp in enumerate(p2year[item]):
        py2index[(item,temp)]=index+1

for item in py:
    pp=item[0]
    yy=item[1]
    result=str(pp).zfill(6)+str((py2index[(pp,yy)])).zfill(6)
    print(result)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[int(input()) for _ in range(n)]
from collections import deque
d.sort()
a=deque(d)

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

res=ans

d.sort(reverse=True)
a= deque(copy.deepcopy(d))

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

print(max(ans,res))




            




Fixed submission:
n=int(input())
d=[int(input()) for _ in range(n)]
from collections import deque
d.sort()
a=deque(d)

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

res=ans
import copy
d.sort(reverse=True)
a= deque(copy.deepcopy(d))

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

print(max(ans,res))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n==1:
    print("Hello World")
else:
    a,b=map(int,input().split())
    print(a+b)

Fixed submission:
n=int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy python submission (verdict: Runtime Error):
n=int(input())

zahyo=[]

for _ in range(n):
    zahyo.append(list(map(int,input().split())))

for x in range(101):
    for y in range(101):

        flag=0
        saisho=10**9+1
        H=0
        for item in zahyo:
            if item[2]==0:
                saisho=min(saisho,abs(x-item[0])+abs(y-item[1]))
            else:
                if H==0:
                    H=item[2]+abs(item[0]-x)+abs(item[1]-y)
                else:
                    H_temp=item[2]+abs(item[0]-x)+abs(item[1]-y)
                    if H_temp!=H:
                        flag=1
                        break
        if flag==0 and H<=saisho:
            print(x,y,H)


            




Fixed submission:
n=int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
n=int(input())

zahyo=[]

for _ in range(n):
    zahyo.append(tuple(map(int,input().split())))

zahyo.sort(key=lamda x:x[2])

for x in range(101):
    for y in range(101):


        H=zahyo[0][2]+abs(zahyo[0][0]-x)+abs(zahyo[0][1]-y)
        flag=0
        saisho=10**9+1
        H=0
        for item in zahyo[1:]:
                if item[2]==0:
                    if H>abs(item[0]-x)+abs(item[1]-y):
                        flag=1
                        break
                else:
                    if H!=item[2]+abs(item[0]-x)+abs(item[1]-y):
                        flag=1
                        break
        if flag==0:
            print(x,y,H)


            




Fixed submission:
n=int(input())

hxy=[]
for _ in range(n):
    x,y,h=map(int,input().split())
    hxy.append([h,x,y])

hxy.sort()

for cx in range(101):
    for cy in range(101):
        flag=0
        temp=hxy[-1]
        H=temp[0]+abs(temp[1]-cx)+abs(temp[2]-cy)

        for item in hxy:
            h=item[0]
            x=item[1]
            y=item[2]
            if h!=max(H-abs(x-cx)-abs(y-cy),0):
                flag=1
                break
        
        if flag==0:
            print(cx,cy,H)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

for _ in range(m):
    if m%n==0:
        print(m//n)
        exit()
    n+=1



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

def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i>=m:
                divisors.append(i)
            if i != n // i:
                if n//i>=m:
                    divisors.append(n//i)

    divisors.sort()
    return divisors

test=make_divisors(m,n)
print(m//min(test))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

for _ in range(m)
    if m%n==0:
        print(m//n)
        exit()
    n+=1

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

def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i>=m:
                divisors.append(i)
            if i != n // i:
                if n//i>=m:
                    divisors.append(n//i)

    divisors.sort()
    return divisors

test=make_divisors(m,n)
print(m//min(test))

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

while 1:
    if m%n==0:
        print(m//n)
        exit()
    n+=1



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

def make_divisors(n,m):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i>=m:
                divisors.append(i)
            if i != n // i:
                if n//i>=m:
                    divisors.append(n//i)

    divisors.sort()
    return divisors

test=make_divisors(m,n)
print(m//min(test))
Buggy python submission (verdict: Runtime Error):
n=int(input())
vv=list(map(int,input().split()))

odd=[[0,0] for _ in range(5+1)]
even=[[0,0] for _ in range(5+1)]
ev=0
od=0


for i,v in enumerate(vv):
    if i%2==0:
        ev+=1
        even[v-1][1]=v-1
        even[v-1][0]+=1
    else:
        od+=1
        odd[v-1][1]=v-1
        odd[v-1][0]+=1


even.sort()
odd.sort()

#print(odd)
#print(even)


if even[-1][1]!=odd[-1][1]:
    print(ev-even[-1][0]+od-odd[-1][0])
else:
    print(min(ev-even[-2][0]+od-odd[-1][0],ev-even[-1][0]+od-odd[-2][0]))






Fixed submission:
n=int(input())
vv=list(map(int,input().split()))

odd=[[0,0] for _ in range(10**5+1)]
even=[[0,0] for _ in range(10**5+1)]
ev=0
od=0


for i,v in enumerate(vv):
    if i%2==0:
        ev+=1
        even[v-1][1]=v-1
        even[v-1][0]+=1
    else:
        od+=1
        odd[v-1][1]=v-1
        odd[v-1][0]+=1


even.sort()
odd.sort()

#print(odd)
#print(even)


if even[-1][1]!=odd[-1][1]:
    print(ev-even[-1][0]+od-odd[-1][0])
else:
    print(min(ev-even[-2][0]+od-odd[-1][0],ev-even[-1][0]+od-odd[-2][0]))
Buggy python submission (verdict: Runtime Error):
n,start=map(int,input().split())
town=list(map(int,input().split()))

kyori=[]

for item in town:
    kyori.append(abs(item-start))

import math
temp=kyori[0]

for item in kyori:
    temp=math.gcd(item, temp)

print(temp)


Fixed submission:
n,start=map(int,input().split())
town=list(map(int,input().split()))

kyori=[]

for item in town:
    kyori.append(abs(item-start))
import fractions
temp=kyori[0]

for item in kyori:
    temp=fractions.gcd(item, temp)

print(temp)