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

using namespace std;

typedef long long ll;

#define MAX 100005

struct BIT{

  void init(){  memset(bit,0,sizeof(bit));  }

  ll bit[MAX];

  void set(int r,ll x){

    r=MAX-r-1;

    while(r){

      bit[r]=max(bit[r],x);

      r-=(r&-r);

    }

  }

  ll get(int i){

    i=MAX-i-1;

    ll res=0;

    while(i<MAX){

      res=max(res,bit[i]);

      i+=(i&-i);

    }

    return res;

  }

};



int n;

ll sum,ans,a[MAX];

BIT A;



int main(){

  A.init();

  cin>>n;

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

    cin>>a[i];

    sum+=a[i];

    ll k=A.get(a[i]);

    ans=max(ans,k+a[i]);

    A.set(a[i],k+a[i]);

  }

  cout<<sum-ans<<endl;

  return 0;

}

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

using namespace std;

typedef long long ll;

#define MAX 100005





ll bit[MAX];



void numSet(int r,ll x){

  r=MAX-r-1;

  while(r){

    bit[r]=max(bit[r],x);

    r-=(r&-r);

  }

}



ll getMin(int i){

  i=MAX-i-1;

  ll res=0;

  while(i<MAX){

    res=max(res,bit[i]);

    i+=(i&-i);

  }

  return res;

}





ll n,k,sum,ans,num;

int main(){

  scanf("%lld",&n);

  while(n--){

    scanf("%lld",&num);

    sum+=num;

    k=getMin(num);

    ans=max(ans,k+num);

    numSet(num,k+num);

  }

  printf("%lld\n",sum-ans);

  return 0;

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

#include<vector>

#include<cmath>

#include<algorithm>

#include<limits>

using namespace std;

using uint = unsigned int;

using ll = long long;



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

#define REP(i,n) FOR(i,0,n)



uint N;

ll A[200001];

uint l, c, r;



ll getVal() {

  ll prev_diff, curr_diff;

  ll cval = A[c], eval = A[N];



  // left side

  prev_diff = numeric_limits<ll>::max();

  while (1) {

    curr_diff = abs((cval - A[l]) - (A[l] - 0));

    if (curr_diff > prev_diff) {

      --l;

      break;

    }



    prev_diff = curr_diff;

    ++l;

    if (l >= c) {

      --l;

      break;

    }

  }



  // right side

  prev_diff = numeric_limits<ll>::max();

  while(1) {

    curr_diff = abs((eval - A[r]) - (A[r] - cval));

    if (curr_diff > prev_diff) {

      --r;

      break;

    }



    prev_diff = curr_diff;

    ++r;

    if (r >= N) {

      --r;

      break;

    }

  }



  // calc val

  ll sum[4];

  sum[0] = A[l] - 0;

  sum[1] = cval - A[l];

  sum[2] = A[r] - cval;

  sum[3] = eval - A[r];

  ll maxval = *max_element(sum, sum+4);

  ll minval = *min_element(sum, sum+4);

  return maxval - minval;

}



int main() {

  scanf("%u", &N);



  A[0] = 0;

  REP(i,N) {

    scanf("%llu", &A[i+1]);

    A[i+1] += A[i];

  }



  ll minval = numeric_limits<ll>::max();

  for (l = 1, c = 2, r = 3; c <= N - 2; ++c) {

    if (r <= c) r = c + 1;   

    ll val = getVal();

    if (val < minval) minval = val;

  }



  printf("%llu\n", minval);

  return 0;

}

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

#include <algorithm>

#include <cstring>

#include <cmath>

#include <limits>



using ull =  long long;

using namespace std;



const int MAX_N = 2 * 10e5 + 5;

ull arr[MAX_N];//start from 1, arr[1] = 0

int n;

int pre_l, pre_r;



ull solve(int mid) {

    ull pre_diff = numeric_limits<ull>::max();

    ull curr_diff;

    int l = mid - 1, r = n - 1;

    for (int i = pre_l; i < mid; ++i) {

        curr_diff = abs(arr[mid] - arr[i] - arr[i]);

        if (curr_diff >= pre_diff) {

            l = i - 1;

            break;

        }

        pre_diff = curr_diff;

    }

    pre_diff = numeric_limits<ull>::max();

    for (int j = pre_r; j < n; ++j) {

        curr_diff = abs(arr[n] - arr[j] - (arr[j] - arr[mid]));

        if (curr_diff >= pre_diff) {

            r = j - 1;

            break;

        }

        pre_diff = curr_diff;

    }

    ull sum[4];

    sum[0] = arr[l];

    sum[1] = arr[mid] - arr[l];

    sum[2] = arr[r] - arr[mid];

    sum[3] = arr[n] - arr[r];

    ull mi, ma;

    ma = *max_element(sum, sum + 4);

    mi = *min_element(sum, sum + 4);

    pre_l = l;

    pre_r = r;

    return ma - mi;

}



int main() {

    scanf("%d", &n);

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

        scanf("%lld", arr + i);

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

    }

    ull mi = numeric_limits<ull>::max();

    pre_l = 1;

    pre_r = 3;

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

        ull ans = solve(i);

        mi = mi < ans ? mi : ans;

    }

    printf("%lld", mi);

    return 0;

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

#include<cstdio>

#include<cmath>

#include<cstring>

#include<string>

#include<stack>

#include<queue>

#include<vector>

#include<algorithm>

#include<iomanip>

#include<utility>

#include<set>

#include<unordered_set>

typedef long long int ll;

#define REP(i,n) for(int i=0;i<signed(n);i++)

using std::cout;

using std::vector;

using std::endl;

using std::cin;

using std::string;

using std::min;

using std::max;

const ll MOD = 1000000007;

const ll INF = 9e9;

ll N, M, ans = INF;

ll A[300010], S[301000];



using namespace std;

int main() {

	//fill(begin(A), end(A), 0);

	fill(begin(S), end(S), 0);

	N = M = 0;

	std::ios_base::sync_with_stdio(false);

	cin >> N;

	REP(i, N) {

		cin >> A[i];

		S[i] += A[i];

		S[i + 1] = S[i];

	}

	//a:右半分の区切り i:真ん中 b:左半分

	//s:右の和 t:左の和

	ll a = 0, b = 2, s, t;

	REP(i, N - 1) {

		if (i == b)b++;

		s = (S[i] - S[a]) - S[a];

		t = (S[N - 1] - S[b]) - (S[b] - S[i]);

		bool f = true;

		if (i == 0)continue;

		while (f) {

			f = false;

			if (a + 1 == i)continue;

			if (abs(s)>abs(s - A[a + 1] * 2)) {

				s -= A[a + 1] * 2;

				a++; f = true;

			}

		}

		f = true;

		while (f) {

			f = false;

			if (b + 1 == N - 1 || b == N - 1)continue;

			if (abs(t)>abs(t - A[b + 1] * 2)) {

				t -= A[b + 1] * 2;

				b++; f = true;

			}

		}

		ans = min(ans, (max({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })

			- min({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })));

	}

	cout << ans << endl;

	return 0;

}


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

#include<cstdio>

#include<cmath>

#include<cstring>

#include<string>

#include<stack>

#include<queue>

#include<vector>

#include<algorithm>

#include<iomanip>

#include<utility>

#include<set>

#include<unordered_set>

typedef long long int ll;

#define REP(i,n) for(int i=0;i<signed(n);i++)

using std::cout;

using std::vector;

using std::endl;

using std::cin;

using std::string;

using std::min;

using std::max;

const ll MOD = 1000000007;

const ll INF = 9e9;

ll N,M,ans=INF;

ll A[300010],S[301000];



using namespace std;



int main(){

    std::ios_base::sync_with_stdio(false);

    cin>>N;

    REP(i,N){

        cin>>A[i];

        S[i]+=A[i];

        S[i+1]=S[i];

    }

    //a:右半分の区切り i:真ん中 b:左半分

    //s:右の和 t:左の和

    ll a=0,b=2,s,t;

    REP(i,N-2){

        if(i==b)b++;

        s=(S[i]-S[a])-S[a];

        t=(S[N-1]-S[b])-(S[b]-S[i]);

        bool f=true;

        if(i==0)continue;

        while(f){

            f=false;

            if(a+1==i)continue;

            if(abs(s)>abs(s-A[a+1]*2)){

                s-=A[a+1]*2;

                a++;f=true;

            }

        }

        f=true;

        while(f){

            f=false;

            if(b+1==N-1||b==N-1)continue;

            if(abs(t)>abs(t-A[b+1]*2)){

                t-=A[b+1]*2;

                b++;f=true;

            }

        }

        ans=min( ans,( max({S[a],S[i]-S[a],S[b]-S[i],S[N-1]-S[b]})

        -min({S[a],S[i]-S[a],S[b]-S[i],S[N-1]-S[b]}) ) );

    }

    cout<<ans<<endl;

    return 0;

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

#include<cstdio>

#include<cmath>

#include<cstring>

#include<string>

#include<stack>

#include<queue>

#include<vector>

#include<algorithm>

#include<iomanip>

#include<utility>

#include<set>

#include<unordered_set>

typedef long long int ll;

#define REP(i,n) for(int i=0;i<signed(n);i++)

using std::cout;

using std::vector;

using std::endl;

using std::cin;

using std::string;

using std::min;

using std::max;

const ll MOD = 1000000007;

const ll INF = 9e9;

ll N, M, ans = INF;

ll A[300010], S[301000];



using namespace std;

int main() {

	//fill(begin(A), end(A), 0);

	fill(begin(S), end(S), 0);

	N = M = 0;

	std::ios_base::sync_with_stdio(false);

	cin >> N;

	REP(i, N) {

		cin >> A[i];

		S[i] += A[i];

		S[i + 1] = S[i];

	}

	//a:右半分の区切り i:真ん中 b:左半分

	//s:右の和 t:左の和

	ll a = 0, b = 2, s, t;

	REP(i, N - 1) {

		if (i == b)b++;

		s = (S[i] - S[a]) - S[a];

		t = (S[N - 1] - S[b]) - (S[b] - S[i]);

		bool f = true;

		if (i == 0)continue;

		while (f) {

			f = false;

			if (a + 1 == i)continue;

			if (abs(s)>abs(s - A[a + 1] * 2)) {

				s -= A[a + 1] * 2;

				a++; f = true;

			}

		}

		f = true;

		while (f) {

			f = false;

			if (b + 1 == N - 1 || b == N - 1)continue;

			if (abs(t)>abs(t - A[b + 1] * 2)) {

				t -= A[b + 1] * 2;

				b++; f = true;

			}

		}

		ans = min(ans, (max({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })

			- min({ S[a],S[i] - S[a],S[b] - S[i],S[N - 1] - S[b] })));

	}

	cout << ans << endl;

	return 0;

}


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

#include<cstdio>

#include<cmath>

#include<cstring>

#include<string>

#include<stack>

#include<queue>

#include<vector>

#include<algorithm>

#include<iomanip>

#include<utility>

#include<set>

#include<unordered_set>

typedef long long int ll;

using namespace std;

#define REP(i,n) for(int i=0;i<signed(n);i++)

using std::cout;

using std::vector;

using std::endl;

using std::cin;

using std::string;

using std::min;

using std::max;

const ll MOD = 1000000007;

const ll INF = 9e9;

ll N,M,ans=INF;

ll A[300010],S[301000];



int main(){

    std::ios_base::sync_with_stdio(false);

    cin>>N;

    REP(i,N){

        cin>>A[i];

        S[i]+=A[i];

        S[i+1]=S[i];

    }

    //a:右半分の区切り i:真ん中 b:左半分

    //s:右の和 t:左の和

    ll a=0,b=2,s,t;

    REP(i,N-2){

        if(i==b)b++;

        s=(S[i]-S[a])-S[a];

        t=(S[N-1]-S[b])-(S[b]-S[i]);

        bool f=true;

        if(i==0)continue;

        while(f){

            f=false;

            if(a+1==i)continue;

            if(abs(s)>abs(s-A[a+1]*2)){

                s-=A[a+1]*2;

                a++;f=true;

            }

        }

        f=true;

        while(f){

            f=false;

            if(b+1==N-1||b==N-1)continue;

            if(abs(t)>abs(t-A[b+1]*2)){

                t-=A[b+1]*2;

                b++;f=true;

            }

        }

        ans=min( ans,( max({S[a],S[i]-S[a],S[b]-S[i],S[N-1]-S[b]})

        -min({S[a],S[i]-S[a],S[b]-S[i],S[N-1]-S[b]}) ) );

    }

    cout<<ans<<endl;

    return 0;

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



using namespace std;



int main()

{

	int a,b,c;

	cin>>a;

	cin>>b;

	if ((a==1)&&(b==2))

	{

		c=3;

	}

		if ((a==2)&&(b==3))

	{

		c=1;

	}

		if ((a==1)&&(b==3))

	{

		c=2;

	}

		if ((a==3)&&(b==1))

	{

		c=2;

	}

		if ((a==2)&&(b==1))

	{

		c=3;

	}

		if ((a==3)&&(b==2))

	{

		c=1;

	}

	

	cout<<c;

	

	

	

	return 0;

}

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

int main()

{

	int A,B;

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

	scanf("%d",&B);

	if(A==1&&B==2)  printf("3");

	if(A==1&&B==3)  printf("2");

	if(A==2&&B==1)  printf("3");

	if(A==2&&B==3)  printf("1");

	if(A==3&&B==1)   printf("2");

	if(A==3&&B==2)    printf("1");

//	if((A+B)%2==0)  printf("2\n");

//	if((A+B)%2==1&&A!=1)  printf("1\n");

//	if((A+B)%2==1&&A!=3)   printf("3\n");

	return 0;

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



using namespace std;



int main()

{

	int a,b,c;

	cin>>a;

	cin>>b;

	if ((a==1)&&(b==2))

	{

		c=3;

	}

		if ((a==2)&&(b==3))

	{

		c=1;

	}

		if ((a==1)&&(b==3))

	{

		c=2;

	}

		if ((a==3)&&(b==1))

	{

		c=2;

	}

		if ((a==2)&&(b==1))

	{

		c=3;

	}

		if ((a==3)&&(b==2))

	{

		c=1;

	}

	

	cout<<c;

	

	

	

	return 0;

}

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

int main()

{

    int a,b,c;

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



    if( a!=1 && b!=1)

        printf("1");

    else if(a!=2 && b!=2)

        printf("2");

    else

        printf("3");

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

using namespace std;

int main()

{

    int n,m;

    cin>>n>>m;

    cout<<6-n-m<<endl;

    return 0;

}


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

int main()

{

    int a,b,c;

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



    if( a!=1 && b!=1)

        printf("1");

    else if(a!=2 && b!=2)

        printf("2");

    else

        printf("3");

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



using namespace std;



int main()

{

	int a,b,c;

	cin>>a;

	cin>>b;

	if ((a==1)&&(b==2))

	{

		c=3;

	}

		if ((a==2)&&(b==3))

	{

		c=1;

	}

		if ((a==1)&&(b==3))

	{

		c=2;

	}

		if ((a==3)&&(b==1))

	{

		c=2;

	}

		if ((a==2)&&(b==1))

	{

		c=3;

	}

		if ((a==3)&&(b==2))

	{

		c=1;

	}

	

	cout<<c;

	

	

	

	return 0;

}

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;

int main()

{

    int n,m;

    cin>>n>>m;

    cout<<6-n-m<<endl;

    return 0;

}


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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

int main ()

{

    int A,B;

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

    if ((A==1 && B==2)||(B==1 && A==2))

    {

        printf ("3\n");

    }

    if ((A==2 && B==3)||(B==2 && A==3))

    {

        printf ("1\n");

    }

    if ((A==1 && B==3)||(B==1 && A==3))

    {

        printf ("2\n");

    }

    return 0;

}

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

#define pb push_back

#define mk make_pair

#define ll long long

#define ss second

#define ff first

#define pll pair<ll,ll>

#define vll vector<ll>

#define mll map<ll,ll>

#define mod 1000000007

#define w(x) ll x; cin>>x; while(x--)

#define ps(x,y) fixed<<setprecision(y)<<x;

#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)

#define re(i, j) fo(i, 0, j, 1)

#define pi 3.1415926535897932384626433832795

#define all(cont) cont.begin(), cont.end()

#define countbit(x) __builtin_popcount(x)

#define mod 1000000007

#define lo lower_bound

#define de(n) ll n;cin>>n;

#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}

#define defi(a,n,k) ll n;cin>>n; ll k;cin>>k;ll a[n];re(i,n){cin>>a[i];}

#define deb(x) cout<<#x<<"="<<x<<endl;

#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)

#define nl cout<<endl;

using namespace std;

void cp()

{

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

    #ifndef ONLINE_JUDGE  

    freopen("input.txt", "r", stdin);  

    freopen("output.txt", "w", stdout);

#endif

}

int main()

{

    //cp();

    //w(x)

    de(a);

    de(b);

    re(i,3)

    {

        if(a==i+1)

        continue;

        else if(b==i+1)

        continue;

        else

        {

            cout<<i+1;

        } 

    }

    return 0;

}

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;



int A, B;



int main () {

	cin >> A >> B;

	if (A==1){

		if (B==2){

			cout << "3";

		} else {

			cout << "2";

		}

	} else if (A==2){

		if (B==1){

			cout << "3";

		} else {

			cout << "1";

		}

	} else if (A==3){

		if (B==1){

			cout << "2";

		} else {

			cout << "1";

		}

	}

}

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

}
// Slower C++ solution:
//Bismillahir Rahmanir Rahim

#include<bits/stdc++.h>



using namespace std;





int main(){



                int a,b;

                cin>>a>>b;



                if((a==1&&b==2)||(a==2&&b==1)){

                    cout<<"3";

                }

                 else if((a==2&&b==3)||(a==3&&b==2)){

                    cout<<"1";

                }

                else{

                    cout<<"2";

                }





         }

//Pavel


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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;

#define Y cout<<"YES"<<endl;

#define N cout<<"NO"<<endl;

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

#define eki int n; cin>>n;

#define loop for(int i=0; i<n; i++)

int main()

{  

    int a, b;

    cin>>a>>b;

    if(a!=1 && b!=1)

    cout<<1<<endl;

    else if(a!=2 && b!=2)

    cout<<2<<endl;

    else cout<<3<<endl;

    

}






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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;



int main()

{

    int A,B;

    cin >> A >> B;

    if((A==1 && B==2) || (A==2 && B==1))

    {

        cout << "3" << endl;

    }

    else if((A==2 && B==3) || (A==3 && B==2))

    {

        cout << "1" << endl;

    }

    else

    {

        cout << "2" << endl;

    }

}


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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;

#define int  long long

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

#define f(n)    for(int i=0;i<n;i++)

#define endl   "\n"















int32_t main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int  a,b;

    cin>>a>>b;

    vector<int>dp(3,0);

    dp[a-1]=1;

    dp[b-1]=1;

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

    {

        if(dp[i]==0)

        {

            cout<<i+1<<endl;

            break;

        }

    }















}

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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

using namespace std;

int main()

{ 

     int a,b,c;

     cin>>a>>b;

      if(a+b==3)

     { 

         cout<<"3";

     }

     else if(a+b==5)

     { 

         cout<<"1";

     } 

     else if(a+b==4)

     {

         cout<<"2";

     }

      

     return 0;

     } 

     

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

int main()

{

	int a;

	int b;

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

	if(a==1 && b==2){

		printf("3\n");

	}

	else if(a==1&&b==3)

	    printf("2\n");

	else if(a==2&&b==3)

	    printf("1\n");

	else if(a==2&&b==1)

	    printf("3\n");

	else if(a==3&&b==1)

	    printf("2\n");

	else

	    printf("1\n");

	return 0;

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



using namespace std;



int main()

{

	int a,b,c;

	cin>>a;

	cin>>b;

	if ((a==1)&&(b==2))

	{

		c=3;

	}

		if ((a==2)&&(b==3))

	{

		c=1;

	}

		if ((a==1)&&(b==3))

	{

		c=2;

	}

		if ((a==3)&&(b==1))

	{

		c=2;

	}

		if ((a==2)&&(b==1))

	{

		c=3;

	}

		if ((a==3)&&(b==2))

	{

		c=1;

	}

	

	cout<<c;

	

	

	

	return 0;

}

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

int main(){

	int a;

	int b;

	

	scanf("%d",&a);

	scanf("%d",&b);

	

	if(a==1 && b==2 || a==2 && b==1){

		printf("3");

	}

	else if(a==2 && b==3 || a==3 && b==2){

		printf("1");

	}

	else if(a==1 && b==3 || a==3 && b==1){

		printf("2");

	}

	else{

		printf("error");

	}



	return 0;

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

using namespace std;

int main()

{

    int n,m;

    cin>>n>>m;

    cout<<6-n-m<<endl;

    return 0;

}


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

int main(){

	int a;

	int b;

	

	scanf("%d",&a);

	scanf("%d",&b);

	

	if(a==1 && b==2 || a==2 && b==1){

		printf("3");

	}

	else if(a==2 && b==3 || a==3 && b==2){

		printf("1");

	}

	else if(a==1 && b==3 || a==3 && b==1){

		printf("2");

	}

	else{

		printf("error");

	}



	return 0;

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

int main ()

{

    int A,B;

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

    if ((A==1 && B==2)||(B==1 && A==2))

    {

        printf ("3\n");

    }

    if ((A==2 && B==3)||(B==2 && A==3))

    {

        printf ("1\n");

    }

    if ((A==1 && B==3)||(B==1 && A==3))

    {

        printf ("2\n");

    }

    return 0;

}

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

int main(){

	int a;

	int b;

	

	scanf("%d",&a);

	scanf("%d",&b);

	

	if(a==1 && b==2 || a==2 && b==1){

		printf("3");

	}

	else if(a==2 && b==3 || a==3 && b==2){

		printf("1");

	}

	else if(a==1 && b==3 || a==3 && b==1){

		printf("2");

	}

	else{

		printf("error");

	}



	return 0;

}