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

using namespace std;

const int MAXn = 50 + 5, INF = 1e9;

int dp[MAXn][MAXn][MAXn], a, b, c, res = INF;



int main() {

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin >> a >> b >> c;

	if (a == b && b == c)

		return cout << 0,0;

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

		for (int j = 0; j < MAXn; j++)

			for (int x = 0; x < MAXn; x++)

				dp[i][j][x] = INF;

	dp[a][b][c] = 0;

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

		for (int j = 1; j < MAXn; j++)

			for (int x = 1; x < MAXn; x++) {

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i][j-1][x-1] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j][x-1] + 1);

				if (i >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i-2][j][x] + 1);

				}

				if (j >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j-2][x] + 1);

				}

				if (x >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j][x-2] + 1);

				}

				if (i == j && j == x)

					res = min(res, dp[i][j][x]);

			}

	cout << res;

}


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

#include <stdio.h>

#include <string>

#include <string.h>

#include <algorithm>

#include <math.h>

using namespace std;

int main()

{

    int a,b,c,t,sum=0;

    cin>>a>>b>>c;

    if(a>b)

    {

        t=a;

        a=b;

        b=t;

    }

    if(b>c)

    {

        t=b;

        b=c;

        c=t;

    }

    if(a>b)

    {

        t=a;

        a=b;

        b=t;

    }

    t=(c-b)/2;

    sum+=t;

    if((c-b)%2)

    {

        a++;

        sum++;

    }

    t=(c-a)/2;

    sum+=t;

    if((c-a)%2)

    sum+=2;

    cout<<sum<<endl;

    return 0;

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

using namespace std;

const int MAXn = 50 + 5, INF = 1e9;

int dp[MAXn][MAXn][MAXn], a, b, c, res = INF;



int main() {

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin >> a >> b >> c;

	if (a == b && b == c)

		return cout << 0,0;

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

		for (int j = 0; j < MAXn; j++)

			for (int x = 0; x < MAXn; x++)

				dp[i][j][x] = INF;

	dp[a][b][c] = 0;

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

		for (int j = 1; j < MAXn; j++)

			for (int x = 1; x < MAXn; x++) {

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i][j-1][x-1] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j][x-1] + 1);

				if (i >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i-2][j][x] + 1);

				}

				if (j >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j-2][x] + 1);

				}

				if (x >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j][x-2] + 1);

				}

				if (i == j && j == x)

					res = min(res, dp[i][j][x]);

			}

	cout << res;

}


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

using namespace std;

int main()

{

    int a[4],i,t,m,ans,per;

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

        cin>>a[i];

    sort(a,a+3);

    t=a[2]-a[1];

    a[0]=a[0]+t;

    m=a[2]-a[0];

    ans=m/2;

    if(m%2!=0)

        ans=ans+2;

    per=ans+t;

    cout<<per<<endl;

    return 0;

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

using namespace std;

const int MAXn = 50 + 5, INF = 1e9;

int dp[MAXn][MAXn][MAXn], a, b, c, res = INF;



int main() {

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin >> a >> b >> c;

	if (a == b && b == c)

		return cout << 0,0;

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

		for (int j = 0; j < MAXn; j++)

			for (int x = 0; x < MAXn; x++)

				dp[i][j][x] = INF;

	dp[a][b][c] = 0;

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

		for (int j = 1; j < MAXn; j++)

			for (int x = 1; x < MAXn; x++) {

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i][j-1][x-1] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j][x-1] + 1);

				if (i >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i-2][j][x] + 1);

				}

				if (j >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j-2][x] + 1);

				}

				if (x >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j][x-2] + 1);

				}

				if (i == j && j == x)

					res = min(res, dp[i][j][x]);

			}

	cout << res;

}


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

using namespace std;

int main()

{

     int a[1000];

     int n=0;

     cin>>a[1]>>a[2]>>a[3];

     

     while(a[1]!=a[2]||a[2]!=a[3]||a[1]!=a[3])

     {

	 sort(a+1,a+3+1);

     	if(a[2]!=a[3]) 

     	{

     		a[1]++;

     		a[2]++;

     	}

     	else a[1]+=2;

     	n++;

     }

     cout<<n;

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

using namespace std;

const int MAXn = 50 + 5, INF = 1e9;

int dp[MAXn][MAXn][MAXn], a, b, c, res = INF;



int main() {

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin >> a >> b >> c;

	if (a == b && b == c)

		return cout << 0,0;

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

		for (int j = 0; j < MAXn; j++)

			for (int x = 0; x < MAXn; x++)

				dp[i][j][x] = INF;

	dp[a][b][c] = 0;

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

		for (int j = 1; j < MAXn; j++)

			for (int x = 1; x < MAXn; x++) {

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j-1][x] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i][j-1][x-1] + 1);

				dp[i][j][x] = min(dp[i][j][x], dp[i-1][j][x-1] + 1);

				if (i >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i-2][j][x] + 1);

				}

				if (j >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j-2][x] + 1);

				}

				if (x >= 2) {

					dp[i][j][x] = min(dp[i][j][x], dp[i][j][x-2] + 1);

				}

				if (i == j && j == x)

					res = min(res, dp[i][j][x]);

			}

	cout << res;

}


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

using namespace std;

int main()

{

	int a,b,c;

	cin>>a>>b>>c;

	

	int a1,b1,c1;

	a1=a%2;

	b1=b%2;

	c1=c%2;

	int st=0;

	    if(a1==b1&&b1==c1)

	    {

	    	st+=0;

		}

		else if(a1==b1)

		{

			a++;

			b++;

			st++;

		}

		else if(b1==c1)

		{

			c++;

			b++;

			st++;

		}

		else if(c1==a1)

		{

			a++;

			c++;

			st++;

		}

	int ma=max(a,max(b,c));

	st+=(ma-a)/2;

	st+=(ma-b)/2;

	st+=(ma-c)/2;

	cout<<st<<endl;

}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    int s=max(a,max(b,c));

    int t=3*s-a-b-c;

    if(t%2)

    {

        printf("%d",t/2+2);

    }

    else printf("%d",t/2);

}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

#include<algorithm>

using namespace std;



int main(){

    int A,B,C,Ans=0;

    scanf("%d%d%d",&A,&B,&C);

    int Max1=max(A,max(B,C));

    int Max2;

    if(A==Max1) Max2=max(B,C);

    else if(B==Max1) Max2=max(A,C);

    else if(C==Max1) Max2=max(A,B);

    int Max3=A+B+C-Max1-Max2;

    int tmp1=Max1-Max2;

    Ans+=tmp1,Max3+=tmp1,Max2+=tmp1;



    if((Max1-Max3)%2) Ans+=(Max1-Max3)/2+2;

    else Ans+=(Max1-Max3)/2;

    printf("%d",Ans);

}

/*

Sample Input 1

2 5 4

Sample Output 1

2



Sample Input 2

2 6 3

Sample Output 2

5



Sample Input 3

31 41 5

Sample Output 3

23

*/
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    int s=max(a,max(b,c));

    int t=3*s-a-b-c;

    if(t%2)

    {

        printf("%d",t/2+2);

    }

    else printf("%d",t/2);

}

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

#include<algorithm>

using namespace std;



int main(){

    int A,B,C,Ans=0;

    scanf("%d%d%d",&A,&B,&C);

    int Max1=max(A,max(B,C));

    int Max2;

    if(A==Max1) Max2=max(B,C);

    else if(B==Max1) Max2=max(A,C);

    else if(C==Max1) Max2=max(A,B);

    int Max3=A+B+C-Max1-Max2;

    int tmp1=Max1-Max2;

    Ans+=tmp1,Max3+=tmp1,Max2+=tmp1;



    if((Max1-Max3)%2) Ans+=(Max1-Max3)/2+2;

    else Ans+=(Max1-Max3)/2;

    printf("%d",Ans);

}

/*

Sample Input 1

2 5 4

Sample Output 1

2



Sample Input 2

2 6 3

Sample Output 2

5



Sample Input 3

31 41 5

Sample Output 3

23

*/
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

#include<algorithm>

using namespace std;



int main(){

    int A,B,C,Ans=0;

    scanf("%d%d%d",&A,&B,&C);

    int Max1=max(A,max(B,C));

    int Max2;

    if(A==Max1) Max2=max(B,C);

    else if(B==Max1) Max2=max(A,C);

    else if(C==Max1) Max2=max(A,B);

    int Max3=A+B+C-Max1-Max2;

    int tmp1=Max1-Max2;

    Ans+=tmp1,Max3+=tmp1,Max2+=tmp1;



    if((Max1-Max3)%2) Ans+=(Max1-Max3)/2+2;

    else Ans+=(Max1-Max3)/2;

    printf("%d",Ans);

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

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    int s=max(a,max(b,c));

    int t=3*s-a-b-c;

    if(t%2)

    {

        printf("%d",t/2+2);

    }

    else printf("%d",t/2);

}

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

#include<algorithm>

using namespace std;



int main(){

    int A,B,C,Ans=0;

    scanf("%d%d%d",&A,&B,&C);

    int Max1=max(A,max(B,C));

    int Max2;

    if(A==Max1) Max2=max(B,C);

    else if(B==Max1) Max2=max(A,C);

    else if(C==Max1) Max2=max(A,B);

    int Max3=A+B+C-Max1-Max2;

    int tmp1=Max1-Max2;

    Ans+=tmp1,Max3+=tmp1,Max2+=tmp1;



    if((Max1-Max3)%2) Ans+=(Max1-Max3)/2+2;

    else Ans+=(Max1-Max3)/2;

    printf("%d",Ans);

}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

#include<cstdlib>

#include<algorithm>

using namespace std;



int main()

{

    int a[3],count=0,min0,Max,min1,i0,i1;

    cin>>a[0]>>a[1]>>a[2];



   sort(a,a+3);

   while( a[1]!=a[2])

   {

       a[0]++;

       a[1]++;

       count++;

   }

   while(a[0]<a[2])

   {

       a[0]+=2;

       count++;

   }

   if(a[0]>a[2])

   {

       a[1]++;

       a[2]++;

    count++;

   }





    cout<<count<<endl;





}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

using namespace std;

int main()

{

    int a,b,c,a1,b1,c1,sum=0;

    cin>>a>>b>>c;

    if(a<b){a1=a;

    a=b;

    b=a1;}

    if(a<c)

    {

        a1=a;

        a=c;

        c=a1;

    }

    if(b<c)

    {

        b1=b;

        b=c;

        c=b1;

    }

    a1=a%2;

    b1=b%2;

    c1=c%2;

    if((a1==0&&b1==0&&c1==0)||(a1==1&&b1==1&&c1==1))

    {

     sum+=(a-b)/2;

     sum+=(a-c)/2;

    }

    else

    {

        if(a1==b1)

        {

            a+=1;

            b+=1;

        }

        else if(a1==c1)

        {

            a+=1;

            c+=1;

        }

        else if(b1==c1)

        {

            b+=1;

            c+=1;

        }

        sum+=(a-b)/2;

        sum+=(a-c)/2;

        sum++;



    }

    cout<<sum<<endl;



}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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

using namespace std;



int main()

{

	int a[3],ans=0;

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

	cin>>a[i];

	sort(a,a+3);

	int x=a[0],y=a[1],z=a[2];

	x+=z-y;

	ans+=z-y;

	y=z;

	int k=y-x;

	

	if(k%2==0)

	cout<<ans+k/2;

	else

	cout<<ans+k/2+2;

}
// Slower C++ solution:
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#include<vector>

using namespace std;

#define MOD 7007

struct QUEUE

{

	int a,b,c,tot;

}Push;

int F[6][3]={{1,1,0},{1,0,1},{0,1,1},{2,0,0},{0,2,0},{0,0,2}};

vector<int> Hash[MOD];

bool HASH(int n)

{

	for(int i=0;i<Hash[n%MOD].size();i++)

		if(n==Hash[n%MOD][i])

			return false;

	Hash[n%MOD].push_back(n);

	return true;

}

int main()

{

	Push.tot=0;

	queue<QUEUE> que;

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

	que.push(Push);

	while(!que.empty())

	{

		QUEUE Fro=que.front();

		if(Fro.a==Fro.b && Fro.b==Fro.c)

		{

			printf("%d\n",Fro.tot);

			return 0;

		}

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

		{

			Push=Fro;

			Push.tot++;

			Push.a+=F[i][0];Push.b+=F[i][1];Push.c+=F[i][2];

			int n=Push.a*10000+Push.b*100+Push.c;

			if(!HASH(n)) continue;

			que.push(Push);

		}

		que.pop();

	}

	return 0;

}


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



int main()

{	 

	int a, b, c, s = 0; 

	

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

	if(a > b) a ^= b, b ^= a, a ^= b;

	if(b > c) b ^= c, c ^= b, b ^= c;

	if(a > b) a ^= b, b ^= a, a ^= b;

	if((b - a) & 1) b++, c++, s++;

	s += ((b - a) >> 1) + c - b;

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

		

	return 0;

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

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    int s=max(a,max(b,c));

    int t=3*s-a-b-c;

    if(t%2)

    {

        printf("%d",t/2+2);

    }

    else printf("%d",t/2);

}

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



int main()

{	 

	int a, b, c, s = 0; 

	

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

	if(a > b) a ^= b, b ^= a, a ^= b;

	if(b > c) b ^= c, c ^= b, b ^= c;

	if(a > b) a ^= b, b ^= a, a ^= b;

	if((b - a) & 1) b++, c++, s++;

	s += ((b - a) >> 1) + c - b;

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

		

	return 0;

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

#include<cstdlib>

#include<algorithm>

using namespace std;



int main()

{

    int a[3],count=0,min0,Max,min1,i0,i1;

    cin>>a[0]>>a[1]>>a[2];



   sort(a,a+3);

   while( a[1]!=a[2])

   {

       a[0]++;

       a[1]++;

       count++;

   }

   while(a[0]<a[2])

   {

       a[0]+=2;

       count++;

   }

   if(a[0]>a[2])

   {

       a[1]++;

       a[2]++;

    count++;

   }





    cout<<count<<endl;





}

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



int main()

{	 

	int a, b, c, s = 0; 

	

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

	if(a > b) a ^= b, b ^= a, a ^= b;

	if(b > c) b ^= c, c ^= b, b ^= c;

	if(a > b) a ^= b, b ^= a, a ^= b;

	if((b - a) & 1) b++, c++, s++;

	s += ((b - a) >> 1) + c - b;

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

		

	return 0;

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

using namespace std;

int main()

{

    int a,b,c,a1,b1,c1,sum=0;

    cin>>a>>b>>c;

    if(a<b){a1=a;

    a=b;

    b=a1;}

    if(a<c)

    {

        a1=a;

        a=c;

        c=a1;

    }

    if(b<c)

    {

        b1=b;

        b=c;

        c=b1;

    }

    a1=a%2;

    b1=b%2;

    c1=c%2;

    if((a1==0&&b1==0&&c1==0)||(a1==1&&b1==1&&c1==1))

    {

     sum+=(a-b)/2;

     sum+=(a-c)/2;

    }

    else

    {

        if(a1==b1)

        {

            a+=1;

            b+=1;

        }

        else if(a1==c1)

        {

            a+=1;

            c+=1;

        }

        else if(b1==c1)

        {

            b+=1;

            c+=1;

        }

        sum+=(a-b)/2;

        sum+=(a-c)/2;

        sum++;



    }

    cout<<sum<<endl;



}


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



int main()

{	 

	int a, b, c, s = 0; 

	

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

	if(a > b) a ^= b, b ^= a, a ^= b;

	if(b > c) b ^= c, c ^= b, b ^= c;

	if(a > b) a ^= b, b ^= a, a ^= b;

	if((b - a) & 1) b++, c++, s++;

	s += ((b - a) >> 1) + c - b;

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

		

	return 0;

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

using namespace std;



int main()

{

	int a[3],ans=0;

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

	cin>>a[i];

	sort(a,a+3);

	int x=a[0],y=a[1],z=a[2];

	x+=z-y;

	ans+=z-y;

	y=z;

	int k=y-x;

	

	if(k%2==0)

	cout<<ans+k/2;

	else

	cout<<ans+k/2+2;

}

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



int main()

{	 

	int a, b, c, s = 0; 

	

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

	if(a > b) a ^= b, b ^= a, a ^= b;

	if(b > c) b ^= c, c ^= b, b ^= c;

	if(a > b) a ^= b, b ^= a, a ^= b;

	if((b - a) & 1) b++, c++, s++;

	s += ((b - a) >> 1) + c - b;

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

		

	return 0;

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

#include <queue>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;

int vis[110][110][110];

struct node

{

	int a,b,c,s;

	node (int aa,int bb,int cc,int ss):a(aa),b(bb),c(cc),s(ss){}

};

int bfs(int a,int b,int c)

{

	queue<node>q;

	q.push(node(a,b,c,0));

	while(!q.empty())

	{

		node t=q.front();

		q.pop();

		if(t.a==t.b&&t.b==t.c)

			return t.s;

		int x,y,z;

		x=t.a+2;y=t.b;z=t.c;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b+2;z=t.c;	

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b;z=t.c+2;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}	

		x=t.a+1;y=t.b+1;z=t.c;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a;y=t.b+1;z=t.c+1;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}

		x=t.a+1;y=t.b;z=t.c+1;

		if(x<110&&y<110&&z<110&&vis[x][y][z]==0)

		{

			q.push(node(x,y,z,t.s+1));

			vis[x][y][z]=1;

		}		

	}

	return -1;

}

int main()

{

	int x,y,z,ans;

	cin>>x>>y>>z;

	memset(vis,0,sizeof(vis));

	vis[x][y][z]=1;

	ans=bfs(x,y,z);

	cout<<ans<<endl;

	return 0;

}

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

int main()

{

	long long max,sum,a,b,c;

	while(scanf("%lld%lld%lld",&a,&b,&c)!=EOF)

	{

		max=a>b?a:b;

		max=max>c?max:c;

		sum=(max-a)+(max-b)+(max-c);

		if(sum%2==0)

		printf("%lld\n",sum/2);

		else

		{

			printf("%lld\n",sum/2+2);

		}

	}

	return 0;

 }