criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>

using namespace std;

typedef long long ll;
 
#define rep(i,n) for(int i=0;i<(n);++i)

int upper_Bound(ll A[],int N,ll key){
    int left=-1;
    int right=N;
    int mid;
    while(right-left>1){
        mid=(left+right)/2;
        if(A[mid]<key){
            left=mid;
        }else{
            right=mid;
        }
        
       // cout<<"upper left:"<<left<<":"<<A[left]<<" right:"<<right<<":"<<A[right]<<endl;
    }
    return left;
}

int lower_Bound(ll A[],int N,ll key){
    int left=-1;
    int right=N;
    int mid;
    while(right-left>1){
        mid=(left+right)/2;
        if(key<A[mid]){
            right=mid;
        }else{
            left=mid;
        }
       // cout<<"lower left:"<<left<<":"<<A[left]<<" right:"<<right<<":"<<A[right]<<endl;
    }
    return right;
}


int main(){
  /*
    ll arr1[]={2,3,3,3,5,6};
   
    ll a=upper_Bound(arr1,6,3);
    cout<<a<<endl;

    ll b=lower_Bound(arr1,6,3);
    cout<<b<<endl;
    cout<<(a+1)*(3-b);
    */
   
    int N;
    cin>>N;
    
    ll A[N];
    rep(i,N){
        cin>>A[i];
    }
    sort(A,A+N);
    
    ll B[N];
    rep(i,N){
        cin>>B[i];
    }
    sort(B,B+N);
    
    ll C[N];
    rep(i,N){
        cin>>C[i];
    }
    sort(C,C+N);
    
    ll a,c;
    
    ll count=0;
    
    rep(i,N){
        a=upper_Bound(A,N,B[i]);
        c=lower_Bound(C,N,B[i]);
        count+=(a+1)*(N-c);
    }
    
    cout<<count<<endl;
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:62:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   62 |     sort(A,A+N);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)


bool jud(ll A[],int i,ll t){
    if(((A[i-1]<=t&&t<A[i]))||i==0){
        return true;
    }
    return false;
}

ll binary(ll A[],int N,ll t){
    int  left=0;
    int  right=N;
    int mid;
    while(left<right){
        mid=(left+right)/2;
        //cout<<"mid:"<<mid<<" A["<<mid<<"]:"<<A[mid]<<" left:"<<left<<" right:"<<right<<endl;
        if(jud(A,mid,t)){//cout<<"fin"<<endl;
            return mid;}
        if(A[mid]>=t&&!jud(A,mid,t)){
            right=mid;
        }else if(A[mid]<t){
            left=mid+1;
        }
    }
    return -1;
}

int main(){
    /*
    ll arr[]={2,50,79,288,383,2643};
    ll a=binary(arr,6,58);
    cout<<a<<endl;
    */
    
    int N;
    scanf("%d",&N);
    
    ll A[N];
    rep(i,N){
        cin>>A[i];
        sort(A,A+i+1);
    }
    
    ll B[N];
    rep(i,N){
        cin>>B[i];
        sort(B,B+i+1);
    }

    
    ll C[N];
    rep(i,N){
        cin>>C[i];
        sort(C,C+i+1);
    }
   
    
    ll b;
    ll c;
    ll count=0;
    vector<ll> vec;
    rep(i,N){
        c=binary(C,N,B[i]);
        vec.push_back(N-c);
        
    }
  
    
    rep(i,N){
        b=binary(B,N,A[i]);
        for(ll j=b;j!=N;++j){
            count+=vec[j];
        }
    }
   
    cout<<count<<endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   50 |         sort(A,A+i+1);
      |         ^~~~
      |         short
a.cc:56:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   56 |         sort(B,B+i+1);
      |         ^~~~
      |         short
a.cc:63:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   63 |         sort(C,C+i+1);
      |         ^~~~
      |         short
Language: C++

#include <iostream>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)

typedef long long ll;

bool is_func(ll S[],int n,ll p){
    
    if((S[n-1]<=p&&S[n]>p)||n==0) return true;
    return false;
}

int binary(ll S[],int n,ll x){
    int left=0;
    int right=n;
    int mid;
    while(left<right){
        mid=(left+right)/2;
        if(is_func(S,mid,x)) return mid;
        if(S[mid]>=x){
            right=mid;
        }else if(S[mid]<x){
            left=mid+1;
        }
        
    }
    return -1;
    
}

int main(){
    
    /*
    ll A[]={3,6};
    
    cout<<binary(A,2,4)<<endl;
    */
    
    
    
    int N;
    cin>>N;
    ll A[N];
    
    rep(i,N)cin>>A[i];
    sort(A,A+N);
    ll B[N];
    
    rep(i,N)cin>>B[i];
    sort(B,B+N);
    
    ll C[N];
    rep(i,N)cin>>C[i];
    sort(C,C+N);
    int num_b;
    int num_c;
    ll count=0;
    
    for(int i=0;i!=N;++i){
        num_b=binary(B,N,A[i]);
        //cout<<i<<"A["<<i<<"]:"<<A[i]<<" num_b:"<<num_b<<endl;
        if(num_b==-1){continue;}
        else{
            for(int j=num_b;j!=N;++j){
                num_c=binary(C,N,B[j]);
                if(num_c==-1){continue;}
                else{
                   // cout<<i<<":"<<j<<"B["<<j<<"]"<<B[j]<< " num_c :"<<num_c<<endl;
                    count+=N-(num_c);
                }
                
            }
        }
        
    }
    
    cout<<count<<endl;
    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   48 |     sort(A,A+N);
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	vector<int>a(n),b(n),c(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	for (int i = 0; i < n; i++) cin >> b.at(i);
	for (int i = 0; i < n; i++)cin >> c.at(i);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long as = lower_bound(a.begin(), a.end(), b.at(i)) - a.begin();
		long long cs = c.end() - upper_bound(c.begin(), c.end(), b.at(i));
		ans += as * cs;
	}
	cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int>a(n),b(n),c(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	for (int i = 0; i < n; i++) cin >> b.at(i);
	for (int i = 0; i < n; i++)cin >> c.at(i);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long as = lower_bound(a.begin(), a.end(), b.at(i)) - a.begin();
		long long cs = c.end() - upper_bound(c.begin(), c.end(), b.at(i));
		ans += as * cs;
	}
	cout << ans << endl;
}

Compiler output:
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	vector<int>a(n),b(n),c(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	for (int i = 0; i < n; i++) cin >> b.at(i);
	for (int i = 0; i < n; i++)cin >> c.at(i);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long as = lower_bound(a.begin(), a.end(), b.at(i)) - a.begin();
		long long cs = c.end() - upper_bound(c.begin(), c.end(), b.at(i));
		ans += as * cs;
	}
	cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int>a(n),b(n),c(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	for (int i = 0; i < n; i++) cin >> b.at(i);
	for (int i = 0; i < n; i++)cin >> c.at(i);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long as = lower_bound(a.begin(), a.end(), b.at(i)) - a.begin();
		long long cs = c.end() - upper_bound(c.begin(), c.end(), b.at(i));
		ans += as * cs;
	}
	cout << ans << endl;
}
提出情報

Compiler output:
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
a.cc:43:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   43 | 提出情報
      | ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0};
using namespace std;

int main(){
  int N,ans=0;
  cin>>N;
  
  vector<ll> A,B,C;
  REP(i,N){
    ll a;
    cin>>a;
    A.push_back(a);
  }
  REP(i,N){
    ll a;
    cin>>a;
    B.push_back(a);
  }
  REP(i,N){
    ll a;
    cin>>a;
    C.push_back(a);
  }
  
  SORT(A);
  SORT(B);
  SORT(C);
  
  REP(i,N){
    auto Iter_a=lower_bound(ALL(A),B[i]);
    auto Iter_c=upper_bound(ALL(C),B[i]);
    
    ll anum,cnum;
    if(b[i] <= a[Iter_a - a.begin()]) anum = Iter_a - a.begin();
        else anum = a.size();
        if(b[i] < c[Iter_c - c.begin()]) cnum = c.end() - Iter_c;
        else cnum = 0;
        ans += anum * cnum;
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:8: error: 'b' was not declared in this scope
   76 |     if(b[i] <= a[Iter_a - a.begin()]) anum = Iter_a - a.begin();
      |        ^
a.cc:76:16: error: 'a' was not declared in this scope
   76 |     if(b[i] <= a[Iter_a - a.begin()]) anum = Iter_a - a.begin();
      |                ^
a.cc:78:12: error: 'b' was not declared in this scope
   78 |         if(b[i] < c[Iter_c - c.begin()]) cnum = c.end() - Iter_c;
      |            ^
a.cc:78:19: error: 'c' was not declared in this scope
   78 |         if(b[i] < c[Iter_c - c.begin()]) cnum = c.end() - Iter_c;
      |                   ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc077/tasks/arc084_a

int main() {
    int N; cin >> N;
    vector<int> A(N); REP(i, N) cin >> A[i];
    vector<int> B(N); REP(i, N) cin >> B[i];
    vector<int> C(N); REP(i, N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    int cnt = 0;
    REP(i, N) {
        int a = A[i];

        auto IterB = upper_bound(B.begin(), B.end(), a);
        while(IterB != B.end()) {
            int b = *IterB;
            auto IterC = upper_bound(C.begin(), C.end(), b);

            while(IterC != C.end()) {
                cnt++;
                IterC++;
            }

            IterB++;
        }
    }

    cout << cnt << "\n";

    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:77:14: error: expected '}' at end of input
   77 |     return 0;
      |              ^
a.cc:47:12: note: to match this '{'
   47 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 int  n ;
 cin >> n ;
vector<int> A(n) ;
vector<int> B(n) ;
vector<int> C(n) ;
rep(i,n) cin>> A[i] ;
rep(i,n) cin >> B[i] ;
rep(i,n) cin >>C[i] ;
sort(A.begin(),A.end()) ;
sort(C.begin(),C.end()) ;
int ans=0 ;
rep(i,n){
auto p= lower_bound(A.begin(),A.end(),B[i]) ;
auto q= upper_bound(C.begin(),c.end(),B[i]) ;
ans+= p*(n-q) ;
}
 
 cout <<ans<<endl ;
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:31: error: 'c' was not declared in this scope
   28 | auto q= upper_bound(C.begin(),c.end(),B[i]) ;
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
    it n;
    cin >> n ;
    vector<long long> A(n), B(n), C(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> B[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> C[i];
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<long long>bc(n);

    for (int i = 0; i < n; i++) {
        long long x = upper_bound(C.begin(), C.end(), B[i]) - B.begin();
        bc[i] = n - x;
    }

    for (int i = N-2; i >=0 ; i--) {
        bc[i] += bc[i+1];
    }

    long long ans = 0;

    for (int i; i<n; i++) {
        long long x = upper_bound(B.begin(), B.end(), A[i]) - B.begin();
        ans += bc[x]
    }

    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'it' was not declared in this scope; did you mean 'int'?
    5 |     it n;
      |     ^~
      |     int
a.cc:6:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     cin >> n ;
      |            ^
      |            yn
a.cc:29:18: error: 'N' was not declared in this scope
   29 |     for (int i = N-2; i >=0 ; i--) {
      |                  ^
a.cc:37:21: error: expected ';' before '}' token
   37 |         ans += bc[x]
      |                     ^
      |                     ;
   38 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (a[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    int N;
    cin>>N;
    long long a[N];
    long long b[N];
    long long c[N];
    for(int i=0;i<N;i++){
    cin>>a[i];}
    for(int i=0;i<N;i++){
    cin>>b[i];}
    for(int i=0;i<N;i++){
    cin>>c[i];}
    sort(a,a+N);
    sort(b,b+N);
    sort(c,c+N);
    long long counter=0;
    int acount=0;
    int ccount=0;
    for(int i=0;i<N;i++){
    acount=lower_bound(a, a + N, b[i]) - a;
    ccount=lower_bound(c, c + N, b[i]) - c;
    counter+=acount*ccount;}
    

    
    cout << counter << endl; // 10 (場外)
}


Compiler output:
a.cc: In function 'bool isOK(int, int)':
a.cc:6:9: error: 'a' was not declared in this scope
    6 |     if (a[index] >= key) return true;
      |         ^
a.cc: In function 'int binary_search(int)':
a.cc:13:19: error: 'a' was not declared in this scope
   13 |     int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
      |                   ^
a.cc: In function 'bool isOK(int, int)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
    8 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (a[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)d.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    int N;
    cin>>N;
    long long a[N];
    long long b[N];
    long long c[N];
    for(int i=0;i<N;i++){
    cin>>a[i];}
    for(int i=0;i<N;i++){
    cin>>b[i];}
    for(int i=0;i<N;i++){
    cin>>c[i];}
    sort(a,a+N);
    sort(b,b+N);
    sort(c,c+N);
    long long counter=0;
    int acount=0;
    int ccount=0;
    for(int i=0;i<N;i++){
    acount=lower_bound(a, a + N, b[i]) - a;
    ccount=lower_bound(c, c + N, b[i]) - c;
    counter+=acount*ccount;}
    

    
    cout << counter << endl; // 10 (場外)
}


Compiler output:
a.cc: In function 'bool isOK(int, int)':
a.cc:6:9: error: 'a' was not declared in this scope
    6 |     if (a[index] >= key) return true;
      |         ^
a.cc: In function 'int binary_search(int)':
a.cc:13:19: error: 'd' was not declared in this scope
   13 |     int ok = (int)d.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
      |                   ^
a.cc: In function 'bool isOK(int, int)':
a.cc:8:1: warning: control reaches end of non-void function [-Wreturn-type]
    8 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

// index が条件を満たすかどうか
bool isOK(int index, int key) {
    if (a[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key) {
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)d.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    int N;
    cin>>N;
    long long a[N];
    long long b[N];
    long long c[N];
    for(int i=0;i<N;i++){
    cin>>a[i];}
    for(int i=0;i<N;i++){
    cin>>b[i];}
    for(int i=0;i<N;i++){
    cin>>c[i];}
    sort(a,a+N);
    sort(b,b+N);
    sort(c,c+N);
    long long counter=0;
    int acount=0;
    int ccount=0;
    for(int i=0;i<N;i++){
    
    cout << binary_search(911) << endl; // 10 (場外)
}

Compiler output:
a.cc: In function 'bool isOK(int, int)':
a.cc:7:9: error: 'a' was not declared in this scope
    7 |     if (a[index] >= key) return true;
      |         ^
a.cc: In function 'int binary_search(int)':
a.cc:14:19: error: 'd' was not declared in this scope
   14 |     int ok = (int)d.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
      |                   ^
a.cc: In function 'int main()':
a.cc:38:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   38 |     sort(a,a+N);
      |     ^~~~
      |     short
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:26:12: note: to match this '{'
   26 | int main() {
      |            ^
a.cc: In function 'bool isOK(int, int)':
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int binary_search_bigger(int a,vector<int> s){
    int head=0;
    int end=s.size()-1;
    while(end>head){
        int mid=(head+end)/2;
        if(s[mid]>a) end=mid;
        else head=mid+1;
    }
    return head;
}

int binary_search_smaller(int a, vector<int> s){
    int head=0;
    int end=s.size()-1;
    while(end>head){
        int mid=(head+end)/2;
        if(a>s[mid]) head=mid+1;
        else end=mid;
    }
    return head;
}
int main(){
    int n;
    cin>>n;
    vector<int> A(n);
    vector<int> B(n);
    vector<int> C(n);
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    for(int i=0;i<n;i++){
        cin>>B[i];
    }
    for(int i=0;i<n;i++){
        cin>>C[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=(n-binary_search_bigger(B[i],C))*binary_search_smaller(B[i],A)
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:76: error: expected ';' before '}' token
   45 |         ans+=(n-binary_search_bigger(B[i],C))*binary_search_smaller(B[i],A)
      |                                                                            ^
      |                                                                            ;
   46 |     }
      |     ~
Language: Java


import java.util.Arrays;
import java.util.Scanner;

public class Binarysearch20 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(scan.next());
        }
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = Integer.parseInt(scan.next());
        }
        int[] c = new int[n];
        for (int i = 0; i < n; i++) {
            c[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        Arrays.sort(a);
        Arrays.sort(b);
        Arrays.sort(c);

        int[] bc = new int[n];
        for (int i = 0; i < n; i++) {
            int okMinIndex = binarySearch(c, b[i]);
            bc[i] = n - okMinIndex;
        }

        long[] abc = new long[n];
        abc[n - 1] = bc[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            abc[i] = abc[i + 1] + bc[i];
        }

        long ans = 0;
        for (int i = 0; i < n; i++) {
            int okMinIndex = binarySearch(b, a[i]);
            if (okMinIndex == n) {
                continue;
            }
            ans += abc[okMinIndex];
        }

        System.out.println(ans);
    }

    private static int binarySearch(int[] array, int key) {
        int ng = -1;
        int ok = array.length;

        while (ok - ng > 1) {
            int mid = (ok + ng) / 2;
            if (array[mid] > key) {
                ok = mid;
            } else {
                ng = mid;
            }
        }

        return ok;
    }

}


Compiler output:
Main.java:5: error: class Binarysearch20 is public, should be declared in a file named Binarysearch20.java
public class Binarysearch20 {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;

    vector<ll> A(N), B(N), C(N);

    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    for(int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    
    ll ret = 0;
    for(int i = 0; i < N; i++) {
        int a = distance(A.begin(), lower_bound(A.begin(), A.end(), B[i]));
        int c = distance(upper_bound(C.begin(), C.end(), B[i]), C.end());

        ret += a*c;

    }

    cout << ret << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
a.cc:24:26: error: 'upper_bound' was not declared in this scope
   24 |         int c = distance(upper_bound(C.begin(), C.end(), B[i]), C.end());
      |                          ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  int N;
  cin>>N;
  vector<ll> A,B,C;
  A=B=C=vector<int>(N);
  for(int i=0;i<N;i++)cin>>A[i];
  for(int i=0;i<N;i++)cin>>B[i];
  for(int i=0;i<N;i++)cin>>C[i];
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  ll ans=0;
  for(int i=0;i<N;i++){
    ll C_num=N-(upper_bound(C.begin(),C.end(),B[i])-C.begin());
    ll A_num=lower_bound(A.begin(),A.end(),B[i])-A.begin();
    ans+=A_num*C_num;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
    8 |   A=B=C=vector<int>(N);
      |                      ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;

    int A[N], B[N], C[N];
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    sort(A.begin(), A.end());//小さい順に
    sort(C.begin(), C.end());

    ll cnt = 0;
    rep(i, N) {
        int a = upper_bound(A.begin(), A.end(), B[i] - 1) - A.begin();
        int c = lower_bound(C.begin(), C.end(), B[i] + 1) - C.begin();
        cnt += 1LL * (N - c) * (a);
    }
    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   15 |     sort(A.begin(), A.end());//小さい順に
      |            ^~~~~
a.cc:15:23: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   15 |     sort(A.begin(), A.end());//小さい順に
      |                       ^~~
a.cc:16:12: error: request for member 'begin' in 'C', which is of non-class type 'int [N]'
   16 |     sort(C.begin(), C.end());
      |            ^~~~~
a.cc:16:23: error: request for member 'end' in 'C', which is of non-class type 'int [N]'
   16 |     sort(C.begin(), C.end());
      |                       ^~~
a.cc:20:31: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   20 |         int a = upper_bound(A.begin(), A.end(), B[i] - 1) - A.begin();
      |                               ^~~~~
a.cc:20:42: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   20 |         int a = upper_bound(A.begin(), A.end(), B[i] - 1) - A.begin();
      |                                          ^~~
a.cc:20:63: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   20 |         int a = upper_bound(A.begin(), A.end(), B[i] - 1) - A.begin();
      |                                                               ^~~~~
a.cc:21:31: error: request for member 'begin' in 'C', which is of non-class type 'int [N]'
   21 |         int c = lower_bound(C.begin(), C.end(), B[i] + 1) - C.begin();
      |                               ^~~~~
a.cc:21:42: error: request for member 'end' in 'C', which is of non-class type 'int [N]'
   21 |         int c = lower_bound(C.begin(), C.end(), B[i] + 1) - C.begin();
      |                                          ^~~
a.cc:21:63: error: request for member 'begin' in 'C', which is of non-class type 'int [N]'
   21 |         int c = lower_bound(C.begin(), C.end(), B[i] + 1) - C.begin();
      |                                                               ^~~~~
Language: C++

from bisect import bisect_right, bisect_left
from itertools import accumulate
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
li_a.sort()
li_b.sort()
li_c.sort()
relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
for i in range(n):
    i += 1
    j = li_b[(-1)*i]
    k = bisect_right(li_c, j)
    relation_bc.append(len(li_c)-k)
ans = 0
li = list(accumulate(relation_bc))
for i in li_a:
    p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
    p = n - p
    if p >= 1:
        ans += li[p-1]
    else:
        continue
print(ans)

Compiler output:
a.cc:10:18: error: stray '#' in program
   10 | relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
      |                  ^
a.cc:19:31: error: stray '#' in program
   19 |     p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
      |                               ^
a.cc:1:1: error: 'from' does not name a type
    1 | from bisect import bisect_right, bisect_left
      | ^~~~
Language: C++

#include "stdc++.h"
using namespace std;
typedef long long LL;

int main() 
{
    int N;
    cin >> N;

    vector<int> A(N), B(N), C(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) cin >> B[i];
    for (int i = 0; i < N; i++) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    LL ans = 0;

    for (int i = 0; i < N; i++) {
        LL pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        LL over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
        ans += pre * over;
    }


    cout << ans;

    return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdc++.h: No such file or directory
    1 | #include "stdc++.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

int main() {
    int N;
    cin >> N;

    vint As(N);
    vint Bs(N);
    vint Cs(N);
    rep(i, N) {
        cin >> As[i];
    }
    rep(i, N) {
        cin >> Bs[i];
    }
    rep(i, N) {
        cin >> Cs[i];
    }
    std::sort(As.begin(), As.end());
    std::sort(Bs.begin(), Bs.end());
    std::sort(Cs.begin(), Cs.end());

    int ans = 0;
    int tmpA = 0;
    int tmpAVal = 0;
    rep(aindex, N) {
        int a = As[aindex];
        if (tmpA == a) {

            ans += tmpAVal;
            continue;
        }
        tmpAVal = 0;
        tmpBVal = 0;
        int bLeft = -1;
        int bRight = N;
        while (bRight - bLeft > 1) {
            int bMid = (bRight + bLeft) / 2;
            if (Bs[bMid] <= a) {
                bLeft = bMid;
            } else {
                bRight = bMid;
            }
        }

        int tmpB = 0;
        int tmpBVal = 0;
        for (int bIndex = bRight; bIndex < N; bIndex++) {
            int b = Bs[bIndex];
            if (b == tmpB) {
                tmpAVal += tmpBVal;
                ans += tmpBVal;
                continue;
            }
            int cLeft = -1;
            int cRight = N;
            while (cRight - cLeft > 1) {
                int cMid = (cRight + cLeft) / 2;
                if (Cs[cMid] <= b) {
                    cLeft = cMid;
                } else {
                    cRight = cMid;
                }
            }
            
            tmpAVal += N - cRight;
            tmpB = b;
            tmpBVal = N - cRight;
            ans += N - cRight;
        }
        tmpA = a;
        
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'tmpBVal' was not declared in this scope; did you mean 'tmpAVal'?
   56 |         tmpBVal = 0;
      |         ^~~~~~~
      |         tmpAVal
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
#define MAX_C 1000000001
#define MOD 1000000007

int main() {
  cin.tie(0);
　ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) { cin >> a[i]; }
  for (int i = 0; i < n; i++) { cin >> b[i]; }
  for (int i = 0; i < n; i++) { cin >> c[i]; }

  sort(a.begin(), a.end());
  sort(c.begin(), c.end());

  ll cnt = 0;
  for (int i = 0; i < n; i++) {
    ll bi = b[i];
    ll p = lower_bound(a.begin(), a.end(), bi) - a.begin();
    ll q = c.end() - upper_bound(c.begin(), c.end(), bi);
    cnt += p * q;
  }

  cout << cnt << endl;
}


Compiler output:
a.cc:11:1: error: extended character 　 is not valid in an identifier
   11 | 　ios::sync_with_stdio(false);
      | ^
a.cc: In function 'int main()':
a.cc:11:1: error: '\U00003000ios' has not been declared
   11 | 　ios::sync_with_stdio(false);
      | ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>c[i];
	
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	
	ll ans=0;
	rep(i,n){
		auto Iter1 = lower_bound(A.begin(), A.end(), B[i]);
		auto Iter2 = upper_bound(C.begin(), C.end(), B[i]);
		long k1 = Iter1 - A.begin();
		long k2 = C.end() - Iter2;
		ans += k1 * k2;
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:42: error: 'A' was not declared in this scope
   20 |                 auto Iter1 = lower_bound(A.begin(), A.end(), B[i]);
      |                                          ^
a.cc:20:62: error: 'B' was not declared in this scope
   20 |                 auto Iter1 = lower_bound(A.begin(), A.end(), B[i]);
      |                                                              ^
a.cc:21:42: error: 'C' was not declared in this scope
   21 |                 auto Iter2 = upper_bound(C.begin(), C.end(), B[i]);
      |                                          ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>c[i];
	
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	
	int ans=0;
	
	rep(i,n){
		int ab,bc;
		//先にcについて2分探索(フツーだと間に合わない)
		int left=-1;
		int right=c.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid<=b[i])left=mid;
			else right=mid;
		}
		bc=left+1;
		
		left=-1;
		right=a.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid>=b[i])left=mid;
			else right=mid;
		}
		ab=left+1;
		ans+=ac*bc;
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:22: error: 'ac' was not declared in this scope; did you mean 'bc'?
   42 |                 ans+=ac*bc;
      |                      ^~
      |                      bc
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>c[i];
	
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	
	int ans=0;
	
	rep(i,n){
		int ab,bc;
		//先にcについて2分探索(フツーだと間に合わない)
		int left=-1;
		int right=c.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid<=b[i])left=mid;
			else right=mid;
		}
		bc=left+1;
		
		left=-1;
		right=a.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid>=b[i])left=mid;
			else right=mid;
		}
		ac=left+1;
		ans+=ac*bc;
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'ac' was not declared in this scope; did you mean 'bc'?
   41 |                 ac=left+1;
      |                 ^~
      |                 bc
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	rep(i,n)cin>>a[i];
	rep(i,n)cin>>b[i];
	rep(i,n)cin>>c[i];
	
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	sort(a.begin(),b.end());
	
	int ans=0;
	
	rep(i,n){
		int ab,bc;
		//先にcについて2分探索(フツーだと間に合わない)
		int left=-1;
		int right=(int)c.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid<=b[i])left=mid;
			else right=mid;
		}
		bc=left+1;
		
		int left=-1;
		int right=(int)a.size();
		
		while(right-left>1){
			int mid=left+(right-left)/2;
			if(mid>=b[i])left=mid;
			else right=mid;
		}
		ac=left+1;
		ans+=ac*bc;
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:21: error: redeclaration of 'int left'
   33 |                 int left=-1;
      |                     ^~~~
a.cc:23:21: note: 'int left' previously declared here
   23 |                 int left=-1;
      |                     ^~~~
a.cc:34:21: error: redeclaration of 'int right'
   34 |                 int right=(int)a.size();
      |                     ^~~~~
a.cc:24:21: note: 'int right' previously declared here
   24 |                 int right=(int)c.size();
      |                     ^~~~~
a.cc:41:17: error: 'ac' was not declared in this scope; did you mean 'bc'?
   41 |                 ac=left+1;
      |                 ^~
      |                 bc
Language: C++

	using LL = long long;
  
 //~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~
  
  
 int main() {
  
     int N;
     cin >> N;
  
     vector<int> A(N), B(N), C(N);
     for (int i = 0; i < N; i++) cin >> A[i];
     for (int i = 0; i < N; i++) cin >> B[i];
     for (int i = 0; i < N; i++) cin >> C[i];
     sort(A.begin(), A.end());
     sort(B.begin(), B.end());
     sort(C.begin(), C.end());
  
     LL ans = 0;
  
     for (int i = 0; i < N; i++) {
         LL pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
         LL over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
         ans += pre * over;
     }
  
  
     cout << ans;
  
     return 0;
 }
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: 'cin' was not declared in this scope
    9 |      cin >> N;
      |      ^~~
a.cc:11:6: error: 'vector' was not declared in this scope
   11 |      vector<int> A(N), B(N), C(N);
      |      ^~~~~~
a.cc:11:13: error: expected primary-expression before 'int'
   11 |      vector<int> A(N), B(N), C(N);
      |             ^~~
a.cc:12:41: error: 'A' was not declared in this scope
   12 |      for (int i = 0; i < N; i++) cin >> A[i];
      |                                         ^
a.cc:13:41: error: 'B' was not declared in this scope
   13 |      for (int i = 0; i < N; i++) cin >> B[i];
      |                                         ^
a.cc:14:41: error: 'C' was not declared in this scope
   14 |      for (int i = 0; i < N; i++) cin >> C[i];
      |                                         ^
a.cc:15:11: error: 'A' was not declared in this scope
   15 |      sort(A.begin(), A.end());
      |           ^
a.cc:15:6: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |      sort(A.begin(), A.end());
      |      ^~~~
      |      short
a.cc:16:11: error: 'B' was not declared in this scope
   16 |      sort(B.begin(), B.end());
      |           ^
a.cc:17:11: error: 'C' was not declared in this scope
   17 |      sort(C.begin(), C.end());
      |           ^
a.cc:22:19: error: 'lower_bound' was not declared in this scope
   22 |          LL pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
      |                   ^~~~~~~~~~~
a.cc:23:30: error: 'upper_bound' was not declared in this scope
   23 |          LL over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
      |                              ^~~~~~~~~~~
a.cc:28:6: error: 'cout' was not declared in this scope
   28 |      cout << ans;
      |      ^~~~
Language: C++

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 i in range(n):
  canB = bisect.bisect_right(B, A[i])
  if canB == n:
    continue
  else:
    for j in range(canB, n):
      canC = bisect.bisect_right(C, B[j])
      ans += (n - canC)
print(ans)



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

/*
Problem

Category
二分探索

URL:
https://atcoder.jp/contests/abc077/tasks/arc084_a

考察:
N^2 * log(N)^2 という方法を思いついたが当然間に合わない。

前処理が必要。

scoreB[i]: B[i]より大きい C[j] の数
を求める。 O(N log(N))

これで色々すると
O(N * log(N))
で求りそう

テクニカルな問題として
lower_bound() で入手したイテレータのインデックスが何番目かわからない。
この情報を持つマップを先に作らないとダメそう


Date: 2020/04/12
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int N;
vector<int> A, B, C;

/* ======================== */

signed main(){
    getInput();
    solve();
    return 0;
}

void getInput() {
    cin>>N;
    A = vector<int>(N);
    B = vector<int>(N);
    C = vector<int>(N);
    for(int i=0; i<N; ++i) {
        cin>>A[i];
    }
    for(int i=0; i<N; ++i) {
        cin>>B[i];
    }
    for(int i=0; i<N; ++i) {
        cin>>C[i];
    }
}

void solve() {
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    print(A, B, C);
    
    map<int, int> CtoI;
    
    int ci = 0;
    int bc = 0;
    for(int c: C) {
        if(c==bc) continue;
        CtoI[c] = ci++;
        bc = c;
    }
    // vector<int> scoreB;
    map<int, int> scoreB;
    for(int b: B) {
        auto c = upper_bound(C.begin(), C.end(), b);
        if (c==C.end()) {
            scoreB[b] = 0;
            continue;
        }
        // print(b, *c);
        int idx = CtoI[*c];
        int score = N - idx;
        scoreB[b] = score;
    }

    map<int, int> cumScoreB;
    auto rB = B;
    reverse(rB.begin(), rB.end());

    int cum = 0;
    for(int b: rB) {
        cum += scoreB[b];
        cumScoreB[b] = cum;
    }
    // print(scoreB);
    // print(cumScoreB);

    int ans = 0;
    for(int a: A) {
        auto b = upper_bound(B.begin(), B.end(), a);
        ans += cumScoreB[*b];
    }
    cout<<ans<<endl;
    


}




Compiler output:
a.cc: In function 'void solve()':
a.cc:72:5: error: 'print' was not declared in this scope; did you mean 'rint'?
   72 |     print(A, B, C);
      |     ^~~~~
      |     rint
Language: C++

#include <bits/stdc++.h>

#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;
using namespace std;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
const int N=1e5+5, mxN=(1<<22);
int mod=1e9+7;
ll a[N],b[N],c[N];
ll arr[N]= {};
int n;
int bin(int x, int ar[])
{
    int low=0,high=n-1,ans=n;
    while(low<=high)
    {
        int mid=(low+high)/2;
        if(ar[mid]>x)
        {
            ans=mid;
            high=mid-1;
        }
        else
            low=mid+1;

    }
    return ans;

}
int main()
{
    FIO
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    for(int i=0; i<n; i++)
    {
        cin>>b[i];
    }
    for(int i=0; i<n; i++)
    {
        cin>>c[i];
    }

    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    for(int i=0; i<n; i++)
    {
        int ind=bin(b[i],c);
        arr[i]=n-ind;
    }
    for(int i=n-2;i>=0;i--)
    {
        arr[i]+=arr[i+1];

    }
    ll ans=0;
    for(int i=0; i<n; i++)
    {
        int ind=bin(a[i],b);
        if(ind!=n)
        {
            ans+=(ll)arr[ind];
        }
    }


    cout<<ans;

    return 0;

}






Compiler output:
a.cc: In function 'int main()':
a.cc:59:26: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   59 |         int ind=bin(b[i],c);
      |                          ^
      |                          |
      |                          ll* {aka long long int*}
a.cc:19:20: note:   initializing argument 2 of 'int bin(int, int*)'
   19 | int bin(int x, int ar[])
      |                ~~~~^~~~
a.cc:70:26: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   70 |         int ind=bin(a[i],b);
      |                          ^
      |                          |
      |                          ll* {aka long long int*}
a.cc:19:20: note:   initializing argument 2 of 'int bin(int, int*)'
   19 | int bin(int x, int ar[])
      |                ~~~~^~~~