Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = sorted(list(map(int, input().split(' '))))
    Cs = sorted(list(map(int, input().split(' '))))

    Bs_count = [len(list(filter(lambda c : b < c, Cs))) for b in Bs]
    As_count = [len(list(filter(lambda b : a < b, Bs))) for a in As]

    count = 0
    for c in As_count:
        if -1 * c == 0:
            break
        for c_ in Bs_count[-1 * c:]:
            count += c_

    print(count)


if __name__ == '__main__':
    sys.exit(main())

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re
import itertools

import bisect

pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = map(int, input().split(' '))
    Cs = sorted(list(map(int, input().split(' '))))

    count = 0
    for b in Bs:
        i = bisect.bisect_left(As, b)
        k = N - bisect.bisect_right(Cs, b)
        count += i * k

    print(count)

if __name__ == '__main__':
    sys.exit(main())

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = sorted(list(map(int, input().split(' '))))
    Cs = sorted(list(map(int, input().split(' '))))

    As_start_pos = [-1] * N
    Bs_start_pos = [-1] * N

    count = 0
    for idx_a, a in enumerate(As):
        if idx_a == 0:
            idx_a_ = 0
        else:
            idx_a_ = idx_a - 1
        if As_start_pos[idx_a_] == -1:
            pos_a = 0
        else:
            pos_a = As_start_pos[idx_a_]
        for idx_b, b in enumerate(Bs[pos_a:]):
            if a >= b:
                continue
            if idx_b == 0:
                idx_b_ = 0
            else:
                idx_b_ = idx_b - 1
            if As_start_pos[idx_a] == -1:
                As_start_pos[idx_a] = idx_b + pos_a
            if Bs_start_pos[idx_b_] == -1:
                pos_b = 0
            else:
                pos_b = Bs_start_pos[idx_b_]
            for idx_c, c in enumerate(Cs[pos_b:]):
                if b >= c:
                    continue
                else:
                    if Bs_start_pos[idx_b] == -1:
                        Bs_start_pos[idx_b] = idx_c + pos_b
                    count += len(Cs[pos_b:]) - idx_c
                    break

    print(count)




if __name__ == '__main__':
    sys.exit(main())

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re
import itertools

import bisect

pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = map(int, input().split(' '))
    Cs = sorted(list(map(int, input().split(' '))))

    count = 0
    for b in Bs:
        i = bisect.bisect_left(As, b)
        k = N - bisect.bisect_right(Cs, b)
        count += i * k

    print(count)

if __name__ == '__main__':
    sys.exit(main())