Buggy python submission (verdict: Time Limit Exceeded):
import bisect
def main():
  N = int(input())
  parts = [[] for i in range(3)]
  con = [0] * N
  
  ans = 0
  
  for i in range(3):
    t = sorted(list(map(int,input().split())))
    parts[i] = t
  
  under =parts[2]
  middle = parts[1]
  upper = parts[0]
  
  for i in range(N):
    p = middle[i]
    q = bisect.bisect_left(upper,p)
    con[i] += q
  
  
  for i in range(N):
    p = under[i]
    q = bisect.bisect_left(middle,p)
    ans += sum(con[:q])
      
  print(ans)
main()

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)

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

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  q = bisect.bisect_left(upper,p)
  con[i] += q


for i in range(N):
  p = under[i]
  q = bisect.bisect_left(middle,p)
  ans += sum(con[:q])
    
print(ans)

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)

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

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  q = bisect.bisect_left(upper,p)
  con[i] += q

for i in range(N):
  p = under[i]
  q = bisect.bisect_left(middle,p)
  for j in range(0,q):
    ans += con[j]
    
print(ans)

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = list(map(int,input().split()))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  for j in range(N):
    q = upper[j]
    if p > q:
      con[i] += 1
for i in range(N):
  p = under[i]
  for j in range(N):
    q = middle[j]
    if p > q:
      ans += con[j]

          
print(ans)

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int con;
    con = 0;
    vector<vector<int>> parts(3, vector<int>(N));

    for(int i = 0;i < 3; i++){
        for(int j = 0;j < N; j++){
            cin >> parts[i][j];
        }
    }

    for (int i = 0;i < N; i ++){
        for (int j = 0;j < N; j++){
            if (parts[2][i] > parts[1][j]){
                for (int k = 0;k < N; k++){
                    if (parts[1][j] > parts[0][k]){
                        con += 1;

                    } 
                }
            }
        }
    }
    cout << con << endl;
}

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
parts = [[] for i in range(3)]
bigger = [[0] * N for i in range(2)]

m = 0

for i in range(3):
  t = list(map(int,input().split()))
  t = [i for i in t if i >= m]
  parts[i] = t
  m = min(t)

under =parts[2]
middle = parts[1]
upper = parts[0]

con = 0

for i in range(len(under)):
  p = under[i]
  for j in range(len(middle)):
    q = middle[j]
    if p > q:
      for k in range(len(upper)):
        r = upper[k]
        if q > r:
          con += 1
          
print(con)

Fixed submission:
import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)