Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())

a = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)

A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    q = np.maximum(0, A - s // F_)
    r = (q.sum() <= k)
    if r:
        right = s 
    else:
        left = s 

print(right)



Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
a = np.array(input().split(),np.int)
F = np.array(input().split(),np.int)

A.sort()
F.sort()
F = F[::-1]

left = -1
right = (A * F).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())

a = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)

A.sort()
F.sort()

F = F[::-1]

left = -1
right = (A * F).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())

a = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)

A.sort()
F.sort()
F = F[::-1]

left = -1
right = (A * F).sum()

while (right - left) > 1:
    s = left + ((right - left) // 2)
    for i in range(n):
        b = np.minimum(s//F,A)
    if (A - b).sum() <= k:
        right = s 
    else:
        left = s 

print(right)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())

a = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F = F[::-1]

left = -1
right = (A * F).sum()

while (right - left) > 1:
    b = np.zeros(n,dtype = int)
    s = left + ((right - left) // 2)
    for i in range(n):
        b = np.minimum(s//F,A)
    if (A - b).sum() <= k:
        right = s 
    else:
        left = s 

print(right)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)

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

ss = [[] for i in range(2)]
for i in range(2):
    ss[i] = list(map(int,input().split()))


A = ss[0]
F = ss[1]
A.sort()
F.sort()
F.reverse()

left = -1
right = max([(A[j] * F[j]) for j in range(n)])

while (right - left) > 1:
    b = [[] for i in range(n)]
    s = left + ((right - left) // 2)
    for i in range(n):
        b[i] = min(s//F[i],A[i])
    if (sum(A) - sum(b)) <= k:
        right = s 
    else:
        left = s 

print(right)


Fixed submission:
import numpy as np
n,k = map(int,input().split())

A = np.array(input().split(),np.int)

F = np.array(input().split(),np.int)


A.sort()
F.sort()

F_ = F[::-1]

left = -1
right = (A * F_).sum()

while (right - left) > 1:
    s = (left + right) // 2
    r = np.maximum(0, A - s // F_).sum() <= k
    if r:
        right = s 
    else:
        left = s 

print(right)