Language: C++

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


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:32:24: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'insert'
   32 |                 events.insert(make_pair(make_pair(s[i] - x[i], x[i]), 1));
      |                        ^~~~~~
a.cc:33:24: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'insert'
   33 |                 events.insert(make_pair(make_pair(t[i] - x[i], x[i]), 0));
      |                        ^~~~~~
a.cc:38:29: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'empty'
   38 |                 if (!events.empty())
      |                             ^~~~~
a.cc:40:41: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   40 |                         while ((*events.begin()).first.first <= d[i])
      |                                         ^~~~~
a.cc:42:46: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   42 |                                 if ((*events.begin()).second == 1) bye.insert((*events.begin()).first.second);
      |                                              ^~~~~
a.cc:42:88: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   42 |                                 if ((*events.begin()).second == 1) bye.insert((*events.begin()).first.second);
      |                                                                                        ^~~~~
a.cc:43:66: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   43 |                                 else bye.erase(bye.find((*events.begin()).first.second));
      |                                                                  ^~~~~
a.cc:44:40: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'erase'
   44 |                                 events.erase(events.begin());
      |                                        ^~~~~
a.cc:44:53: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   44 |                                 events.erase(events.begin());
      |                                                     ^~~~~
a.cc:45:44: error: 'struct std::pair<std::pair<long long int, long long int>, long long int>' has no member named 'empty'
   45 |                                 if (events.empty()) break;
      |                                            ^~~~~