criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<vector>
#include<set>

#define INF 1000000001

using namespace std;

typedef struct{
    int t;
    bool in;
    int x;
} event;

bool cmp(const event &a, const event &b){
    return (a.t) < (b.t);
}

int main(){
    int N, Q;
    cin >> N >> Q;

    int s, t, x;
    vector< event > E(2*N + 2);
    int cnt = 0;
    for(int i=0; i<N; i++){
        cin >> s >> t >> x;
        E[cnt] = event{s-x, true, x};
        cnt ++;
        E[cnt] = event{t-x, false, x};
        cnt++;
    }
    E[cnt] = event{-1, true, INF};
    E[cnt+1] = event{INF+1, false, INF};

    sort(E.begin(), E.end(), cmp);

    set<int> SET;
    int D[Q];
    for(int i=0; i<Q; i++){
        cin >> D[i];
    }

    int d;
    int pre = INF;
    cnt = 0;
    bool brk = false;

    for(int i=0; i<Q; i++){
        d = D[i];
        brk = false;
        while(1){
            auto e = E[cnt];
            t = e.t;
            if(t <= d){
                if(e.in){
                    SET.insert(e.x);
                }
                else{
                    SET.erase(e.x);
                }
            }
            else{
                if(*SET.begin() != INF) cout << *SET.begin() << endl;
                else cout << -1 << endl;
                break;
            }
            cnt++;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   36 |     sort(E.begin(), E.end(), cmp);
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<set>

#define INF 1000000001

using namespace std;

typedef struct{
    int t;
    bool in;
    int x;
} event;

bool cmp(const event &a, const event &b){
    return (a.t) < (b.t);
}

int main(){
    int N, Q;
    cin >> N >> Q;

    int s, t, x;
    vector< event > E(2*N + 2);
    int cnt = 0;
    for(int i=0; i<N; i++){
        cin >> s >> t >> x;
        E[cnt] = event{s-x, true, x};
        cnt ++;
        E[cnt] = event{t-x, false, x};
        cnt++;
    }
    E[cnt] = event{-1, true, INF};
    E[cnt+1] = event{INF+1, false, INF};

    sort(E.begin(), E.end(), cmp);
    set<int> SET;

    int D[Q];
    for(int i=0; i<Q; i++){
        cin >> D[i];
    }

    int d;
    int pre = INF;
    cnt = 0;
    bool brk = false;

    for(int i=0; i<Q; i++){
        d = D[i];
        brk = false;
        while(1){
            auto e = E[cnt]; cnt++;
            t = e.t;
            if(t > d && pre <= d){
                if(*SET.begin() != INF) cout << *SET.begin() << endl;
                else cout << -1 << endl;
                brk = true;
            }
            if(e.in){
                SET.insert(e.x);
            }
            else{
                SET.erase(e.x);
            }
            pre = t;
            if(brk) break;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   36 |     sort(E.begin(), E.end(), cmp);
      |     ^~~~
      |     short
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, Q;
	scanf("%d %d", &N, &Q);

	struct rw { 
		int s, t, x; 
		rw(int s = 0, int t = 0, int x = 0) :s(s), t(t), x(x) {}
	};
	vector<rw> RW(N);
	for (int i = 0; i < N; i++) {
		int s, t, x;
		scanf("%d %d %d", %s, %t, %x);
		RW[i] = { s, t, x };
	}
	sort(RW.begin(), RW.end(), [](auto &l, auto &r) { return (l.s - l.x) < (r.s - r.x); });

	int idx = 0;
	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
	for (int i = 0; i < Q; i++) {

		int d;
		scanf("%d", d);

		while (idx < N && RW[idx].s - RW[idx].x <= d) {
			pq.emplace(RW[idx].x, RW[idx].t - RW[idx].x);
			idx++;
		}
		while (!pq.empty() && pq.top().second <= d) pq.pop();

		printf("%d\n", (pq.empty() ? -1 : pq.top().first));

	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:35: error: expected primary-expression before '%' token
   53 |                 scanf("%d %d %d", %s, %t, %x);
      |                                   ^
a.cc:53:39: error: expected primary-expression before '%' token
   53 |                 scanf("%d %d %d", %s, %t, %x);
      |                                       ^
a.cc:53:43: error: expected primary-expression before '%' token
   53 |                 scanf("%d %d %d", %s, %t, %x);
      |                                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
int main(){
  int n,q;cin>>n>>q;
  vector<PP> p(n);
  rep(i,n){
    int s,t,x;scanf("%d %d %d",&s,&t,&x);
    get<2>(p[i])=x-t+1;
    get<1>(p[i])=x-s;
    get<0>(p[i])=x;
  }
  sort(p.begin(),p.end());
  set<P> s;
  vi ans(q,-1);
  rep(i,q){
    int a;scanf("%d",&a);
    s.insert(P(-a,i));
  }
  rep(i,n){
    if(s.size()==0)break;
    int a=get<2>(p[i]),b=get<1>(p[i]);
    auto from=lower_bound(P(a,-1));
    while(from!=s.end()){
      if((from->first)>get<1>(p[i]))break;
      ans[from->second]=get<0>(p[i]);
      s.erase(from++);
    }
  }
  rep(i,q)printf("%d\n",ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: no matching function for call to 'lower_bound(P)'
   28 |     auto from=lower_bound(P(a,-1));
      |               ~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
Language: C++

#include <set>
#include <cstdio>
#include <algorithm>
using namespace std;

const int Maxn = 2e5;

struct Node {
	int tim, x, typ;
	Node(){}
	Node(int a, int b, int c) {
		tim = a, x = b, typ = c;
	}
	bool operator < (const Node &rhs) const {
		return tim < rhs.tim;
	}
};

int N, M;
vector<Node> A;

int main() {
#ifdef LOACL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	scanf("%d %d", &N, &M);
	for(int i = 1; i <= N; i++) {
		int s, t, x;
		scanf("%d %d %d", &s, &t, &x);
		A.push_back(Node(s - x, x, 1));
		A.push_back(Node(t - x, x, 0));
	}
	sort(A.begin(), A.end());
	int k = 0;
	set<int> t;
	for(int i = 1; i <= M; i++) {
		int d;
		scanf("%d", &d);
		while(k < (int)A.size())
			if(A[k].tim <= d) {
				if(A[k].typ == 1) t.insert(A[k].x);
				else t.erase(A[k].x);
				k++;
			} else break;
		int ans = -1;
		if(!t.empty()) ans = *t.begin();
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc:20:1: error: 'vector' does not name a type
   20 | vector<Node> A;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:31:17: error: 'A' was not declared in this scope
   31 |                 A.push_back(Node(s - x, x, 1));
      |                 ^
a.cc:34:14: error: 'A' was not declared in this scope
   34 |         sort(A.begin(), A.end());
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> P;
typedef pair<int,P> E;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n,q;cin>>n>>q;
  vector<E> v;
  rep(i,n){
    int a,b,c;cin>>a>>b>>c;
    v.push_back(E(a-c,P(-1,c)));
    v.push_back(E(b-c,P(0,c)));
  }
  rep(i,q){
    int c;cin>>c;
    v.push_back(E(c,P(1,i)));
  }
  sort(all(v));
  multiset<int> m;
  for(auto a:v){
    int x=a.first,y=a.second.first,z=a.second.second;
    if(y==-1)m.insert(z);
    else if(y==0)m.erase.lower_bound(z);
    else cout<<(m.empty()?-1:*m.begin())<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: invalid use of member function 'std::multiset<int>::erase' (did you forget the '()' ?)
   27 |     else if(y==0)m.erase.lower_bound(z);
      |                  ~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  int n,q;cin>>n>>q;
  vector<PP> p(n);
  rep(i,n){
    int s,t,x;cin>>s>>t>>x;
    get<0>(p[i])=x-t+1;
    get<1>(p[i])=x-s;
    get<2>(p[i])=x;
  }
  set<P> s;
  vi ans(q);
  rep(i,q){
    int a;cin>>a;
    s.insert(P(a,i));
  }
  rep(i,n){
    if(p.size()==0)break;
    int a=get<0>(p[i]),b=get<1>(p[i]);
    int from=lower_bound(s.begin(),s.end(),P(a,-1));
    int to=upper_bound(s.begin(),s.end(),P(b,-1));
    rep(j,to-from){
      ans[s[from].second]=get<2>(p[i]);
      s.erase(s[from]);
    }
  }
  rep(i,q)cout<<ans[i]<<endl;
}


Compiler output:
a.cc:13:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:13:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:14:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   14 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:14:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   14 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:33:25: error: cannot convert 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' to 'int' in initialization
   33 |     int from=lower_bound(s.begin(),s.end(),P(a,-1));
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                         |
      |                         std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >
a.cc:34:23: error: cannot convert 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' to 'int' in initialization
   34 |     int to=upper_bound(s.begin(),s.end(),P(b,-1));
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >
a.cc:36:12: error: no match for 'operator[]' (operand types are 'std::set<std::pair<long long int, long long int> >' and 'int')
   36 |       ans[s[from].second]=get<2>(p[i]);
      |            ^
a.cc:37:16: error: no match for 'operator[]' (operand types are 'std::set<std::pair<long long int, long long int> >' and 'int')
   37 |       s.erase(s[from]);
      |                ^
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &st) {
	for (const auto &e : st) os << e << " ";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << e << " ";
	return os;
}

template<class T>
inline bool chmin(T &a, T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, Q;
	cin >> N >> Q;

	// t = x - D_i と x = X_j (S_j <= t <= T_j) が交わるD_iの範囲を計算しておく
	vector <pair<pair<int, int>, int>> stx(N);
	for (int i = 0; i < N; i++) {
		int s, t, x;
		cin >> s >> t >> x;
		stx[i] = { { max(0, s - x), t - x }, x };
	}
	sort(stx.begin(), stx.end());

	set<pair<int,int>> st;
	auto first = stx.begin();
	auto last = stx.end();
	for (int i = 0; i < Q; i++) {

		int d;
		cin >> d;

		// add
		last = upper_bound(stx.begin(), stx.end(), make_pair(make_pair(d, INF), INF));
		for (auto itr = first; itr != last; itr++) st.emplace(itr->second, itr->first.second);
		first = last;

		//erase
		vector<pair<int, int>> memo;
		for (const auto &e : st) {
			if (d < e.second) {
				cout << (e.first == INF ? - 1 : e) << "\n";
				break;
			}
			else memo.emplace_back(e);
		}
		for (const auto e : memo) st.erase(e);

	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:57: error: operands to '?:' have different types 'int' and 'const std::pair<int, int>'
  100 |                                 cout << (e.first == INF ? - 1 : e) << "\n";
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include<set>
using namespace std;

#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)

int main() {
	int n,q;
	cin >> n >> q;
	int s, t, x;
	vector<pair<int, int>> da(n * 2 + q);
	rip(i, n, 0) {
		cin >> s >> t >> x;
		da[i * 2].first = s - x;
		da[i * 2].second = x;
		da[i * 2 + 1].first = t - x;
		da[i * 2 + 1].second = -x;
	}
	int d;
	rip(i, q, 0) {
		cin >> d;
		da[n * 2 + i].first = d;
		da[n * 2 + i].second = INT_MAX;
	}
	set<int> se;
	sort(da.begin(), da.end());
	vector<int> ans(q);
	int co = 0;
	rip(i, n * 2 + q, 0) {
		if (da[i].second == INT_MAX) {
			if (se.empty()) {
				ans[co] = -1;
			}
			else {
				ans[co] = *se.begin();
			}
			co++;
		}
		else {
			if (da[i].second < 0) {
				se.erase(-da[i].second);
			}
			else {
				se.insert(da[i].second);
			}
		}
	}
	rip(i, q, 0) {
		printf("%d\n", ans[i]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:40: error: 'INT_MAX' was not declared in this scope
   25 |                 da[n * 2 + i].second = INT_MAX;
      |                                        ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<set>
  +++ |+#include <climits>
    5 | using namespace std;
a.cc:32:37: error: 'INT_MAX' was not declared in this scope
   32 |                 if (da[i].second == INT_MAX) {
      |                                     ^~~~~~~
a.cc:32:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int>S(N);
    vector<int>T(N);
    vector<int>X(N);
    for (int i = 0; i < N; ++i) {
        cin >> S[i] >> T[i] >> X[i];
    }
    vector<int>D(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> D[i];
    }

    for (int i = 0; i < N; ++i) {
        S[i] = max(0, S[i] - X[i]);
        T[i] = max(0, T[i] - X[i]);
    }

    vector<tuple<int, int, int>> timeline;
    timeline.reserve(N*2+Q);
    for (int i = 0; i < N; ++i) {
        timeline.push_back(tie(S[i], 0, X[i])); // 追加クエリ
        timeline.push_back(tie(T[i], -1, X[i])); // 削除クエリ
    }
    for (int i = 0; i < Q; ++i) {
        timeline.push_back(tie(D[i], 1, 0)); // 求値クエリ
    }
    sort(timeline.begin(), timeline.end());
    set<int> se;
    vector<int> ans;
    ans.reserve(Q);
    for (int i = 0; i < timeline.size(); ++i) {
        int k = get<1>(timeline[i]);
        int x = get<2>(timeline[i]);
        if(k == 1){
            if(se.size() == 0){
                ans.push_back(-1);
            } else{
                auto iter = se.begin();
                ans.push_back(*iter);
                se.erase(iter);
            }
        } else if(k == 0){
            se.insert(x);
        } else{
            se.erase(x);
        }
    }
    
    for (int i = 0; i < Q; ++i) {
        cout << ans[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:38: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   27 |         timeline.push_back(tie(S[i], 0, X[i])); // 追加クエリ
      |                                      ^
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/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 2 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {int, int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
a.cc:28:38: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   28 |         timeline.push_back(tie(T[i], -1, X[i])); // 削除クエリ
      |                                      ^~
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 2 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {int, int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
a.cc:31:38: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   31 |         timeline.push_back(tie(D[i], 1, 0)); // 求値クエリ
      |                                      ^
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 2 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {int, int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
struct si{
	long long s,t,x;
};
si l[100000];
long  long d[1000000000],k[1000000000];
bool cmp(si m,si n){
	if(m.x!=n.x)return m.x<n.x;
}
int main(){
	long long n,q;
	cin>>n>>q;
	for(int i=0;i<n;i++){
		cin>>l[i].s>>l[i].t>>l[i].x;
	}	
	sort(l,l+n,cmp);
	for(int i=0;i<q;i++){
		cin>>d[i];
		for(int j=0;j<n;j++){
			long long a=l[j].x+d[i];
			if(a>l[j].s-0.5&&a<l[j].t-0.5){
				k[i]=l[j].x;
				break;
			}	
		}
		if(k[i]!=0)cout<<k[i]<<endl;
		else cout<<"-1"<<endl;
	}
}

Compiler output:
a.cc: In function 'bool cmp(si, si)':
a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
/tmp/ccW6a8Bm.o: in function `main':
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccW6a8Bm.o
a.cc:(.text+0x2b3): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccW6a8Bm.o
a.cc:(.text+0x2d0): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccW6a8Bm.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
struct si{
	long long s,t,x;
};
si l[1000];
long  long d[10000],k[10000];
bool cmp(si m,si n){
	if(m.x!=n.x)return m.x<n.x;
}
int main(){
	long long n,q;
	cin>>n>>q;
	for(int i=0;i<n;i++){
		cin>>l[i].s>>l[i].t>>l[i].x;
	}	
	sort(l,l+n,cmp);
	for(int i=0;i<q;i++){
		cin>>d[i];
		for(int j=0;j<n;j++){
			long long a=l[j].x+d[i];
			if(a>l[j].s-0.5&&a<l[j].t-0.5){
				k[i]=l[j].x;
				break;
			}	
		}
		if(k[i]!=)cout<<k[i]<<endl;
		else cout<<"-1"<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: expected primary-expression before ')' token
   28 |                 if(k[i]!=)cout<<k[i]<<endl;
      |                          ^
a.cc: In function 'bool cmp(si, si)':
a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)

struct even{
  ll start;
  int type;
  ll x;

  even(ll _start, int _type, ll _x){
    start = _start;
    type = _type;
    x = _x;
  }
};

int main() {

  ll N, Q;
  cin >> N >> Q;
  ll S, T, X;
  vector<even> SS;
  REP(i, N) {
    cin >> S >> T >> X;
    SS.push_back(even(S - X, 1, X));
    SS.push_back(even(T - X, -1, X));
  }
  vector<ll> D(Q);
  REP(i, Q) cin >> D[i];

  sort(SS.begin(), SS.end(), [](even& even1, even& even2){
    if (even1.start != even2.start) return (even1.start < even2.start);
    else return (even1.type < even2.type)
  });

  ll latest = 0;
  set<ll> stat;
  for (auto iter : D){
    while(latest < SS.size()){
      if (iter >= SS[latest].start){
        if (SS[latest].type == 1) stat.insert(SS[latest].x);
        else stat.erase(SS[latest].x);
        latest++;
      }
      else break;

    }
    if (stat.empty()) cout << -1 << endl;
    else cout << *stat.begin() << endl;
  }

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:54:42: error: expected ';' before '}' token
   54 |     else return (even1.type < even2.type)
      |                                          ^
      |                                          ;
   55 |   });
      |   ~
Language: C++

//けんちょん解説AC　試験用
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include<map>

using namespace std;

using type = pair<int, long long>; // 1: query, 0; delete, -1: insert
using event = pair<long long, type>;

int main() {
    int N, Q; cin >> N >> Q;
    vector<event> v;
    for (int i = 0; i < N; ++i) {
        int s, t, x; cin >> s >> t >> x;
        v.push_back({s-x, type(-1, x)});
        v.push_back({t-x, type(0, x)});
    }
    for (int i = 0; i < Q; ++i) {
        int d; cin >> d;
        v.push_back({d, type(1, i)});
    }
    sort(v.begin(), v.end());

    vector<long long> res(Q);
    map<long long> se;
    for (auto p : v) {
        long long x = p.first;
        int type = p.second.first;
        long long val = p.second.second;
        if (type == -1) se.insert(val);
        else if (type == 0) se.erase(se.lower_bound(val));
        else res[val] = (se.empty() ? -1 : *(se.begin()));
    }
    for (auto v : res) cout << v << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: wrong number of template arguments (1, should be at least 2)
   28 |     map<long long> se;
      |                  ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:33:28: error: request for member 'insert' in 'se', which is of non-class type 'int'
   33 |         if (type == -1) se.insert(val);
      |                            ^~~~~~
a.cc:34:32: error: request for member 'erase' in 'se', which is of non-class type 'int'
   34 |         else if (type == 0) se.erase(se.lower_bound(val));
      |                                ^~~~~
a.cc:34:41: error: request for member 'lower_bound' in 'se', which is of non-class type 'int'
   34 |         else if (type == 0) se.erase(se.lower_bound(val));
      |                                         ^~~~~~~~~~~
a.cc:35:29: error: request for member 'empty' in 'se', which is of non-class type 'int'
   35 |         else res[val] = (se.empty() ? -1 : *(se.begin()));
      |                             ^~~~~
a.cc:35:49: error: request for member 'begin' in 'se', which is of non-class type 'int'
   35 |         else res[val] = (se.empty() ? -1 : *(se.begin()));
      |                                                 ^~~~~
Language: C++

//けんちょん解説AC　試験用
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

using type = pair<int, long long>; // 1: query, 0; delete, -1: insert
using event = pair<long long, type>;

int main() {
    int N, Q; cin >> N >> Q;
    vector<event> v;
    for (int i = 0; i < N; ++i) {
        int s, t, x; cin >> s >> t >> x;
        v.push_back({s-x, type(-1, x)});
        v.push_back({t-x, type(0, x)});
    }
    for (int i = 0; i < Q; ++i) {
        int d; cin >> d;
        v.push_back({d, type(1, i)});
    }
    sort(v.begin(), v.end());

    vector<long long> res(Q);
    map<long long> se;
    for (auto p : v) {
        long long x = p.first;
        int type = p.second.first;
        long long val = p.second.second;
        if (type == -1) se.insert(val);
        else if (type == 0) se.erase(se.lower_bound(val));
        else res[val] = (se.empty() ? -1 : *(se.begin()));
    }
    for (auto v : res) cout << v << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'map' was not declared in this scope
   26 |     map<long long> se;
      |     ^~~
a.cc:6:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    5 | #include <algorithm>
  +++ |+#include <map>
    6 | using namespace std;
a.cc:26:9: error: expected primary-expression before 'long'
   26 |     map<long long> se;
      |         ^~~~
a.cc:31:25: error: 'se' was not declared in this scope
   31 |         if (type == -1) se.insert(val);
      |                         ^~
a.cc:32:29: error: 'se' was not declared in this scope
   32 |         else if (type == 0) se.erase(se.lower_bound(val));
      |                             ^~
a.cc:33:26: error: 'se' was not declared in this scope
   33 |         else res[val] = (se.empty() ? -1 : *(se.begin()));
      |                          ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t N, Q;
  cin >> N >> Q;
  vector<pair<int64_t, pair<int64_t, int64_t>>> event;
  for (int64_t i = 0; i < N; i++) {
    int64_t s,t,x;
    cin >> s >> t >> x;
    event.push_back(make_pair(s-x, make_pair(1, x)));
    event.push_back(make_pair(t-x, make_pair(-1, x)));
  }
  sort(event.begin(), event.end());
  event.push_back(make_pair(10000000000, make_pair(1, 10000000000)));
  vector<int64_t> pos(Q);
  for (int64_t i = 0; i < Q; i++) {
    int64_t x;
    pos.at(i) = x;
  }
  set<int64_t> S;
  int64_t cnt = 0;
  int64_t m = 10000000000;
  vector<int64_t> ans;
  for (int64_t p : pos) {
    while (event.at(cnt).first <= p) {
      int64_t s, f, x;
      tie(s, tie(f, x)) = event.at(cnt);
      cnt++;
      if (f == 1) {
        S.insert(x);
        m = *begin(S);
      }
      else {
        S.erase(x);
        if (m == x) {
          if (S.empty()) {
            m = 10000000000
          }
          else {
            m = *begin(S);
          }
        }
      }
    }
    if (S.empty()) {
      ans.push_back(-1);
    }
    else {
      ans.push_back(m);
    }
  }
  for (int64_t val : ans) {
    cout << val << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: cannot bind non-const lvalue reference of type 'std::tuple<long int&, long int&>&' to an rvalue of type 'std::tuple<long int&, long int&>'
   28 |       tie(s, tie(f, x)) = event.at(cnt);
      |              ~~~^~~~~~
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/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 2 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {long int, tuple<long int&, long int&>}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
a.cc:38:28: error: expected ';' before '}' token
   38 |             m = 10000000000
      |                            ^
      |                            ;
   39 |           }
      |           ~
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i=(a) ; i<=(b) ; ++i)
#define mp make_pair
#define pii pair<int, int>
#define PB push_back
#define F first
#define S second
#define Task ""
using namespace std;
const int N=200001;
int n, Q, q[N], Sz;
pair <pii, int > a[N];
vector <int > v;

struct intervaltree {
    int t[600001*4], lazy[600001*4];
    intervaltree() {
        rep(i, 0, 600001*4-1) {
            t[i]=(int)(1e9+2);
            lazy[id]=0;
        }
    }

    void down(int id) {
        if(!lazy[id]) return;
        t[id*2]=t[id*2+1]=lazy[id*2]=lazy[id*2+1]=lazy[id];
        lazy[id]=0;
    }

    void update(int l, int r, int id, int u, int v, int val) {
        if(r<u||v<l) return;
        if(u<=l&&r<=v) {
            if(t[id]>val) t[id]=val, lazy[id]=val;
            return;
        }
        int mid=(r+l)>>1;
        down(id);
        update(l, mid, id*2, u, v, val);
        update(mid+1, r, id*2+1, u, v, val);
        t[id]=min(t[id*2], t[id*2+1]);
    }

    int get(int l, int r, int id, int u) {
        if(l==r) return t[id];
        int mid=(r+l)>>1;
        down(id);
        if(u<=mid) return get(l, mid, id*2, u);
        return get(mid+1, r, id*2+1, u);
    }

} IT;

bool cmp(pair <pii, int > a, pair <pii, int > b) {
    return a.S>b.S;
}

void setup() {
    cin >> n >> Q;
    rep(i, 1, n) {
        int s, t, x; cin >> s >> t >> x;
        a[i]=mp(mp(s-x, t-1-x), x);
        v.PB(s-x); v.PB(t-1-x);
    }
    rep(i, 1, Q) {
        cin >> q[i];
        v.PB(q[i]);
    }
}

void Unique() {
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end())-v.begin());
    Sz=v.size();
    sort(a+1, a+n+1, cmp);
    rep(i, 1, n) {
        int s=lower_bound(v.begin(), v.end(), a[i].F.F)-v.begin()+1;
        int f=lower_bound(v.begin(), v.end(), a[i].F.S)-v.begin()+1;
        IT.update(1, Sz, 1, s, f, a[i].S);
    }
}

void answer() {
    rep(i, 1, Q) {
        int idQ=lower_bound(v.begin(), v.end(), q[i])-v.begin()+1;
        int ans=IT.get(1, Sz, 1, idQ);
        if(ans>(int)(1e9)) ans=-1;
        cout << ans << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(Task".inp", "r", stdin);
    //freopen(Task".out", "w", stdout);
    setup();
    Unique();
    answer();
    return 0;
}


Compiler output:
a.cc: In constructor 'intervaltree::intervaltree()':
a.cc:20:18: error: 'id' was not declared in this scope; did you mean 'i'?
   20 |             lazy[id]=0;
      |                  ^~
      |                  i
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,q;
  cin>>n>>q;
  
  long long s[n],t[n],x[n];
  REP(i,n){
    cin>>s[i]>>t[i]>>x[i];
  }
  
  long long d[q];
  REP(i,q){
    cin>>d[i];
  }
  
  vector<pair<long long,pair<int,long long> > > events;
  REP(i,n){
    events.push_back(make_pair(s[i]-x[i],make_pair(1,x[i])));
    events.push_back(make_pair(t[i]-x[i],make_pair(-1,x[i])));
  }
  int event_num=events.size();
  sort(events.begin(),events.end());
  
  long long ans=0;
  bool flag=true;
  int index=0;
  set<long long> xs;
  REP(i,q){
    while(events[index].first<=d[i] && index<event_num){
      if(events[index].second.first==1){
        xs.insert(events[index].second.second);
      }else{
        xs.erase(events[index].second.second);
      }
      index++;
    }
    if(xs.empty()){
      flag = false;
      break;
    }else{
      ans += (long long)min_element(xs.begin(), xs.end());
    }
  }
  if(flag){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:128:14: error: invalid cast from type 'std::_Rb_tree_const_iterator<long long int>' to type 'long long int'
  128 |       ans += (long long)min_element(xs.begin(), xs.end());
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,q;
  cin>>n>>q;
  
  long long s[n],t[n],x[n];
  REP(i,n){
    cin>>s[i]>>t[i]>>x[i];
  }
  
  long long d[q];
  REP(i,q){
    cin>>d[i];
  }
  
  vector<pair<long long,pair<int,long long> > > events;
  REP(i,n){
    events.push_back(make_pair(s[i]-x[i],make_pair(1,x[i])));
    events.push_back(make_pair(t[i]-x[i],make_pair(-1,x[i])));
  }
  int event_num=events.size();
  sort(events.begin(),events.end());
  
  long long ans=0;
  bool flag=true;
  int index=0;
  set<long long> xs;
  REP(i,q){
    while(events[index].first<=d[i] && index<event_num){
      if(events[index].second.first==1){
        xs.insert(events[index].second.second);
      }else{
        xs.erase(events[index].second.second);
      }
      index++;
    }
    if(xs.empty()){
      flag = false;
      break;
    }else{
      ans += min_element(xs.begin(), xs.end());
    }
  }
  if(flag){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:128:11: error: no match for 'operator+=' (operand types are 'long long int' and 'std::_Rb_tree_const_iterator<long long int>')
  128 |       ans += min_element(xs.begin(), xs.end());
      |       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,q;
  cin>>n>>q;
  
  long long s[n],t[n],x[n];
  REP(i,n){
    cin>>s[i]>>t[i]>>x[i];
  }
  
  long long d[q];
  REP(i,q){
    cin>>d[i];
  }
  
  vector<pair<long long,pair<int,long long>>> events;
  REP(i,n){
    events.push_back(make_pair(s[i]-x[i],make_pair(1,x[i])));
    events.push_back(make_pair(t[i]-x[i],make_pair(-1,x[i])));
  }
  int event_num=events.size();
  sort(events.begin(),events.end());
  
  long long ans=0;
  bool flag=true;
  int index=0;
  set<long long> xs;
  REP(i,q){
    while(events[index].first<=d[i] && index<event_num){
      if(events[index].second.first==1){
        xs.insert(events[index].second.second);
      }else{
        xs.erase(events[index].second.second);
      }
      index++;
    }
    if(xs.empty()){
      flag = false;
      break;
    }else{
      ans += min_element(xs.begin(), xs.end());
    }
  }
  if(flag){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:128:11: error: no match for 'operator+=' (operand types are 'long long int' and 'std::_Rb_tree_const_iterator<long long int>')
  128 |       ans += min_element(xs.begin(), xs.end());
      |       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    vector<pair<double, pair<int, double>>> ev;
    vector<int> d(Q);
    REP(i, N)
    {
        int s, t, x;
        cin >> s >> t >> x;
        ev.emplace_back(s - 0.5 - x, make_pair(1, x));
        ev.emplace_back(t - 0.5 - x, make_pair(-1, x));
    }
    REP(i, Q)
    {
        cin >> d[i];
    }
    sort(ALL(ev));
    set<int> st;
    int index = 0;
    int i = 0;
    FOR(index, Q)
    {
        while (ev[i].first <= d[index])
        {
            if (ev[i].second.first == 1)
            {
                st.insert(ev[i].second.second);
            }
            else if (ev[i].second.first == -1)
            {
                st.erase(ev[i].second.second);
            }
            index++;
        }
        cout << (st.empty() ? -1 : *(st.begin())) << "\n";
    }
}
//https://atcoder.jp/contests/abc128/submissions?f.Language=3003&f.Status=AC&f.Task=abc128_e&f.User=&orderBy=created

Compiler output:
a.cc:37:17: error: macro "FOR" requires 3 arguments, but only 2 given
   37 |     FOR(index, Q)
      |                 ^
a.cc:5:9: note: macro "FOR" defined here
    5 | #define FOR(i, m, n) for (int i = m; i < n; i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:37:5: error: 'FOR' was not declared in this scope
   37 |     FOR(index, Q)
      |     ^~~
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][0] = X;
      	li[i][1] = S;
      	li[i][2] = 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:22: 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 'int')
   49 |                 li[i][0] = X;
      |                      ^
a.cc:50:14: 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 'int')
   50 |         li[i][1] = S;
      |              ^
a.cc:51:14: 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 'int')
   51 |         li[i][2] = T;
      |              ^
Language: C++

require 'set'

nn, qq = gets.split.map(&:to_i)
events = []
temp = []

t = 0
nn.times do
  temp = gets.split.map(&:to_i)
  next if (t = temp[1] - temp[2]) <= 0

  events.push(
    ((temp[0] - temp[2]) << 32) +
    (2 << 30) +
    temp[2]
  )
  events.push(
    (t << 32) +
    temp[2]
  )
end

1.step(qq, 1) do |i|
  events.push(
    (gets.to_i << 32) +
    (3 << 30) +
    i
  )
end

# '30bit-2bit-30bit'
#  ソートするための区間 - タイプ - indexなどの情報
mask_3 = ((1 << 30) - 1)
mask_4 = ((1 << 18) - 1)

events.sort!

ss = Hash.new
ans = []
events.each do |event|
  if event[30] == 0
    event[31] == 1 ? (ss[event & mask_3] = 1) : ss.delete(event & mask_3)
  else
    ans[(event & mask_4)] = ss.keys.min || -1
  end
end

puts ans[1..-1]


Compiler output:
a.cc:1:9: warning: multi-character character constant [-Wmultichar]
    1 | require 'set'
      |         ^~~~~
a.cc:31:3: error: invalid preprocessing directive #'30bit-2bit-30bit'
   31 | # '30bit-2bit-30bit'
      |   ^~~~~~~~~~~~~~~~~~
a.cc:32:4: error: invalid preprocessing directive #\U000030bd\U000030fc\U000030c8\U00003059\U0000308b\U0000305f\U00003081\U0000306e\U0000533a\U00009593
   32 | #  ソートするための区間 - タイプ - indexなどの情報
      |    ^~~~~~~~~~~~~~~~~~~~
a.cc:48:10: error: too many decimal points in number
   48 | puts ans[1..-1]
      |          ^~~
a.cc:1:1: error: 'require' does not name a type
    1 | require 'set'
      | ^~~~~~~