Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin >> t;
    for(int i=0;i<t;i++){
        int n;
        cin >> n;
        int k;
        long long int l,r;
        long long int ans=0;
        vector<pair<int,long long int> > left;
        vector<pair<int,long long int> > right;       
        for(int j=0;j<n;j++){
            cin >> k >> l >> r;
            k--;
            if(l>r){
                ans+=r;
                left.push_back(k,l-r));
            }
            else if(r>l){
                ans+=l;
                right.push_back(n-1-k,r-l);
            }
            else ans+=l;
        }
        sort(left.begin(),left.end());
        sort(right.begin(),right.end());
        priority_queue<long long int> q;
        for(auto u:left){
            q.emplace(d);
		    ans+=u.second;
		    while(q.size()>u.first) ans-=q.top(), q.pop();
        }
        priority_queue<long long int> q;
        for(auto u:right){
            q.emplace(d);
		    ans+=u.second;
		    while(q.size()>u.first) ans-=q.top(), q.pop();
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:31: error: no matching function for call to 'std::vector<std::pair<int, long long int> >::push_back(int&, long long int)'
   19 |                 left.push_back(k,l-r));
      |                 ~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:23:32: error: no matching function for call to 'std::vector<std::pair<int, long long int> >::push_back(int, long long int)'
   23 |                 right.push_back(n-1-k,r-l);
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, long long int>; _Alloc = std::allocator<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:31:23: error: 'd' was not declared in this scope
   31 |             q.emplace(d);
      |                       ^
a.cc:35:39: error: redeclaration of 'std::priority_queue<long long int> q'
   35 |         priority_queue<long long int> q;
      |                                       ^
a.cc:29:39: note: 'std::priority_queue<long long int> q' previously declared here
   29 |         priority_queue<long long int> q;
      |                                       ^
a.cc:37:23: error: 'd' was not declared in this scope
   37 |             q.emplace(d);
      |                       ^