stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
 #include<iostream>

 #include<string>

 using namespace std;



 int main()

 {

     int N,L,i,j;

     string s[101];

     string a[10001];

     string temp;



     cin>>N>>L;

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

        cin>>s[i];

     }



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

        for(j=0;j<N-1-i;j++){

            if(s[j]>s[j+1]){

                temp = s[j];

                s[j] = s[j+1];

                s[j+1] = temp;

            }

        }

     }

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

        cout<<s[i];

     }

     cout<<endl;



     return 0;

 }


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



using namespace std;

#define pi acos(-1)

#define _terminated return 0

#define endl "\n"

#define yes cout << "yes" << endl 

#define no cout << "no" << endl 

#define booster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);





typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vll;

typedef vector<vector<long> > v2l;



const int mod = 1e+5;

const int mx = 2e+5;

const ll inf = 1e18;



void upper_bubble_sort(){

     int i,j,temp,number_of_input;

     int array[100];

     cin >> number_of_input;

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

         cin >> array[i];

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

             for(j=0; j<(number_of_input-i-1); j++){

               if(array[j] > array[j+1]){

                 temp = array[j];

                 array[j] = array[j+1];

                 array[j+1] = temp;

                }

              }

         }

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

      cout << array[i] << endl;

}

void bst(void){

          int low,high,mid,keynum,num,array[100];

          cin >> keynum;

          low = 1;

	         high = num;

         	do{

		        mid = (low + high) / 2;

		         if(keynum < array[mid])

			         high = mid - 1;

		         else if (keynum > array[mid])

			         low = mid + 1;

	         } 

          while (keynum != array[mid] && low <= high);

	        if(keynum == array[mid]){

            cout << "number located at " << mid +1 << endl;}

         else

           no;

        }

#define max 101

void solve(){ 

	   int N,L;

    string S[max];

    cin >> N >> L;

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

       cin >> S[i];

       sort(S,S+N);

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

       cout << S[i];

    cout << endl;

}

    

    

int main(){

    booster;

    solve();

    _terminated;

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

 #include<string>

 using namespace std;



 int main()

 {

     int N,L,i,j;

     string s[101];

     string a[10001];

     string temp;



     cin>>N>>L;

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

        cin>>s[i];

     }



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

        for(j=0;j<N-1-i;j++){

            if(s[j]>s[j+1]){

                temp = s[j];

                s[j] = s[j+1];

                s[j+1] = temp;

            }

        }

     }

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

        cout<<s[i];

     }

     cout<<endl;



     return 0;

 }


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

using namespace std;



int main()

{

    int n, m;

    cin>> n >> m;



    string input;



    vector<string>vec;



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

    {

        cin>> input;

        vec.push_back(input);

    }



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



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

    {

        cout<< vec[i];

    }



    return 0;

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

 #include<string>

 using namespace std;



 int main()

 {

     int N,L,i,j;

     string s[101];

     string a[10001];

     string temp;



     cin>>N>>L;

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

        cin>>s[i];

     }



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

        for(j=0;j<N-1-i;j++){

            if(s[j]>s[j+1]){

                temp = s[j];

                s[j] = s[j+1];

                s[j+1] = temp;

            }

        }

     }

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

        cout<<s[i];

     }

     cout<<endl;



     return 0;

 }


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

using namespace std;

int main()

{

    long long n,i,l;

    cin>>n>>l;

    vector<string>m(n);

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

    {

        cin>>m[i];

    }

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

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

    {

        cout<<m[i];

    }

    cout<<endl;

    return 0;

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

using namespace std;

 

typedef long long LL;

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<double> VD;

#define MP make_pair

#define PB push_back

#define X first

#define Y second

 

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

#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)

#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

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

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

#define FILL(a, value) memset(a, value, sizeof(a))

#define debug(a) cout << #a << " = " << a << endl;



const double PI = acos(-1.0);

const LL INF = 1e9 + 47;

const LL LINF = INF * INF;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



const int N = 1 << 18;

int n;

PII e[N];

int ptr;



void add(int u, int v)

{

	e[ptr++] = {u, v};

}



int main()

{

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

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

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

	

	cin >> n;

	if (__builtin_popcount(n) == 1)

	{

		cout << "No";

		return 0;

	}

	

	cout << "Yes" << endl;

	

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

	{

		add(1, i);

		add(i, i + 1);

		add(1, n + i + 1);

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

	}

	

	add(n + 1, n + 2);

	

	if (n % 2 == 0)

	{

		int ksor = n ^ (n - 1);

		add(2 * n, 2 * n - 1);

		add(n, ksor - 1);

	}

	

	assert(ptr == 2 * n - 1);	

	FOR(i, 0, ptr)

		cout << e[i].X << ' ' << e[i].Y << endl;

	

	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;

	return 0;

}


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

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

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

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

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

	}

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

	if (n!=m-1){

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

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

	}

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

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

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

	}

	return 0;

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

#include<cstdio>

using namespace std;

int n;

int main()

{

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

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

	scanf("%d",&n);

	int m=1;

	while(m<n) m<<=1;

	if(n<3||m==n)

    {

        printf("No");

        return 0;

    }

	printf("Yes\n");

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

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

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

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

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

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

    {

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

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

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

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

    }

    if(n%2==0)

    {

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

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

            {

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

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

                break;

            }

	}

	return 0;

}

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

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

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

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

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

	}

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

	if (n!=m-1){

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

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

	}

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

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

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

	}

	return 0;

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

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

#define per(i,a,b) for(int i=(a);i>=(b);i--)

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

#define fi first

#define se second

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pii;

typedef vector<int> vi;

typedef long long ll;

 

template<class T> inline void read(T &x){

	int f=0;x=0;char ch=getchar();

	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');

	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';

	if(f)x=-x;

}



vector<pii> ans;

int n; 



void add(int a,int b){

	ans.pb(mp(a,b));

}



int main(){

	read(n);

	if(n<=2)return puts("No"),0;

	int k=log(n+0.1)/log(2);

	if(n==(1<<k))return puts("No"),0;

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

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

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

		add(1,k),add(k,k+1),

		add(1,n+k+1),add(n+k+1,n+k);

	if(n%2==0){

		int p=__builtin_ctz(n);

		int t=n-(1<<p);

		add(n,1<<p);

		add(n*2,n+t+1);

	}

	puts("Yes");

	for(auto x:ans)

		printf("%d %d\n",x.fi,x.se);

	return 0;

}

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

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

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

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

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

	}

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

	if (n!=m-1){

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

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

	}

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

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

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

	}

	return 0;

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

#include <iostream>

#include <algorithm>

#include <cstring>

#define PII pair<int,int>

#define MP make_pair

#define fir first

#define sec second

#define PB push_back

#define db long double

#define ll long long

using namespace std;

template <class T>

inline void rd(T &x) {

	x=0; char c=getchar(); int f=1;

	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }

	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;

}

int n;

int lowbit(int x) {

	int y=1;

	while(!(x&y)) y<<=1;

	return y;

}

int main() {

	rd(n);

	int k=1; while(k<n) k<<=1;

	if(k==n) { printf("No\n"); return 0; }

	printf("Yes\n");

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

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

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

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

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

	for(int j=4;j+1<=n;j+=2) {

		int k=j+1;

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

		printf("%d %d\n",j,n+k);

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

		printf("%d %d\n",k,n+j);

	}

	if(!(n&1)) {

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

			int y=n^x^1;

			if(y>=2&&y<=n-1) {

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

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

				break;

			}

		}

	}

	return 0;

}


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

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

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

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

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

	}

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

	if (n!=m-1){

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

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

	}

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

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

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

	}

	return 0;

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

using namespace std;

 

typedef long long LL;

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<double> VD;

#define MP make_pair

#define PB push_back

#define X first

#define Y second

 

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

#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)

#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

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

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

#define FILL(a, value) memset(a, value, sizeof(a))

#define debug(a) cout << #a << " = " << a << endl;



const double PI = acos(-1.0);

const LL INF = 1e9 + 47;

const LL LINF = INF * INF;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



const int N = 1 << 18;

int n;

PII e[N];

int ptr;



void add(int u, int v)

{

	e[ptr++] = {u, v};

}



int main()

{

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

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

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

	

	cin >> n;

	if (__builtin_popcount(n) == 1)

	{

		cout << "No";

		return 0;

	}

	

	cout << "Yes" << endl;

	

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

	{

		add(1, i);

		add(i, i + 1);

		add(1, n + i + 1);

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

	}

	

	add(n + 1, n + 2);

	

	if (n % 2 == 0)

	{

		int ksor = n ^ (n - 1);

		add(2 * n, 2 * n - 1);

		add(n, ksor - 1);

	}

	

	assert(ptr == 2 * n - 1);	

	FOR(i, 0, ptr)

		cout << e[i].X << ' ' << e[i].Y << endl;

	

	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.46016667962207x):
#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);

	}

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

#include<cstdio>

using namespace std;

int n;

int main()

{

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

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

	scanf("%d",&n);

	int m=1;

	while(m<n) m<<=1;

	if(n<3||m==n)

    {

        printf("No");

        return 0;

    }

	printf("Yes\n");

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

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

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

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

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

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

    {

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

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

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

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

    }

    if(n%2==0)

    {

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

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

            {

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

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

                break;

            }

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.24529013625741x):
#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);

	}

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

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

#define per(i,a,b) for(int i=(a);i>=(b);i--)

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

#define fi first

#define se second

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pii;

typedef vector<int> vi;

typedef long long ll;

 

template<class T> inline void read(T &x){

	int f=0;x=0;char ch=getchar();

	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');

	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';

	if(f)x=-x;

}



vector<pii> ans;

int n; 



void add(int a,int b){

	ans.pb(mp(a,b));

}



int main(){

	read(n);

	if(n<=2)return puts("No"),0;

	int k=log(n+0.1)/log(2);

	if(n==(1<<k))return puts("No"),0;

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

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

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

		add(1,k),add(k,k+1),

		add(1,n+k+1),add(n+k+1,n+k);

	if(n%2==0){

		int p=__builtin_ctz(n);

		int t=n-(1<<p);

		add(n,1<<p);

		add(n*2,n+t+1);

	}

	puts("Yes");

	for(auto x:ans)

		printf("%d %d\n",x.fi,x.se);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.274287306546574x):
#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);

	}

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

#include <iostream>

#include <algorithm>

#include <cstring>

#define PII pair<int,int>

#define MP make_pair

#define fir first

#define sec second

#define PB push_back

#define db long double

#define ll long long

using namespace std;

template <class T>

inline void rd(T &x) {

	x=0; char c=getchar(); int f=1;

	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }

	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;

}

int n;

int lowbit(int x) {

	int y=1;

	while(!(x&y)) y<<=1;

	return y;

}

int main() {

	rd(n);

	int k=1; while(k<n) k<<=1;

	if(k==n) { printf("No\n"); return 0; }

	printf("Yes\n");

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

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

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

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

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

	for(int j=4;j+1<=n;j+=2) {

		int k=j+1;

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

		printf("%d %d\n",j,n+k);

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

		printf("%d %d\n",k,n+j);

	}

	if(!(n&1)) {

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

			int y=n^x^1;

			if(y>=2&&y<=n-1) {

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

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

				break;

			}

		}

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.233792477006249x):
#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);

	}

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

#include <cstdio>

using namespace std;

int n;

inline int read()

{

	int x = 0, f = 1; char ch = getchar();

	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}

	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}

	return x * f;

}

int main()

{

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

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

	n = read();

	if(!(n & (n - 1))) {puts("No"); return 0;}

	puts("Yes"); puts("1 2"); puts("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 + 1 <= n; i += 2)

	{

		int j = i + 1;

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

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

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

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

	}

	if(n % 2 == 0)

	{

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

		{

			int j = n ^ i ^ 1;

			if(j != 3 && j < n)

			{

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

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

				return 0;

			}

		}

	}

	fclose(stdin);

	fclose(stdout);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.26838826215384x):
#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);

	}

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.282052007377057x):
#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);

	}

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.245864431525261x):
#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);

	}

}
// Slower C++ solution:
#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);

}

// Faster C++ solution for the same problem (measured speedup: 5.2589854015602855x):
#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);

}