Buggy python submission (verdict: Runtime Error):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = 10**18+1
    l = -10**18

    while l+1 < h:
        m = (h+l)//2

        if m > 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)-1):
                if i >= j: break
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1):
                if i >= j: break
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            for i in range(len(pl)):
                while -pl[i] * mi[j] > m:
                    j += 1
                    if j == len(mi): break
                else:
                    k += len(mi) - j
                    continue
                break
        else:
            k = minus + zero

        if k < K:
            l = m
        else:
            h = m

    print(h)


if __name__ == '__main__':
    main()

Fixed submission:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = INF
    l = -INF-1

    while l+1 < h:
        m = (h+l)//2

        if m > 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)-1):
                if i >= j: break
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1):
                if i >= j: break
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            if len(mi) > 0:
                for i in range(len(pl)-1,-1,-1):
                    while -pl[i] * mi[j] > m:
                        j += 1
                        if j == len(mi): break
                    else:
                        k += len(mi) - j
                        continue
                    break
        else:
            k = minus + zero

        if k < K:
            l = m
        else:
            h = m

    print(h)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = 10**18+1
    l = -10**18

    while l+1 < h:
        m = (h+l)//2

        if m >= 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)-1):
                if i >= j: break
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1):
                if i >= j: break
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            for i in range(len(pl)):
                while -pl[i] * mi[j] > m:
                    j += 1
                    if j == len(mi): break
                else:
                    k += len(mi) - j
                    continue
                break

        if k >= K:
            h = m
        else:
            l = m

    print(h)


if __name__ == '__main__':
    main()

Fixed submission:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = INF
    l = -INF-1

    while l+1 < h:
        m = (h+l)//2

        if m > 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)-1):
                if i >= j: break
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1):
                if i >= j: break
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            if len(mi) > 0:
                for i in range(len(pl)-1,-1,-1):
                    while -pl[i] * mi[j] > m:
                        j += 1
                        if j == len(mi): break
                    else:
                        k += len(mi) - j
                        continue
                    break
        else:
            k = minus + zero

        if k < K:
            l = m
        else:
            h = m

    print(h)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = 10**9+1
    l = -10**9

    while l+1 < h:
        m = (h+l)//2

        if m > 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)):
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1,-1,-1):
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            for i in range(len(pl)):
                while -pl[i] * mi[j] > m:
                    j += 1
                    if j == len(mi): break
                else:
                    k += len(mi) - j
                    continue
                break
        else:
            k = minus

        if k >= K:
            h = m
        else:
            l = m

    print(h)


if __name__ == '__main__':
    main()

Fixed submission:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    N,K = LI()
    pl = []
    mi = []
    z = 0
    for x in sys.stdin.readline().split():
        x = int(x)
        if x > 0:
            pl.append(x)
        elif x < 0:
            mi.append(-x)
        else:
            z += 1
    pl.sort()
    mi.sort()

    minus = len(pl) * len(mi)
    zero = z * (len(pl) + len(mi)) + z * (z-1) // 2

    h = INF
    l = -INF-1

    while l+1 < h:
        m = (h+l)//2

        if m > 0:
            k = minus + zero
            j = len(pl)-1
            for i in range(len(pl)-1):
                if i >= j: break
                while pl[i] * pl[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
            j = len(mi)-1
            for i in range(len(mi)-1):
                if i >= j: break
                while mi[i] * mi[j] > m:
                    j -= 1
                    if j == i: break
                else:
                    k += j - i
                    continue
                break
        elif m < 0:
            k = 0
            j = 0
            if len(mi) > 0:
                for i in range(len(pl)-1,-1,-1):
                    while -pl[i] * mi[j] > m:
                        j += 1
                        if j == len(mi): break
                    else:
                        k += len(mi) - j
                        continue
                    break
        else:
            k = minus + zero

        if k < K:
            l = m
        else:
            h = m

    print(h)


if __name__ == '__main__':
    main()