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
54
55
56
57
58
59
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int k;

    cin >> k;

    string c, s = bitset<31>(k).to_string();

    cout << "93\n2 ";

    if (s[s.length() - 1] == '0')
    {
        cout << "-1\n";
    }
    else
    {
        cout << "93\n";
    }

    int n = 2;

    for (int i = s.length() - 2; i >= 0; i-=2)
    {
        cout << n + 1 << " " << n + 2 << endl;
        cout << n + 3 << " " << n + 4 << endl;
        cout << n + 3 << " " << n + 4 << endl;
        cout << n + 5 << " " << -1    << endl;

        if (s[i] == '0')
        {
            cout << n + 5 << " " << -1 << endl;
        }
        else
        {
            cout << n + 5 << " " << 93 << endl;
        }
        
        if (s[i - 1] == '0')
        {
            cout << n + 6 << " " << -1 << endl;
        }
        else
        {
            cout << n + 6 << " " << 93 << endl;
        }

        n += 6;
    }

    cout << "-1 -1\n-1 -1";
}