stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long



using namespace std;



const int N = 1e5;



int readInt ()

{

    bool minus = false;

    int result = 0;

    char ch;

    ch = getchar();

    while (true)

    {

        if (ch == '-') break;

        if (ch >= '0' && ch <= '9') break;

        ch = getchar();

    }

    if (ch == '-') minus = true;

    else result = ch-'0';

    while (true)

    {

        ch = getchar();

        if (ch < '0' || ch > '9') break;

        result = result*10 + (ch - '0');

    }

    if (minus)

        return -result;

    else

        return result;

}

string s[N + 1];

main() {

    int n = readInt();

    for (int i = 1; i <= n; i++) {

        cin >> s[i];

        sort(s[i].begin(), s[i].end());

    }

    sort(s + 1, s + n + 1);

    int ans = 0, cnt = 1;

    for (int i = 2; i <= n; i++) {

        if (s[i] == s[i - 1]) {

            ++cnt;

        } else {

//            cout << s[i] << " " << cnt << " fuck \n";

            ans += cnt * (cnt - 1) / 2;

            cnt = 1;

        }

    }

    if (cnt) {

        ans += cnt * (cnt - 1) / 2;

    }

    cout << ans;

}


// Faster C++ solution for the same problem (measured speedup: 4.253454960735612x):
#include "bits/stdc++.h"

#include "sstream"

#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

const int N=1e5+1;

map<string,long long>mp;

int main() {

    quick

int n; cin>>n; string s; long long ans=0;

while(n--){

    cin>>s;

     sort(s.begin(),s.end()); mp[s]++;

}

for(auto i:mp){

    ans+=(i.second-1)*i.second/2;

}

cout<<ans;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long



using namespace std;



const int N = 1e5;



int readInt ()

{

    bool minus = false;

    int result = 0;

    char ch;

    ch = getchar();

    while (true)

    {

        if (ch == '-') break;

        if (ch >= '0' && ch <= '9') break;

        ch = getchar();

    }

    if (ch == '-') minus = true;

    else result = ch-'0';

    while (true)

    {

        ch = getchar();

        if (ch < '0' || ch > '9') break;

        result = result*10 + (ch - '0');

    }

    if (minus)

        return -result;

    else

        return result;

}

string s[N + 1];

main() {

    int n = readInt();

    for (int i = 1; i <= n; i++) {

        cin >> s[i];

        sort(s[i].begin(), s[i].end());

    }

    sort(s + 1, s + n + 1);

    int ans = 0, cnt = 1;

    for (int i = 2; i <= n; i++) {

        if (s[i] == s[i - 1]) {

            ++cnt;

        } else {

//            cout << s[i] << " " << cnt << " fuck \n";

            ans += cnt * (cnt - 1) / 2;

            cnt = 1;

        }

    }

    if (cnt) {

        ans += cnt * (cnt - 1) / 2;

    }

    cout << ans;

}


// Faster C++ solution for the same problem (measured speedup: 4.308872364867169x):
#include <iostream>

#include <vector>

#include <algorithm>

#include <map>

using namespace std;



int main()

{

    int n;

    long long ans = 0;

    string s;

    map <string,int> m;

    cin >> n;





    for(int i = 0; i < n; i++)

    {

        cin >> s;

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

        if(m.find(s) != m.end())

        {

            ans += m[s];

            m[s]++;

        }else

        {

            m.insert({s,1});

        }

    }





    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long



using namespace std;



const int N = 1e5;



int readInt ()

{

    bool minus = false;

    int result = 0;

    char ch;

    ch = getchar();

    while (true)

    {

        if (ch == '-') break;

        if (ch >= '0' && ch <= '9') break;

        ch = getchar();

    }

    if (ch == '-') minus = true;

    else result = ch-'0';

    while (true)

    {

        ch = getchar();

        if (ch < '0' || ch > '9') break;

        result = result*10 + (ch - '0');

    }

    if (minus)

        return -result;

    else

        return result;

}

string s[N + 1];

main() {

    int n = readInt();

    for (int i = 1; i <= n; i++) {

        cin >> s[i];

        sort(s[i].begin(), s[i].end());

    }

    sort(s + 1, s + n + 1);

    int ans = 0, cnt = 1;

    for (int i = 2; i <= n; i++) {

        if (s[i] == s[i - 1]) {

            ++cnt;

        } else {

//            cout << s[i] << " " << cnt << " fuck \n";

            ans += cnt * (cnt - 1) / 2;

            cnt = 1;

        }

    }

    if (cnt) {

        ans += cnt * (cnt - 1) / 2;

    }

    cout << ans;

}


// Faster C++ solution for the same problem (measured speedup: 4.311046254541741x):
#include <bits/stdc++.h>

using namespace std;



#define ll long long



int main() {

    ll n,i,count=0;

    cin>>n;

    vector<string> v1(n);

    map<string,ll> map1;

    for(i=0;i<n;i++)

    {

        cin>>v1[i];

        sort(v1[i].begin(),v1[i].end());

        map1[v1[i]]++;

    }

    for(auto x: map1)

    {

        if(x.second)

        {

            //cout<<x.second;

            count+=x.second*(x.second-1)/2;

        }

    }

    cout<<count;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long



using namespace std;



const int N = 1e5;



int readInt ()

{

    bool minus = false;

    int result = 0;

    char ch;

    ch = getchar();

    while (true)

    {

        if (ch == '-') break;

        if (ch >= '0' && ch <= '9') break;

        ch = getchar();

    }

    if (ch == '-') minus = true;

    else result = ch-'0';

    while (true)

    {

        ch = getchar();

        if (ch < '0' || ch > '9') break;

        result = result*10 + (ch - '0');

    }

    if (minus)

        return -result;

    else

        return result;

}

string s[N + 1];

main() {

    int n = readInt();

    for (int i = 1; i <= n; i++) {

        cin >> s[i];

        sort(s[i].begin(), s[i].end());

    }

    sort(s + 1, s + n + 1);

    int ans = 0, cnt = 1;

    for (int i = 2; i <= n; i++) {

        if (s[i] == s[i - 1]) {

            ++cnt;

        } else {

//            cout << s[i] << " " << cnt << " fuck \n";

            ans += cnt * (cnt - 1) / 2;

            cnt = 1;

        }

    }

    if (cnt) {

        ans += cnt * (cnt - 1) / 2;

    }

    cout << ans;

}


// Faster C++ solution for the same problem (measured speedup: 4.2491286640797075x):
//Bismillahir Rahmanir Rahim

#include <bits/stdc++.h>

using namespace std;



typedef long long              ll;

typedef long double            ld;

typedef pair<int, int>         pi;

typedef vector<int>            vi;

typedef vector<pair<int, int>> vpi;



#define pb       push_back

#define all(x)   begin(x), end(x)

#define sz(x)    (int)(x).size()

#define ff       first

#define ss       second

#define mp       make_pair

#define lb       lower_bound

#define ub       upper_bound

#define tcase()  int t; cin >> t; while(t--)



const int MOD = 1e9 + 7; // 998244353;

const int MX  = 2e5 + 5;

const ll  INF = 1e18;

const ld  PI  = acos((ld) -1);



void setIO(string name = "") {

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    if(sz(name)){

        freopen((name+".in").c_str(), "r", stdin);

        freopen((name+".out").c_str(), "w", stdout);

    }

}



int main(){



    setIO();



    int n;

    cin >> n;



    vector<string> v(n + 1);



    for(int i = 0; i < n; i++){

        string s;

        cin >> s;



        sort(all(s));



        v[i] = s;

    }



    v[n] = "{";



    ll ans = 0, cnt = 1;



    sort(all(v));



    for(int i = 1; i < n + 1; i++){

        if(v[i].compare(v[i - 1]) == 0) cnt++;

        else{

            ans += cnt * (cnt - 1) / 2;

            cnt = 1;

        }

    }



    cout << ans;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

string s[200010];

long long x[200010]={0};

int main(){

	int n,i,j,m;

	long long ans=0,k=0;

	char t;

	cin >> n;

	for(i=1;i<=n;i++){

		x[i]=x[i]+x[i-1]+i;

	}

	for(i=0;i<n;i++){

		cin >> s[i];

	}

	for(m=0;m<n;m++){

		for(i=0;i<s[m].size()-1;i++){

			for(j=i+1;j<s[m].size();j++){

				if(s[m][i]>s[m][j]){

					t=s[m][i];

					s[m][i]=s[m][j];

					s[m][j]=t;

				}

			}

		}

	}

	sort(s,s+n);

	ans=0;

	k=0;

	for(i=1;i<n;i++){

		if(s[i]!=s[i-1]){

			ans+=x[k];

			k=0;

		}

		else

			k++;

	}

	ans+=x[k];

	cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 8.221514551772545x):
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int n; 

	cin>>n;

	string s[n];

	for(int i=0; i<n; i++)

	{

		cin>>s[i];

		sort(s[i].begin(), s[i].end());

	}

	sort(s, s+n);

	long long cnt=0, ans=0;

	string last=s[0];

	for(int i=1; i<n; i++)

	{

		if(s[i]==last) cnt++;

		else ans+=(cnt+1)*cnt/2, last=s[i], cnt=0;

	}

	ans+=(cnt+1)*cnt/2;

	cout<<ans;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int a[100];

int main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0);

    int i,j,k,m,n;

    int ans=2;

    cin>>n;

    if(n==1)

        cout<<1<<endl;

    else

    {

        while(ans<=n)

            ans*=2;

        cout<<ans/2<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.393099531330854x):
#include<cstdio>

using namespace std; 

int main()

{

    int a;

    scanf("%d\n",&a);

    if(a<2)  {printf("1\n"); return 0;}

    if(a<4)  {printf("2\n"); return 0;}

    if(a<8)  {printf("4\n"); return 0;}

    if(a<16) {printf("8\n"); return 0;}

    if(a<32) {printf("16\n");return 0;}

    if(a<64) {printf("32\n");return 0;}

    if(a<128){printf("64\n");return 0;}

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long int a;

int main()

{

    cin>>a;

    if(a<2) cout<<1<<endl;

    else if(a<4)  cout<<2<<endl;

    else if(a<8)  cout<<4<<endl;

    else if(a<16) cout<<8<<endl;

    else if(a<32) cout<<16<<endl;

    else if(a<64) cout<<32<<endl;

    else cout<<64<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.319564208396332x):
#include<cstdio>

using namespace std; 

int main()

{

    int a;

    scanf("%d\n",&a);

    if(a<2)  {printf("1\n"); return 0;}

    if(a<4)  {printf("2\n"); return 0;}

    if(a<8)  {printf("4\n"); return 0;}

    if(a<16) {printf("8\n"); return 0;}

    if(a<32) {printf("16\n");return 0;}

    if(a<64) {printf("32\n");return 0;}

    if(a<128){printf("64\n");return 0;}

}
// Slower C++ solution:
/*

Character Drawing Adapted from FAKEUPDATE.NET

		   _    _____         _

		   \`,""   ,'7"r-..__/ \

		  ,'\ `, ,',','    _/   \

		 /   \, 7 / /     (   \ |

		J     \/ j  L______\  / |

		L   __JF"""/""\"\_,    /

		L,-"| O|  f O |  L_  _/

		F   \_ /  \__/   `-  j|

			.-'    `"""    ,' |          _..====.._

			\__/         r"_  A        ,' _..---.._`,

			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,

					  j   / / / 7"    `-<""=:'  '':. \ \

					 /   <,' /  F  . i , \   `,    :T W I

					 |    \,'  /    >X<  |     \   :| | L

					 |     `._/    ' ! ` |      I  :| |  G

					  \           \     /       |  :H T  |

					 __>-.__   __,-\   |        |  S P   |

					/     /|   | \  \  \_       | 'A R   |

				   /   __/ |   |  L  L   \      K./ /    L

				  /   |    |   4  I  I    |    E./ /   ,'

				 J    \    I    L F  I    |    // / _,'

		_________|     |   F    |J   F    |   //_/-'

		\   __   |    /   J     |/  J     |  /="

		\\  \_\  \__,' \  F     |   F     |

		\\\_____________\/      F__/      F

		 \\| 计算机编程 |_____/  (______/

		  \/从入门到入土/

*/

#include <iostream>

#include <cstdlib>

#include <iomanip>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <vector>

#include <sstream>

#include <set>

#include <queue>

#include <stack>

#include <cctype>

#include <map>

#include <climits>

#include <bitset>

#include <functional>

using namespace std;

#define MATH_PI 3.14159265358979323846

int main(){

	ios::sync_with_stdio(false);

	int iNum;

	cin >> iNum;

	cout << ceil(pow(2, int(log2(iNum)))) << endl;

endapp:

	system("pause > nul");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.5225327748930795x):
#include<cstdio>

using namespace std; 

int main()

{

    int a;

    scanf("%d\n",&a);

    if(a<2)  {printf("1\n"); return 0;}

    if(a<4)  {printf("2\n"); return 0;}

    if(a<8)  {printf("4\n"); return 0;}

    if(a<16) {printf("8\n"); return 0;}

    if(a<32) {printf("16\n");return 0;}

    if(a<64) {printf("32\n");return 0;}

    if(a<128){printf("64\n");return 0;}

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

 

#define INF 1145141919

 

int main()

{

	int n;

	cin >> n;

	cout << pow(2,((int)log2(n))) << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.401900895501022x):
#include<cstdio>

using namespace std;

int main()

{

	int n;

	scanf("%d",&n);

	if(n<2)

	{

		printf("1\n");

		return 0;

	}

	if(n<4)

	{

		printf("2\n");

		return 0;

	}

	if(n<8)

	{

		printf("4\n");

		return 0;

	}

	if(n<16)

	{

		printf("8\n");

		return 0;

	}

	if(n<32)

	{

		printf("16\n");

		return 0;

	}

	if(n<64)

	{

		printf("32\n");

		return 0;

	}

	printf("64\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n,l=1;

    scanf("%d",&n);

    while(n>=l){

        l*=2;

    }

    printf("%d",l/2);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1914895096091875x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

using namespace std;

int main()

{   int x,i;

    cin>>x;

    for(i=1;pow(2,i)<=x;i++);

    cout<<pow(2,i-1)<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.333053128378672x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int a,ans=1;

    cin>>a;

    while(ans<=a)

	ans*=2;

    cout<<ans/2<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.257433571902311x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,ans;

int main(){

    cin>>n;

    for(int i=0;i<=10;i++){

        if(pow(2,i)<=n){

        	ans=pow(2,i);

		}

    }

    cout<<ans<<endl;

    return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.265344528898985x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,a[105]={0,2};

int main(void) {

    cin>>n;

    if(n==1) {

        cout<<1<<"\n";

        exit(0);

    }

    for(int i=2; i<=100; i++)  a[i]=a[i-1]*2;

    for(int i=1; i<=100; i++) {

        if(n>=a[i]&&n<a[i+1]) {

            cout<<a[i]<<endl;

            exit(0);

        }

    }

}

// Faster C++ solution for the same problem (measured speedup: 5.261145392902726x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n;

	cin>>n;

	if(n==1){cout<<1<<endl;return 0;}

	for(int i=1;i<=n;i++)

		if(pow(2,i)<=n&&pow(2,i+1)>n)

		{

			cout<<pow(2,i)<<endl;

			return 0;

		}

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3726721178485475x):
#include<cstdio>

using namespace std;

int n,sum[110];

int main(){

    scanf("%d",&n);

    if(n==1)

	{

        printf("1\n");

        return 0;

    }

    sum[1]=2;

    for(int i=2;i<=100;i++)

        sum[i]=sum[i-1]*2;

    for(int i=1;i<=100;i++)

	{

        if(n<sum[i+1]&&n>=sum[i])

		{

        	printf("%d\n",sum[i]);

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	int a;

	cin>>a;

	int p=0;

	while(a=a/2)

	{

		p++;

	 } 

	cout<<pow(2,p);

 } 

// Faster C++ solution for the same problem (measured speedup: 5.309023809851625x):
#include<stdio.h>

int a[102],b[102];

int main()

{

	int N,i,j,max=0,k;

	scanf("%d",&N);

	for(i=1;i<=N;i++)

	{	

		k=i;

		for(j=0;k%2==0;j++)

			k=k/2;

			a[i-1]=j;

	}

	for(j=0;j<i;j++)

	{

		if(a[j]<=a[max])

			max=max;

		else

			max=j;

	}

	for(j=0;j<i;j++)

	{

		b[j]=j+1;

	}

	printf("%d",b[max]);				

	return 0;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



int main()

{

    int N;

    cin >> N;

    if(N>=64)

    {

        cout<<64<<endl;

    }

    else if(N>=32){

        cout<<32<<endl;

    }

    else if(N>=16)

    {

        cout<<16<<endl;

    }

    else if(N>=8)

    {

        cout<<8<<endl;

    }

    else if(N >= 4)

    {

        cout<<4<<endl;

    }

    else if(N >=2)

    {

        cout<<2<<endl;

    }

    else {

        cout<<N;

    }

    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.24788922186354x):
#include<stdio.h>

int a[102],b[102];

int main()

{

	int N,i,j,max=0,k;

	scanf("%d",&N);

	for(i=1;i<=N;i++)

	{	

		k=i;

		for(j=0;k%2==0;j++)

			k=k/2;

			a[i-1]=j;

	}

	for(j=0;j<i;j++)

	{

		if(a[j]<=a[max])

			max=max;

		else

			max=j;

	}

	for(j=0;j<i;j++)

	{

		b[j]=j+1;

	}

	printf("%d",b[max]);				

	return 0;

}
// Slower C++ solution:
using namespace std;

#include <iostream>

#include <cmath>

int main()

{

 	int n;cin>>n;

 	int sum=0;

 	int i=1;

 	while(pow(2,i)<=n) i++;

 	//cout<<pow(2,3)<<endl;

 	cout<<pow(2,i-1);

} 

// Faster C++ solution for the same problem (measured speedup: 5.312055324088921x):
#include<stdio.h>

int a[102],b[102];

int main()

{

	int N,i,j,max=0,k;

	scanf("%d",&N);

	for(i=1;i<=N;i++)

	{	

		k=i;

		for(j=0;k%2==0;j++)

			k=k/2;

			a[i-1]=j;

	}

	for(j=0;j<i;j++)

	{

		if(a[j]<=a[max])

			max=max;

		else

			max=j;

	}

	for(j=0;j<i;j++)

	{

		b[j]=j+1;

	}

	printf("%d",b[max]);				

	return 0;

}
// Slower C++ solution:
#include<cmath>

#include<cstdio>

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int i;

	while(n/2)

	{

		n/=2;

		i++;	

	}	

	i=pow(2,i);

	cout<<i<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.279452436562415x):
#include<cstdio>

int main()

{

	int N;

	scanf("%d",&N);

	int t=1;

	for( int i=1;t<=N;i++)

	{

		if(t*2>N)

			break;

		t*=2;

	}

	printf("%d",t);

}
// Slower C++ solution:
#define taskname ""

#include <bits/stdc++.h>



using namespace std;



const int maxN = 1e5;



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(nullptr);

    int a, b, c, d;

    cin >> a >> b >> c >> d;

    cout << min(a, b) + min(c, d);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.323314065510598x):
#include <cstdio>

#include <algorithm>

using namespace std;

int main() {

    int a, b, c, d;

    scanf("%d%d%d%d", &a, &b, &c, &d);

    printf("%d", min(a, b) + min(c, d));

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int a,b,c,d;

	cin>>a>>b>>c>>d;

	int sum=0;

	if(a>b) sum+=b;

	else sum+=a;

	if(c>d) sum+=d;

	else sum+=c;

	cout<<sum<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.246129706376901x):
#include<stdio.h>

int main()

{

    int a,b,c,d,s,s1;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(a<b)

        s=a;

    else

        s=b;

        if(c<d)

            s1=c;

            else

            s1=d;

        printf("%d\n",(s+s1));



}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;

const int MAX=1e3+5;

int main(int argc, char *argv[])

{

	int a,b,c,d;

	cin>>a>>b>>c>>d;

	printf("%d\n",min(a,b)+min(c,d));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.223121890972249x):
#include<stdio.h>

int main()

{

    int a,b,c,d,s,s1;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(a<b)

        s=a;

    else

        s=b;

        if(c<d)

            s1=c;

            else

            s1=d;

        printf("%d\n",(s+s1));



}
// Slower C++ solution:


#include<bits/stdc++.h>

using namespace std;

main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);



    long long i,j,k,l,m,n,o,p,q;

    while(cin>>m>>n>>o>>p)



    {

        if(m>n)

            m=n;

        if(p>o)

            p=o;

        cout<<m+p<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.313062820123627x):
#include<stdio.h>

int main()

{

    int a,b,c,d,s,s1;

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(a<b)

        s=a;

    else

        s=b;

        if(c<d)

            s1=c;

            else

            s1=d;

        printf("%d\n",(s+s1));



}