Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

num = int(input())
print(a[num])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

num = input()
num = int(num) - 1

if 0 <= num <= 31:
    print(a[num])
else:
    pass

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

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[num])


Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

num = input()
num = int(num) - 1

if 0 <= num <= 31:
    print(a[num])
else:
    pass

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b, = map(int, input())
print(a[b-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[input()-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[map(int, input())-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])

Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[map(input())-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])
Buggy python submission (verdict: Runtime Error):
a,b,c = input()
if a == b && b == c:
  print(No)
else:
  print(Yes)

Fixed submission:
a,b,c = input()
if a == b == c:
  print('No')
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if b = 1:
  print(0)
else:
	print(a - b)

Fixed submission:
a, b = map(int, input().split())
if b == 1:
    print(0)
else:
    print(a - b)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = list(map(int, input().split()))
flg = True
while True:
  num = str(N)
  for i in range(len(num)):
    if num[i] in D:
      flg = False
      break
  if fig is True:
    print(int(num))
    break
  N += 1
  

Fixed submission:
N, K = map(int, input().split())
D = list(map(str, input().split()))
while True:
    flg = True
    num = str(N)
    for i in range(len(num)):
        if num[i] in D:
            flg = False
            break
    if flg is True:
        print(int(num))
        break
    N += 1
Buggy python submission (verdict: Runtime Error):
print(*[1,2,3,3]

Fixed submission:
# 2020/01/19

n,k,s=map(int,input().split())
if s==10**9:
    rest=10**9-1
else:
    rest=10**9
ans=[s]*k+[rest]*(n-k)
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    lim=False
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=max(bisect_right(l,MIN),j+1)
        if not lim:
            max_idx=bisect_left(l,MAX)
            if max_idx==n:lim=True
        res=max_idx-min_idx
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=max(res,0)
print(cnt)

Fixed submission:
from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    lim=False
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=max(bisect_right(l,MIN),j+1)
        if not lim:
            max_idx=bisect_left(l,MAX)
            if max_idx==n:lim=True
        res=max_idx-min_idx
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=max(res,0)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=bisect_right(l,MIN)
        max_idx=bisect_left(l,MAX)
        min_idx=max(min_idx,j+1)
        res=max_idx-min_idx
        if res<0:continue
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=(max(res,0))
print(cnt)

Fixed submission:
from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    lim=False
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=max(bisect_right(l,MIN),j+1)
        if not lim:
            max_idx=bisect_left(l,MAX)
            if max_idx==n:lim=True
        res=max_idx-min_idx
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=max(res,0)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
# 2019/09/01

n=int(input())
cnt=0
for i in range(1,n):
    cnt+=i
print(cnt)

Fixed submission:
# 2019/09/01

n=int(input())

ans=(1+n-2)*n//2
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import factorial as fc

MOD=10**9+7
n,k=map(int,input().split())

for i in range(1,k+1):
    b=fc(n-k+1)//fc(i)//fc(n-k+1-i)
    r=fc(k-1)//fc(i-1)//fc(k-1-(i-1))
    print(b%MOD*r%MOD)



Fixed submission:
from math import factorial as fc

MOD=10**9+7
n,k=map(int,input().split())

for i in range(1,k+1):
    if n-k+1<i:
        print(0)
        continue
    b=fc(n-k+1)//fc(i)//fc(n-k+1-i)
    r=fc(k-1)//fc(i-1)//fc(k-1-(i-1))
    print(b%MOD*r%MOD)

Buggy python submission (verdict: Runtime Error):
from math import factorial as fc

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

for i in range(1,k+1):
    bl=n-k+1
    br=i
    b=fc(bl)//(fc(br)*fc(bl-br))
    rl=k-1
    rr=i-1
    r=fc(rl)//(fc(rr)*fc(rl-rr))
    print(b*r%(10**9+7))



Fixed submission:
from math import factorial as fc

MOD=10**9+7
n,k=map(int,input().split())

for i in range(1,k+1):
    if n-k+1<i:
        print(0)
        continue
    b=fc(n-k+1)//fc(i)//fc(n-k+1-i)
    r=fc(k-1)//fc(i-1)//fc(k-1-(i-1))
    print(b%MOD*r%MOD)

Buggy python submission (verdict: Runtime Error):
from math import factorial as fc

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

for i in range(1,k+1):
    b=fc(n-k+1)//fc(i)//fc(n-k+1-i)
    r=fc(k-1)//fc(i-1)//fc(k-1-(i-1))
    print(b*r%(10**9+7))


Fixed submission:
from math import factorial as fc

MOD=10**9+7
n,k=map(int,input().split())

for i in range(1,k+1):
    if n-k+1<i:
        print(0)
        continue
    b=fc(n-k+1)//fc(i)//fc(n-k+1-i)
    r=fc(k-1)//fc(i-1)//fc(k-1-(i-1))
    print(b%MOD*r%MOD)
Buggy python submission (verdict: Runtime Error):
n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values())
print(n-mx)



Fixed submission:
n=int(input())
xy=[]
for _ in range(n):
	xy+=[list(map(int,input().split()))]

dic={}
for e in xy:
	for f in xy:
		if e==f:continue
		tmp=(e[0]-f[0],e[1]-f[1])
		dic[tmp]=dic.get(tmp,0)+1

mx=max(dic.values()) if dic else 0
print(n-mx)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=set(range(1,n+1))
for i in range(m):
    l,r=map(int,input().split())
    tmp=set(range(l,r+1))
    ans=ans&tmp
print(len(ans))

Fixed submission:
n,m=map(int,input().split())
left=0
right=n
for i in range(m):
    l,r=map(int,input().split())
    left=max(l,left)
    right=min(r,right)
print(max(0,right-left+1))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ans=set(range(1,n+1))
for i in range(m):
    l,r=map(int,input().split())
    tmp=set(range(l,r+1))
    ans=ans&tmp
print(len(ans))

Fixed submission:
n,m=map(int,input().split())
left=0
right=n
for i in range(m):
    l,r=map(int,input().split())
    left=max(l,left)
    right=min(r,right)
print(max(0,right-left+1))
Buggy python submission (verdict: Runtime Error):
s=input()
aa=int(s[:2])
bb=int(s[3:])
if 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif 0<bb<=12: ans='YYMM'
elif 0<aa<=12: ans='MMYY'
else: ans='NA'
print(ans)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
s=input()
aa=int(s[:2])
bb=int(s[3:])
if aa>12 and bb==0 or aa==0 and bb>12: ans='NA'
elif 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif aa>12 or aa==0 and 0<bb<=12: ans='YYMM'
else :ans='MMYY'
print(ans)1

Fixed submission:
s=input()
aa=int(s[:2])
bb=int(s[2:])
if 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif 0<bb<=12: ans='YYMM'
elif 0<aa<=12: ans='MMYY'
else: ans='NA'
print(ans)
Buggy python submission (verdict: Runtime Error):
# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)

Fixed submission:
# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

import sys
sys.setrecursionlimit(10**7)

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)
Buggy python submission (verdict: Runtime Error):
# 2019/10/10

class unionfind():
    def __init__(self,n):
        self.par=list(range(n+1))
        self.rank=[0]*(n+1)
    
    def find(self,x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.par[x]
    
    def is_same(self,x,y):
        return self.find(x)==self.find(y)
    
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if self.rank[x]<self.rank[y]:
            self.par[x]=y
        else:
            self.par[y]=x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

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

uf=unionfind(n)

for i in range(m):
    x,y=map(int,input().split())
    uf.unite(x,y)
    uf.unite(y,x)

ans=set(uf.par[1:])
print(len(ans))

Fixed submission:
# 2019/10/10

class unionfind():
    def __init__(self,n):
        self.par=list(range(n+1))
        self.rank=[0]*(n+1)
        self.groups=n
    
    def find(self,x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.par[x]
    
    def is_same(self,x,y):
        return self.find(x)==self.find(y)
    
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if self.rank[x]<self.rank[y]:
            self.par[x]=y
        else:
            self.par[y]=x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1
        if x!=y:self.groups-=1

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

uf=unionfind(n)

for i in range(m):
    x,y,z=map(int,input().split())
    uf.unite(x,y)
print(uf.groups)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
cnt=0
s=0
for i in range(n//r+1):
    for j in range(n//g+1):
        k=(n-(i*r+j*g))//b
        s=i*r+j*g+k*b
        if s==n and k>=0:
            cnt+=1
print(cnt)

Fixed submission:
# 2019/10/17

R,G,B,n=map(int,input().split())
cnt=0
for i in range(n//R+1):
    r=i*R
    rem=n-r
    for j in range((n-r)//G+1):
        g=j*G
        b=n-(r+g)
        if b%B:continue
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import re
regex=(r'[A|C|G|T]+')
s=input()
mo=re.search(regex,s)
print(len(mo.group()))

Fixed submission:
import re
regex=(r'[A|C|G|T]+')
s=input()
mo=re.findall(regex,s)
print(len(max(mo,key=len)) if mo!=[] else 0)
Buggy python submission (verdict: Time Limit Exceeded):
import re

n,q=map(int,input().split())
s=input()
pat=r'.*?AC.*?'
regex=re.compile(pat)
res=0

for i in range(q):
	l,r=map(int,input().split())
	l-=1
	res=len(regex.findall(s[l:r]))
	print(res)

Fixed submission:
n,q=map(int,input().split())
s=input()
ac=[0]*n
tmp=0
for i in range(1,n):
	if s[i-1]=='A' and s[i]=='C':
		tmp+=1
	ac[i]=tmp

for i in range(q):
	l,r=map(int,input().split())
	print(ac[r-1]-ac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
import re

n,q=map(int,input().split())
s=input()
pat=r'.*?AC.*?'
regex=re.compile(pat)
res=0

for i in range(q):
	l,r=map(int,input().split())
	l-=1
	res=len(regex.findall(s[l:r]))
	print(res)

Fixed submission:
n,q=map(int,input().split())
s=input()
ac=[0]*n
tmp=0
for i in range(1,n):
	if s[i-1]=='A' and s[i]=='C':
		tmp+=1
	ac[i]=tmp

for i in range(q):
	l,r=map(int,input().split())
	print(ac[r-1]-ac[l-1])
Buggy python submission (verdict: Runtime Error):
t,x=map(float,input())
print(t/3)

Fixed submission:
t,x=map(float,input().split())
print(t/x)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0

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

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

for i in range(1,n):
    for j in range(1,k+1):
        if i-j<0:break
        pre=dp[i-j]+abs(h[i]-h[i-j])
        dp[i]=min(dp[i],pre)
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())

dp=[[0]*(W+1) for i in range(N+1)]

for i in range(1,N+1):
	w,v=map(int,input().split())
	j=0
	for j in range(1,W+1):
		if j-w>=0:
			dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
		else:
			dp[i][j]=dp[i-1][j]
			j+=1
print(dp[-1][-1])

Fixed submission:
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N,W=map(int,input().split())
dp_1=[0]*(W+1)
dp_2=[0]*(W+1)

for i in range(1,N+1):
    w,v=map(int,input().split())
    #dp_2=[0]*(W+1)
    for j in range(1,W+1):
        if j-w>=0:
            dp_2[j]=max(dp_1[j],dp_1[j-w]+v)
        else:
            dp_1[j]=dp_2[j]
    dp_1=copy.copy(dp_2)
print(dp_2[-1])

Fixed submission:
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
input=sys.stdin.readline

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Fixed submission:
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Fixed submission:
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
t=list(input())

lens=len(s)
lent=len(t)

dp=[[0]*(lent+1) for _ in range(lens+1)]

for i in range(lens):
    for j in range(lent):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

ans=''
i,j=lens,lent

while i>=0 and j>=0:
    if dp[i-1][j]==dp[i][j]:i-=1
    elif dp[i][j-1]==dp[i][j]:j-=1
    else:
        ans=s[i-1]+ans
        i,j=i-1,j-1
print(ans)

Fixed submission:
s=list(input())
t=list(input())

lens=len(s)
lent=len(t)

dp=[[0]*(lent+1) for _ in range(lens+1)]

for i in range(lens):
    for j in range(lent):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

ans=''
i,j=lens,lent

while i>=0 and j>=0:
    if dp[i-1][j]==dp[i][j]:i-=1
    elif dp[i][j-1]==dp[i][j]:j-=1
    else:
        ans=s[i-1]+ans
        i,j=i-1,j-1
print(ans)

Buggy python submission (verdict: Runtime Error):
s=list(input())
t=list(input())

lens=len(s)
lent=len(t)

dp=[[0]*(lent+1) for _ in range(lens+1)]

for i in range(lens):
    for j in range(lent):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
#print(dp[-1][-1])

ans=''
i=-1
tmp=dp[-1][-1]
for j in range(lent,-1,-1):
    if dp[i-1][j-1]<tmp:
        ans+=t[j-1]
        tmp=dp[i-1][j-1]
        i-=1
print(ans[::-1])

Fixed submission:
s=list(input())
t=list(input())

lens=len(s)
lent=len(t)

dp=[[0]*(lent+1) for _ in range(lens+1)]

for i in range(lens):
    for j in range(lent):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

ans=''
i,j=lens,lent

while i>=0 and j>=0:
    if dp[i-1][j]==dp[i][j]:i-=1
    elif dp[i][j-1]==dp[i][j]:j-=1
    else:
        ans=s[i-1]+ans
        i,j=i-1,j-1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,*p,=map(int,open(0).read().split())
p=sorted(p)
print(p(max)//2)


Fixed submission:
n=int(input())
p=sorted([int(input()) for i in range(n)])
print(int(max(p)//2+sum(p[:-1])))
Buggy python submission (verdict: Runtime Error):
# 2019/07/25

input=open(0).readline

n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]

h.sort()
ans=float('inf')
for i in range(n-2):
    res=h[i+k-1]-h[i]
    ans=min(ans,res)

print(ans)

Fixed submission:
# 2019/07/25

input=open(0).readline

n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]

h.sort()
ans=float('inf')
for i in range(n-(k-1)):
    res=h[i+k-1]-h[i]
    ans=min(ans,res)

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=[abs((t-int(i)*6/1000)-a) for i in input().split()]
print(h.index(min(h))+1)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
tmp=[]
tmp=[abs(int(t-h[i]*0.006)-a) for i in range(n)]
print(tmp.index(min(tmp))+1)


Fixed submission:
x,y=map(int,input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=[abs((t-int(i)*0.006)-a) for i in open(0).readline().split()]
print(h.index(min(h))+1)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=[abs(t-6e-3*int(i)-a) for i in input().split()]
print(h.index(min(h))+1)
Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x=['' for _ in range(lcd)]
aa=(lcd//n)
bb=(lcd//m)
for i in range(max(n,m)):
    if i<n:
        a=i*aa
        if x[a]==s[i] or x[a]=='':
            x[a]=s[i]
        else:
            print(-1)
            exit()
    if i<m:
        b=i*bb
        if x[b]==t[i] or x[b]=='':
            x[b]=t[i]
        else:
            print(-1)
            exit()
        
print(lcd)


Fixed submission:
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x={}
aa=(lcd//n)
bb=(lcd//m)
for i in range(n):
    a=i*aa
    x[a]=s[i]

for i in range(m):
    b=i*bb
    if b in x and x[b]!=t[i]:
        print(-1)
        exit()
    
print(lcd)

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=list(input())
t=list(input())
lcd=(n*m)//gcd(n,m)
x=['' for _ in range(lcd)]

for i in range(max(n,m)):
    if i<n:
        a=i*(lcd//n)
        if x[a]==s[i] or x[a]=='':
            x[a]=s[i]
        else:
            print(-1)
            exit()
    if i<m:
        b=i*(lcd//m)
        if x[b]==t[i] or x[b]=='':
            x[b]=t[i]
        else:
            print(-1)
            exit()
        
print(lcd)


Fixed submission:
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x={}
aa=(lcd//n)
bb=(lcd//m)
for i in range(n):
    a=i*aa
    x[a]=s[i]

for i in range(m):
    b=i*bb
    if b in x and x[b]!=t[i]:
        print(-1)
        exit()
    
print(lcd)

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=list(input())
t=list(input())
lcd=(n*m)//gcd(n,m)
x=['' for _ in range(lcd)]

for i in range(n):
    a=i*(lcd//n)
    x[a]=s[i]

for i in range(m):
    b=i*(lcd//m)
    if x[b]==t[i] or x[b]=='':
        x[b]=t[i]
    else:
        print(-1)
        exit()
    
print(lcd)


Fixed submission:
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x={}
aa=(lcd//n)
bb=(lcd//m)
for i in range(n):
    a=i*aa
    x[a]=s[i]

for i in range(m):
    b=i*bb
    if b in x and x[b]!=t[i]:
        print(-1)
        exit()
    
print(lcd)

Buggy python submission (verdict: Time Limit Exceeded):
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=list(input())
t=list(input())
lcd=(n*m)//gcd(n,m)
x=['' for _ in range(lcd)]

for i in range(n):
    a=i*(lcd//n)
    x[a]=s[i]

for i in range(m):
    b=i*(lcd//m)
    if x[b]==t[i] or x[b]=='':
        x[b]=t[i]
    else:
        print(-1)
        exit()
    
print(lcd)


Fixed submission:
# 2019/08/11

from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
lcd=(n*m)//gcd(n,m)
x={}
aa=(lcd//n)
bb=(lcd//m)
for i in range(n):
    a=i*aa
    x[a]=s[i]

for i in range(m):
    b=i*bb
    if b in x and x[b]!=t[i]:
        print(-1)
        exit()
    
print(lcd)
Buggy python submission (verdict: Runtime Error):
# 2019/08/01

from fractions import gcd

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

def divisors(n,m):
    div=[]
    end=min(m//n,int(pow(m,0.5)))
    for i in range(2,end+1):
        if m%i==0:
            div.append(i)
    return div

res=divisors(n,m)
print(res[-1])



Fixed submission:
# 2019/08/01

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

def divisors(n,m):
    div=[]
    end=int(pow(m,0.5))
    for i in range(1,end+1):
        if m%i==0:
            div.append(i)
            div.append(m//i)
    div.sort(reverse=True)
    return div

res=divisors(n,m)
for e in res:
    if m//n>=e:
        print(e)
        break