Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	long long int n, q;
  
	cin >> n >> q;
  
	long long int s[200010],t[200010],x[200010],d[200010];
  
  for(int i=0;i<n;i++){
    
	 cin >> s[i] >> t[i] >> x[i];
  }
  
  for(int i=0;i<q;i++){
	cin >> d[i];
  }

    pair<pair<long long int, long long int>, long long int> events;
  
	set<long long int>bye;
	for(int i=0;i<n;i++)
	{
		events.insert(make_pair(make_pair(s[i] - x[i], x[i]), 1));
		events.insert(make_pair(make_pair(t[i] - x[i], x[i]), 0));
	}
  
	for(int i=0;i<q;i++)
	{
		if (!events.empty())
		{
			while ((*events.begin()).first.first <= d[i])
			{
				if ((*events.begin()).second == 1) bye.insert((*events.begin()).first.second);
				else bye.erase(bye.find((*events.begin()).first.second));
				events.erase(events.begin());
				if (events.empty()) break;
			}
		}

		long long int ans;
		if (bye.empty()) ans = -1;
      
		else ans = *bye.begin();
      
		cout << ans << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'insert'
   29 |                 events.insert(make_pair(make_pair(s[i] - x[i], x[i]), 1));
      |                        ^~~~~~
a.cc:30:24: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'insert'
   30 |                 events.insert(make_pair(make_pair(t[i] - x[i], x[i]), 0));
      |                        ^~~~~~
a.cc:35:29: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'empty'
   35 |                 if (!events.empty())
      |                             ^~~~~
a.cc:37:41: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   37 |                         while ((*events.begin()).first.first <= d[i])
      |                                         ^~~~~
a.cc:39:46: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   39 |                                 if ((*events.begin()).second == 1) bye.insert((*events.begin()).first.second);
      |                                              ^~~~~
a.cc:39:88: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   39 |                                 if ((*events.begin()).second == 1) bye.insert((*events.begin()).first.second);
      |                                                                                        ^~~~~
a.cc:40:66: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   40 |                                 else bye.erase(bye.find((*events.begin()).first.second));
      |                                                                  ^~~~~
a.cc:41:40: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'erase'
   41 |                                 events.erase(events.begin());
      |                                        ^~~~~
a.cc:41:53: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   41 |                                 events.erase(events.begin());
      |                                                     ^~~~~
a.cc:42:44: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'empty'
   42 |                                 if (events.empty()) break;
      |                                            ^~~~~