Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#define ll __int32

vector< ll > a;

main(){
	ll n,t,i,sum=0,f=0;
	cin>>n;
	while(n--){
		cin >> t;
		a.push_back(t);
	}
	sort(a.begin(), a.end(), greater<ll>());
	for(i=0;i<a.size()-2;i++){
		if(a[i] < a[i+1]+a[i+2]){
			sum += a[i]+a[i+1]+a[i+2];
			f++;i+=2;
		}
		if(f==2) break;
	}
	if(!f)sum=0;
	for(i=0;i<a.size()-5;i++){
		if((a[i] < a[i+1]+a[i+4] && a[i+2] < a[i+3]+a[i+5]) ||
		   (a[i] < a[i+3]+a[i+4] && a[i+1] < a[i+2]+a[i+5]) ||
		   (a[i] < a[i+1]+a[i+5] && a[i+2] < a[i+3]+a[i+4])
		   ){
			sum = max(sum, a[i]+a[i+1]+a[i+2]+a[i+3]+a[i+4]+a[i+5]);
			break;
		}
	}
	
	if(sum) cout << sum << endl;
	else cout << -1 << endl;
	return 0;
}

Compiler output:
a.cc:6:12: error: '__int32' was not declared in this scope; did you mean '__int32_t'?
    6 | #define ll __int32
      |            ^~~~~~~
a.cc:8:9: note: in expansion of macro 'll'
    8 | vector< ll > a;
      |         ^~
a.cc:8:12: error: template argument 1 is invalid
    8 | vector< ll > a;
      |            ^
a.cc:8:12: error: template argument 2 is invalid
a.cc:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:12: error: '__int32' was not declared in this scope; did you mean '__int32_t'?
    6 | #define ll __int32
      |            ^~~~~~~
a.cc:11:9: note: in expansion of macro 'll'
   11 |         ll n,t,i,sum=0,f=0;
      |         ^~
a.cc:12:14: error: 'n' was not declared in this scope
   12 |         cin>>n;
      |              ^
a.cc:14:24: error: 't' was not declared in this scope; did you mean 'tm'?
   14 |                 cin >> t;
      |                        ^
      |                        tm
a.cc:15:19: error: request for member 'push_back' in 'a', which is of non-class type 'int'
   15 |                 a.push_back(t);
      |                   ^~~~~~~~~
a.cc:17:16: error: request for member 'begin' in 'a', which is of non-class type 'int'
   17 |         sort(a.begin(), a.end(), greater<ll>());
      |                ^~~~~
a.cc:17:27: error: request for member 'end' in 'a', which is of non-class type 'int'
   17 |         sort(a.begin(), a.end(), greater<ll>());
      |                           ^~~
a.cc:18:13: error: 'i' was not declared in this scope
   18 |         for(i=0;i<a.size()-2;i++){
      |             ^
a.cc:18:21: error: request for member 'size' in 'a', which is of non-class type 'int'
   18 |         for(i=0;i<a.size()-2;i++){
      |                     ^~~~
a.cc:20:25: error: 'sum' was not declared in this scope
   20 |                         sum += a[i]+a[i+1]+a[i+2];
      |                         ^~~
a.cc:21:25: error: 'f' was not declared in this scope
   21 |                         f++;i+=2;
      |                         ^
a.cc:23:20: error: 'f' was not declared in this scope
   23 |                 if(f==2) break;
      |                    ^
a.cc:25:13: error: 'f' was not declared in this scope
   25 |         if(!f)sum=0;
      |             ^
a.cc:25:15: error: 'sum' was not declared in this scope
   25 |         if(!f)sum=0;
      |               ^~~
a.cc:26:13: error: 'i' was not declared in this scope
   26 |         for(i=0;i<a.size()-5;i++){
      |             ^
a.cc:26:21: error: request for member 'size' in 'a', which is of non-class type 'int'
   26 |         for(i=0;i<a.size()-5;i++){
      |                     ^~~~
a.cc:31:25: error: 'sum' was not declared in this scope
   31 |                         sum = max(sum, a[i]+a[i+1]+a[i+2]+a[i+3]+a[i+4]+a[i+5]);
      |                         ^~~
a.cc:36:12: error: 'sum' was not declared in this scope
   36 |         if(sum) cout << sum << endl;
      |            ^~~