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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>

using namespace std;

vector<pair<int, int>> v(110);
vector<long long> dp(110, 0);
long long k;
vector<int> g[110];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    for (int i=1; i<99; ++i) {
        v[i].first = i+1;
        g[i+1].push_back(i);
        v[i].second = -1;
    }
    v[99] = {-1, -1};
    v[100] = {-1, -1};

    for (int i=1; i<=83; ++i) {
        if (i % 2) {
            v[i].second = i + 3;
            g[i+3].push_back(i);
        }
    }

    dp[1] = 1;
    for (int i=2; i<=100; ++i) {
        for (auto u: g[i])
            dp[i] += dp[u];
    }

    cin >> k;
    for (int i=43; i>0; --i) {
        if (k > 0 && k - dp[i*2] >= 0) {
            k -= dp[i*2];
            g[100].push_back(i*2);
            v[i*2].second = 100;
        }
    }


    dp[1] = 1;
    for (auto u: g[100])
        dp[100] += dp[u];

    cout << 100 << endl;
    for (int i=1; i<=100; ++i) {
        cout << v[i].first << ' ' << v[i].second << endl;
    }
    
}