Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

comb_n = 0

for i in range(N):  # 10 ** 5
    b = b_list[i]
    c_n = len([c for c in c_list if c > b])  # 10 ** 5
    a_n = len([a for a in a_list if a < b])  # 10 ** 5
    comb_n += a_n * c_n

ans = comb_n
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival
import bisect

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

comb_n = 0
comb_n_list = []

# 自分より大きい個数
start_c_index = 0
start_a_index = 0

for i in range(N):  # 10 ** 5
    b = b_list[i]
    a_n = bisect.bisect_left(a_list, b)
    c_n = N - bisect.bisect_right(c_list, b)
    comb_n += a_n * c_n
ans = comb_n
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

# あらかじめ計算しておく
b2c_dict = {}
for i in range(N):  # 10 ** 5
    b = b_list[i]
    b2c_dict[i] = len([c for c in c_list if c > b])  # 10 ** 5

comb_n = 0

for i in range(N):  # 10 ** 5
    a = a_list[i]
    for j, b in enumerate(b_list):  # 10 ** 5
        if b > a:
            comb_n += b2c_dict[j]

ans = comb_n
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival
import bisect

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

comb_n = 0
comb_n_list = []

# 自分より大きい個数
start_c_index = 0
start_a_index = 0

for i in range(N):  # 10 ** 5
    b = b_list[i]
    a_n = bisect.bisect_left(a_list, b)
    c_n = N - bisect.bisect_right(c_list, b)
    comb_n += a_n * c_n
ans = comb_n
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

# あらかじめ計算しておく
b2c_dict = {}
for i in range(N):  # 10 ** 5
    b = b_list[i]
    b2c_dict[i] = len([c for c in c_list if c > b])  # 10 ** 5

comb_n_list = []

for i in range(N):  # 10 ** 5
    a = a_list[i]
    comb_n_list.append(sum([b2c_dict[j] for j, b in enumerate(b_list) if b > a]))

ans = sum(comb_n_list)
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc077/tasks/arc084_a
# C - Snuke Festival
import bisect

N = int(input().split()[0])
a_list = sorted(list(map(int, input().split())))
b_list = sorted(list(map(int, input().split())))
c_list = sorted(list(map(int, input().split())))

comb_n = 0
comb_n_list = []

# 自分より大きい個数
start_c_index = 0
start_a_index = 0

for i in range(N):  # 10 ** 5
    b = b_list[i]
    a_n = bisect.bisect_left(a_list, b)
    c_n = N - bisect.bisect_right(c_list, b)
    comb_n += a_n * c_n
ans = comb_n
print(ans)