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

#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    vector<int> l(n);
    rep(i, n) scanf("%d", &l[i]);

    LL ans = 0;
    rep(i, n - 2) loop(j, i + 1, n - 1) loop(k, j + 1, n) {
        if (l[i] < l[j] + l[k] and l[j] < l[i] + l[k] and l[k] < l[i] + l[l]) ++ans;

    }
    printf("%lld\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:74: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::vector<int>')
   30 |         if (l[i] < l[j] + l[k] and l[j] < l[i] + l[k] and l[k] < l[i] + l[l]) ++ans;
      |                                                                          ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

#include<iostream>
using namespace std; 
int a,b,c,n,d[1000],k; 
int main () 
{ cin >>n ; 
 for (int i=1;i<=n;i++)
 {cin>>d[i];
    for (int e=2;e<=n;e++)
    { if(e>i)
      { d[e]=b;
        for (int f=3;f<=n;f++)
        { if(f>e)
        { d[f]=c; if (a+b>c && b+c>a && a+c>b)k++}
        }
      }
    }
 }
 cout << k;
 return 0; 
}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:13:50: error: expected ';' before '}' token
   13 |         { d[f]=c; if (a+b>c && b+c>a && a+c>b)k++}
      |                                                  ^
      |                                                  ;
Language: C++

#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

template<class T>bool chmax(T &a, const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}

template<class T>bool chmin(T &a, const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

LL lcm(LL a,LL b){
	return a*b/gcd(a,b);
}

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n;cin>>n;
	VI l(n);
	rep(i,n)cin>>l.at(i);
	sort(all(l));
	reverse(all(l));
	LL ans=0;
	rep(i,n-2){
		for(int j=i+1;j<n-1;j++){
			if(l.at(i)>=l.at(k)*2){
				break;
			}
			for(int k=j+1;k<n;k++){
				if(l.at(i)<l.at(j)+l.at(k)){
					ans++;
				}else{
					break;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:42: error: 'k' was not declared in this scope
   76 |                         if(l.at(i)>=l.at(k)*2){
      |                                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 2e3+20;
int n,l[N],ans;
int main(void)
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%d",&l[i]);
    sort( l+1 , l+n+1 );
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
            ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 1LL*0 );
    printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: no matching function for call to 'max(long int, long long int)'
   13 |             ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 1LL*0 );
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:23: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   13 |             ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 1LL*0 );
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   13 |             ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 1LL*0 );
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int n,cnt=0;
  cin >> n;
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;a[k]<a[i]+a[j];k++){
        if((a[i]<a[k]+a[j])&&(a[j]<a[i]+a[k])) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:31: error: 'a' was not declared in this scope
    7 |   for(int i=0;i<n;i++) cin >> a[i];
      |                               ^
a.cc:10:21: error: 'a' was not declared in this scope
   10 |       for(int k=j+1;a[k]<a[i]+a[j];k++){
      |                     ^
Language: C++

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

int main(){
  int n, ans=0; cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++)cin>>l[i];
  
  sort(l.begin(), l.end());
  
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      auto itr = lower_bound(l.begin(), l.end(), l[i]+l[j]);
      ans += int(a.end()-itr);
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'a' was not declared in this scope
   14 |       ans += int(a.end()-itr);
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	vi v(n);
  	for(int &x:v)cin>>x;
  	sort(v.begin(),v.end());
  	int ans = 0;
  	for(int i=0;i<n;i++){
    	for(int j=i+1;j<n;j++){
        	int idx = (lower_bound(v.begin(),v.end(),v[i]+v[j])-v.begin());
          	ans += max(idx-j,0);
        }
    }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'vi' was not declared in this scope
    6 |         vi v(n);
      |         ^~
a.cc:7:20: error: 'v' was not declared in this scope
    7 |         for(int &x:v)cin>>x;
      |                    ^
a.cc:8:14: error: 'v' was not declared in this scope
    8 |         sort(v.begin(),v.end());
      |              ^
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int> l(0);
    int input = 0;
    for(int i=0;i<n;i++){
        cin >> input;
        l.push_back(input);
    }
    sort(l.begin(),l.end());
    int ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
            int left = j+1;
            ans += right - left;
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:55: error: 'a' was not declared in this scope
   17 |             int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
      |                                                       ^
a.cc:17:57: error: 'b' was not declared in this scope
   17 |             int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
      |                                                         ^
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int> l(0);
    int input = 0;
    for(int i=0;i<n;i++){
        cin >> input;
        l.push_back(input);
    }
    sort(l.begin(),l.end());
    int ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
            int left = j+1;
            ans += right - left
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:55: error: 'a' was not declared in this scope
   17 |             int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
      |                                                       ^
a.cc:17:57: error: 'b' was not declared in this scope
   17 |             int right = lower_bound(l.begin(),l.end(),a+b) - l.begin();
      |                                                         ^
a.cc:19:32: error: expected ';' before '}' token
   19 |             ans += right - left
      |                                ^
      |                                ;
   20 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) lower_bound(all(v),k)-v.begin()
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=100100100100;
const int mod=1000000007;
int main(){
    int n;cin>>n;
    ll ans=0;
    vi v(n);
    rep(i,n)cin>>v[i];
    sort(all(v));
    rep(i,n){
        REP(j,i+1,n){
            int c=v[i]+v[j];
            int r=lb(v,c);
            int l=b+1;
            ans+=r-l;
        }
    }
    cout<<ans<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) lower_bound(all(v),k)-v.begin()
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=100100100100;
const int mod=1000000007;
int main(){
    int n;cin>>n;
    ll ans=0;
    vi v(n);
    rep(i,n)cin>>v[i];
    rep(i,n){
        REP(j,i+1,n){
            int c=v[i]+v[j];
            int r=lb(v,c);
            int l=b+1;
            ans+=r-l;
        }
    }
    cout<<ans<<endl;
}

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

#include <iostream>
#include <vector>

using namespace std;

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

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

  long long ans = 0;
  for(int b=0; b<n; b++){
    for(int a=0; a<b; a++){
      int r = lower_bound(Li.begin(), Li.end(), Li[a]+Li[b]) - Li.begin();
      int l = b + 1;
      ans += r - l;
    }
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(Li.begin(), Li.end());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(){
  int n;
  cin >> n;
  vector<int> a;
  for (int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(a.begin(),a.end());
  int ans = 0;
  for(int i=tmp.size()-1;i>=2;i--){
    for(int j=0;j<i-1;j++){
      for(int k=j+1;k<i;k++){
        if(a[j] + a[k] > a[i]) ans++;
      }
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   18 |   for(int i=tmp.size()-1;i>=2;i--){
      |             ^~~
      |             tm
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(){
  int n;
  cin >> n;
  vector<int> a;
  for (int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(tmp.begin(),tmp.end());
  int ans = 0;
  for(int i=tmp.size()-1;i>=2;i--){
    for(int j=0;j<i-1;j++){
      for(int k=j+1;k<i;k++){
        if(a[j] + a[k] > a[i]) ans++;
      }
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   16 |   sort(tmp.begin(),tmp.end());
      |        ^~~
      |        tm
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(){
  int n;
  cin >> n;
  vector<int> a;
  for (int i=0;i<n;i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(tmp.begin(),tmp.end());
  int ans = 0;
  for(int i=tmp.size()-1,i>=2;i--){
    for(int j=0;j<i-1;j++){
      for(int k=j+1;k<i;k++){
        if(a[j] + a[k] > a[i]) ans++;
      }
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   16 |   sort(tmp.begin(),tmp.end());
      |        ^~~
      |        tm
a.cc:18:34: error: expected ';' before ')' token
   18 |   for(int i=tmp.size()-1,i>=2;i--){
      |                                  ^
      |                                  ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
main(){
  int n,a[2222],res=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(a[k]<a[i]+a[j])ans++;
      }
    }
  }
  cout<<res;
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         if(a[k]<a[i]+a[j])ans++;
      |                           ^~~
      |                           abs
Language: C++

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

int main() {
  int N;
  cin>>N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }

  int a=0;
  for(int i=0; i<N;i++){
    for(int j=i+1; j<N;j++){
      for(int k=j+1; k<N;k++){
        if(v.at(i)<v.at(j)+v.at(k)&&(v.at(j)<v.at(i)+v.at(k)&&(v.at(k)<v.at(j)+v.at(i)){
        a++;
      }
    }
  }
  cout <<a<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:88: error: expected ')' before '{' token
   16 |         if(v.at(i)<v.at(j)+v.at(k)&&(v.at(j)<v.at(i)+v.at(k)&&(v.at(k)<v.at(j)+v.at(i)){
      |                                     ~                                                  ^
      |                                                                                        )
a.cc:18:8: error: expected ')' before '}' token
   18 |       }
      |        ^
      |        )
   19 |     }
      |     ~   
a.cc:16:11: note: to match this '('
   16 |         if(v.at(i)<v.at(j)+v.at(k)&&(v.at(j)<v.at(i)+v.at(k)&&(v.at(k)<v.at(j)+v.at(i)){
      |           ^
a.cc:19:5: error: expected primary-expression before '}' token
   19 |     }
      |     ^
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int kaijo(int a)
{
    int n = 1;
    for(int i = 1; i <= a; i++){
        n *= i;
    }

    return n;
}

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

    vector<int> L(n);
    for(int i = 0; i < n; i++){
        cin >> L[i];
    }
    sort(L.begin(), L.end());

    int ans = 0;
    for(int b = 0; b < n; b++){
        for(int a = 0; a < b; a++){
            int ab = L[a] + L[b];
            int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
            int l = b + 1;
            ans += r - l;
        }
    }

    cout << ans << endl;
}

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

import java.util.Scanner;
public class AA
{
  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();
    int count=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] && l[i]+l[k]>l[j] && l[j]+l[k]>l[i])
            count++;
        }
      }
    }
    System.out.println(count);
  }
}


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

#include <bits/stdc++.h>

using namespace std;

int main() {
  size_t n;
  cin >> n;
  vector<int> L;
  for (size_t i = 0; i < n; ++n) {
    cin >> L[i];
  }
  sort(L.begin(), K.end());
  size_t result = 0;
  for (size_t a = 0; a < n; ++a) {
    for (size_t b = a + 1; b < n; ++b) {
      auto it = lower_bound(L.begin(), L.end(), a + b);
      result += it - L.begin();
    }
  }
  cout << result;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'K' was not declared in this scope
   12 |   sort(L.begin(), K.end());
      |                   ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, s, n) for(long i = s; i < (long)(n); ++i)

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

  vector<long> l(n);
  rep(i, 0, n) {
    cin >> l[i];
  }

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

  long answer = 0;
  rep(i, 0, n) {
    rep(j, i + 1, n) {
      long upper_limit = l[i] + l[j];
      auto bound = lower_bound(l.begin() + j + 1, l.end(), upper_limit);
      auto bound_index = bound - l.begin();s
      answer += max(bound_index - j - 1, (long)0);
    }
  }

  cout << answer << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:44: error: 's' was not declared in this scope
   25 |       auto bound_index = bound - l.begin();s
      |                                            ^
Language: Java

fun main(args: Array<String>) {
    abc143d()
}

fun abc143d() {
    val n = readLine()!!.toInt()
    val lines = readLine()!!.split(" ").map { it.toInt() }
        .sorted().toIntArray()

    var answer = 0
    for (bi in 0 until n) {
        var right = bi + 1
        for (ai in 0 until bi) {
            while (right < n && lines[right] < lines[ai] + lines[bi]) right++
            val left = bi + 1
            answer += right - left
        }
    }

    println(answer)
}


Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
fun main(args: Array<String>) {
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
fun main(args: Array<String>) {
             ^
Main.java:1: error: class, interface, enum, or record expected
fun main(args: Array<String>) {
                    ^
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

void Main() {
	int n; cin >> n;
	vector<int > v;
  	int a;
	rep(i, n){cin >>a; v.push_buck(a);}
	sort(all(v)); reverse(all(v));
	int ans = 0;
	rep(i, n - 2) {
		repi(j, i + 1, n - 1) {
			repi(k, j + 1, n) {
				if (v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[k] + v[i] > v[j]) {
					ans++;
					//cout << v[i] << v[j] << v[k] << endl;
					
				}
			}
		}
	}
	cout << ans;
	//rep(i, n)cout << v[i];
}


int main() {
	Main();

	return 0;
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:12:30: error: 'class std::vector<int>' has no member named 'push_buck'; did you mean 'push_back'?
   12 |         rep(i, n){cin >>a; v.push_buck(a);}
      |                              ^~~~~~~~~
      |                              push_back
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

void Main() {
	int n; cin >> n;
	vector<int > v;
  	int a;
	rep(i, n){cin >>a; v.push_buck(a);
	sort(all(v)); reverse(all(v));
	int ans = 0;
	rep(i, n - 2) {
		repi(j, i + 1, n - 1) {
			repi(k, j + 1, n) {
				if (v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[k] + v[i] > v[j]) {
					ans++;
					//cout << v[i] << v[j] << v[k] << endl;
					
				}
			}
		}
	}
	cout << ans;
	//rep(i, n)cout << v[i];
}


int main() {
	Main();

	return 0;
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:12:30: error: 'class std::vector<int>' has no member named 'push_buck'; did you mean 'push_back'?
   12 |         rep(i, n){cin >>a; v.push_buck(a);
      |                              ^~~~~~~~~
      |                              push_back
a.cc:31:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   31 | int main() {
      |         ^~
a.cc:31:9: note: remove parentheses to default-initialize a variable
   31 | int main() {
      |         ^~
      |         --
a.cc:31:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:31:12: error: a function-definition is not allowed here before '{' token
   31 | int main() {
      |            ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:8:13: note: to match this '{'
    8 | void Main() {
      |             ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

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

	Int ans = 0;
	for (Int i = 0; i < N; i++) {
		for (Int j = i+1; j < N; j++) {
			for (Int k = j + 1; k < N; k++) {
        
				if (L[i] < L[j] + L[k]&&(abs(L[j]-L[k])< L[i]) {
						ans++;
					
				}

			}
		}
	}

	cout << ans << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:79: error: expected ')' before '{' token
   38 |                                 if (L[i] < L[j] + L[k]&&(abs(L[j]-L[k])< L[i]) {
      |                                    ~                                          ^~
      |                                                                               )
a.cc:43:25: error: expected primary-expression before '}' token
   43 |                         }
      |                         ^
Language: C++

#include<iostream>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
LL mod=1000000007;
LL LINF=1LL<<52;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) {
        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++) {
            for (int k = j+1; k < n; k++) {
                if(l[i]+l[j]>l[k]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

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

	Int ans = 0;
	for (Int i = 0; i < N; i++) {
		for (Int j = i+1; j < N; j++) {
			for (Int k = j + 1; k < N; k++) {
				if (((L[j] - L[k])>0?L[j]-L[k]:L[k]-L[j]) < L[i] && L[i] < L[j] + L[k]) {
						ans++;
					}
				}

			}
		}
	}

	cout << ans << "\n";
}


Compiler output:
a.cc:46:9: error: 'cout' does not name a type
   46 |         cout << ans << "\n";
      |         ^~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

n = int(input())
L = list(map(int, input().split()))
x = [0] * 1010
for l in L:
  x[l] += 1

ans = 0;
for a in range(1, 1001):
  for b in range(a, 1001):
    for c in range(b, 1001):
      if c >= a + b:
        break
      if a == b == c:
        ans += x[a] * (x[b]-1) * (x[c]-2) // 6
      elif a == b:
        ans += x[a] * (x[b]-1) // 2
      elif b == c:
        ans += x[a] * x[b] * (x[c]-1) // 2
      else:
        ans += x[a] * x[b] * x[c]

print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for a in range(1, 1001):
      | ^~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N;
  vector <int> L;
  cin >> N;
  for(int i=0; i<N; i++){
    int l;
    cin >> l;
    L.push_back(l);
  }
  sort(L.begin(), L.end());
#  auto result = unique(L.begin(), L.end());
#  L.erase(result, L.end());
  int n = L.size();
  int ans = 0;
  for(int i=0; i<n-2; i++){
    for(int j=i+1; j<n-1; j++){
      int a = L[i], b = L[j];
      for(int k=n-1; k>j; k--){
        if(a+b > L[k]){
          ans += k-j;
          break;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:14:4: error: invalid preprocessing directive #auto
   14 | #  auto result = unique(L.begin(), L.end());
      |    ^~~~
a.cc:15:4: error: invalid preprocessing directive #L
   15 | #  L.erase(result, L.end());
      |    ^
a.cc: In function 'int main()':
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(L.begin(), L.end());
      |   ^~~~
      |   short
Language: C++

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(ALL(l));
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                if (l[i] + l[j] > l[k])
                {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin.tie(0);
      |     ^~~
a.cc:4:5: error: 'ios' has not been declared
    4 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> l(n);
      |     ^~~~~~
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> l(n);
      |            ^~~
a.cc:9:16: error: 'l' was not declared in this scope
    9 |         cin >> l[i];
      |                ^
a.cc:11:14: error: 'l' was not declared in this scope
   11 |     sort(ALL(l));
      |              ^
a.cc:11:10: error: 'ALL' was not declared in this scope
   11 |     sort(ALL(l));
      |          ^~~
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(ALL(l));
      |     ^~~~
      |     short
a.cc:12:5: error: 'll' was not declared in this scope
   12 |     ll ans = 0;
      |     ^~
a.cc:21:21: error: 'ans' was not declared in this scope
   21 |                     ans++;
      |                     ^~~
a.cc:26:5: error: 'cout' was not declared in this scope
   26 |     cout << ans << endl;
      |     ^~~~
a.cc:26:13: error: 'ans' was not declared in this scope
   26 |     cout << ans << endl;
      |             ^~~
a.cc:26:20: error: 'endl' was not declared in this scope
   26 |     cout << ans << endl;
      |                    ^~~~
Language: Java

package abc143;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class MainD {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.valueOf(sc.nextLine());
		int[] list = new int[n];
		for (int i = 0; i < n; i++) {
			list[i] = sc.nextInt();
		}

		Arrays.sort(list);

		int size = n;
		int sizei = size - 2;
		int sizej = size - 1;
		long sum = 0;

		for (int i = 0; i < sizei; i++) {
			int li = list[i];
			for (int j = i + 1; j < sizej; j++) {
				int lj = list[j];
				int val = li + lj;
				for (int k = j + 1; k < size; k++) {
					int lk = list[k];
					if (val <= lk) {
						sum = sum + k - j - 1;
						break;
					} else if (k == sizej) {
						sum = sum + k - j;
					}
				}
			}
		}
		System.out.println(sum);
	}
}


Compiler output:
Main.java:10: error: class MainD is public, should be declared in a file named MainD.java
public class MainD {
       ^
1 error
Language: Java

import java.util.*;
public class Triangle{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    ArrayList<Integer> array = new ArrayList<>();
		// 整数の入力
		int number = sc.nextInt();
		for(int i = 0; i < number; i++){
      array.add(sc.nextInt());
    }

    Collections.sort(array);
    int total = 0;
    for(int i = 0; i < array.size()-2; i++){

        for(int j = 1+i; j < array.size()-1; j++){

            for(int k = 1+j; k < array.size(); k++){
              if(array.get(i)+array.get(j) <= array.get(k))
                break;
              total++;
            }

        }

    }

    System.out.println(total);
	}
}

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

#include<bits/stdc++.h>
    using namespace std;
    int main() {
        int N;cin>>N;
        int ans;ans=0;
        vector<int> L;
        for(int i=0;i<N;i++){
            cin>>L[i];
        }
        sort(L.begin(),L.end())
        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[k]<(L[i]+L[j])){
                        ans=ans+1;
                    }
                    else{
                        break;
                    }
                }
            }
        }
        cout<<ans;
        return 0;
    
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: expected ';' before 'for'
   10 |         sort(L.begin(),L.end())
      |                                ^
      |                                ;
   11 |         for(int i=0;i<N-2;i++){
      |         ~~~                     
a.cc:11:21: error: 'i' was not declared in this scope
   11 |         for(int i=0;i<N-2;i++){
      |                     ^
Language: C++

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

using ll = long long;
const ll MOD = 998244353;
const ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    rep(i, N - 2) {
        for (int j = i + 1; j < N - 1; j++) {
            auto it = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            ans += max(0, it - 1 - j);
            //cout << i << " " << j << " " << it << " " << ans << endl;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'max(int, long int)'
   21 |             ans += max(0, it - 1 - j);
      |                    ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:21:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   21 |             ans += max(0, it - 1 - j);
      |                    ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:21:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |             ans += max(0, it - 1 - j);
      |                    ~~~^~~~~~~~~~~~~~~
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <cstdlib>

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pi;

const ll MOD = 1e9+7;

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
/*
long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}*/

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< ll, ll > prime_factor(ll n) {//素因数分解
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

ll calcNumOfCombination(ll n, ll r){
    ll num = 1;
    for(ll i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

int bubblesort(vector<int> array,int size){//バブルソート　転倒数
    int kaisu = 0;
    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size; j++){
            if(array[i] > array[j]){
                int number = array[i];
                array[i] = array[j];
                array[j] = number;
                kaisu++;
            }
        }
    }
    return kaisu;
}

ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = (sum * i)%MOD;
    }
    return sum;
}

int main() {
    int N;
    cin >> N;
    int L[N];
    for(int i=0;i<N;i++){
        cin >> L[i];
    }
    sort(L,L+N);
    set<string> st;
    int result = 0;.
    for(int i=0;i<N-2;i++){
        bool flag = true;
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]+L[j]>L[k]){
                    //string str = to_string(L[i])+to_string(L[j])+to_string(L[k]);
                    //st.insert(str);
                    result++;

                }else{
                    break;
                }

            }


        }

    }

    cout << result << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:113:20: error: expected primary-expression before '.' token
  113 |     int result = 0;.
      |                    ^
a.cc:114:5: error: expected unqualified-id before 'for'
  114 |     for(int i=0;i<N-2;i++){
      |     ^~~
a.cc:114:17: error: 'i' was not declared in this scope
  114 |     for(int i=0;i<N-2;i++){
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
#include<bits/stdc++.h>
    using namespace std;
    int main() {
        int N;cin>>N;
        int ans;ans=0;
        vector<int> L(N);
        for(int i=0;i<N;i++){
            cin>>L[i];
        }
        sort(L.begin(),L.end())
        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[k]<(L[i]+L[j])){
                        ans=ans+1;
                    }
                    else{
                        break;
                    }
                }
            }
        }
        cout<<ans;
        return 0;
    }
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    6 |     int main() {
      |             ^~
a.cc:6:13: note: remove parentheses to default-initialize a variable
    6 |     int main() {
      |             ^~
      |             --
a.cc:6:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:6:16: error: a function-definition is not allowed here before '{' token
    6 |     int main() {
      |                ^
Language: C++





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


int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int n;
  scanf("%d", &n);
  int l[2000];
  rep(i, n) {
    scanf("%d", &l[i]);
  }

  int ans = 0;
  rep(i, n) {
    for (int j = i+1; j < n; 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]) {
          ans++;
        }
      }
    }
  }
  printf("%d\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin.tie(0); ios::sync_with_stdio(false);
      |   ^~~
a.cc:9:15: error: 'ios' has not been declared
    9 |   cin.tie(0); ios::sync_with_stdio(false);
      |               ^~~
a.cc:12:3: error: 'scanf' was not declared in this scope
   12 |   scanf("%d", &n);
      |   ^~~~~
a.cc:5:23: error: 'll' was not declared in this scope; did you mean 'l'?
    5 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                       ^~
a.cc:14:3: note: in expansion of macro 'rep'
   14 |   rep(i, n) {
      |   ^~~
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   rep(i, n) {
      |       ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                ^
a.cc:5:23: error: 'll' was not declared in this scope; did you mean 'l'?
    5 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                       ^~
a.cc:19:3: note: in expansion of macro 'rep'
   19 |   rep(i, n) {
      |   ^~~
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   rep(i, n) {
      |       ^
a.cc:5:32: note: in definition of macro 'rep'
    5 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                ^
a.cc:30:3: error: 'printf' was not declared in this scope
   30 |   printf("%d\n", ans);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 |
Language: C++


using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int n;
  scanf("%d", &n);
  int l[2000];
  rep(i, n) {
    scanf("%d", &l[i]);
  }

  int ans = 0;
  rep(i, n) {
    for (int j = i+1; j < n; 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]) {
          ans++;
        }
      }
    }
  }
  printf("%d\n", ans);
}


Compiler output:
a.cc:4:13: error: 'pair' does not name a type
    4 | using pii = pair<int, int>;
      |             ^~~~
a.cc:5:12: error: 'vector' does not name a type
    5 | using vi = vector<int>;
      |            ^~~~~~
a.cc:6:12: error: 'vector' does not name a type
    6 | using vl = vector<ll>;
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin.tie(0); ios::sync_with_stdio(false);
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:13:15: error: 'ios' has not been declared
   13 |   cin.tie(0); ios::sync_with_stdio(false);
      |               ^~~
a.cc:16:3: error: 'scanf' was not declared in this scope
   16 |   scanf("%d", &n);
      |   ^~~~~
a.cc:34:3: error: 'printf' was not declared in this scope
   34 |   printf("%d\n", ans);
      |   ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 |
Language: C++

N = int(input())
L = [int(i) for i in input().split()]

import bisect
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        idx = bisect.bisect_left(L, L[i]+L[j])
        ans += (idx-(j+1))

print(ans)
          

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    vector<int> L(n);
    REP(i, n) cin >> L[i];
    // int n = 2000;
    // vector<int> L(n);
    // random_device rnd;
    // REP(i,n)L[i] = rnd() % 100;


    sort(L.begin(),L.end(),greater<int>);
    int ans = 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]))
                    ans++;
            }
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:40: error: expected primary-expression before ')' token
   17 |     sort(L.begin(),L.end(),greater<int>);
      |                                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N,ans;
int l[2000];

signed main(){
  cin>>N;
  for(int i=0;i<N;i++)cin>>l[i];
  sort(l.begin(),l.end());
  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++;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: request for member 'begin' in 'l', which is of non-class type 'int [2000]'
    9 |   sort(l.begin(),l.end());
      |          ^~~~~
a.cc:9:20: error: request for member 'end' in 'l', which is of non-class type 'int [2000]'
    9 |   sort(l.begin(),l.end());
      |                    ^~~