Buggy python submission (verdict: Time Limit Exceeded):
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

import bisect
A2 = []
B2 = []
C2 = []
for a,b,c in zip(A,B,C):
    bisect.insort_left(A2, a)
    # bisect.insort_left(B2, b)
    bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Fixed submission:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

import bisect
A2 = []
B2 = []
C2 = []
# for a,b,c in zip(A,B,C):
#     bisect.insort_left(A2, a)
#     # bisect.insort_left(B2, b)
#     bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

import bisect
A2 = []
B2 = []
C2 = []
for a,b,c in zip(A,B,C):
    bisect.insort_left(A2, a)
    bisect.insort_left(B2, b)
    bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A2, b) * (N - bisect.bisect_right(C2, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Fixed submission:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

import bisect
A2 = []
B2 = []
C2 = []
# for a,b,c in zip(A,B,C):
#     bisect.insort_left(A2, a)
#     # bisect.insort_left(B2, b)
#     bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

# print(A,B,C)


sum = 0
for b in B:
    sum += len(
        [x for x in A if x < b]
    ) * len (
        [x for x in C if x > b]
    )

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

Fixed submission:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

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

import bisect
A2 = []
B2 = []
C2 = []
# for a,b,c in zip(A,B,C):
#     bisect.insort_left(A2, a)
#     # bisect.insort_left(B2, b)
#     bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)