Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    def check(a,b,mid,k):
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            return 1
        else:
            return 0
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if check(a,b,mid,k):
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    def check(a,b,mid,k):
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            return 1
        else:
            return 0
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if check(a,b,mid,k):
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    def check(a,b,mid,k):
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            return 1
        else:
            return 0
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if check(a,b,mid,k):
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from numpy import*
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    def check(a,b,mid,k):
        a=array(a)
        b=array(b)
        c=[a[k]-mid//b[k]for k,v in enumerate(a*b)if v>mid]
#        print(c)
        if sum(c)<=k:
            return 1
        else:
            return 0
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if check(a,b,mid,k):
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    def check(a,b,mid,k):
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            return 1
        else:
            return 0
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if check(a,b,mid,k):
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()