Go: package main

import "fmt"

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	ans := 10000
	ans = min(ans, abs((a+b)-(c+d)))
	ans = min(ans, abs((a+c)-(b+d)))
	ans = min(ans, abs((a+d)-(b+c)))
	fmt.Println(ans)
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    vector<ll> x(4);
    REP(i, 4) cin >> x[i];
    sort(x.begin(), x.end());
    cout << abs(x[0]+x[3]-x[1]-x[2]) << endl;
    return 0;
}

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

int main() {
	int a[4];
	int sum = 0;
	for(int i = 0; i < 4; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	int ans = 1e9;
	for(int i = 0; i < 4; ++i) {
		for(int j = i + 1; j < 4; ++j) {
			ans = min(ans, abs(2 * (a[i] + a[j]) - sum));
		}
	}
	cout << ans << '\n';
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    vector<int> N(4);
    cin >> N[0] >> N[1] >> N[2] >> N[3];
    sort(N.begin(), N.end());
    int ans = abs((N[0] + N[3]) - (N[1] + N[2]));
    cout << ans << endl;
}

C++: //#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll n,ans=MOD;
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll sum=a+b+c+d;
  ans=min(ans,abs(sum-2*(a+b)));
  ans=min(ans,abs(sum-2*(a+c)));
  ans=min(ans,abs(sum-2*(a+d)));
  ans=min(ans,abs(sum-2*(b+c)));
  ans=min(ans,abs(sum-2*(b+d)));
  ans=min(ans,abs(sum-2*(c+d)));
  cout<<ans<<endl;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
using namespace std;


int main(int argc, char* argv[]){
	int a[4];
	int sum = 0;
	for (int i=0; i<4; i++){
		scanf("%d", &a[i]);
		sum+=a[i];
	}
	int min = 10000;
	for(int i=0; i<4; i++){
		for(int j=i+1; j<4; j++){
			int team1 = a[i]+a[j];
			int team2 = sum - team1;
			if(abs(team1-team2)<min){
				min = abs(team1-team2);
			}
		}
	}
	printf("%d\n", min);


	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define vi vector<int>

using ll = long long;
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
inline ll inv(ll x, ll div){return pow(x, div - 2, div);}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
 int ans = INF;
 ans = min(ans, abs((a+b)-(c+d))); 
 ans = min(ans, abs((a+c)-(b+d))); 
 ans = min(ans, abs((a+d)-(c+b))); 
 cout << ans << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;


int main() {
    vector<int> a(4);
    for (int i = 0; i < 4; i++){
        cin >> a.at(i);
    }
    sort(ALL(a));
    cout << abs(a.at(0) + a.at(3) - a.at(1) - a.at(2)) << endl;
    

}