Language: C++

////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

set<int> s;
set<int>::iterator it;

vector<pair<pair<int,int>,int> > result;

void hora(int tc) {
	int n, k;
	cin>>n>>k;
	for(int i = 0;i < 2 * n;i++) s.insert(k + i);
	for(int i = 1;i <= n;i++) {
		int val = k + 3 * n - i;
		it = s.end();
		if(it != s.begin()) {
			it--;
			int a = *it;
			s.erase(it);
			int candidate = val - a;
			it = s.upper_bound(candidate);
			if(it != s.begin()) {
				it--;1
				int b = *it;
				s.erase(it);
				result.pb({{a, b}, val});
			}
		}
	}
	if(result.size() != n) cout<<-1<<endl;
	else {
		for(auto x: result) cout<<x.F.F<<" "<<x.F.S<<" "<<x.S<<endl;
	}
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Compiler output:
a.cc: In function 'void hora(int)':
a.cc:77:39: error: expected ';' before 'int'
   77 |                                 it--;1
      |                                       ^
      |                                       ;
   78 |                                 int b = *it;
      |                                 ~~~    
a.cc:80:48: error: 'b' was not declared in this scope
   80 |                                 result.pb({{a, b}, val});
      |                                                ^
a.cc:80:42: error: no matching function for call to 'std::vector<std::pair<std::pair<int, int>, int> >::push_back(<brace-enclosed initializer list>)'
   80 |                                 result.pb({{a, b}, val});
      |                                 ~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:27:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<std::pair<int, int>, int> >::value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<std::pair<int, int>, int> >; value_type = std::pair<std::pair<int, int>, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<std::pair<int, int>, int> >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~