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
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
    cin.tie(NULL),cin.sync_with_stdio(false);
    
    int n,s; cin >> n >> s;
    vi a(n+1);
    rep(i,0,s){
        int x; cin >> x;
        a[x] = 1;
    }

    string ans = "";
    int prev = -1;
    int ops = 0;
    rep(x,1,n+1){
        if (prev == -1){
            if (a[x]){
                prev = n+1;
                ans +=  "2 1 " + to_string(x) + '\n'; 
                ops++;
            }
        }else{
            if (a[x]){
                ans +=  "1 " + to_string(x) + ' ' + to_string(prev) + '\n';
                prev++;
                ops ++;
            }else{
                ans += "3 " + to_string(x) + '\n';
                prev++;
                ans +=  "2 " + to_string(prev-1) + ' ' + to_string(prev) + '\n';
                prev++;
                ops += 2;
            }
        }
    }

    if (prev == -1){
        ans += "3 1\n";
        ops++;
    }

    cout << ops << '\n';
    cout << ans;
}