Language: C++

 
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2
 
 
 
int main() {
	int N, Q;
	cin >> N >> Q;
	vector<tuple<ll, ll, ll>>li(N);
	rep(i, 0, N) {
		ll S, T, X;
		cin >> S >> T >> X;
		li[i] = ( X,S,T );
	}
	sort(all(li));
 
	vector<ll>ans(Q,-1);
	vector<ll>D(Q);
	set<ll>st;
	rep(i, 0, Q) {
		ll d;
		cin >> d;
		st.insert(d);
		D[i] = d;
	}
 
	rep(i, 0, N) {
		auto t = li[i];
		ll X = get<0>(t);
		ll S = get<1>(t);
		ll T = get<2>(t);
		vector<ll>temp;
		auto it = st.lower_bound(S-X);
		while (it != st.end() && *it < T - X) {
			auto it2 = it;
			++it2;
			temp.pb(*it);
			st.erase(it);
			it = it2;
		}
		if (temp.size()) {
			ll l = lower_bound(all(D),temp[0]) - D.begin();
			ll r = lower_bound(all(D),temp[temp.size()-1]) - D.begin();
			for (int j = l; j <= r; j++) {
				ans[j] = X;
			}
		}
	}
 
	rep(i, 0, Q) {
		cout << ans[i] << endl;
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:33: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<long long int, long long int, long long int> >, std::tuple<long long int, long long int, long long int> >::value_type' {aka 'std::tuple<long long int, long long int, long long int>'} and 'll' {aka 'long long int'})
   49 |                 li[i] = ( X,S,T );
      |                                 ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/tuple:1930:9: note: candidate: 'template<class ... _UElements> std::__enable_if_t<((bool)__assignable<const _UElements& ...>()), std::tuple< <template-parameter-1-1> >&> std::tuple< <template-parameter-1-1> >::operator=(const std::tuple<_Args1 ...>&) [with _UElements = {_UElements ...}; _Elements = {long long int, long long int, long long int}]'
 1930 |         operator=(const tuple<_UElements...>& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:1930:9: note:   template argument deduction/substitution failed:
a.cc:49:33: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'll' {aka 'long long int'}
   49 |                 li[i] = ( X,S,T );
      |                                 ^
/usr/include/c++/14/tuple:1940:9: note: candidate: 'template<class ... _UElements> std::__enable_if_t<((bool)__assignable<_UElements ...>()), std::tuple< <template-parameter-1-1> >&> std::tuple< <template-parameter-1-1> >::operator=(std::tuple<_Args1 ...>&&) [with _UElements = {_UElements ...}; _Elements = {long long int, long long int, long long int}]'
 1940 |         operator=(tuple<_UElements...>&& __in)
      |         ^~~~~~~~
/usr/include/c++/14/tuple:1940:9: note:   template argument deduction/substitution failed:
a.cc:49:33: note:   mismatched types 'std::tuple<_UTypes ...>' and 'll' {aka 'long long int'}
   49 |                 li[i] = ( X,S,T );
      |                                 ^
/usr/include/c++/14/tuple:1907:7: note: candidate: 'std::tuple< <template-parameter-1-1> >& std::tuple< <template-parameter-1-1> >::operator=(std::__conditional_t<((bool)__assignable<const _Elements& ...>()), const std::tuple< <template-parameter-1-1> >&, const std::__nonesuch&>) [with _Elements = {long long int, long long int, long long int}; std::__conditional_t<((bool)__assignable<const _Elements& ...>()), const std::tuple< <template-parameter-1-1> >&, const std::__nonesuch&> = const std::tuple<long long int, long long int, long long int>&]'
 1907 |       operator=(__conditional_t<__assignable<const _Elements&...>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:1909:52: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::__conditional_t<true, const std::tuple<long long int, long long int, long long int>&, const std::__nonesuch&>' {aka 'const std::tuple<long long int, long long int, long long int>&'}
 1907 |       operator=(__conditional_t<__assignable<const _Elements&...>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1908 |                                 const tuple&,
      |                                 ~~~~~~~~~~~~~       
 1909 |                                 const __nonesuch&> __in)
      |                                 ~~~~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/14/tuple:1918:7: note: candidate: 'std::tuple< <template-parameter-1-1> >& std::tuple< <template-parameter-1-1> >::operator=(std::__conditional_t<((bool)__assignable<_Elements ...>()), std::tuple< <template-parameter-1-1> >&&, std::__nonesuch&&>) [with _Elements = {long long int, long long int, long long int}; std::__conditional_t<((bool)__assignable<_Elements ...>()), std::tuple< <template-parameter-1-1> >&&, std::__nonesuch&&> = std::tuple<long long int, long long int, long long int>&&]'
 1918 |       operator=(__conditional_t<__assignable<_Elements...>(),
      |       ^~~~~~~~
/usr/include/c++/14/tuple:1920:47: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::__conditional_t<true, std::tuple<long long int, long long int, long long int>&&, std::__nonesuch&&>' {aka 'std::tuple<long long int, long long int, long long int>&&'}
 1918 |       operator=(__conditional_t<__assignable<_Elements...>(),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1919 |                                 tuple&&,
      |                                 ~~~~~~~~       
 1920 |                                 __nonesuch&&> __in)
      |                                 ~~~~~~~~~~~~~~^~~~