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
60
#include <bits/stdc++.h>
using namespace std;

constexpr int MAXN = 50007;
constexpr int MAXM = 400007;
constexpr int MAXNM = MAXN+MAXM;

vector<bitset<MAXN>> bit;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    bitset<MAXN> done;
    bitset<MAXN> act;
    int n, s;
    cin >> n >> s;
    bit.resize(n);
    vector<pair<pair<int,int>,int>> ans;

    for (int i = 0; i < s; ++i) {
        int act;
        cin >> act;
        done.set(act-1, 1);
    }

    for (int i = 0; i < n; ++i) {
        for (int j = i; j < n; j += (i+1)) {
            bit[i].set(j, 1);
        }
    }
    
    int k = 0;
    ans.push_back({{3, 1}, 0});
    k = n+1;
    for (int i = 0; i < n; ++i) {
        if (done[i] == 1) {
            ans.push_back({{1, i+1}, k});
            ++k;
        } else {
            ans.push_back({{3, i+1}, 0});
            ++k;
            ans.push_back({{2, k}, k-1});
            ++k;
        }
    }

    int z = ans.size();
    cout << z << '\n';
    for (int i = 0; i < z; ++i) {
        cout << ans[i].first.first << ' ' << ans[i].first.second;
        if (ans[i].first.first != 3) {
            cout << ' ' << ans[i].second;
        }
        cout << '\n';
    }

    return 0;
}