fork download
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp>
  3. #include <ext/pb_ds/tree_policy.hpp>
  4. #define ll long long
  5. #define ld long double
  6. #define ull unsigned long long
  7. #define ff first
  8. #define ss second
  9. #define pii pair<int,int>
  10. #define pll pair<long long, long long>
  11. #define vi vector<int>
  12. #define vl vector<long long>
  13. #define pb push_back
  14. #define rep(i, b) for(int i = 0; i < (b); ++i)
  15. #define rep2(i,a,b) for(int i = a; i <= (b); ++i)
  16. #define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c)
  17. #define count_bits(x) __builtin_popcountll((x))
  18. #define all(x) (x).begin(),(x).end()
  19. #define siz(x) (int)(x).size()
  20. #define forall(it,x) for(auto& it:(x))
  21. using namespace __gnu_pbds;
  22. using namespace std;
  23. typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
  24. //mt19937 mt;void random_start(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());}
  25. //ll rand(ll a, ll b) {return a + (mt() % (b-a+1));}
  26. const int INF = 1e9+50;
  27. const ll INF_L = 1e18+40;
  28. const ll MOD = 1e9+7;
  29.  
  30. int main()
  31. {
  32. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  33. //random_start();
  34. int n,m;
  35. cin >> n >> m;
  36. cout << "3\n";
  37. rep2(i,1,n)
  38. {
  39. cout << i << " " << n-i+1 << " " << 0 << "\n";
  40. }
  41. cout << m + 40 << "\n";
  42. rep2(i,1,20)
  43. {
  44. cout << i << " " << 0 << " " << i << "\n";
  45. cout << 0 << " " << i << " " << 10000*i << "\n";
  46. }
  47. rep(i,m)
  48. {
  49. int a,b;
  50. cin >> a >> b;
  51. cout << -a << " " << -(n-a+1) << " " << b + (n-b+1) * 10000 << "\n";
  52. }
  53. }
Success #stdin #stdout 0.01s 5284KB
stdin
6 9
1 2
2 3
3 4
4 2
1 5
5 2
5 4
4 6
3 6
stdout
3
1 6 0
2 5 0
3 4 0
4 3 0
5 2 0
6 1 0
49
1 0 1
0 1 10000
2 0 2
0 2 20000
3 0 3
0 3 30000
4 0 4
0 4 40000
5 0 5
0 5 50000
6 0 6
0 6 60000
7 0 7
0 7 70000
8 0 8
0 8 80000
9 0 9
0 9 90000
10 0 10
0 10 100000
11 0 11
0 11 110000
12 0 12
0 12 120000
13 0 13
0 13 130000
14 0 14
0 14 140000
15 0 15
0 15 150000
16 0 16
0 16 160000
17 0 17
0 17 170000
18 0 18
0 18 180000
19 0 19
0 19 190000
20 0 20
0 20 200000
-1 -6 50002
-2 -5 40003
-3 -4 30004
-4 -3 50002
-1 -6 20005
-5 -2 50002
-5 -2 30004
-4 -3 10006
-3 -4 10006