Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    lst = (AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]
    lst = [math.ceil(a) for a in lst]
    count = np.sum(lst)
    return count <= K


if(__name__ == "__main__"):
    main()


Fixed submission:
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum(np.ceil((AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]))
    return count <= K


if(__name__ == "__main__"):
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = [int(a) for a in input().split(" ")]
    F = [int(a) for a in input().split(" ")]
    A.sort()
    F.sort()
    F.reverse()
    AF = [A[i] * F[i] for i in range(N)]
    idx = np.argsort(AF)[::-1]

    A = [A[idx[i]] for i in range(N)]
    F = [F[idx[i]] for i in range(N)]
    AF = [AF[idx[i]] for i in range(N)]
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if(abs(b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = 0
    for n in range(N):
        if(AF[n] <= saidai):
            return True
        count += math.ceil((AF[n] - saidai) / F[n])
        if(count > K):
            return False
    return True


if(__name__ == "__main__"):
    main()


Fixed submission:
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum(np.ceil((AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]))
    return count <= K


if(__name__ == "__main__"):
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = [int(a) for a in input().split(" ")]
    F = [int(a) for a in input().split(" ")]
    A.sort()
    F.sort()
    F.reverse()
    AF = [A[i] * F[i] for i in range(N)]
    idx = np.argsort(AF)[::-1]

    A = [A[idx[i]] for i in range(N)]
    F = [F[idx[i]] for i in range(N)]
    AF = [AF[idx[i]] for i in range(N)]
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if(abs(b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = 0
    for n in range(N):
        if(AF[n] <= saidai):
            continue
        count += math.ceil((AF[n] - saidai) / F[n])
        if(count > K):
            return False
    return True


if(__name__ == "__main__"):
    main()


Fixed submission:
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum(np.ceil((AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]))
    return count <= K


if(__name__ == "__main__"):
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = [int(a) for a in input().split(" ")]
    F = [int(a) for a in input().split(" ")]
    A.sort()
    F.sort()
    F.reverse()
    AF = [A[i] * F[i] for i in range(N)]
    idx = np.argsort(AF)[::-1]

    A = [A[idx[i]] for i in range(N)]
    F = [F[idx[i]] for i in range(N)]
    AF = [AF[idx[i]] for i in range(N)]
    m = np.max(AF)

    for i in range(m - 1, 0, -1):
        count = 0
        for n in range(N):
            if(AF[n] <= i):
                continue
            count += math.ceil((AF[n] - i) / F[n])
            if(count > K):
                print(i + 1)
                return
    print(0)


if(__name__ == "__main__"):
    main()


Fixed submission:
import math
import numpy as np


def main():
    s = input().split(" ")
    N = int(s[0])
    K = int(s[1])
    A = np.array([int(a) for a in input().split(" ")])
    F = np.array([int(a) for a in input().split(" ")])
    A = np.sort(A)
    F = np.sort(F)[::-1]
    AF = A * F
    m = np.max(AF)

    if(func(0, AF, F, N, K)):
        print(0)
        return
    a = 0
    b = m
    for aaa in range(m):
        if((b - a) <= 1):
            print(b)
            return
        mid = int((b - a) / 2.) + a
        if(func(mid, AF, F, N, K)):
            b = mid
        else:
            a = mid
    print("???????")


def func(saidai, AF, F, N, K):
    count = np.sum(np.ceil((AF[(AF - saidai) > 0] - saidai) / F[(AF - saidai) > 0]))
    return count <= K


if(__name__ == "__main__"):
    main()