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

#include <bits/stdc++.h>

using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  int S = 0;
  for(int i=0;i<N;++i){
    cin >> L.at(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(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
        ++S
       }
      }
    }
  }
   cout<<S<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |           ~^~~
a.cc:15:17: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                ~^~~
a.cc:15:22: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                     ~^~~
a.cc:15:30: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                             ~^~~
a.cc:15:35: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                                  ~^~~
a.cc:15:40: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                                       ~^~~
a.cc:15:48: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                                               ~^~~
a.cc:15:53: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                                                    ~^~~
a.cc:15:58: error: no match for call to '(std::vector<int>) (int&)'
   15 |       if((L(k)<L(i)+L(j))&&(L(k)>L(i)-L(j))&&(L(k)>L(j)-L(i))){
      |                                                         ~^~~
a.cc:16:12: error: expected ';' before '}' token
   16 |         ++S
      |            ^
      |            ;
   17 |        }
      |        ~
Language: C++

std::vector<int> len;

int main()
{
	long int N;
	std::string S;
	cin >> N;

	std::vector< std::vector<int> > tmp;


	len.resize(N);
	for (int i = 0; i < N; ++i) {
		cin >> len[i];
	}

	tmp.resize(N);
	for (int i = 0; i < N; ++i) {
		const int &ii = len[i];
		tmp[i].resize(N);

		for (int j = i + 1; j < N; ++j) {
			const int &jj = len[j];
			tmp[i][j] = ii + jj;
		}
	}

	int c = 0;
	for (int i = 0; i < N; ++i) {
		const int &ii = len[i];
		for (int j = i + 1; j < N; ++j) {
			const int &jj = len[j];
			//int s = ii + jj;
			for (int k = j + 1; k < N; ++k) {
				const int &kk = len[k];

				if (tmp[i][j] <= kk) {
					continue;
				}
				if (tmp[i][k] <= jj) {
					continue;
				}
				if (tmp[j][k] <= ii) {
					continue;
				}
				/*
				if (s <= kk) {
					continue;
				}
				if (jj + kk <= ii) {
					continue;
				}
				if (ii + kk <= jj) {
					continue;
				}
				*/

				++c;
			}
		}
	}



	printf("%d", c);
	printf("\n");

	return 0;
}




Compiler output:
a.cc:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> len;
      |      ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | std::vector<int> len;
a.cc: In function 'int main()':
a.cc:6:14: error: 'string' is not a member of 'std'
    6 |         std::string S;
      |              ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | std::vector<int> len;
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> N;
      |         ^~~
a.cc:9:14: error: 'vector' is not a member of 'std'
    9 |         std::vector< std::vector<int> > tmp;
      |              ^~~~~~
a.cc:9:14: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:9:27: error: 'vector' is not a member of 'std'
    9 |         std::vector< std::vector<int> > tmp;
      |                           ^~~~~~
a.cc:9:27: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:9:34: error: expected primary-expression before 'int'
    9 |         std::vector< std::vector<int> > tmp;
      |                                  ^~~
a.cc:12:9: error: 'len' was not declared in this scope
   12 |         len.resize(N);
      |         ^~~
a.cc:17:9: error: 'tmp' was not declared in this scope
   17 |         tmp.resize(N);
      |         ^~~
a.cc:65:9: error: 'printf' was not declared in this scope
   65 |         printf("%d", c);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | std::vector<int> len;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
        {
            int l = upper_bound(a.begin(), a.end(), a[j] - a[i]) - a.begin();
            int r = lower_bound(a.begin(), a.end(), a[j] + a[i]) - a.begin() - 1;
            ans += max(0, r - l + 1 - (l <= i && i <= r) - (l <= j && j <= r));
        }
    cout << ans / 3;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll ans = 0;
      |     ^~
a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |             ans += max(0, r - l + 1 - (l <= i && i <= r) - (l <= j && j <= r));
      |             ^~~
      |             abs
a.cc:19:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     cout << ans / 3;
      |             ^~~
      |             abs
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 = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      for (int k = j; k < N; k++) {
        if (L.at(L.at(i) + L.at(j) > L.at(k)) {
          ans++;
        }
        else {
          break;
        }
      }
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:46: error: expected ')' before '{' token
   16 |         if (L.at(L.at(i) + L.at(j) > L.at(k)) {
      |            ~                                 ^~
      |                                              )
a.cc:22:7: error: expected primary-expression before '}' token
   22 |       }
      |       ^
Language: C++

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

inline bool suffice(int a, int b, int c)
{
  return
    a < b + c &&
    b < c + a &&
    c < a + b;
}

int main()
{
  int n;
  cin >> n;
  vector<int> list(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> list[i];
  }
  
  sort(list.begin(), list.end());
  auto ite = unique(list.begin(), list.end());
  if(ite != list.end()) { list.erase(ite, list.end()); }
  n = list.size();
  
  long long result = 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(suffice(list[i], list[j], list[k])) { ++result; }
  }
  cout << result << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |   sort(list.begin(), list.end());
      |   ^~~~
      |   short
a.cc:24:14: error: 'unique' was not declared in this scope
   24 |   auto ite = unique(list.begin(), list.end());
      |              ^~~~~~
Language: C++

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

int main(void){
	int n;
	cin >> n;
	vector<int> l(n);
	for(int i = 0; i < n; ++i){
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	long long ans = 0;
	for(int i = 0; i < n; ++i){
		for(int j = i+1; j < n; ++j){
			int left = -1;
			int right = n;
			int key1 = max(l[i]-l[j], l[j]-l[i]);
			int key2 = l[i]+l[j];
			while (right - left > 1) {
        		int mid = left + (right - left) / 2;

        		if (l[mid] > key1) right = mid;
        		else left = mid;
    		}
    		int ll = right;
    		left = -1;
			right = n;
    		while (right - left > 1) {
        		int mid = left + (right - left) / 2;

        		if (l[mid] >= key2) right = mid;
        		else left = mid;
    		}
    		int rr = left;
    		ll = max(ll, j);
    		ans += max(rr-ll, 0);
    		// cout << i << " " << j << " ";
    		// cout << l[ll] << " " << l[rr] << endl;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#include<bits/stdc++.h> 
using namespace std; 
  
void ct(vector <long long int> v){  
  
    long long int n=v.size(); 
  
    sort(v.begin(), v.end());  
  
    long long int count = 0; 
      
    for( long long int i = n-1; i >= 1; i--){ 
        long long int l = 0, r = i-1; 
        while( l < r){ 
            if( v[l] + v[r] > v[i]){
                count += r - l ;  
                r--;   
            } 
            else {
                l++;}   
        } 
    } 
    cout<<count<<endl; 
} 
int main(){ 
  
  	long long int n,a,i;
  cin>>n;
    vector<int> v;  
   for(i=0;i<n;i++)
   {
     cin>>a;
     v.push_back(a);
   }
    ct(v); 
    return 0;
}     

Compiler output:
a.cc: In function 'int main()':
a.cc:35:8: error: could not convert 'v' from 'vector<int>' to 'vector<long long int>'
   35 |     ct(v);
      |        ^
      |        |
      |        vector<int>
Language: C++

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

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

int main(int argc, char const *argv[]) {
  int n;
  int i,j,k;
  int *lens;
  int sum;
  int a,b,c;

  scanf("%d\n", &n);
  lens = malloc(sizeof(int) * n);
  for(i = 0; i < n; i++){
    scanf("%d", &lens[i]);
  }
  qsort(lens, n, sizeof(int), compare_int);
  sum = 0;
  i = 0;
  while(i <= n - 2){
    a = lens[i];
    for(j = i+1; j < n-1; j++){
      b = lens[i];
      for(k = j+1; k < n; k++){
        c = lens[j];
        if(c < a + b){
          if(b < c + a){
            if(a < b + c){
              sum++;
            }
          }
        }
      }
    }
    i++;
  }
  printf("%d\n", sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:17:16: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   17 |   lens = malloc(sizeof(int) * n);
      |          ~~~~~~^~~~~~~~~~~~~~~~~
      |                |
      |                void*
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,n,d=0;
  cin >> n;
  int l[n];
  for(i=0;i<n;i++){
    cin >> l[i];
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
        if(abs((l[i]*l[i]+l[j]*l[j]-l[k]*l[k])/(2*l[i]*l[j])<1){
          d++;
        }
      }
    }
  }
  cout << d << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:64: error: expected ')' before '{' token
   13 |         if(abs((l[i]*l[i]+l[j]*l[j]-l[k]*l[k])/(2*l[i]*l[j])<1){
      |           ~                                                    ^
      |                                                                )
a.cc:16:7: error: expected primary-expression before '}' token
   16 |       }
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 vector<int>vec;
 int x;
 for(int i=0;i<n;i++)
 {
   cin>>x;
   vec.push_back(x);
 }

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

 int cnt=0,flag;

 for(int i=0;i<n;i++)
 {
     flag=0;
     for(int j=i+1;j<n;j++)
     {
         for(int k=j+1;k<n;k++)
         {
             if(vec[k]<vec[i]+vec[j])cnt++;
             else {flag=1;break;}
         }
     }
 }

 cout<<cnt;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 vector<int>vec;
 int x;
 for(int i=0;i<n;i++)
 {
   cin>>x;
   vec.push_back(x);
 }

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

 int cnt=0,flag;

 for(int i=0;i<n;i++)
 {
     flag=0;
     for(int j=i+1;j<n;j++)
     {
         for(int k=j+1;k<n;k++)
         {
             if(vec[k]<vec[i]+vec[j])cnt++;
             else {flag=1;break;}
         }
     }
 }

 cout<<cnt;
}


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

#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<cstdlib>

using namespace std;

int mymax(int a, int b, int c){
    if(a > b && a > c) return a;
    else if(b > c) return b;
    else return c;
}

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 i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            int sum = L[i] + L[j];
            ans += (int) (lower_bound(L.begin(), L.end(), sum) - L.begin()) - j -1;
        }
    }

    cout << ans << endl;

    return 0;
}

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

n = int(input())
l = list(map(int,input().split()))
nl = sorted(l,reverse=True)
c = 0
for i in range(n-2):
    a = nl[i]
    for j in range(n-1,i,-1):
        for k in range(i+1,j):
            if a<(nl[j]+nl[k]):
                c+=1
            else:
				break
print(c)

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


#include<iostream>
#include<algorithm>
#include<utility>
#include<map>
#include<vector>
#include<string>
using namespace std;


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


Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: no matching function for call to 'max(__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type, int)'
   24 |                 ans += max(itr - l.begin() - j - 1, 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/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:24:27: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   24 |                 ans += max(itr - l.begin() - j - 1, 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,
                 from a.cc:3:
/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:24:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   24 |                 ans += max(itr - l.begin() - j - 1, 0);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

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 count = 0;
  for (int a = 0; a < n - 2; a++) {
    int c = a + 2;
    for (int b = a + 1; b < n - 1; b++) {
      while (c < n && l[a] + l[b] > l[c]) {
        c++;
      }
      count += c - b - 1;
    }
  }

  cout << count << "\n";
  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(l.begin(), l.end());
      |   ^~~~
      |   short
Language: C++

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

const int N = 2200;
int n, ans = 0;
int d[N];

inline int read() {
	int s = 0, f = 1;
	char ch;
	for(; ch < '0' || ch > '9'; ch = getchar())	if(ch == '-')	f = -1;
	for(; ch >= '0' && ch <= '9'; ch = getchar())	s = (s << 1) + (s << 3) + ch - '0';
	return s * f;
}

int main() {
	n = read();
	for(int i = 1; i <= n; ++i)	d[i] = read();
	sort(d + 1, d + n + 1);
	for(int i = 1; i <= n; ++i)
		for(int j = i + 1; j <= n; ++j)
			for(int k = j + 1; k <= n; ++k) {
				if(a[j] + a[k] > a[i] && a[i] + a[j] > a[k])	ans++;
				if(a[i] + a[j] <= a[k])	break;
			}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:36: error: 'a' was not declared in this scope
   23 |                                 if(a[j] + a[k] > a[i] && a[i] + a[j] > a[k])    ans++;
      |                                    ^
a.cc:24:36: error: 'a' was not declared in this scope
   24 |                                 if(a[i] + a[j] <= a[k]) break;
      |                                    ^
Language: C

#include <stdio.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 ) , l[n+1] = 1<<30;
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
        {
            int L = 1 , R = n+1;
            while ( L < R )
            {
                int mid = L + R >> 1;
                if ( l[mid] < l[i]+l[j] ) L = mid + 1;
                else R = mid;
            }
            ans += max( L - j - 1 , 0 );
        }
    printf("%d\n",ans);
}


Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c:4:7: error: variably modified 'l' at file scope
    4 | int n,l[N],ans;
      |       ^
main.c: In function 'main':
main.c:10:5: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   10 |     sort( l+1 , l+n+1 ) , l[n+1] = 1<<30;
      |     ^~~~
main.c:21:20: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   21 |             ans += max( L - j - 1 , 0 );
      |                    ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100000
#define L 1001
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
int length[L];
int s[L][L];
int A(int m,int n)
{
    int x=1,i;
    for(i=m; i>=m-n+1; i--) x*=i;
    for(i=2; i<=n; i++) x/=i;
    return x;
}
int main()
{
    int n,i,j,kt,l,head,tail;
    __int64 ans=0;
    while(scanf("%d",&n)!=EOF)
    {
        memset(length,0,sizeof(length));
        memset(s,0,sizeof(s));
        for(i=0; i<n; i++)
        {
            scanf("%d",&l);
            length[l]++;
        }
        head=0;
        while(length[head]==0) head++;
        tail=L-1;
        while(length[tail]==0) tail--;
        for(i=head; i<=tail; i++) s[i][i]=length[i];
        for(i=head; i<tail; i++)
            for(j=i+1; j<=tail; j++)
                s[i][j]=s[i][j-1]+length[j];
        ans=0;
        for(i=head; i<=tail; i++)
            for(j=i; j<=tail; j++)
            {
                kt=MIN(tail,i+j-1);
                if(i==j)
                {
                    if(length[j]>2)
                    {
                        ans+=A(length[j],3);
                        ans+=(A(length[j],2)*s[j+1][kt]);
                    }
                    else if(length[i]>1) ans+=s[j+1][kt];
                }
                else
                {
                    if(length[j]>1)
                    {
                        ans+=(length[i]*A(length[j],2));
                        ans+=(length[i]*length[j]*s[j+1][kt]);
                    }
                    else if(length[j]>0)
                    {
                        ans+=(length[i]*s[j+1][kt]);
                    }
                }
            }
        printf("%I64d\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   20 |     __int64 ans=0;
      |     ^~~~~~~
      |     __int64_t
a.cc:38:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |         ans=0;
      |         ^~~
      |         abs
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N;
  int L[3000];
  int total =0;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int a = 0; a <= N; ++a) {
    for (int b = a + 1; b <= N; ++b) {
      for (int c = b + 1; c <= N; ++c) {
        
        if (L[a] + L[b]>L[c]&&L[a] + L[c] > L[b]&&L[b] + L[c] > L[a]){
          total += 1;
          
        }
      }
    }
  }
  cout << total << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:38: error: 'A' was not declared in this scope
    9 |   for (int i = 0; i < N; ++i) cin >> A[i];
      |                                      ^
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;

void Main()
{
    int N;
    cin >> N;
    vector<int> L(N, 0);
    for (int i = 0; i < N; i++) {
        int Li;
        cin >> Li;
        L[i] = Li;
    }

    int result = 0;

    sort(L.begin(), L.end(), greater<int>());

    for (int i = 0; i < N - 2; i++) {
        for (int k = i + 1; k < N - 1; k++) {
            for (int l = k + 1; l < N; l++) {
                if (
                        (L[i] < L[k] + L[l]) &&
                        (L[k] < L[l] + L[i]) &&
                        (L[l] < L[i] + L[k])
                   ) {
                    result++;
                } else {
                    break;
                }
            }
        }
    }

    cout << result;

}

int main()
{
    Main();
    return 0;
}


/*
	std::sort(data.begin(),data.end(),std::greater<int>());//降順ソート

 */


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

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

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		final int N = sc.nextInt();
    		int [] L = new int[N];
    		for (int i=0; i<N; i++) {
    			L[i] = sc.nextInt();
    		}

    		Arrays.parallelSort(L, Comparator.reverseOrder());

    		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[j] < L[k] + L[i] &&
    						L[k] < L[i] + L[j]) {
    						count++;
    					}
    				}
    			}
    		}

    		System.out.println(count);

    	} finally {
    		sc.close();
    	}
    }
}



Compiler output:
Main.java:15: error: no suitable method found for parallelSort(int[],Comparator<T#1>)
    		Arrays.parallelSort(L, Comparator.reverseOrder());
    		      ^
    method Arrays.<T#2>parallelSort(T#2[]) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
    method Arrays.<T#3>parallelSort(T#3[],int,int) is not applicable
      (cannot infer type-variable(s) T#3
        (actual and formal argument lists differ in length))
    method Arrays.<T#4>parallelSort(T#4[],Comparator<? super T#4>) is not applicable
      (inference variable T#4 has incompatible bounds
        equality constraints: int
        upper bounds: Object)
    method Arrays.<T#5>parallelSort(T#5[],int,int,Comparator<? super T#5>) is not applicable
      (cannot infer type-variable(s) T#5
        (actual and formal argument lists differ in length))
  where T#1,T#2,T#3,T#4,T#5 are type-variables:
    T#1 extends Comparable<? super T#1>
    T#2 extends Comparable<? super T#2> declared in method <T#2>parallelSort(T#2[])
    T#3 extends Comparable<? super T#3> declared in method <T#3>parallelSort(T#3[],int,int)
    T#4 extends Object declared in method <T#4>parallelSort(T#4[],Comparator<? super T#4>)
    T#5 extends Object declared in method <T#5>parallelSort(T#5[],int,int,Comparator<? super T#5>)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int N = 2e3 + 10;
int n, ans, arr[N];
int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i);
	sort(arr, arr + n);
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			ans += max(0, upper_bound(arr, arr + n, arr[i] + arr[j] - 1) - 1 - arr - j);
	printf("%d", ans);	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:35: error: no matching function for call to 'max(int, long int)'
   16 |                         ans += max(0, upper_bound(arr, arr + n, arr[i] + arr[j] - 1) - 1 - arr - j);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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:16:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   16 |                         ans += max(0, upper_bound(arr, arr + n, arr[i] + arr[j] - 1) - 1 - arr - 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:16:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |                         ans += max(0, upper_bound(arr, arr + n, arr[i] + arr[j] - 1) - 1 - arr - j);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[100001];
signed main()
{
    
	int n;
	long long ans=0;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:36: error: no matching function for call to 'max(int, long long int)'
   16 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:16:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   16 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:16:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
      |                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100001];
signed main()
{
    
	int n;
	long long ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: no matching function for call to 'max(int, long int)'
   15 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:15:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   15 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:15:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                         ans=ans+max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
      |                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1100000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)};
const int max_n = 1 << 20;

signed main() {
	int n;cin>>n;int l[2100];rep(i,n)cin>>l[i];
  sort(l,l+n);int ans = 0;
  rep(a,n){
    repd(b,a+1,n){
      int mm = abs(l[a]-l[b]), mx = l[a]+l[b];
      auto itr = upper_bound(l+b+1,l+n, mm),
          itrr = lower_bound(l+b+1,l+n, mx);
      ans += max((ll)0, distance(l,itrr)-distance(l,itr));
    }
  }
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: no matching function for call to 'max(ll, std::iterator_traits<long long int*>::difference_type)'
   21 |       ans += max((ll)0, distance(l,itrr)-distance(l,itr));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::iterator_traits<long long int*>::difference_type' {aka 'long int'})
   21 |       ans += max((ll)0, distance(l,itrr)-distance(l,itr));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |       ans += max((ll)0, distance(l,itrr)-distance(l,itr));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <algorithm>
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 , 0 );
    printf("%d\n",ans);
}


Compiler output:
main.c:2:10: fatal error: algorithm: No such file or directory
    2 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100001];
signed main()
{
    
	int n;
	long long ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans+=max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: no matching function for call to 'max(int, long int)'
   15 |                         ans+=max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:15:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   15 |                         ans+=max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-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:15:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                         ans+=max(0,lower_bound(a+1,a+n+1,a[i]+a[j])-a-1-j);
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 , 0 );
    printf("%d\n",ans);
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,n,d=0;
  cin >> n;
  int l[n];
  for(i=0;i<n;i++){
    cin >> l[i];
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
        if(l[k]<l[i]+l[j]&&l[i]<l[j]+l[k]6&l[j]<l[i]+l[k]){
          d++;
        }
      }
    }
  }
  cout << d << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:42: error: expected ')' before numeric constant
   13 |         if(l[k]<l[i]+l[j]&&l[i]<l[j]+l[k]6&l[j]<l[i]+l[k]){
      |           ~                              ^
      |                                          )
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 , 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, int)'
   13 |             ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 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 'int')
   13 |             ans += max( lower_bound( l+1 , l+n+1 , l[i]+l[j] ) - l - j - 1 , 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 , 0 );
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int a[2003];
int main(){
	int n;scanf("%d",&n);	
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	LL ans = 0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0);
	printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:35: error: no matching function for call to 'max(long int, int)'
   13 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 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:35: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   13 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 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:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   13 |                         ans += max(lower_bound(a+1,a+1+n,a[i]+a[j]) - a - 1 - j , 0);
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~