Language: C++

typedef long long int;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

map<ll,ll> zip;

void compress(vector<ll> &x) {
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(),x.end()),x.end());
  for(int i = 0; i < x.size(); i++){
      zip[x[i]] = i;
  }
}
const ll seg_n = 1048576;
ll seg_array[2*seg_n];

void seg_init(){
    for (int i = 0; i < 2*seg_n; i++) {
        seg_array[i] = 1000000000;
    }
}

pair<ll,ll> seg_range(ll node){
    // ノードの長さ
    ll len = seg_n/(ll)pow(2,floor( log2(node+1) ));
//  cout	<<node <<" nl "<<len<<endl;
    // 開始地点は左の子を追えばいい
    ll child = node;
    while(true){
        if( 2*child+1 < seg_n-1 ){
            child = 2*child+1;
        }else{
            break;
        }
    }
//  cout<<child<<endl;
    return {child - seg_n+1, child - seg_n+1 +len-1};
}

void seg_update_range(ll s,ll t,ll v){
  	if(s>t) return;
  	if(t<0) return;
	s = max((ll)0,s);
//	cout<<s <<" "<<t<<" "<<v<<endl;


    ll now_node = seg_n-1 + s;
    ll parent = (now_node-1)/2;
    
    while(true){
        // 親も収まるなら
        pair<ll,ll> now_p = seg_range(parent);
        if(now_p.second <= t && now_p.first == s){
            now_node = parent;
            parent = (now_node-1)/2;
        }else{
            seg_array[now_node] = min(seg_array[now_node],v);
//          	cout<<now_node<<" "<<seg_range(now_node).first<<" -> "<< seg_range(now_node).second<<" = "<<v<<endl;
            break;
        }
    }
    ll end = seg_range(now_node).second;
    if( end < t){
//    	cout<<seg_range(now_node).first<<" "<<seg_range(now_node).second<<endl;
        seg_update_range(end+1,t,v);
    }
}

ll seg_get(ll i){
    cin.tie(0);
ios::sync_with_stdio(false);
    // 固有ロジック
    ll min_value = 1000000000;
  
    ll now_node = seg_n-1 + i;
    while(true){
        min_value = min(min_value,seg_array[now_node]);
        if(now_node == 0){
            break;
        }
        now_node = now_node/2;
    }
    return min_value;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n,q;
    ll s[400010],t[400010],x[400010],d[400010];
	seg_init();
    vector<ll> XX;
    std::cin >> n>>q;
    for (int i = 0; i < n; i++) {
        std::cin >> s[i]>>t[i]>>x[i];
        XX.push_back(s[i]-x[i]);
        XX.push_back(t[i]-x[i]-1);
    }
    for (int i = 0; i < q; i++) {
        std::cin >> d[i];
        XX.push_back(d[i]);
    }
    compress(XX);
    
    for (int i = 0; i < n; i++) {
        seg_update_range(zip[s[i]-x[i]],zip[t[i]-x[i]-1],x[i]);
    }
    
    for (int i = 0; i < q; i++) {
        ll ans = seg_get(zip[d[i]]);
        if(ans == 1000000000){
            ans = -1;
        }
        std::cout << ans << "\n";
    }
    
}


Compiler output:
a.cc:1:19: error: declaration does not declare anything [-fpermissive]
    1 | typedef long long int;
      |                   ^~~
a.cc:9:5: error: 'll' was not declared in this scope
    9 | map<ll,ll> zip;
      |     ^~
a.cc:9:8: error: 'll' was not declared in this scope
    9 | map<ll,ll> zip;
      |        ^~
a.cc:9:10: error: template argument 1 is invalid
    9 | map<ll,ll> zip;
      |          ^
a.cc:9:10: error: template argument 2 is invalid
a.cc:9:10: error: template argument 3 is invalid
a.cc:9:10: error: template argument 4 is invalid
a.cc:11:22: error: 'll' was not declared in this scope
   11 | void compress(vector<ll> &x) {
      |                      ^~
a.cc:11:24: error: template argument 1 is invalid
   11 | void compress(vector<ll> &x) {
      |                        ^
a.cc:11:24: error: template argument 2 is invalid
a.cc: In function 'void compress(int&)':
a.cc:12:10: error: request for member 'begin' in 'x', which is of non-class type 'int'
   12 |   sort(x.begin(), x.end());
      |          ^~~~~
a.cc:12:21: error: request for member 'end' in 'x', which is of non-class type 'int'
   12 |   sort(x.begin(), x.end());
      |                     ^~~
a.cc:13:5: error: request for member 'erase' in 'x', which is of non-class type 'int'
   13 |   x.erase(unique(x.begin(),x.end()),x.end());
      |     ^~~~~
a.cc:13:20: error: request for member 'begin' in 'x', which is of non-class type 'int'
   13 |   x.erase(unique(x.begin(),x.end()),x.end());
      |                    ^~~~~
a.cc:13:30: error: request for member 'end' in 'x', which is of non-class type 'int'
   13 |   x.erase(unique(x.begin(),x.end()),x.end());
      |                              ^~~
a.cc:13:39: error: request for member 'end' in 'x', which is of non-class type 'int'
   13 |   x.erase(unique(x.begin(),x.end()),x.end());
      |                                       ^~~
a.cc:14:24: error: request for member 'size' in 'x', which is of non-class type 'int'
   14 |   for(int i = 0; i < x.size(); i++){
      |                        ^~~~
a.cc:15:12: error: invalid types 'int[int]' for array subscript
   15 |       zip[x[i]] = i;
      |            ^
a.cc: At global scope:
a.cc:18:7: error: 'll' does not name a type
   18 | const ll seg_n = 1048576;
      |       ^~
a.cc:19:1: error: 'll' does not name a type
   19 | ll seg_array[2*seg_n];
      | ^~
a.cc: In function 'void seg_init()':
a.cc:22:27: error: 'seg_n' was not declared in this scope
   22 |     for (int i = 0; i < 2*seg_n; i++) {
      |                           ^~~~~
a.cc:23:9: error: 'seg_array' was not declared in this scope
   23 |         seg_array[i] = 1000000000;
      |         ^~~~~~~~~
a.cc: At global scope:
a.cc:27:6: error: 'll' was not declared in this scope
   27 | pair<ll,ll> seg_range(ll node){
      |      ^~
a.cc:27:9: error: 'll' was not declared in this scope
   27 | pair<ll,ll> seg_range(ll node){
      |         ^~
a.cc:27:11: error: template argument 1 is invalid
   27 | pair<ll,ll> seg_range(ll node){
      |           ^
a.cc:27:11: error: template argument 2 is invalid
a.cc:27:23: error: 'll' was not declared in this scope
   27 | pair<ll,ll> seg_range(ll node){
      |                       ^~
a.cc:44:6: error: variable or field 'seg_update_range' declared void
   44 | void seg_update_range(ll s,ll t,ll v){
      |      ^~~~~~~~~~~~~~~~
a.cc:44:23: error: 'll' was not declared in this scope
   44 | void seg_update_range(ll s,ll t,ll v){
      |                       ^~
a.cc:44:28: error: 'll' was not declared in this scope
   44 | void seg_update_range(ll s,ll t,ll v){
      |                            ^~
a.cc:44:33: error: 'll' was not declared in this scope
   44 | void seg_update_range(ll s,ll t,ll v){
      |                                 ^~
a.cc:73:1: error: 'll' does not name a type
   73 | ll seg_get(ll i){
      | ^~
a.cc: In function 'int main()':
a.cc:94:5: error: 'll' was not declared in this scope
   94 |     ll n,q;
      |     ^~
a.cc:95:7: error: expected ';' before 's'
   95 |     ll s[400010],t[400010],x[400010],d[400010];
      |       ^~
      |       ;
a.cc:97:14: error: template argument 2 is invalid
   97 |     vector<ll> XX;
      |              ^
a.cc:98:17: error: 'n' was not declared in this scope; did you mean 'yn'?
   98 |     std::cin >> n>>q;
      |                 ^
      |                 yn
a.cc:98:20: error: 'q' was not declared in this scope
   98 |     std::cin >> n>>q;
      |                    ^
a.cc:100:21: error: 's' was not declared in this scope
  100 |         std::cin >> s[i]>>t[i]>>x[i];
      |                     ^
a.cc:100:27: error: 't' was not declared in this scope
  100 |         std::cin >> s[i]>>t[i]>>x[i];
      |                           ^
a.cc:100:33: error: 'x' was not declared in this scope
  100 |         std::cin >> s[i]>>t[i]>>x[i];
      |                                 ^
a.cc:101:12: error: request for member 'push_back' in 'XX', which is of non-class type 'int'
  101 |         XX.push_back(s[i]-x[i]);
      |            ^~~~~~~~~
a.cc:102:12: error: request for member 'push_back' in 'XX', which is of non-class type 'int'
  102 |         XX.push_back(t[i]-x[i]-1);
      |            ^~~~~~~~~
a.cc:105:21: error: 'd' was not declared in this scope
  105 |         std::cin >> d[i];
      |                     ^
a.cc:106:12: error: request for member 'push_back' in 'XX', which is of non-class type 'int'
  106 |         XX.push_back(d[i]);
      |            ^~~~~~~~~
a.cc:111:30: error: 's' was not declared in this scope
  111 |         seg_update_range(zip[s[i]-x[i]],zip[t[i]-x[i]-1],x[i]);
      |                              ^
a.cc:111:35: error: 'x' was not declared in this scope
  111 |         seg_update_range(zip[s[i]-x[i]],zip[t[i]-x[i]-1],x[i]);
      |                                   ^
a.cc:111:45: error: 't' was not declared in this scope
  111 |         seg_update_range(zip[s[i]-x[i]],zip[t[i]-x[i]-1],x[i]);
      |                                             ^
a.cc:111:9: error: 'seg_update_range' was not declared in this scope
  111 |         seg_update_range(zip[s[i]-x[i]],zip[t[i]-x[i]-1],x[i]);
      |         ^~~~~~~~~~~~~~~~
a.cc:115:11: error: expected ';' before 'ans'
  115 |         ll ans = seg_get(zip[d[i]]);
      |           ^~~~
      |           ;
a.cc:116:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
  116 |         if(ans == 1000000000){
      |            ^~~
      |            abs
a.cc:119:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
  119 |         std::cout << ans << "\n";
      |                      ^~~
      |                      abs