Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)
	points := make([]int, 6)
	for i := 0; i < 6; i++ {
		points[i] = nextInt()
	}
	// fmt.Println(points)
	sort.Slice(points[:4], func(i, j int) bool { return points[i] > points[j] })
	// fmt.Println(points)
	points2 := points[4:]
	sort.Slice(points2, func(i, j int) bool { return points2[i] > points2[j] })
	// fmt.Println(points)

	fmt.Println(points[0] + points[1] + points[2] + points2[0])
}

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

int main(void){
    int n,q;
    long long t;
    cin>>n>>t>>q;
    vector<pair<int,int> >c(n);
    vector<int> ans;
    for (int i = 0; i < n; ++i) {
        cin>>c[i].first>>c[i].second;
        if(c[i].second==2)c[i].second=-1;
    }
    for (int i = 0; i < n; ++i) {
        if(c[i].second!=c[i+1].second)ans.push_back((c[i].first+c[i+1].first)/2);
    }
    for (int i = 0; i < q; ++i) {
        int a;
        cin>>a;a=a-1;
        for (int j = 0; j < ans.size(); ++j) {
            if(c[a].second==1){
                if(c[a].first<ans[j]){
                    if(abs(ans[j]-c[a].first)<t){cout<<ans[j]<<endl;break;}
                    else {cout<<t*c[a].second+c[a].first<<endl;break;}
                }
            }
            else {
                if(c[a].first>ans[j]){
                    if(abs(ans[j]-c[a].first)<t){cout<<ans[j]<<endl;break;}
                    else {cout<<t*c[a].second+c[a].first<<endl;break;}
                }
            }
        }
    }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,n;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	scanf("%d",&f);
	if(a<b && a<c && a<d && e<=f){
		n=b+c+d+f;
		printf("%d\n",n);
	}
	else if(a<b && a<c && a<d && f<e){
		n=b+c+d+e;
		printf("%d\n",n);
	}
	else if(b<a && b<c && b<d && e<=f){
		n=a+c+d+f;
		printf("%d\n",n);
	}
	else if(b<a && b<c && b<d && f<e){
		n=a+c+d+e;
		printf("%d\n",n);
	}
	else if(c<a && c<b && c<d && e<=f){
		n=a+b+d+f;
		printf("%d\n",n);
	}
	else if(c<a && c<b && c<d && f<e){
		n=a+b+d+e;
		printf("%d\n",n);
	}
	else if(d<a && d<b && d<c && e<=f){
		n=a+b+d+f;
		printf("%d\n",n);
	}
	else if(d<a && d<b && d<c && f<e){
		n=a+b+d+e;
		printf("%d\n",n);
	}
	else if(a=b=c=d && e<=f){
		n=a+b+c+f;
		printf("%d\n",n);
	}
	else if(a=b=c=d && f<e){
		n=a+b+c+e;
		printf("%d\n",n);
	}
		return 0;
}

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

int main(){
    int a,b,c,d,e,f;
    cin >>a>>b>>c>>d>>e>>f;
    score[]={a,b,c,d};
    sort(score,score+4);
    score2[]={e,f};
    sort(score2,score2+2);
    cout <<score[1]+score[2]+score[3]+score2[1]<<endl;
    
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;
	cout << a+b+c+d-min({a,b,c,d})+max(e,f) << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g,h,i,j,x;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&e,&f);
	if(a>b){
		a=g;
	}
	else if(a<b){
		b=g;
	}
	if(b>c){
		b=h;
	}
	else if(b<c){
		c=h;
	}
	if(c>d){
		c=i;
	}
	else if(c<d){
		d=i;
	}
	if(e>f){
		e=j;
	}
	else if(e<f){
		f=j;
	}
	x=g+h+i+j;
	printf("%d\n",x);
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
	int a,b,c[100]={0},d,e=0,f=0,g,h,i;
	for (a=0;a<4;a++)
	{
		cin>>b;
		c[b]=1;
	}
	for (a=99;a>0;a--)
	{
		if (c[a]==1&&e!=3)
		{
			f=f+a;
			e++;
		}
	}
	cin>>d>>e;
	if (d>=e)
	{
		g=d+f;
	}
	else if (d<=e)
	{
		g=e+f;
	}
	cout<<g<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std ;
int main()
{
    int score1[4] = {0} ;
    int score2[2] = {0} ;

    for ( int i = 0 ; i < 4 ; i++ )
    {
        cin >> score1[i] ;
    }
    for ( int i = 0 ; i < 2 ; i++ )
    {
        cin >> score2[i] ;
    }

    sort( score1 , score1+4 ) ;
    reverse( score1 , score1+4 ) ;
    cout << score1[0] + score1[1] + score1[2] + max( score2[0],score2[1] ) << endl ;

    return 0 ;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
    int a[4],e,f,i,i2,tmp;
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>e>>f;
    for(i=0;i<4;i++){
        for(i2=i;i2<4;i2++){
            if(a[i]<a[i2]){
                tmp=a[i];
                a[i]=a[i2];
                a[i2]=tmp;
            }
        }
    }
    if(e<f)cout<<a[0]+a[1]+a[2]+f<<endl;
    else cout<<a[0]+a[1]+a[2]+e<<endl;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
	int sum = 0;
	int a[4], b[2];

	for (int i = 0; i < 4; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < 2; i++)
	{
		scanf("%d", &b[i]);
	}
	sort(rbegin(a), rend(a));
	sum = max(b[0], b[1]);
	for (int i = 0; i < 3; i++)
	{
		sum += a[i];
	}

	printf("%d\n", sum);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    vector<int> v1(4), v2(2);
    for (int i = 0; i < 4; ++i) {
        cin >> v1[i];
    }
    for (int i = 0; i < 2; ++i) {
        cin >> v2[i];
    }
    sort(v1.begin(), v1.end(), greater<int>());
    sort(v2.begin(), v2.end(), greater<int>());
    cout<<v1[0] + v1[1] + v1[2] + v2[0]<<endl;
    return 0;
}

C++: #include "iostream"
#include "algorithm"
#include "string"
using namespace std;

int main() {
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int x = a + b + c + d;
	cout << x - min(min(a, b), min(c, d)) + max(e, f) << endl;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int A,B,C,D,E,F;
  int temp=0,temp_max=0;
  
  cin>>A>>B>>C>>D>>E>>F;

  temp=(A+B+C+D)-min({A,B,C,D})+max({E,F});

  cout<<temp<<endl;

  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
	int a[4];
	int b[2];
	int res = 0;
	REP(i, 4){
		cin >> a[i];
	}
	cin >> b[0] >> b[1];

	sort(a, a+4);
	sort(b, b+2);
	cout << a[2] + a[3] + b[1] << endl;
	return 0;
}