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
#include <iostream>
#include <vector>
#include <bitset>

int main()
{
    std::ios_base::sync_with_stdio(false);
    int k;
    std::cin>>k;
    std::vector<std::vector<int>> v(65,std::vector<int>{-1,-1});
    for(int i=0;i<v.size()-1;++i)
    {
      if(i%2 == 0) {
          v[i][0] = i+2; v[i][1] = i+3;}
    }
    std::bitset<32> bk(k);
    size_t idx = bk.size()-1;
    while (idx >=0 && !bk.test(idx)) --idx;
    for(int i=0;i<idx;++i)
    {
        v[2*i+1][0] = 2*i +3;
    }
    while(idx)
    {
        --idx;
        if(bk.test(idx)) v[2*idx+1][1] = 65;
    }
    std::cout<<v.size()<<std::endl;
    for(auto x:v){std::cout<<x[0]<<" "<<x[1]<<std::endl;}
    return 0;
}