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

#include<cstdio>

using namespace std;

int n;

int vis[100010];

int main()

{

	for(int i=1;i<=100000;i<<=1)vis[i]=1;

	cin>>n;

	if(vis[n])return puts("No")==2333;

	puts("Yes");

	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",n+1,n+1,n+2,n+2,n+3);

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

	{

		printf("%d %d\n",1,i);printf("%d %d\n",1,i+1);

		printf("%d %d\n",i,n+i+1);printf("%d %d\n",i+1,n+i);

	}

	if(n%2==0)for(int i=2,p;i<=n;++i)

		{

			p=i^1^n;

			if(1<p&&p<n)

			{

				if(i==2)printf("%d %d\n",n,n+i);

				else printf("%d %d\n",n,i);

				printf("%d %d\n",p,n+n);

				break;

			}

		}

	return 0;

}

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



using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int z=1;

	while(z*2<=n)z*=2;

	if(n==z){

		printf("No\n");

		return 0;

	}

	printf("Yes\n");

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

		printf("%d %d\n",1,i);

		printf("%d %d\n",i,i+1+n);

		printf("%d %d\n",1,i+1);

		printf("%d %d\n",i+1,i+n);

	}

	printf("%d %d\n",n+1,2+n);

	if(n%2==0){

		printf("%d %d\n",z+1,n);

		printf("%d %d\n",n-z,2*n);

	}

}

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

using namespace std;

#define Maxn 200007

int n;

void print(int x,int y)

{

    printf("%d %d\n",x,y);

}

int main()

{

    scanf("%d",&n);

    int tmp=n;

    while (tmp%2==0) tmp/=2;

    if (tmp==1)

    {

        printf("No\n");

        return 0;

    }

    printf("Yes\n");

    print(1,2);

    print(2,3);

    print(3,n+1);

    print(n+1,n+2);

    print(n+2,n+3);

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

    {

        print(i,i+1);

        print(i+1,n+2);

        print(n+3,n+i);

        print(n+i,n+i+1);

    }

    if (n%2==0)

    {

        print(n-1,n);

        int r=(n-1)^n;

        if (r==3) print(n+1,n+n);

        else

        {

            r^=1;

            print(n+r,n+n);

        }

    }

    return 0;

}

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



using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int z=1;

	while(z*2<=n)z*=2;

	if(n==z){

		printf("No\n");

		return 0;

	}

	printf("Yes\n");

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

		printf("%d %d\n",1,i);

		printf("%d %d\n",i,i+1+n);

		printf("%d %d\n",1,i+1);

		printf("%d %d\n",i+1,i+n);

	}

	printf("%d %d\n",n+1,2+n);

	if(n%2==0){

		printf("%d %d\n",z+1,n);

		printf("%d %d\n",n-z,2*n);

	}

}

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

using namespace std;

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

int n, t=1, u=2;

int main(){

	scanf("%d", &n);

	for(;t<n;t*=2);

	if(t==n) return 0*puts("No");

	puts("Yes");

	if(n==3) return 0*printf("1 2\n2 3\n3 4\n4 5\n5 6\n");

	t/=2;

	for(;u<t;u++) printf("%d %d\n%d %d\n", u-1,u,u-1+n,u+n);

	printf("%d %d\n", u-1,1+n);

	for(;u<n;u+=2) printf("%d %d\n%d 1\n1 %d\n%d %d\n", u,u+1,u+1,u+n,u+n,u+n+1);

	if(n==u) printf("%d %d\n%d %d\n", n,u%4==2?t+1:t+n,u^t,n+n);

}

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

int n,t=1,u=4;

int main(){

	scanf("%d", &n);

	for(;t*2<=n;t*=2);

	if(t==n) return 0*puts("No");

	puts("Yes");

	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",n+1,n+1,n+2,n+2,n+3);

	for(;u<n;u+=2) printf("%d %d\n%d 1\n1 %d\n%d %d\n", u+1,u,u,u+n+1,u+n+1,u+n);

	if(n==u) printf("%d %d\n%d %d\n", n,u^t,t+1+n,n*2);

}

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

#pragma GCC optimize("Ofast", "unroll-loops")

#define ll long long 

#define pii pair<int, int>

#define ull unsigned ll

#define f first

#define s second

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

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

#define RREP(i,n) for (int i=(n-1); i>=0; i--)

#define ALL(x) x.begin(),x.end()

#define SZ(x) x.size()

#define SQ(x) (x)*(x)

#define MNTO(a,b) a = min(a,(__typeof__(a))(b))

#define MXTO(a,b) a = max(a,(__typeof__(a))(b))

#define pb push_back

#define debug(x) cerr<<#x<<" is "<<x<<endl

using namespace std;



// #define int ll



const int maxn = 1e5+5;

const int iinf = 1<<29;

const ll inf = 1ll<<60;

const ll mod = 1e9+7;





void GG(){cout<<"No\n"; exit(0);}



ll pow(ll a, ll n){ // a^n % mod

    ll re=1;

    while (n>0){

        if (n&1) re = re*a %mod;

        a = a*a %mod;

        n>>=1;

    }

    return re;

}



ll inv (ll b){

    if (b==1) return b;

    return (mod-mod/b) * inv(mod%b) % mod;

}



int n; 



int id (int x){

    if (x>n) return x-n;

    return x;

}



main(){

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

    cin>>n;

    if (1<<((int)log2(n))==n) {

        GG();

    }

    cout<<"Yes\n";

    cout<<1+n<<' '<<2+n<<'\n';

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

        cout<<i<<' '<<1<<'\n';

        cout<<i+1<<' '<<1<<'\n';

        cout<<i+1+n<<' '<<i<<'\n';

        cout<<i+n<<' '<<i+1<<'\n';

    }

    if (n%2==0){

        int lb = n&(-n);

        int cp = n-lb;

        cout<<n<<' '<<lb+1<<'\n';

        cout<<n+n<<' '<<cp<<'\n';

    }

}

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

using namespace std;

int n;

int main()

{

	scanf("%d",&n);

	if(n<3){printf("No\n");return 0;}

	if(n&1)

	{

		printf("Yes\n");

		printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

		for(int i=4;i<=n;i+=2)printf("%d %d\n",i,i+1),printf("%d %d\n",i+n,i+n+1),printf("%d %d\n",i,1),printf("%d %d\n",i+n+1,1);

	}

	else

	{

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

		if((n^i^1)<n)

		{

			int st=n^i^1;

			printf("Yes\n");

			printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

			for(int j=4;j<n;j+=2)printf("%d %d\n",j,j+1),printf("%d %d\n",j+n,j+n+1),printf("%d %d\n",j,1),printf("%d %d\n",j+n+1,1);

			printf("%d %d\n",n,(i&1)?i+n:i);printf("%d %d\n",n*2,(st&1)?st+n:st);

			return 0;

		}

		printf("No\n");

	}

}


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

#include<iostream>

#define out(u,v) printf("%d %d\n",u,v)

#define lowbit(x) (x&(-x))

using namespace std;

int n,m,a,b;

int main(){

    // freopen("atcoder5140.in","r",stdin);

    // freopen("atcoder5140.out","w",stdout);

    scanf("%d",&n);

    if(n==lowbit(n)||n<3) return puts("No"),0;

    puts("Yes");

    out(1,2);out(2,3);out(3,n+1);out(n+1,n+2);out(n+2,n+3);

    for(int i=4;i<n;i+=2) out(1,i+1),out(i+1,i),out(1,i+n),out(i+n,i+1+n);

    if(!(n&1)) out(n,lowbit(n)+n),out(n+n,(n^lowbit(n))^1);

    return 0;

}


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

using namespace std;

int n;

int main()

{

	scanf("%d",&n);

	if(n<3){printf("No\n");return 0;}

	if(n&1)

	{

		printf("Yes\n");

		printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

		for(int i=4;i<=n;i+=2)printf("%d %d\n",i,i+1),printf("%d %d\n",i+n,i+n+1),printf("%d %d\n",i,1),printf("%d %d\n",i+n+1,1);

	}

	else

	{

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

		if((n^i^1)<n)

		{

			int st=n^i^1;

			printf("Yes\n");

			printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

			for(int j=4;j<n;j+=2)printf("%d %d\n",j,j+1),printf("%d %d\n",j+n,j+n+1),printf("%d %d\n",j,1),printf("%d %d\n",j+n+1,1);

			printf("%d %d\n",n,(i&1)?i+n:i);printf("%d %d\n",n*2,(st&1)?st+n:st);

			return 0;

		}

		printf("No\n");

	}

}


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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <iostream>



using namespace std;



int main()

{

	int N; scanf("%d",&N);

	int t;

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

		if(N == i)

		{

			printf("No\n");

			return 0;

		}

	if(N == 3)

	{

		printf("Yes\n");

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

			printf("%d %d\n",i,i + 1);

	}

	else

	{

		puts("Yes");

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

		{

			printf("%d %d\n", 1, i);

			printf("%d %d\n", i, i+1);

			printf("%d %d\n", 1, N+i+1);

			printf("%d %d\n", N+i+1, N+i);

		}

		printf("%d %d\n", N+1, 3);

		if(!(N&1))

		{

			printf("%d %d\n", N, N^t);

			printf("%d %d\n", N*2, N+(t^1));

		}

	}

}

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

using namespace std;

int n;

int main()

{

	scanf("%d",&n);

	if(n<3){printf("No\n");return 0;}

	if(n&1)

	{

		printf("Yes\n");

		printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

		for(int i=4;i<=n;i+=2)printf("%d %d\n",i,i+1),printf("%d %d\n",i+n,i+n+1),printf("%d %d\n",i,1),printf("%d %d\n",i+n+1,1);

	}

	else

	{

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

		if((n^i^1)<n)

		{

			int st=n^i^1;

			printf("Yes\n");

			printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

			for(int j=4;j<n;j+=2)printf("%d %d\n",j,j+1),printf("%d %d\n",j+n,j+n+1),printf("%d %d\n",j,1),printf("%d %d\n",j+n+1,1);

			printf("%d %d\n",n,(i&1)?i+n:i);printf("%d %d\n",n*2,(st&1)?st+n:st);

			return 0;

		}

		printf("No\n");

	}

}


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

#include<iostream>

#include<vector>

using namespace std;

typedef pair<int,int> PII;

int n;

int pos[400050],rnk[400050];

vector<PII> an;

int main()

{

	scanf("%d",&n);

	int k=0;

	while((1<<k)<n)

	{

		++k;

	}

	if(n==(1<<k))

	{

		printf("No\n");

		return 0;

	}

	pos[1]=1;

	an.push_back(make_pair(n+1,3));

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

	{

		int m=1<<i;

		an.push_back(make_pair(1<<(i-1),m));

		an.push_back(make_pair(m+n,m+1+n)); 

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

		{

			rnk[pos[j]]=j;

		}

		for(int j=1;j<m&&j+m<=n;++j)

		{

			an.push_back(make_pair(m+j+n,rnk[j]));

			an.push_back(make_pair(m+j,m));

			pos[j+m]=j;

			pos[j]=pos[j]+m; 

		}

		pos[m]=m;

	}

	printf("Yes\n");

	for(unsigned int i=0;i<an.size();++i)

	{

		printf("%d %d\n",an[i].first,an[i].second);

	}

	return 0;

} 

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

using namespace std;

int n;

int main()

{

	scanf("%d",&n);

	if(n<3){printf("No\n");return 0;}

	if(n&1)

	{

		printf("Yes\n");

		printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

		for(int i=4;i<=n;i+=2)printf("%d %d\n",i,i+1),printf("%d %d\n",i+n,i+n+1),printf("%d %d\n",i,1),printf("%d %d\n",i+n+1,1);

	}

	else

	{

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

		if((n^i^1)<n)

		{

			int st=n^i^1;

			printf("Yes\n");

			printf("%d %d\n",1,2);printf("%d %d\n",2,3);printf("%d %d\n",3,n+1);printf("%d %d\n",n+1,n+2);printf("%d %d\n",n+2,n+3);

			for(int j=4;j<n;j+=2)printf("%d %d\n",j,j+1),printf("%d %d\n",j+n,j+n+1),printf("%d %d\n",j,1),printf("%d %d\n",j+n+1,1);

			printf("%d %d\n",n,(i&1)?i+n:i);printf("%d %d\n",n*2,(st&1)?st+n:st);

			return 0;

		}

		printf("No\n");

	}

}


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

using namespace std;

int main()

{

    int a,n,b,i,flag=0,j;

    cin>>a;

    cin>>b;

    if(a>=1&&a<=9&&b>=1&&b<=9)

        cout<<a*b;

    else

        cout<<"-1";



}

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



int main(){

	

	

	int a,b;

	

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

	

	if(a<=9 && b<=9){

		

		printf("%d\n",a*b);

		

		

	}	

	

	else{

		printf("-1\n");

	}

	

	return 0;

}


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

using namespace std;

#pragma GCC optimize ("03")

#pragma GCC optimize ("unroll-loops")

#define ll long long

#define ms(a,b) memset(a,b,sizeof(a))

#define endl '\n'

#define pb push_back

#define mp(a,b) make_pair(a,b)

#define mpp(a,b,c) make_pair(a,make_pair(b,c))

#define fi first

#define se second

#define rep(a,b,c) for(int a=b;a<=c;a++)

#define repp(a,b,c) for(int a=b;a>=c;a--)



int main(){

/////////////////////////////////////////////

//	ios_base::sync_with_stdio(0);

//	cin.tie(0); cout.tie(0);

/////////////////////////////////////////////

	ll a,b;

	cin >> a >> b;

	if(a <10 && b<10)cout << a*b << endl;

	else cout << "-1" << 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<=9 && b<=9){

		

		printf("%d\n",a*b);

		

		

	}	

	

	else{

		printf("-1\n");

	}

	

	return 0;

}


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

using namespace std;



int main() {

	int a, b;

	cin>>a>>b; 

	if (a>9 || b>9)

	cout<<"-1";

	else

	cout<<a*b;

	return 0;

}

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



int main(){

	

	

	int a,b;

	

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

	

	if(a<=9 && b<=9){

		

		printf("%d\n",a*b);

		

		

	}	

	

	else{

		printf("-1\n");

	}

	

	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<=9) && (B<=9)) {

		cout << A*B << endl;

	} else {

		cout << -1 << endl;

	}

}


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



int main(){

	

	

	int a,b;

	

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

	

	if(a<=9 && b<=9){

		

		printf("%d\n",a*b);

		

		

	}	

	

	else{

		printf("-1\n");

	}

	

	return 0;

}


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

using namespace std;

typedef long long ll;

const int N = 2e5+10 , OO = 0x3f3f3f3f;



#define clr(arr,val) memset(arr , val , sizeof (arr))

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

#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)

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

#define range(n) for(int &x : n) cin >> x;

#define ALL(v) ((v).begin()) , ((v).end())

#define SZ(v)  ((int)((v).size()))

typedef pair <int,int> pii ;

typedef vector < pii > vii ;

typedef vector < int > vi;

int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

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

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



int rkm1 , rkm2;





int main()

{   



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



      cin >> rkm1 >> rkm2;

      if(rkm1 >= 1 && rkm1 <= 9 && rkm2 >= 1 && rkm2 <= 9)

            cout << (rkm1*rkm2) << "\n";

      else cout << "-1\n";











    

      return 0;

}

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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    if(a>=1&&a<=9&&b>=1&&b<=9)

        cout<<a*b<<endl;

    else

        cout<<-1<<endl;

    return 0;

}

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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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

using namespace std;



int main()

{

    int a, b; cin >> a >> b;

    

    if (a >= 1 and a <= 9 and b >= 1 and b <= 9) cout << a*b;

    else cout << -1;



    return 0;

}


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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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

using namespace std;

int main()

{

    int A,B;

    cin >> A >> B;

    if(A<=9 && B<=9)

    {

        int result = A*B;

        cout << result << endl;

    }

    else

    {

        cout << "-1" << endl;

    }

    return 0;





}

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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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



using namespace std;



int main()

{

 int A,B;

 cin>>A>>B;

 if(A<=9&&B<=9)

 {

     cout<<A*B;

 }

else

{

    cout<<-1;

}

    return 0;

}


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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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

using namespace std;

/*const int N = 1e5+5;

int a[N]; // our input array */



int main(){





	int a,b;

	cin>>a>>b;

	if( a<=9 && b<=9)

		cout<<a*b<<endl;

	else

		cout<<-1<<endl;

    

	return 0;

}


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



int main(){

    int a,b;

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

    if (1<=a && a<=9 && 1<=b && b<=9){

        printf("%d",a*b);

    }else{

        printf("%d",-1);

    }

}

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

#include <vector>

#include <algorithm>

#include <string>

#include <map>

#include <cmath>

#include <queue>

#include <numeric>

#include <climits>

#include <iterator>

#include <iomanip>

#include <stack>

#include <set>

#include <bitset>

#include <functional>

using namespace std;

const constexpr int INF = 1e9;

//typedef std::pair<std::string,double> P;



#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)

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



typedef long long ll;

typedef vector<int> VI;

const constexpr ll MOD = 1e9+7;

 

struct Less {

    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {

        return x.first > y.first;

    }

};



ll GCD(ll a, ll b){

    if(b==0) return a;

    return GCD(b, a%b);

}





//グラフの隣接リスト

VI g[200010];

//頂点の入次数を管理

int h[100010];



ll N, X;

ll x[100010];

int main(){

    cin >> N >> X;

    REP(i, N) {

        cin >> x[i];

        x[i] = abs(x[i]-X);

    }

    ll ans=x[0];

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

        if(ans<x[i]) ans =GCD(x[i], ans);

        else ans = GCD(ans, x[i]);

    }

    cout << ans << endl; 

    return 0;

}

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

#include <climits>

#include <iostream>

#include <string>

#include <vector>

#include <set>

#include <cmath>

#include <stack>

#include <algorithm>

#include <iomanip>

#include <map>

#include <queue>

#include <functional>

#include <numeric>

#include <chrono>

#include <cstdlib>

using ll = long long;

using namespace std;



const ll MOD = 1e9 + 7;

const double pi = acos(-1);

typedef pair<int, int> P;

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

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

#define EPS 1e-4

#define OUTPUT(i) (cout << (ll)i << endl)

#define ALL(a) ((a).begin(), (a).end())



bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)

{



    if (a.first == b.first)

        return a.second < b.second;



    return a.first < b.first;

}



ll gcd(ll a, ll b)

{

    if (b == 0)

        return a;

    return gcd(b, a % b);

}

vector<ll> v;

int main()

{

    cin.tie(0);

    ios::sync_with_stdio(false);



    //cout << fixed << setprecision(15);



    ll N, X;

    cin >> N >> X;



    REP(i, N)

    {

        ll a;

        cin >> a;

        v.push_back(a);

    }

    v.push_back(X);

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



    ll ans = v[1] - v[0];

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

    {

        ans = gcd(ans, v[i] - v[i - 1]);

    }

    cout << ans << endl;

    return 0;

}


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

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

#define print(x) cout << (x) << endl;

#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 

#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;

#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}

#define INF (1e9)

typedef long long ll;

typedef struct{

    int x;

    int y;

} P;

ll my_gcd( ll m, ll n )

{

	// 引数に０がある場合は０を返す

	if ( ( 0 == m ) || ( 0 == n ) )

		return 0;

	

	// ユークリッドの方法

	while( m != n )

	{

		if ( m > n ) m = m - n;

		else         n = n - m;

	}

	return m;

}//gcd



using namespace std;



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    int N,X;

    ll x[100010];

    cin >> N >> X;

    rep(i,0,N){

        cin >> x[i];

    }

    ll d[100010] = {};

    rep(i,0,N){

        d[i] = abs(X - x[i]);

    }

    ll ans = d[0];

    ll d_tmp[100010] = {};

    if(N % 2 == 0){

        rep(j,0,N/2){

            d_tmp[j] = my_gcd(d[2*j],d[2*j+1]);

        }

        rep(j,0,N/2){

            ans = my_gcd(ans, d_tmp[j]);

        }

    }else{

        rep(j,0,(N-1)/2){

            d_tmp[j] = my_gcd(d[2*j],d[2*j+1]);

        }

        rep(j,0,(N-1)/2){

            ans = my_gcd(ans, d_tmp[j]);

        }

        ans = my_gcd(ans, d[N-1]);



    }

    print(ans);







}


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

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

#define print(x) cout << (x) << endl;

#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 

#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;

#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}

#define INF (1e9)

typedef long long ll;

typedef struct{

    int x;

    int y;

} P;

ll gcd( ll m, ll n )

{

    if (n == 0){

        return m;

    }else{

        return gcd(n, m % n);

    }

}



using namespace std;



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    int N,X;

    ll x[100010];

    cin >> N >> X;

    rep(i,0,N){

        cin >> x[i];

    }

    ll d[100010] = {};

    rep(i,0,N){

        d[i] = abs(X - x[i]);

    }

    ll ans = d[0];

    rep(i,1,N){

        ans = gcd(ans, d[i]);

    }

    print(ans);

    // if(N % 2 == 0){

    //     rep(j,0,N/2){

    //         d_tmp[j] = my_gcd(d[2*j],d[2*j+1]);

    //     }

    //     rep(j,0,N/2){

    //         ans = my_gcd(ans, d_tmp[j]);

    //     }

    // }else{

    //     rep(j,0,(N-1)/2){

    //         d_tmp[j] = my_gcd(d[2*j],d[2*j+1]);

    //     }

    //     rep(j,0,(N-1)/2){

    //         ans = my_gcd(ans, d_tmp[j]);

    //     }

    //     ans = my_gcd(ans, d[N-1]);



    // }







}


// Fastest known solution for this problem: