Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = sorted([int(i) for i in input().split()])
F = sorted([int(i) for i in input().split()],reverse=True)
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = sum([max(0, a-mid//f) for a,f in zip(A,F)])
  if k>K: low = mid
  else: high = mid
print(high)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
F = sorted(map(int,input().split()),reverse=True)
low,high = -1, max([a*f for a,f in zip(A,F)])
while high-low>1:
  mid = (high+low)//2
  k = sum([max(0, a-mid//f) for a,f in zip(A,F)])
  if k>K: low = mid
  else: high = mid
print(high)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
F = sorted(map(int,input().split()),reverse=True)
low,high = -1, max(map(lambda x,y:x*y, A,F))
while high-low>1:
  mid = (high+low)//2
  k = sum([a-min(a,mid//f) for a,f in zip(A,F)])
  if k>K: low = mid
  else: high = mid
print(high)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
F = sorted(map(int,input().split()),reverse=True)
low,high = -1, max(map(lambda x,y:x*y, A,F))
while high-low>1:
  mid = (high+low)//2
  k = sum(map(lambda x,y: x-min(x,mid//y), A,F))
  if k>K: low = mid
  else: high = mid
print(high)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
F = sorted(map(int,input().split()),reverse=True)
low,high = -1, max(map(lambda x,y:x*y, A,F))
while high-low>1:
  mid = (high+low)//2
  k = sum(map(lambda x,y:x-y,A,map(lambda x,y:min(x,y),map(lambda x: mid//x,F), A)))
  if k>K: low = mid
  else: high = mid
print(high)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
A = np.array(sorted(map(int,input().split())))
F = np.array(sorted(map(int,input().split()) ,reverse=True))
low,high = -1, int(1e12)
while high-low>1:
  mid = (high+low)//2
  k = (A-np.minimum(A,mid//F)).sum()
  if k>K: low = mid
  else: high = mid
print(high)