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
#include<bits/stdc++.h>
using namespace std;
pair<int, int> graf[101];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int k;
    cin >> k;
    for(int i = 1; i <= 99; i++) 
    {
        graf[i].first = i+1;
        graf[i].second = -1;
    }
    graf[100].first = graf[100].second = -1;
    int poz = 1;
    while(k > 1)
    {
        if(k % 2 == 0)
        {
            graf[poz].second = poz+2;
            k /= 2;
            poz += 2;
        }
        else
        {
            graf[poz].second = 100;
            poz++;
            k--;
        }
        
    }
    cout << 100 << '\n';
    for(int i = 1; i <= 100; i++) cout << graf[i].first <<" " << graf[i].second << '\n';


}