stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

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

using namespace std;



int n,m,p;

int a[15][15];



long double dp[1<<14];

long double tmp[1<<14][14];



long double fact[1<<14][14];







int main(void){

	cin >> n >> m >> p;

	rep(i,m){

		int u,v;

		cin >> u >> v;

		a[u-1][v-1]++;

		a[v-1][u-1]++;

	}



	rep(i,n) fact[1<<i][0]=1.0;

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

		for(int smask=(mask-1)&mask;;smask=(smask-1)&mask){

			int tmask=mask^smask;

			if(tmask>smask) break;

			rep(snum,n)rep(tnum,n) if(snum+tnum<n) fact[mask][snum+tnum+1]+=fact[smask][snum]*fact[tmask][tnum];

		}

	}

	

	// cerr << fact[3][1] << endl;

	// cerr << fact[7][2] << endl;

	// cerr << fact[15][3] << endl;



	/*

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

		fact[i]=1.0*(i+1)*i/2.0*fact[i-1]; 

		cerr << fact[i] << endl;

	}

	*/



	rep(i,n){

		rep(mask,1<<i)rep(j,i+1) tmp[mask][j]=0.0;



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

			double cur=1.0;

			rep(j,i) if(mask&(1<<j)) rep(loop,a[j][i]) cur*=1.0*p/100.0; 

			tmp[mask][0]=(1.0-cur)*dp[mask];

		}

		

		

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

			for(int smask=(mask-1)&mask;;smask=(smask-1)&mask){

				int tmask=mask^smask;

				if(tmask>smask) break;

				double cur=1.0;

				rep(j,i)rep(k,i) if((smask&(1<<j))&&(tmask&(1<<k))) rep(loop,a[j][k]) cur*=1.0*p/100.0;

				rep(snum,i+1)rep(tnum,i+1) if(snum+tnum<=i) tmp[mask][snum+tnum+1]+=cur*tmp[smask][snum]*tmp[tmask][tnum];

			}

		}



		tmp[0][0]=1.0;

		rep(mask,1<<i){

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

				// cerr << mask << " " << num << " " << tmp[mask][num] << endl;

 				dp[mask|(1<<i)]+=tmp[mask][num]/fact[(1<<(num+1))-1][num];

			}

		}



	}

	cout.precision(20);

	cout << fixed << dp[(1<<n)-1] << endl;

	// rep(mask,1<<n) cerr << mask << " " << dp[mask] << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name

#define _rep(i,n) _range(i,0,n)

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

#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define bit(x) (1<<(x))

using namespace std;



int n,m,p;

int a[15][15];



using R=long double;

R dp[1<<14];



int main(void){

	cin >> n >> m >> p;

	rep(i,m){

		int u,v;

		cin >> u >> v;

		a[u-1][v-1]++;

		a[v-1][u-1]++;

	}



	rep(mask,1,1<<n){

		dp[mask]=1.0;		

		if(__builtin_popcount(mask)==1) continue;

		int limit=bit(31-__builtin_clz(mask));

		for(int add=(mask-1)&mask;add>=limit;add=(add-1)&mask){

			int root=add^mask;

			double cur=dp[add];

			rep(i,n)rep(j,n) if(root&bit(i)) if(add&bit(j)) rep(loop,a[i][j]) cur*=1.0*p/100.0; 

			dp[mask]-=cur;	

		}

	}

	cout.precision(20);

	cout << fixed << dp[(1<<n)-1] << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <iostream>

#include <string>

#include <cmath>

#include <bitset>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <deque>

#include <algorithm>

#include <complex>

#include <unordered_map>

#include <unordered_set>

#include <random>

#include <cassert>

#define bitcount __builtin_popcount

#define bitctz __builtin_ctz

using namespace std;

typedef long long int ll;

typedef pair<int, int> P;



int main()

{

	int n, m; double p;

	cin>>n>>m>>p; p/=100;

	int a[100], b[100];

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

		cin>>a[i]>>b[i]; a[i]--; b[i]--;

	}

	int ct[1<<14]={};

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

		for(int j=0; j<m; j++){

			if((i&(1<<a[j])) && (i&(1<<b[j]))) ct[i]++;

		}

	}

	double dp[15][1<<14]={};

	for(int i=0; i<n; i++) dp[1][1<<i]=1;

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

		if(bitcount(i)==1) continue;

		int t=bitctz(i);

		for(int j=i; j>0; j=(j-1)&i){

			if((j&(1<<t))==0) continue;

			if(j==i) continue;

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

				dp[k+1][i]+=(dp[k][i-j]*dp[1][j]*pow(p, (double)(ct[i]-ct[j]-ct[i-j])));

			}

		}

		dp[1][i]=1;

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

			dp[1][i]-=dp[k][i];

		}

	}

	printf("%.10lf\n", dp[1][(1<<n)-1]);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <iostream>

#include <string>

#include <cmath>

#include <bitset>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <deque>

#include <algorithm>

#include <complex>

#include <unordered_map>

#include <unordered_set>

#include <random>

#include <cassert>

#define bitcount __builtin_popcount

#define bitctz __builtin_ctz

using namespace std;

typedef long long int ll;

typedef pair<int, int> P;



int main()

{

	int n, m; double p;

	cin>>n>>m>>p; p/=100;

	int a[100], b[100];

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

		cin>>a[i]>>b[i]; a[i]--; b[i]--;

	}

	int ct[1<<14]={};

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

		for(int j=0; j<m; j++){

			if((i&(1<<a[j])) && (i&(1<<b[j]))) ct[i]++;

		}

	}

	double dp[1<<14]={};

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

		int t=bitctz(i);

		if(i==(1<<t)) continue;

		for(int j=i; j>0; j=(j-1)&i){

			if(j==i) continue;

			if((j&(1<<t))==0) continue;

			dp[i]+=((1-dp[j])*pow(p, (double)(ct[i]-ct[j]-ct[i-j])));

			

		}

	}

	printf("%.10lf\n", 1-dp[(1<<n)-1]);

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <vector>

#include <cstring>

#include <climits>

#include <algorithm>

#include <map>

using namespace std;



int N, p[30], min_times;



map<int,int> rot[4] = {

    { {1, 28}, {2, 29}, {3, 30}, {15, 16}, {19, 21}, },

    { {3, 22}, {6, 25}, {9, 28}, {12, 19}, {13, 15} },

    { {7, 22}, {8, 23}, {9, 24}, {13, 18}, {10, 12} },

    { {1, 24}, {4, 27}, {7, 30}, {10, 21}, {16, 18} }

};



vector<int> group_id = {

    0, 0, 0, 0, 0, 0, 0, 0, 0,

    9, 9, 9,

    12, 12, 12,

    15, 15, 15,

    18, 18, 18,

    21, 21, 21, 21, 21, 21, 21, 21, 21

};



void rotate(int i) {

    for (auto it=rot[i].begin(); it!=rot[i].end(); ++it) {

        swap(p[it->first - 1], p[it->second - 1]);

    }

}



bool isOK() {

    for (int i=0; i<(int)group_id.size(); ++i) {

        if (p[i] != p[group_id[i]]) return false;

    }

    return true;

}



int solve(int times, int &min_times) {

    if (8 <= times || min_times <= times || isOK()) {

        min_times = min(min_times, times);

        return times;

    }

    int ret = INT_MAX;

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

        rotate(i);

        ret = min(ret, solve(times + 1, min_times));

        rotate(i);

    }

    return ret;

}



int main() {

    cin >> N;

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

        for (int j=0; j<30; ++j) {

            cin >> p[j];

        }

        min_times = INT_MAX;

        cout << solve(0, min_times) << endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <vector>

#include <cstring>

#include <climits>

#include <algorithm>

#include <map>

using namespace std;



int N, p[30], min_times;



map<int,int> rot[4] = {

    { {1, 28}, {2, 29}, {3, 30}, {15, 16}, {19, 21}, },

    { {3, 22}, {6, 25}, {9, 28}, {12, 19}, {13, 15} },

    { {7, 22}, {8, 23}, {9, 24}, {13, 18}, {10, 12} },

    { {1, 24}, {4, 27}, {7, 30}, {10, 21}, {16, 18} }

};



vector<int> group_id = {

    0, 0, 0, 0, 0, 0, 0, 0, 0,

    9, 9, 9,

    12, 12, 12,

    15, 15, 15,

    18, 18, 18,

    21, 21, 21, 21, 21, 21, 21, 21, 21

};



void rotate(int i) {

    for (auto it=rot[i].begin(); it!=rot[i].end(); ++it) {

        swap(p[it->first - 1], p[it->second - 1]);

    }

}



bool isOK() {

    for (int i=0; i<(int)group_id.size(); ++i) {

        if (p[i] != p[group_id[i]]) return false;

    }

    return true;

}



int solve(int times, int &min_times) {

    if (min_times <= times || isOK()) {

        min_times = min(min_times, times);

        return times;

    } else if (times == 7) {

        return 8;

    }

    int ret = 8;

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

        rotate(i);

        ret = min(ret, solve(times + 1, min_times));

        rotate(i);

    }

    return ret;

}



int main() {

    cin >> N;

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

        for (int j=0; j<30; ++j) {

            cin >> p[j];

        }

        min_times = 8;

        cout << solve(0, min_times) << endl;

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<string>

#include<cctype>

using namespace std;

int main()

{

	int x,t;

	cin>>x>>t;

	int ans=x-t;

	if(ans>0)cout<<ans<<endl;

	else cout<<0<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b;

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

    if(a>b)//还有沙子是会倒完的（不然要a干什么）

    printf("%d\n",a-b);//回车了解一下？

    else

    printf("0\n");//是0，不是空，em··· 大佬的是错的。。。

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int x,y;

    cin>>x>>y;

    if(x>y) cout<<x-y<<endl;

    else cout<<0<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int a,b;

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

    if(a>b)//还有沙子是会倒完的（不然要a干什么）

    printf("%d\n",a-b);//回车了解一下？

    else

    printf("0\n");//是0，不是空，em··· 大佬的是错的。。。

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int x,t;



int main()

{

	cin>>x>>t;

	if(x-t>0) cout<<x-t<<endl;

	else cout<<"0"<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



long long n,t;



int main(void){

    scanf("%lld%lld",&n,&t);

    if(n-t<=0)

        return puts("0"),0;

    printf("%lld\n",n-t);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

	int a, b, c;

	cin >> a >> b;

	c = a - b;

	if(a - b < 0)

	{

		cout << 0 << endl;

	}

	else

	{

		cout << c << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main(){int a,b;scanf("%d%d",&a,&b);if(a>b)printf("%d\n",a-b);else printf("0\n");return 0;}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>  

using namespace std;  

int main()  

{  

    long long int x,t;  

    cin>>x>>t;  

    if(x-t==0)  

    {  

        cout<<0<<endl;  

    }  

    if(x-t>0)  

    {  

        cout<<x-t<<endl;  

    }  

    if(x-t<0)  

    {  

        cout<<0<<endl;  

    }  

    return 0;  

}  

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

    int x,y;

    while(~scanf("%d%d",&x,&y))

    {

        int ans;

        ans=x-y;

        if(ans>0)

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

        else

            printf("0\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define N (1<<17)

using namespace std;

typedef long long ll;



class RMQ{

public:

  ll n,dat[2*N-1];



  //?????????

  RMQ(){n=N;memset(dat,0,sizeof(dat));}

  

  //k???????????????a????????´

  void update(int k,ll a){

    k+=n-1;

    dat[k]=a;

    while(k>0){

      k=(k-1)/2;

      dat[k]=min(dat[k*2+1],dat[k*2+2]);

    }

  }



  //[a,b)???????°????????±???????

  //query(a,b,0,0,n)

  ll query(int a,int b,int k=0,int l=0,int r=N){

    if(r==-1) r=n;

    if(r<=a||b<=l)return 0;

    if(a<=l&&r<=b)return dat[k];

    else{

      ll v1=query(a,b,k*2+1,l,(l+r)/2);

      ll vr=query(a,b,k*2+2,(l+r)/2,r);

      return min(v1,vr);

    }

  }

};





ll x[N];

int main(){  

  ll n;

  cin>>n;

  RMQ rmq;

  for(int i=1;i<=n;i++) cin>>x[i];



  ll sum=n*(1+n)/2,cost=0;  

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

    ll mx=-rmq.query(1,x[i])+x[i];

    cost=max(cost,mx);

    rmq.update(x[i],-mx);

  }

  cout << sum-cost<<endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define N (1<<17)

#define INF 0

using namespace std;

typedef long long ll;



class RMQ{

public:

  ll n,dat[2*N-1];



  //?????????

  RMQ(){

    n=N;

    for(int i=0;i<n;i++) dat[i]=INF;

  }

  

  //k???????????????a????????´

  void update(int k,ll a){

    k+=n-1;

    dat[k]=a;

    while(k>0){

      k=(k-1)/2;

      dat[k]=min(dat[k*2+1],dat[k*2+2]);

    }

  }



  //[a,b)???????°????????±??????? query(a,b,0,0,n)

  ll query(int a,int b,int k=0,int l=0,int r=N){

    if(r<=a||b<=l)return INF;

    if(a<=l&&r<=b)return dat[k];

    ll vl=query(a,b,k*2+1,l,(l+r)/2);

    ll vr=query(a,b,k*2+2,(l+r)/2,r);

    return min(vl,vr);

  }

};





int main(){  

  ll n,x[N];

  cin>>n;

  RMQ rmq;

  for(int i=0;i<n;i++) cin>>x[i];



  ll sum=n*(1+n)/2,ans=sum;

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

    ll mx=-rmq.query(1,x[i])+x[i];

    ans=min(ans,sum-mx);

    rmq.update(x[i],-mx);

  }

  cout <<ans<<endl;

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,m;

    cin>>n>>m;

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

    return 0;

}


// Optimized solution to the same problem (faster):
#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");

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	int a, b, c;

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

	

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

{

	printf("3");

}

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

{

	printf("3");

}

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

{

	printf("1");

}

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

{

	printf("1");

}

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

{

	printf("2");

}

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

{

	printf("2");

}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	int a, b, c;

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

	

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

{

	printf("3");

}

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

{

	printf("3");

}

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

{

	printf("1");

}

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

{

	printf("1");

}

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

{

	printf("2");

}

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

{

	printf("2");

}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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";

		}

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	int a, b, c;

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

	

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

{

	printf("3");

}

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

{

	printf("3");

}

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

{

	printf("1");

}

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

{

	printf("1");

}

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

{

	printf("2");

}

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

{

	printf("2");

}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//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


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	int a, b, c;

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

	

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

{

	printf("3");

}

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

{

	printf("3");

}

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

{

	printf("1");

}

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

{

	printf("1");

}

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

{

	printf("2");

}

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

{

	printf("2");

}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

    

}






// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

	int a, b, c;

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

	

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

{

	printf("3");

}

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

{

	printf("3");

}

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

{

	printf("1");

}

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

{

	printf("1");

}

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

{

	printf("2");

}

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

{

	printf("2");

}

	return 0;

}

// Fastest known solution for this problem: