1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define pr(a, b) make_pair(a, b)
const int INF=1e9+7;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int k;
	cin >> k;
	vector<pair<int,int> >ans;
	while(k) {
		if(k%2==1) {
			--k;
			if(k) ans.push_back(pr(ans.size()+2, INF));
			else ans.push_back(pr(ans.size()+2, -1));
		} else {
			ans.push_back(pr(ans.size()+2, ans.size()+3));
			ans.push_back(pr(ans.size()+2, -1));
			k/=2;
		}
	}
	cout << ans.size()+1 << '\n';
	for(auto i : ans) {
		if(i.second==INF) i.second=ans.size()+1;
		cout << i.first << " " << i.second << '\n';
	}
	cout << "-1 -1" << '\n';
}