Buggy python submission (verdict: Runtime Error):
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()]

def sunuke(ai, bi, ci, ans):

    if ai > N-1:
        print(ans)
    elif bi > N-1:
        sunuke(ai+1, 0, 0, ans)
    elif ci > N-1:
        sunuke(ai, bi+1, 0, ans)

    elif A[ai] >= B[bi]:
        sunuke(ai,bi+1,ci, ans)
    elif B[bi] >= C[ci]:
        sunuke(ai, bi, ci+1, ans)
    else:
        sunuke(ai, bi, ci+1, ans+1)

ans = 0
sunuke(0,0,0, ans)


Fixed submission:
import bisect

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()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)

Buggy python submission (verdict: Runtime Error):
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()]

print(N,A,B,C)
def sunuke(ai, bi, ci, ans):

    if ai > N-1:
        print(ans)
    elif bi > N-1:
        sunuke(ai+1, 0, 0, ans)
    elif ci > N-1:
        sunuke(ai, bi+1, 0, ans)

    elif A[ai] >= B[bi]:
        sunuke(ai,bi+1,ci, ans)
    elif B[bi] >= C[ci]:
        sunuke(ai, bi, ci+1, ans)
    else:
        ans += 1
        sunuke(ai, bi, ci+1, ans)

ans = 0
sunuke(0,0,0, ans)


Fixed submission:
import bisect

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()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)

Buggy python submission (verdict: Runtime Error):
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()]

def sunuke(ai, bi, ci, ans):

    if ai > N-1:
        print(ans)
    elif bi > N-1:
        sunuke(ai+1, 0, 0, ans)
    elif ci > N-1:
        sunuke(ai, bi+1, 0, ans)

    elif A[ai] >= B[bi]:
        sunuke(ai,bi+1,ci, ans)
    elif B[bi] >= C[ci]:
        sunuke(ai, bi, ci+1, ans)
    else:
        ans += 1
        sunuke(ai, bi, ci+1, ans)

ans = 0
sunuke(0,0,0, ans)


Fixed submission:
import bisect

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()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)

Buggy python submission (verdict: Runtime Error):
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()]

def sunuke(ai, bi, ci):
    global ans

    if ai > N-1:
        print(ans)
    elif bi > N-1:
        sunuke(ai+1, 0, 0)
    elif ci > N-1:
        sunuke(ai, bi+1, 0)

    elif A[ai] >= B[bi]:
        sunuke(ai,bi+1,ci)
    elif B[bi] >= C[ci]:
        sunuke(ai, bi, ci+1)
    else:
        ans += 1
        sunuke(ai, bi, ci+1)

ans = 0
sunuke(0,0,0)


Fixed submission:
import bisect

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()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)