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

#include <iostream>
#include <algorithm>

using namespace std;

class Solution143D {
public:
    int Solve(vector<int> vec) {
        int count = 0;
        sort(vec.begin(), vec.end());
        for (int i = 0; i < vec.size(); ++i) {
            for (int j = i + 1; j < vec.size(); ++j) {
                int ab = vec[i] + vec[j];
                auto it = lower_bound(vec.begin()+j, vec.end(), ab);
                //cout << *it << endl;
                count += it - (vec.begin()+j) - 1;
            }
        }
        return count;
    }
};

int main() {
    int n, l;
    vector<int> vec;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> l;
        vec.push_back(l);
    }
    Solution143D sol;
    auto res = sol.Solve(vec);
    cout << res << endl;
}


Compiler output:
a.cc:8:15: error: 'vector' has not been declared
    8 |     int Solve(vector<int> vec) {
      |               ^~~~~~
a.cc:8:21: error: expected ',' or '...' before '<' token
    8 |     int Solve(vector<int> vec) {
      |                     ^
a.cc: In member function 'int Solution143D::Solve(int)':
a.cc:10:14: error: 'vec' was not declared in this scope
   10 |         sort(vec.begin(), vec.end());
      |              ^~~
a.cc: In function 'int main()':
a.cc:25:5: error: 'vector' was not declared in this scope
   25 |     vector<int> vec;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:25:12: error: expected primary-expression before 'int'
   25 |     vector<int> vec;
      |            ^~~
a.cc:29:9: error: 'vec' was not declared in this scope
   29 |         vec.push_back(l);
      |         ^~~
a.cc:32:26: error: 'vec' was not declared in this scope
   32 |     auto res = sol.Solve(vec);
      |                          ^~~
Language: C++

import bisect

n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0

for a in range(n):
    for b in range(a):
        over_c = l[a] + l[b]
        over_c_index = bisect.bisect_left(l,over_c)
        quantity = over_c_index - a - 1
        ans += max(quantity,0)
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++

import bisect

def main():
    n = int(input())
    l = list(map(int, input().split()))

    l.sort()

    ans = 0
    for i in range(n-1):
        for j in range(i+1, n-1):
            ans += bisect.bisect_left(l, l[i] + l[j], j+1) - (j+1)

    print(ans)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:16:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   16 | if __name__ == '__main__':
      |                ^~~~~~~~~~
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: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        long b = 0;
        int c = 0;
        int d = 2;
        int e;
		int [] in = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
		Arrays.sort(in);      
        for(int i=0;i<a-2;i++){for(int j=i+1;j<a-1;j++){if(in[j+1]<in[i]+in[j]){c=0;d=4;
                                                                         while (c==0){e = (a+j)/2;
                                                                     if(e<a-1){if(in[e-1]<in[i]+in[j] && in[e]>=in[i]+in[j]){b+=e-j;c++;}
                                                                      else{if(in[e]<in[i]+in[j]){e+=(a+j)/d;d*=2;}
                                                                          else{e-=(a+j)/d;d*=2;}
                                                                          }
                                                                              }
                                                                      else{b+=e-j;}
                                                                                             }
                                                                        }
                                                 }
                            }                                                                     
		System.out.println(b);
	}
}


Compiler output:
Main.java:10: error: incompatible types: long[] cannot be converted to int[]
		int [] in = new long [a];
		            ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        long b = 0;
        int c = 0;
        int d = 2;
        int e;
		int [] in = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
		Arrays.sort(in);      
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]){c=0;d=4;
                                                                         while (c==0){e = (a+j)/2;
                                                                     if(e<a-1){if(in[e-1]<in[i]+in[j] && in[e]>=in[i]+in[j]){b+=e-j;c++;}
                                                                      else{if(in[e]<in[i]+in[j]){e+=(a+j)/d;d*=2;}
                                                                          else{e-=(a+j)/d;d*=2;}
                                                                          }
                                                                              }
                                                                      else{b+=e-j;}
                                                                                             }
                                                                        }
                                                 }
                            }                                                                     
		System.out.println(b);
	}
}


Compiler output:
Main.java:10: error: incompatible types: long[] cannot be converted to int[]
		int [] in = new long [a];
		            ^
Main.java:15: error: cannot find symbol
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]){c=0;d=4;
                      ^
  symbol:   variable j
  location: class Main
Main.java:15: error: cannot find symbol
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]){c=0;d=4;
                                           ^
  symbol:   variable k
  location: class Main
3 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        long b = 0;
        int c = 0;
        int d = 2;
        int e;
		int [] in = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
		Arrays.sort(in);      
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]{c=0;d=4;
                                                                         while (c==0){e = (a+j)/2;
                                                                     if(e<a-1){if(in[e-1]<in[i]+in[j] && in[e]>=in[i]+in[j]){b+=e-j;c++;}
                                                                      else{if(in[e]<in[i]+in[j]){e+=(a+j)/d;d*=2;}
                                                                          else{e-=(a+j)/d;d*=2;}
                                                                          }
                                                                              }
                                                                      else{b+=e-j;}
                                                                                             }
                                                                        }
                                                 }
                            }                                                                     
		System.out.println(b);
	}
}


Compiler output:
Main.java:15: error: ')' expected
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]{c=0;d=4;
                                                                        ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        long b = 0;
        int c = 0;
        int d = 2;
        int e;
		int [] in = new long [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
		Arrays.sort(in);      
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]{c=0;d=4;
                                                                         (while c==0){e = (a+j)/2;
                                                                     if(e<a-1){if(in[e-1]<in[i]+in[j] && in[e]>=in[i]+in[j]){b+=e-j;c++;}
                                                                      else{if(in[e]<in[i]+in[j]){e+=(a+j)/d;d*=2;}
                                                                          else{e-=(a+j)/d;d*=2;}
                                                                          }
                                                                              }
                                                                      else{b+=e-j;}
                                                                                             }
                                                                        }
                                                 }
                            }                                                                     
		System.out.println(b);
	}
}


Compiler output:
Main.java:15: error: ')' expected
        for(int i=0;i<j;i++){for(int j=1;j<k;j++){if(in[j+1]<in[i]+in[j]{c=0;d=4;
                                                                        ^
Main.java:16: error: illegal start of expression
                                                                         (while c==0){e = (a+j)/2;
                                                                          ^
Main.java:16: error: not a statement
                                                                         (while c==0){e = (a+j)/2;
                                                                         ^
Main.java:16: error: '(' expected
                                                                         (while c==0){e = (a+j)/2;
                                                                               ^
4 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
deque < int > a;
long long ans;
int main()
{
	int n;
	cin>>n;
	int y;
	for(int i=0;i<n;i++) 
	{
		cin>>y;
		a.push_back(y);
	}
	sort(a.begin(),a.end());
	for(int i=0;i<n-2;i++)
	{
		if((a[i]+a[i+1])>(a[n-1]))
			break;
		if((a[i]+a[i+1])==(a[n-1]))
		{
			ans++;
			break;
		}
		int u=0;
		for(int c=i;c<n-1;c++)
		{
			int z;
			for(z=c;z<n;z++)
			{
				if((a[c]+a[z])<a[z+1])
					break;
			}
			u=z-c+1;
			long long a=u*(u-1)*(u-2)/6;
			ans+=a;
		}
		i=c;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:19: error: 'c' was not declared in this scope
   38 |                 i=c;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+6;
int a[N];
int main(){
	int n, m;
	cin>>n>>m;
	for(int i=0;i<n;++i){
		int x;
		cin>>x; 
		a[i]=x;
	}
	int ans = 0, z = 0;
	int al=0, ar=0;
	for(int i=0,j=0;i<n;++i){
		while(j<n){
			if(a[j]==0 && z<m){
				++j;
				++z;
			}else
			if(a[j]==1){
				++j;
			}else break;
		}
		if(ans<j-i){
			ans = j-i;
			al = i;
			ar = j;
		}
		if(a[i]==0) --z;
	}
	cout<<ans<<endl
	for(int i=0;i<n;++i) cout<<(al<=i&&i<ar)?1:a[i]<<' ';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: expected ';' before 'for'
   32 |         cout<<ans<<endl
      |                        ^
      |                        ;
   33 |         for(int i=0;i<n;++i) cout<<(al<=i&&i<ar)?1:a[i]<<' ';
      |         ~~~             
a.cc:33:21: error: 'i' was not declared in this scope
   33 |         for(int i=0;i<n;++i) cout<<(al<=i&&i<ar)?1:a[i]<<' ';
      |                     ^
Language: C++

#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
/****************************/
int a[2010];
int n;
ll ans=0;
int main()
{
	cin>>n
	rep(i,n)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ans=0;
	rep(i,n)
	{
		rep3(j,i+1,n)
		{
			int l=j+1;
			int r=n-1;
			while(l<=r)
			{
				int mid=l+r>>1;
				if(a[i]+a[j]>a[mid])
				{
					l=mid+1;
				}
				else
				{
					r=mid-1;
				}
			}
			ans+=l-j-1;
		 }
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:15: error: expected ';' before 'for'
   49 |         cin>>n
      |               ^
      |               ;
a.cc:50:13: error: 'i' was not declared in this scope
   50 |         rep(i,n)
      |             ^
a.cc:30:29: note: in definition of macro 'rep'
   30 | #define rep(i,n) for(ll i=0;i<(n);i++)
      |                             ^
Language: C++

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

int main(){
  int N;
  cin>>N;
  int a[N];
  for (int i=0;i<N;i++){
    cin >>a[i];
  }
  sort(a,a+N);
  int count=0;
 
  for (int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      int h=(lower_bound(a.begin(),a.end(),a[i]+a[j])-a.begin());
      count=count+max(0,h-(j+1));
        }
      }

  //cout<<N<<a[0]<<a[1]<<a[2]<<endl;
  cout<<count<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   16 |       int h=(lower_bound(a.begin(),a.end(),a[i]+a[j])-a.begin());
      |                            ^~~~~
a.cc:16:38: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   16 |       int h=(lower_bound(a.begin(),a.end(),a[i]+a[j])-a.begin());
      |                                      ^~~
a.cc:16:57: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   16 |       int h=(lower_bound(a.begin(),a.end(),a[i]+a[j])-a.begin());
      |                                                         ^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  int L[N];
  for (int i = 0; i < N; i++) cin >> L[i];

  int s = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      for (int k = j+1; k < N; k++) {
        int a = L[i], b = L[j], c = L[k];

        if ( (a < b+c) && (b<a+c) && (c<a+b) ) s++;
      }
    }
  }
  cout << s << endl;
  return 0;
}


Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'int'
    3 | using int = long long;
      |       ^~~
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

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

  vector<int> A(N);
  F0R(i, N) { cin >> A.at(i); }
  // // vector<int> AA;
  // // reverse_copy(A.begin(), A.end(), back_inserter(AA));
  // // // cout << A.at(1) << endl;
  // // // cout << AA.at(1) << endl;

  F0R(i, N) { cin >> A.at(i); }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());

  // for (int x : A) {
  //   cout << x;  // 1 2 3・・・7 と順に表示される
  // }
  // cout << endl;

  int a, b, c, counter = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        a = A[i];
        b = A[j];
        c = A[k];
        // cout << "ijk" << i << j << k << endl;
        // cout << "abc" << a << b << c << endl;
        if (a + b > c && b + c > a && c + a > b) {
          counter = counter + 1;
        } else {
          break;
        }
      }
    }
  }
  cout << counter << endl;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

import bisect

n = int(input())
l = list(map(int,input().split()))

l.sort()
a = list(set(l))
ans = 0

for b in range(1,n - 1):
    for c in range(b + 1,n):
        left = bisect.bisect_left(a,l[c] - l[b] + 1)
        right = bisect.bisect_right(a,l[b])
        ans+=max(0,right - left - 1)

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++

// C++ implementation of the above approach 
#include<bits/stdc++.h> 
using namespace std; 

void CountTriangles(vector <int> A){ 

	int n=A.size(); 

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

	int count = 0; 
	
	for( int i = n-1; i >= 1; i--){ 
		int l = 0, r = i-1; 
		while( l < r){ 
			if( A[l] + A[r] > A[i]){ 

				// If it is possible with a[l], a[r] 
				// and a[i] then it is also possible 
				// with a[l+1]..a[r-1],a[r] and a[i] 
				count += r - l ; 

				//checking for more possible solutions 
				r--; 
			} 
			else

				// if not possible check for 
				// higher values of arr[l] 
				l++; 
		} 
	} 
	cout<<count; 
} 
int main(){ 
	int n;
  	cin>>n;
	vector<int> A ;
  	for(int i-0;i<n;i++){
      	cin>>a[i];
    }

	CountTriangles(A); 
	
}	 


Compiler output:
a.cc: In function 'int main()':
a.cc:39:18: error: expected ';' before '-' token
   39 |         for(int i-0;i<n;i++){
      |                  ^
      |                  ;
a.cc:39:24: error: expected ')' before ';' token
   39 |         for(int i-0;i<n;i++){
      |            ~           ^
      |                        )
a.cc:39:25: error: 'i' was not declared in this scope
   39 |         for(int i-0;i<n;i++){
      |                         ^
Language: C++

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

int main() {
  long int N, sum=0;
  cin >> N;
  int l[N];
  for(int i=0; i<N; i++) {
     cin >> l[i];
  }
  for(int i=0; i<N-2; i++) {
    for(int j=i+1; j<N-1; j++){
      for(int k=j+1; k<N; k++) {
        if(l[i]<(l[j]+l[k] && l[j]<(l[i]+l[k]) && l[k]<(l[i]+l[j])) {
          sum++; 
        }
      }
    }
  } 
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:68: error: expected ')' before '{' token
   14 |         if(l[i]<(l[j]+l[k] && l[j]<(l[i]+l[k]) && l[k]<(l[i]+l[j])) {
      |           ~                                                        ^~
      |                                                                    )
a.cc:17:7: error: expected primary-expression before '}' token
   17 |       }
      |       ^
Language: C++

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

int main() {
  long int N, sum=0;
  cin >> N;
  int l[N]
  for(int i=0; i<N; i++) {
     cin >> l[i];
  }
  for(int i=0; i<N-2; i+;) {
    for(int j=i+1; j<N-1; j++){
      for(int k=j+1; k<N; k++) {
        if(l[i]<(l[j]+l[k] && l[j]<(l[i]+l[k]) && l[k]<(l[i]+l[j])) {
          sum++; 
        }
      }
    }
  } 
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected initializer before 'for'
    8 |   for(int i=0; i<N; i++) {
      |   ^~~
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   for(int i=0; i<N; i++) {
      |                ^
a.cc:11:25: error: expected primary-expression before ';' token
   11 |   for(int i=0; i<N-2; i+;) {
      |                         ^
a.cc:11:25: error: expected ')' before ';' token
   11 |   for(int i=0; i<N-2; i+;) {
      |      ~                  ^
      |                         )
a.cc:11:26: error: expected primary-expression before ')' token
   11 |   for(int i=0; i<N-2; i+;) {
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  
  cin >> N;
  
  vector<int> L(N);
  
  for(int i = 0;i < N;++i){
    cin >> L[i];
  }
  
  int a = 0;
  
  for(int i = 0;i < N - 1;++i){
    for(int j = i + 1;j < N;++j){
      int num = L[i] + L[j];
      int num2 = lower_boound(L.begin(),L.end(),num) - L;
      int num3 = num2 - i;
      a = a + num3;
    }
  }
  
  cout << a << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: 'lower_boound' was not declared in this scope
   20 |       int num2 = lower_boound(L.begin(),L.end(),num) - L;
      |                  ^~~~~~~~~~~~
Language: C++

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

int main(){
  int N;
  cin>>N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin>>L.at(i);
  }
  sort(L.begin(),L.end());
  
  int ans=0;
  for(int i=2;i<N;i++){
    left=0;
    right=i-1;
    while(left!=right){
      if(L.at(left)+L.at(right)>L.at(i)){
        ans+=right-left;
        right--;
      }else{
        left++;
      }
    }
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: assignment of function 'std::ios_base& std::left(ios_base&)'
   15 |     left=0;
      |     ~~~~^~
a.cc:16:10: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   16 |     right=i-1;
      |     ~~~~~^~~~
a.cc:18:15: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   18 |       if(L.at(left)+L.at(right)>L.at(i)){
      |               ^~~~
      |               |
      |               std::ios_base& (*)(std::ios_base&)
In file included from /usr/include/c++/14/vector:66,
                 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/stl_vector.h:1180:20: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |          ~~~~~~~~~~^~~
a.cc:18:26: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'std::vector<int>::size_type' {aka 'long unsigned int'} [-fpermissive]
   18 |       if(L.at(left)+L.at(right)>L.at(i)){
      |                          ^~~~~
      |                          |
      |                          std::ios_base& (*)(std::ios_base&)
/usr/include/c++/14/bits/stl_vector.h:1180:20: note:   initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |          ~~~~~~~~~~^~~
a.cc:19:19: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
   19 |         ans+=right-left;
      |              ~~~~~^~~~~
a.cc:20:9: warning: ISO C++ forbids decrementing a pointer of type 'std::ios_base& (*)(std::ios_base&)' [-Wpointer-arith]
   20 |         right--;
      |         ^~~~~
a.cc:20:14: error: lvalue required as decrement operand
   20 |         right--;
      |              ^~
a.cc:22:9: warning: ISO C++ forbids incrementing a pointer of type 'std::ios_base& (*)(std::ios_base&)' [-Wpointer-arith]
   22 |         left++;
      |         ^~~~
a.cc:22:13: error: lvalue required as increment operand
   22 |         left++;
      |             ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n;
  cin >> n;
  
  array<int, n> l;
  for (int i = 0;i < n;i++) {
    cin >> l[i];
  }
  
  int result = 0;
  for (int i = 0;i < n-2;i++) {
    for (int j = 0;j < n-1;j++) {
      for (int k = 0;k < n;k++) {
        cout << i << j << k << endl;
        if (l[i] >= l[j]+l[k]) continue;
        if (l[j] >= l[i]+l[k]) continue;
        if (l[k] >= l[i]+l[j]) continue;
        result++;
      }
    }
  }
  
  cout << result << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: the value of 'n' is not usable in a constant expression
    9 |   array<int, n> l;
      |               ^
a.cc:6:7: note: 'int n' is not const
    6 |   int n;
      |       ^
a.cc:9:15: note: in template argument for type 'long unsigned int'
    9 |   array<int, n> l;
      |               ^
a.cc:11:13: error: invalid types 'int[int]' for array subscript
   11 |     cin >> l[i];
      |             ^
a.cc:19:14: error: invalid types 'int[int]' for array subscript
   19 |         if (l[i] >= l[j]+l[k]) continue;
      |              ^
a.cc:19:22: error: invalid types 'int[int]' for array subscript
   19 |         if (l[i] >= l[j]+l[k]) continue;
      |                      ^
a.cc:19:27: error: invalid types 'int[int]' for array subscript
   19 |         if (l[i] >= l[j]+l[k]) continue;
      |                           ^
a.cc:20:14: error: invalid types 'int[int]' for array subscript
   20 |         if (l[j] >= l[i]+l[k]) continue;
      |              ^
a.cc:20:22: error: invalid types 'int[int]' for array subscript
   20 |         if (l[j] >= l[i]+l[k]) continue;
      |                      ^
a.cc:20:27: error: invalid types 'int[int]' for array subscript
   20 |         if (l[j] >= l[i]+l[k]) continue;
      |                           ^
a.cc:21:14: error: invalid types 'int[int]' for array subscript
   21 |         if (l[k] >= l[i]+l[j]) continue;
      |              ^
a.cc:21:22: error: invalid types 'int[int]' for array subscript
   21 |         if (l[k] >= l[i]+l[j]) continue;
      |                      ^
a.cc:21:27: error: invalid types 'int[int]' for array subscript
   21 |         if (l[k] >= l[i]+l[j]) continue;
      |                           ^
Language: C++

include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<long>L(N);
  for(int i=0;i<N;i++)cin>>L[i];
  sort(L.begin(),L.end());
  long ans=0;
  for(int i=2;i<N;i++){
    for(int j=1;j<i;j++){
		for(int k=0;k<j;k++){
          if(L[k]+L[j]>L[i])ans++;
          else break;
        }
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>N;
      |   ^~~
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<long>L(N);
      |   ^~~~~~
a.cc:6:10: error: expected primary-expression before 'long'
    6 |   vector<long>L(N);
      |          ^~~~
a.cc:7:28: error: 'L' was not declared in this scope
    7 |   for(int i=0;i<N;i++)cin>>L[i];
      |                            ^
a.cc:8:8: error: 'L' was not declared in this scope
    8 |   sort(L.begin(),L.end());
      |        ^
a.cc:8:3: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |   sort(L.begin(),L.end());
      |   ^~~~
      |   short
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout<<ans<<endl;
      |   ^~~~
a.cc:18:14: error: 'endl' was not declared in this scope
   18 |   cout<<ans<<endl;
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int ar[2005];

int32_t main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+n+1);
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			auto x = lower_bound(ar+j,ar+n+1,ar[i]+ar[j]);
			if(*x == (ar[i]+ar[j])){
				x--;
			}
			auto y = lower_bound(ar+j,ar+n+1,ar[j]-ar[i]);
			if(*y == (ar[j]-ar[i])){
				y--;
			}
			ans += x-y+1;
			assert(ans>=0);
			cout<<ans<<"\n"
		}
	}
	cout<<ans;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:33:40: error: expected ';' before '}' token
   33 |                         cout<<ans<<"\n"
      |                                        ^
      |                                        ;
   34 |                 }
      |                 ~
Language: C++

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

int main(){
    int n;
    cin >> n;
    int l[n];
    rep(i,n) cin >> l[i];
    sort(l,l+n);
    int ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            auto iter = upper_bound(l,l+n,l[i]+l[j]);
            if(iter==l+n){
                if(l[n-1]>=l[i]+l[j]) continue;
            }
            int x = iter-l-j-1;
            ans+=x;
        }
    }

    cout << ans << endl;

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

int main(){
    int n;
    cin >> n;
    int l[n];
    rep(i,n) cin >> l[i];
    sort(l,l+n);
    int ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            auto iter = upper_bound(l,l+n,l[i]+l[j]);
            if(iter==l+n){
                if(l[n-1]>=l[i]+l[j]) continue;
            }
            int x = iter-l-j-1;
            ans+=x;
        }
    }

    cout << ans << endl;

}

Compiler output:
a.cc:28:2: error: stray '#' in program
   28 | }#include <bits/stdc++.h>
      |  ^
a.cc:28:3: error: 'include' does not name a type
   28 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:35:5: error: redefinition of 'int main()'
   35 | int main(){
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main(){
      |     ^~~~
Language: C++

#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int l[1000];
  for (int i = 0; i < n; ++i)
    cin >> l[i];
  sort(l, n);
  
  int cnt = 0;
  for (int i = 0; i < n-2; ++i)
    for (int j = i+1; j < n-1; ++j)
      for (int k = j+1; k < n; ++k)
        if (l[i]+l[j]>l[k])
          cnt++;

  cout << cnt;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: no matching function for call to 'sort(int [1000], int&)'
   13 |   sort(l, n);
      |   ~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:13:7: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
   13 |   sort(l, n);
      |   ~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int l[1000];
  for (int i = 0; i < n; ++i)
    cin >> l[i];
  for (int i = 0; i < n-2; ++i)
    for (int j = i+1; j < n-1; ++j)
      for (int k = j+1; k < n; ++k)
        if (l[i]+l[j]>l[k])
          cnt++;

  cout << cnt;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |           cnt++;
      |           ^~~
      |           int
a.cc:18:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   18 |   cout << cnt;
      |           ^~~
      |           int
Language: C++

#include <iostream>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int l[1000];
  for (int i = 0, i < n; ++i)
    cin >> l[i];
  for (int i = 0, i < n-2; ++i)
    for (int j = i, j < n-1; ++j)
      for (int k = k, k < n; ++k)
        if (l[i]+l[j]>l[k])
          cnt++;

  cout << cnt;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: expected ';' before '<' token
   10 |   for (int i = 0, i < n; ++i)
      |                    ^~
      |                    ;
a.cc:10:21: error: expected primary-expression before '<' token
   10 |   for (int i = 0, i < n; ++i)
      |                     ^
a.cc:12:20: error: expected ';' before '<' token
   12 |   for (int i = 0, i < n-2; ++i)
      |                    ^~
      |                    ;
a.cc:12:21: error: expected primary-expression before '<' token
   12 |   for (int i = 0, i < n-2; ++i)
      |                     ^
a.cc:13:22: error: expected ';' before '<' token
   13 |     for (int j = i, j < n-1; ++j)
      |                      ^~
      |                      ;
a.cc:13:23: error: expected primary-expression before '<' token
   13 |     for (int j = i, j < n-1; ++j)
      |                       ^
a.cc:14:24: error: expected ';' before '<' token
   14 |       for (int k = k, k < n; ++k)
      |                        ^~
      |                        ;
a.cc:14:25: error: expected primary-expression before '<' token
   14 |       for (int k = k, k < n; ++k)
      |                         ^
a.cc:16:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |           cnt++;
      |           ^~~
      |           int
a.cc:18:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   18 |   cout << cnt;
      |           ^~~
      |           int
Language: C

#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

int main()
{
    int n,l[2000],i,j,k;
    long int total = 0;

    scanf("%d",&n);
    for(i = 0; i < n;i++)scanf("%d",&l[i]);

    qsort(l,n,sizeof(int),asc);

    for (i = 0; i < n; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            for (k = j + 1; k < n; k++)
            {
                if(l[i] < l[j] + l[k])ans++;
            }
        }
    }
    printf("%ld",ans);
}


Compiler output:
main.c: In function 'main':
main.c:24:39: error: 'ans' undeclared (first use in this function); did you mean 'abs'?
   24 |                 if(l[i] < l[j] + l[k])ans++;
      |                                       ^~~
      |                                       abs
main.c:24:39: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(){
  int N;
  cin >> N;
  
  vector<int> L(N);
  for (int i = 0 ; i < N; i++) cin >> L.at(i);
  
  sort(L.begin(), L.end());
  long cnt = 0;
  
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int k = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) – L.begin();
      cnt += max(k – (j + 1), 0);
    }
  }
  cout << cnt;
  return 0;
}


Compiler output:
a.cc:16:66: error: extended character – is not valid in an identifier
   16 |       int k = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) – L.begin();
      |                                                                  ^
a.cc:17:20: error: extended character – is not valid in an identifier
   17 |       cnt += max(k – (j + 1), 0);
      |                    ^
a.cc: In function 'int main()':
a.cc:16:26: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   16 |       int k = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) – L.begin();
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:17:19: error: expected ')' before '\U00002013'
   17 |       cnt += max(k – (j + 1), 0);
      |                 ~ ^~
      |                   )
Language: Java

import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] l = new int[n];
        for(int i=0;i<n;i++)l[i]=sc.nextInt();

        Arrays.sort(l);
        long ans=0;

        for(long i=0;i<n-2;i++){
            for(long j=i+1;j<n-1;j++){
                int max = l[i]+l[j]-1;
                long c = Arrays.binarySearch(l,max);
                if(c<0)c=-(c+2);
                if(c==n)c--;
                if(c>j)ans+=c-j;
            }
        }

        System.out.println(ans);
    }

}




Compiler output:
Main.java:17: error: incompatible types: possible lossy conversion from long to int
                int max = l[i]+l[j]-1;
                            ^
Main.java:17: error: incompatible types: possible lossy conversion from long to int
                int max = l[i]+l[j]-1;
                                 ^
2 errors
Language: C++

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

int n;
int L[10000];
int res = 0;

int main(){
  cin >> n;
  rep(i, n) cin >> L[i];
  
  for(int i = 0; i < n; i++){
    int a = L[i];
    for(int j = i + 1; j < n; j++){
      int b = L[j];
      for(int k = j + 1; k < n; k++){
        int c = L[k];
        if(abs(a - b) < c && c < a + b)
        }
      }
    }
  }
  cout << res << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: expected primary-expression before '}' token
   20 |         }
      |         ^
a.cc: At global scope:
a.cc:24:3: error: 'cout' does not name a type
   24 |   cout << res << endl;
      |   ^~~~
a.cc:26:3: error: expected unqualified-id before 'return'
   26 |   return 0;
      |   ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using ll = long long;


int main(){
        ll n;
        scanf("%lld", &n);

        std::vector<ll> a(n);
        for(ll i=0; i<n; i++) scanf("%lld", &a[i]);
        sort(a.begin(), a.end());


        ll ans = 0;
        for(ll i=0; i<n-2; i++){
                for(ll j=i+1; j<n-1; j++){
                        ll l = j, r = n;
                        while(r-l>1){
                                ll mid = (l+r)/2;
                                if(a[mid]<a[i]+a[j]) l = mid;
                                else r = mid;
                        }
                        ans += l-j;
                }
        }
        printf("%lld\n", ans);
        return 0;
}#include<bits/stdc++.h>
using ll = long long;


int main(){
        ll n;
        scanf("%lld", &n);

        std::vector<ll> a(n);
        for(ll i=0; i<n; i++) scanf("%lld", &a[i]);
        sort(a.begin(), a.end());


        ll ans = 0;
        for(ll i=0; i<n-2; i++){
                for(ll j=i+1; j<n-1; j++){
                        ll l = j, r = n;
                        while(r-l>1){
                                ll mid = (l+r)/2;
                                if(a[mid]<a[i]+a[j]) l = mid;
                                else r = mid;
                        }
                        ans += l-j;
                }
        }
        printf("%lld\n", ans);
        return 0;
}

Compiler output:
a.cc:28:2: error: stray '#' in program
   28 | }#include<bits/stdc++.h>
      |  ^
a.cc:28:3: error: 'include' does not name a type
   28 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
Language: C++

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

int main(void){
    int n;
    cin >> n;
    
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    
    
    sort(l.begin(), l.end());
    
    int ans = 0;
    
    rep(b, n) rep(a, b){
        int ab = l[a] + l[b];
        
        int r = lower_bound(l.begin(), l.end(), ab) - l.begin();
        int l = b + 1;
        
        //c = [l, r);
        
        ans += max(0, r - l);
        
    }
    cout << ans << endl;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n;
      |     ^~~
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> l(n);
      |     ^~~~~~
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> l(n);
      |            ^~~
a.cc:10:22: error: 'l' was not declared in this scope
   10 |     rep(i, n) cin >> l[i];
      |                      ^
a.cc:13:10: error: 'l' was not declared in this scope
   13 |     sort(l.begin(), l.end());
      |          ^
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(l.begin(), l.end());
      |     ^~~~
      |     short
a.cc:20:17: error: 'lower_bound' was not declared in this scope
   20 |         int r = lower_bound(l.begin(), l.end(), ab) - l.begin();
      |                 ^~~~~~~~~~~
a.cc:25:16: error: 'max' was not declared in this scope
   25 |         ans += max(0, r - l);
      |                ^~~
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout << ans << endl;
      |     ^~~~
a.cc:28:20: error: 'endl' was not declared in this scope
   28 |     cout << ans << endl;
      |                    ^~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> t(n);
  rep(i, n)
  {
    cin >> t[i];
  }
  sort(t.begin(), t.end(),greater<int>());

  int a,b,c,s = 0;
  rep(i, n-2)
  {
  rep(j,i+1, n-1)
  {
  rep(k,j+1, n)
  {
   if(t[i]>=t[j]+t[k]){break;}
   s++;
  }
  }
  }

  cout << s << endl;

  return 0;
}


Compiler output:
a.cc:3:9: warning: "rep" redefined
    3 | #define rep(i,j, n) for (int i = (j); i < (n); i++)
      |         ^~~
a.cc:2:9: note: this is the location of the previous definition
    2 | #define rep(i, n) for (int i = 0; i < (n); i++)
      |         ^~~
a.cc:10:11: error: macro "rep" requires 3 arguments, but only 2 given
   10 |   rep(i, n)
      |           ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i,j, n) for (int i = (j); i < (n); i++)
      |         ^~~
a.cc:17:13: error: macro "rep" requires 3 arguments, but only 2 given
   17 |   rep(i, n-2)
      |             ^
a.cc:3:9: note: macro "rep" defined here
    3 | #define rep(i,j, n) for (int i = (j); i < (n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'rep' was not declared in this scope
   10 |   rep(i, n)
      |   ^~~
a.cc:17:6: error: expected ';' before '{' token
   17 |   rep(i, n-2)
      |      ^
      |      ;
   18 |   {
      |   ~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>



using namespace std;


bool isTri(int a, int b, int c) {
	
	if (a >= b + c) {
		return false;
	}
	if (b >= c + a) {
		return false;
	}
	if (c >= a + b) {
		return false;
	}
	return true;

}


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

	vector<int> L(n);
	for (int i = 0; i < n; i++) {
		cin >> L[i];
	}

	int cnt = 0;
	
	sort(L.begin(), L.end());
	for (int i = 0; i < n - 2;i++) {
		for (int j = i+1; j < n - 1; j++) {
			
			

			if (isTri(L[i], L[j], L[j + 1])) {
				if (isTri(L[i], L[j], L[n - 1])) {
					cnt += n - 1 - j;

				}
				else {

					int right = j + 1;
					int left = n - 1;
					int mid = (right + left) / 2;

					while (right < mid) {
						if (isTri(L[i], L[j], L[mid])) {
							right = mid;

						}
						else {
							left = mid;
						}

						mid = (right + left) / 2;
					}


					cnt += right - j;
				}
			}
		}
	}

	cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   42 |         sort(L.begin(), L.end());
      |         ^~~~
      |         sqrt