Buggy python submission (verdict: Runtime Error):
def binary_serch(target, num_list):
    ok = len(num_list)
    ng = -1

    while(abs(ok - ng) > 1):
        mid = int((ok + ng) / 2)
        mid_num = num_list[mid]
        if target < mid_num:
            ok = mid
        else:
            ng = mid

    return ok


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    C = [int(i) for i in input().split()]

    A.sort()
    B.sort()
    C.sort()

    # index
    A2B = [binary_serch(a, B) for a in A]

    # 累積和
    B2C = []
    tmp = 0
    for b in B[::-1]:
        tmp = tmp + (N - binary_serch(b, C))
        B2C.append(tmp)

    B2C = B2C[::-1]

    ans = 0

    for i in range(N):
        ans += B2C[A2B[i-1]]

    print(ans)


Fixed submission:
def binary_serch(target, num_list):
    ok = len(num_list)
    ng = -1

    while(abs(ok - ng) > 1):
        mid = int((ok + ng) / 2)
        mid_num = num_list[mid]
        if target < mid_num:
            ok = mid
        else:
            ng = mid

    return ok


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    C = [int(i) for i in input().split()]

    A.sort()
    B.sort()
    C.sort()

    # index
    A2B = [binary_serch(a, B) for a in A]

    # 累積和
    B2C = []
    tmp = 0
    for b in B[::-1]:
        tmp = tmp + (N - binary_serch(b, C))
        B2C.append(tmp)

    B2C = B2C[::-1]

    ans = 0

    for i in range(N):
        if not A2B[i] == N:
            ans += B2C[A2B[i]]

    print(ans)

Buggy python submission (verdict: Runtime Error):
def binary_serch(target, num_list):
    ok = len(num_list)
    ng = -1

    while(abs(ok - ng) > 1):
        mid = int((ok + ng) / 2)
        mid_num = num_list[mid]
        if target < mid_num:
            ok = mid
        else:
            ng = mid

    return ok


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    C = [int(i) for i in input().split()]

    A.sort()
    B.sort()
    C.sort()

    # index
    A2B = [binary_serch(a, B) for a in A]

    # 累積和
    B2C = []
    tmp = 0
    for b in B[::-1]:
        tmp = tmp + (N - binary_serch(b, C))
        B2C.append(tmp)

    B2C = B2C[::-1]

    ans = 0

    for i in range(N):
        ans += B2C[A2B[i]]

    print(ans)


Fixed submission:
def binary_serch(target, num_list):
    ok = len(num_list)
    ng = -1

    while(abs(ok - ng) > 1):
        mid = int((ok + ng) / 2)
        mid_num = num_list[mid]
        if target < mid_num:
            ok = mid
        else:
            ng = mid

    return ok


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    C = [int(i) for i in input().split()]

    A.sort()
    B.sort()
    C.sort()

    # index
    A2B = [binary_serch(a, B) for a in A]

    # 累積和
    B2C = []
    tmp = 0
    for b in B[::-1]:
        tmp = tmp + (N - binary_serch(b, C))
        B2C.append(tmp)

    B2C = B2C[::-1]

    ans = 0

    for i in range(N):
        if not A2B[i] == N:
            ans += B2C[A2B[i]]

    print(ans)