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

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
const ll LINF = 1e18;
const int INF = 1e9;

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

    int n, s;
    cin >> n >> s;

    vi b(s);
    for (int i = 0; i < s; ++i) {
        cin >> b[i];
    }

    int m = s + 2 * (n - b[0] + 1 - s);
    cout << m << '\n';

    cout << "1 " << b[0] << " " << b[0] << '\n';

    int last_set_idx = n + 1;
    int j = 1;
    for (int i = b[0] + 1; i <= n; ++i) {
        if (i == b[j]) {
            cout << "1 " << last_set_idx << " " << i << '\n';
            ++j;
            ++last_set_idx;
        } else {
            cout << "3 " << i << '\n';
            cout << "2 " << last_set_idx << " " << last_set_idx + 1 << '\n';
            last_set_idx += 2;
        }
    }

    return 0;
}