제출 #1227082

#제출 시각아이디문제언어결과실행 시간메모리
1227082dizzy_groovyTrain (APIO24_train)C++20
컴파일 에러
0 ms0 KiB
#include "train.h"

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll INF = 1e15;

struct PersSegTree{
    struct Node{
        Node *left;
        Node *right;
        ll l, r;
        ll su;
        Node (ll x, ll ind) {
            su = x;
            l = ind;
            r = ind + 1;
            left = nullptr;
            right = nullptr;
        }
        Node (Node *le, Node *ri) {
            left = le;
            right = ri;
            l = le->l;
            r = ri->r;
            su = le->su + ri->su;
        }
    };
    vector<Node*> trs;
    Node* build(ll l, ll r) {
        if (r - l == 1) {
            return new Node(0ll, l);
        }
        ll m = (l + r) / 2;
        return new Node(build(l, m), build(m, r));
    }
    Node* upd(ll ind, ll x, Node* tr) {
        if (tr->l > ind || ind >= tr->r) {
            return tr;
        }
        if (tr->r - tr->l == 1) {
            return new Node(tr->su + x, ind);
        }
        return new Node(upd(ind, x, tr->left), upd(ind, x, tr->right));
    }
    ll update(ll i, ll ind, ll x) {
        trs.push_back(upd(ind, x, trs[i]));
        return trs.size() - 1;
    }
    ll get(ll l, ll r, Node *tr) {
        if (tr->r <= l || tr->l >= r) return 0ll;
        if (l <= tr->l && tr->r <= r) return tr->su;
        return get(l, r, tr->left) + get(l, r, tr->right);
    }
    ll get_ans(ll l, ll r, ll ind) {
        return get(l, r, trs[trs.size() - ind - 1]);
    }
    ll get2(Node* l, Node* r, ll ansl, ll ansr, ll w) {
        if (l->r - l->l == 1) {
            return l->r;
        }
        if (ansl + l->left->su * w <= ansr + r->left->su * w) {
            ansl += l->left->su * w;
            ansr += r->left->su * w;
            return get2(l->right, r->right, ansl, ansr, w);
        }
        return get2(l->left, r->left, ansl, ansr, w);
    }
    ll get_ans2(ll indl, ll indr, ll ansl, ll ansr, ll w) {
        return get2(trs[trs.size() - indl - 1], trs[trs.size() - indr - 1], ansl, ansr, w);
    }
    PersSegTree(ll n) {
        trs.push_back(build(0ll, n));
    }
};

inline ll f(ll l, ll r, PersSegTree &tr, vector<pair<ll, ll>> &tmp2) {
    /*ll cnt = 0;
    for (auto &i : tmp2) {
        if (i.first > l && i.second < r) cnt++;
    }
    return cnt;*/
    return tr.get_ans(0ll, r + 1, lower_bound(tmp2.begin(), tmp2.end(), make_pair((ll)l, 0ll)) - tmp2.begin());
}

//#define f(l, r) tr.get_ans(0ll, r, lower_bound(tmp2.begin(), tmp2.end(), make_pair(l, (long long) INF)) - tmp2.begin())

inline bool check(pair<ll, ll> a, pair<ll, ll> b, ll x, ll w, PersSegTree &tr, vector<pair<ll, ll>> &tmp2) {
    ll lans1 = a.first + f(a.second, x, tr, tmp2) * w;
    ll lans2 = b.first + f(b.second, x, tr, tmp2) * w;
    return (lans2 <= lans1);
}

long long solve(int n, int m, int w, std::vector<int> t, std::vector<int> x, std::vector<int> y, std::vector<int> a, std::vector<int> b, std::vector<int> c, std::vector<int> l, std::vector<int> r) {
    vector<int> tmp(1, -1);
    for (auto &i : a) tmp.push_back(i);
    for (auto &i : b) tmp.push_back(i);
    for (auto &i : l) tmp.push_back(i);
    for (auto &i : r) tmp.push_back(i);
    sort(tmp.begin(), tmp.end());
    tmp.resize(unique(tmp.begin(), tmp.end()) - tmp.begin());
    for (auto &i : a) i = lower_bound(tmp.begin(), tmp.end(), i) - tmp.begin();
    for (auto &i : b) i = lower_bound(tmp.begin(), tmp.end(), i) - tmp.begin();
    for (auto &i : l) i = lower_bound(tmp.begin(), tmp.end(), i) - tmp.begin();
    for (auto &i : r) i = lower_bound(tmp.begin(), tmp.end(), i) - tmp.begin();
    PersSegTree tr((ll)(tmp.size() + 52));
    vector<pair<ll, ll>> tmp2;
    for (ll i = 0ll; i < w; i++) {
        tmp2.push_back({l[i], r[i]});
    }
    sort(tmp2.begin(), tmp2.end());
    for (ll i = w - 1; i >= 0ll; i--) {
        tr.update(w - i - 1, tmp2[i].second, 1);
    }
    //f(2ll, 2ll);
    vector<ll> ans_st(m);
    vector<vector<ll>> all_st(n);
    for (ll i = 0; i < m; i++) {
        all_st[x[i]].push_back(a[i]);
    }
    all_st[n - 1].push_back(tmp.size() - 1);
    for (auto &i : all_st) sort(i.begin(), i.end());
    vector<vector<pair<ll, pair<ll, ll>>>> ans_end(n);
    ans_end[0].push_back({0, {0, 0}});
    vector<pair<pair<ll, ll>, ll>> que;
    for (ll i = 0ll; i < m; i++) {
        que.push_back({{a[i], 0ll}, i});
        que.push_back({{b[i], -1ll}, i});
    }
    que.push_back({{tmp.size() - 1, 0}, -1});
    sort(que.begin(), que.end());
    for (auto &i : que) {
        if (i.first.second == -1) {
            ll j = y[i.second];
            ll lans = ans_st[i.second] + c[i.second];
            if (lans > INF) lans = INF;
            //ans_end[j].push_back({0, {lans, i.first.first}});
            while (ans_end[j].size() > 0  && check(ans_end[j].back().second, {lans, i.first.first}, ans_end[j].back().first, t[j], tr, tmp2)) {
                ans_end[j].pop_back();
            }
            if (ans_end[j].size() == 0) {
                ans_end[j].push_back({0, {lans, i.first.first}});
                continue;
            }
            if (!check(ans_end[j].back().second, {lans, i.first.first}, tmp.size() - 1, t[j], tr, tmp2)) continue;
            /*ll le = ans_end[j].back().first, ri = tmp.size() - 1;
            while (ri - le > 1) {
                ll mid = (le + ri) / 2;
                if (check(ans_end[j].back().second, {lans, i.first.first}, mid, t[j], tr, tmp2)) {
                    ri = mid;
                } else {
                    le = mid;
                }
            }*/
            ll indl = lower_bound(tmp2.begin(), tmp2.end(), make_pair(ans_end[j].back().second.second, 0ll)) - tmp2.begin();
            ll indr = lower_bound(tmp2.begin(), tmp2.end(), make_pair(i.first.first, 0ll)) - tmp2.begin();
            ll lans52 = tr.get_ans2(indl, indr, ans_end[j].back().second.first, lans, t[j]);
            //assert(ri == lans52);
            ans_end[j].push_back({lans52, {lans, i.first.first}});
        } else {
            ll j;
            if (i.second != -1) {
                j = x[i.second];
            } else {
                j = n - 1;
            }
            ll lans;
            if (ans_end[j].size() == 0) {
                lans = INF;
            } else {
                auto it = lower_bound(ans_end[j].begin(), ans_end[j].end(), make_pair(i.first.first, make_pair((ll) INF, 0ll)));
                auto lans2 = (*prev(it));
                lans = lans2.second.first + f(lans2.second.second, i.first.first, tr, tmp2) * t[j];
                for (int tmp3 = -2; tmp3 <= 2; tmp3++){
                  if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
                    lans2 = (*(it + tmp));
                    lans = min(lans, lans2.second.first + f(lans2.second.second, i.first.first, tr, tmp2) * t[j]);
                  }
                }
                if (lans2.second.first >= INF || lans > INF) lans = INF;
                //lans = INF;
                //for (auto &x : ans_end[j]) {
                //    lans = min(lans, x.second.first + f(x.second.second, i.first.first, tr, tmp2) * t[j]);
                //}
            }
            if (i.second == -1) {
                //cout << lans << endl;
                if (lans >= INF) {
                    return -1;
                } else {
                    return lans;
                }
            } else {
                ans_st[i.second] = lans;
            }
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

train.cpp: In function 'long long int solve(int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:178:26: error: no match for 'operator+' (operand types are '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' and 'std::vector<int>')
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                       ~~ ^ ~~~
      |                       |    |
      |                       |    std::vector<int>
      |                       __gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1090:7: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+(__gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type) const [with _Iterator = std::pair<long long int, std::pair<long long int, long long int> >*; _Container = std::vector<std::pair<long long int, std::pair<long long int, long long int> > >; __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type = long int]'
 1090 |       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1090:33: note:   no known conversion for argument 1 from 'std::vector<int>' to '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >::difference_type' {aka 'long int'}
 1090 |       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
      |                 ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_iterator.h:585:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_IteratorL> std::operator+(typename std::reverse_iterator<_IteratorL>::difference_type, const std::reverse_iterator<_IteratorL>&)'
  585 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:585:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_IteratorL>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1700 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6095:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6095 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6095:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:56,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1169 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   mismatched types 'const _CharT*' and '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:56,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.tcc:1189:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1189 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.tcc:1189:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6132:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6132 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6132:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6148:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 6148 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6148:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6160 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6160:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6166:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6166 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6166:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6172:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6172 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6172:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6194:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6194 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6194:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   mismatched types 'const _CharT*' and '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6200:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6200 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6200:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6206:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
 6206 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6206:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6212:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
 6212 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6212:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/complex:332:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)'
  332 |     operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/11/complex:332:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::complex<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/complex:341:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)'
  341 |     operator+(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/11/complex:341:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::complex<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/complex:350:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const _Tp&, const std::complex<_Tp>&)'
  350 |     operator+(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/11/complex:350:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::complex<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/complex:451:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator+(const std::complex<_Tp>&)'
  451 |     operator+(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/11/complex:451:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::complex<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/bits/valarray_after.h:405:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__plus, typename _Dom1::value_type>::result_type> std::operator+(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  405 |     _DEFINE_EXPR_BINARY_OPERATOR(+, struct std::__plus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:405:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
 1186 | _DEFINE_BINARY_OPERATOR(+, __plus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1186:1: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::valarray<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
 1186 | _DEFINE_BINARY_OPERATOR(+, __plus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1186:1: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::valarray<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from train.cpp:3:
/usr/include/c++/11/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__plus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__plus, _Tp>::result_type> std::operator+(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
 1186 | _DEFINE_BINARY_OPERATOR(+, __plus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1186:1: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1276:5: note: candidate: 'template<class _Iterator, class _Container> constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1276 |     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1276:5: note:   template argument deduction/substitution failed:
train.cpp:178:28: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                            ^~~
train.cpp:178:60: error: no match for 'operator+' (operand types are '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' and 'std::vector<int>')
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                         ~~ ^ ~~~
      |                                                         |    |
      |                                                         |    std::vector<int>
      |                                                         __gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1090:7: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+(__gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type) const [with _Iterator = std::pair<long long int, std::pair<long long int, long long int> >*; _Container = std::vector<std::pair<long long int, std::pair<long long int, long long int> > >; __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type = long int]'
 1090 |       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1090:33: note:   no known conversion for argument 1 from 'std::vector<int>' to '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >::difference_type' {aka 'long int'}
 1090 |       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
      |                 ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_iterator.h:585:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_IteratorL> std::operator+(typename std::reverse_iterator<_IteratorL>::difference_type, const std::reverse_iterator<_IteratorL>&)'
  585 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:585:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_IteratorL>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/vector:60,
                 from train.h:1,
                 from train.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1700 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1700:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6095:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6095 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6095:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:56,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1169 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.tcc:1169:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   mismatched types 'const _CharT*' and '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:56,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.tcc:1189:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1189 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.tcc:1189:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6132:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6132 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6132:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6148:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 6148 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6148:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6160 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6160:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6166:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6166 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6166:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6172:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6172 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:6172:5: note:   template argument deduction/substitution failed:
train.cpp:178:62: note:   '__gnu_cxx::__normal_iterator<std::pair<long long int, std::pair<long long int, long long int> >*, std::vector<std::pair<long long int, std::pair<long long int, long long int> > > >' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
  178 |                   if (it + tmp >= ans_end[j].begin() && it + tmp < ans_end[j].end()){
      |                                                              ^~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from train.cpp:3:
/usr/include/c++/11/bits/basic_string.h:6194:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6194 |     operator+(const _CharT* __lhs,
      |