Language: C++

using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	long long int N, Q;
	map<pair<string, int>, int> SP;

	cin >> N>>Q;

	long long int S(N), T(N), X(N), D(Q), r(Q, -1);
  
  for (int i = 0;i<N;i++) {
    cin >> S[i] >> T[i] >> X[i];
    
  }

	for (auto& i : Q)
		cin >> i;
  for (int i = 0;i<N;i++) {
    for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      if (r[it - D.begin()] == -1)
        r[it - D.begin()] = X[i];
      else
        r[it - D.begin()] = min(r[it - D.begin()], X[i]);
    }
    }

  for (auto i : r)
    cout << i << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:54: error: expression list treated as compound expression in initializer [-fpermissive]
   23 |         long long int S(N), T(N), X(N), D(Q), r(Q, -1);
      |                                                      ^
a.cc:26:13: error: invalid types 'long long int[int]' for array subscript
   26 |     cin >> S[i] >> T[i] >> X[i];
      |             ^
a.cc:26:21: error: invalid types 'long long int[int]' for array subscript
   26 |     cin >> S[i] >> T[i] >> X[i];
      |                     ^
a.cc:26:29: error: invalid types 'long long int[int]' for array subscript
   26 |     cin >> S[i] >> T[i] >> X[i];
      |                             ^
a.cc:30:24: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   30 |         for (auto& i : Q)
      |                        ^
      |                        std::begin
In file included from /usr/include/c++/14/string:53,
                 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:3:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:30:24: error: 'end' was not declared in this scope; did you mean 'std::end'?
   30 |         for (auto& i : Q)
      |                        ^
      |                        std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc:33:34: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                  ^~~~~
a.cc:33:45: error: request for member 'end' in 'D', which is of non-class type 'long long int'
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                             ^~~
a.cc:33:57: error: invalid types 'long long int[int]' for array subscript
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                         ^
a.cc:33:64: error: invalid types 'long long int[int]' for array subscript
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                                ^
a.cc:33:96: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                                                                ^~~~~
a.cc:33:107: error: request for member 'end' in 'D', which is of non-class type 'long long int'
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                                                                           ^~~
a.cc:33:119: error: invalid types 'long long int[int]' for array subscript
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                                                                                       ^
a.cc:33:126: error: invalid types 'long long int[int]' for array subscript
   33 |     for (auto it = lower_bound(D.begin(), D.end(), max(S[i] - X[i], 0LL)); it != upper_bound(D.begin(), D.end(), max(T[i] - X[i], 0LL)); ++it) {
      |                                                                                                                              ^
a.cc:34:20: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   34 |       if (r[it - D.begin()] == -1)
      |                    ^~~~~
a.cc:35:18: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   35 |         r[it - D.begin()] = X[i];
      |                  ^~~~~
a.cc:35:30: error: invalid types 'long long int[int]' for array subscript
   35 |         r[it - D.begin()] = X[i];
      |                              ^
a.cc:37:18: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   37 |         r[it - D.begin()] = min(r[it - D.begin()], X[i]);
      |                  ^~~~~
a.cc:37:42: error: request for member 'begin' in 'D', which is of non-class type 'long long int'
   37 |         r[it - D.begin()] = min(r[it - D.begin()], X[i]);
      |                                          ^~~~~
a.cc:37:53: error: invalid types 'long long int[int]' for array subscript
   37 |         r[it - D.begin()] = min(r[it - D.begin()], X[i]);
      |                                                     ^
a.cc:41:17: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   41 |   for (auto i : r)
      |                 ^
      |                 std::begin
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:41:17: error: 'end' was not declared in this scope; did you mean 'std::end'?
   41 |   for (auto i : r)
      |                 ^
      |                 std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~