Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

b_li.sort()
c_li.sort()

check_li = [0]*(n+10)

for i in range(len(b_li)):
    s = bisect.bisect_right(c_li, b_li[i])
    check_li[i] = len(c_li[s:])

tmp = 0
for i in range(1, n+11):
    check_li[-i] = check_li[-i] + tmp
    tmp = check_li[-i]

ans = 0

for i in a_li:
    s = bisect.bisect_right(b_li, i)
    ans += check_li[s]

print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

b_li.sort()
c_li.sort()

check_li = [0]*(n+10)

for i in range(len(b_li)):
    s = bisect.bisect_right(c_li, b_li[i])
    check_li[i] = len(c_li[s:])
    

ans = 0

for i in a_li:
    s = bisect.bisect_right(b_li, i)
    ans += sum(check_li[s:])
        
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

b_li.sort()
c_li.sort()

ans = 0

for i in a_li:
    s = bisect.bisect(b_li, i)
    
    for j in b_li[s:]:
        t = bisect.bisect(c_li, j)
        ans += n-t
        
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

b_li.sort()
c_li.sort()

ans = 0

for i in a_li:
    s = bisect.bisect_right(b_li, i)
    
    for j in b_li[s:]:
        t = bisect.bisect_right(c_li, j)
        ans += n-t
        
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

a_li.sort()
b_li.sort()
c_li.sort()

ans = 0

for i in a_li:
    s = bisect.bisect_right(b_li, i)
    
    for j in b_li[s:]:
        t = bisect.bisect_right(c_li, j)
        ans += n-t
        
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))

a_li.sort()
b_li.sort()
c_li.sort()

if a_li[0] >= b_li[-1]:
    print(0)
    exit()
    
ans = 0

for i in a_li:
    s = bisect.bisect_right(b_li, i)
    
    for j in b_li[s:]:
        t = bisect.bisect_right(c_li, j)
        ans += len(c_li[t:])
        
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

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()

ans = 0

for up in a:
    tmp1 = bisect.bisect_right(b, up)
    for middle in b[tmp1:]:
        down = bisect.bisect_right(c, middle)
        ans += (n - down)
    
print(ans)

Fixed submission:
import bisect

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()

ans = 0

for middle in b:
    tmp1 = bisect.bisect_left(a, middle)
    tmp2 = bisect.bisect_right(c, middle)
    ans += tmp1 * (n - tmp2)

print(ans)