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 <iostream>

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);

    int n, s;
    std::cin >> n >> s;

    std::cout << n * 2 - s << std::endl;

    int fixed = 0;
    int usedSets = 0;
    for (int i = 0; i < s; i++) {
        int b;
        std::cin >> b;

        fixed++;
        while (fixed < b) {
            // not present < b
            std::cout << "3 " << fixed << std::endl;
            std::cout << "2 " << usedSets + n << " " << usedSets + n + 1 << std::endl;

            usedSets += 2;
            fixed++;
        }

        // present b
        std::cout << "1 " << usedSets + n << " " << b << std::endl;
        usedSets++;
    }

    fixed++;
    while (fixed <= n) {
        // not present < b
        std::cout << "3 " << fixed << std::endl;
        std::cout << "2 " << usedSets + n << " " << usedSets + n + 1 << std::endl;

        usedSets += 2;
        fixed++;
    }

    return 0;
}