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
61
62
63
64
65
66
67
68
69
70
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define fors(u, n, s) for(ll u = (s); u < (n); u++)
#define foru(u, n) fors(u, n, 0)
#define vec vector
#define pb push_back

const int N = 5e5 + 100;
int n;

bitset<N> goal = 0;

vec<string> out;

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

    cin >> n;

    int s; cin >> s;
    foru(_i, s){
		int x; cin >> x; x--; goal[x] = true;
    }

	bitset<N> current = 0;

	if(goal[0]) {
		out.pb("3 1");
		out.pb("3 " + to_string(n+out.size()));
		foru(i, n) current[i] = true;
	} else {
		out.pb("3 1");
	}

	fors(i, n, 1){
		if(current[i] == goal[i]) continue;
		if(~current[i]){
			out.pb("1 " + 
				to_string(n+out.size()) + " " +
				to_string(i+1));
				
			int j = i;
			while (j < n) {
				current[j] = true;
				j += i+1;
			}
		} else {
			out.pb("3 " + to_string(i+1));
			out.pb("2 " + 
				to_string(n+out.size()) + " " +
				to_string(n+out.size()-1));

			int j = i;
			while (j < n) {
				current[j] = false;
				j += i+1;
			}
		}
	}

	cout << out.size() << endl;
	for(auto i : out) {
		cout << i << endl;
	}
    
    return 0;
}