Language: C++

#define int long long
using namespace std;
int xa[100010],ya[100010],za[100010];
int x,y,z;
int n;
bool cmp(int i,int j){
    if (ya[i]-xa[i] > ya[j]-xa[j]) return 1;
    return 0;
}
vector<int> v;
int ans1[100010],ans2[100010];
void solve1(){
    int base = 0;
    multiset<int> use,rest;
    for (int i = 1; i <= x; i++){
        base += xa[v[i]];
        rest.insert(za[v[i]]-xa[v[i]]);
    }
 
    ans1[x] = base;
    int optdif = 0;
   // cout << x << " " << ans1[x-1] << "\n";
    for (int i = x+1; i <= x+z; i++){
        rest.insert(za[v[i]]-xa[v[i]]);
        int v1 = *(--rest.end());
        base += xa[v[i]];
        optdif += v1;
        rest.erase(rest.find(v1));
        use.insert(v1);
        ans1[i] = base+optdif;
      //  cout << i << " " << ans1[i] << "\n";
    }
}
void solve2(){
    int base = 0;
    multiset<int> use,rest;
    for (int i = n; i > n-y; i--){
        base += ya[v[i]];
        rest.insert(za[v[i]]-ya[v[i]]);
    }
    //cout << n-y+1 << " " << ans2[n-y+1] << "\n";
    ans2[n-y+1] = base;
    int optdif = 0;
    for (int i = n-y; i > n-y-z; i--){
        rest.insert(za[v[i]]-ya[v[i]]);
        int v1 = *(--rest.end());
        base += ya[v[i]];
        optdif += v1;
        rest.erase(rest.find(v1));
        use.insert(v1);
        ans2[i] = base+optdif;
        //cout << i << " " << ans2[i]<< "\n";
    }
}
main(){
    cin >> x >> y >> z;
    n = x+y+z;
    for (int i = 1; i <= n; i++) {
        cin >> xa[i] >> ya[i] >> za[i];
        v.push_back(i);
    }
    sort(v.begin(),v.end(),cmp);
    v.push_back(0);
    reverse(v.begin(),v.end());
    //for (int i = 1; i <= n; i++) cout << v[i] << " ";
    //cout << "\n";
    solve1();
    solve2();
    int ans = 0;
    for (int i = x; i <= n-y; i++) ans = max(ans1[i]+ans2[i+1],ans);
    cout << ans;
}

Compiler output:
a.cc:10:1: error: 'vector' does not name a type
   10 | vector<int> v;
      | ^~~~~~
a.cc: In function 'void solve1()':
a.cc:14:5: error: 'multiset' was not declared in this scope
   14 |     multiset<int> use,rest;
      |     ^~~~~~~~
a.cc:1:1: note: 'std::multiset' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
  +++ |+#include <set>
    1 | #define int long long
a.cc:1:13: error: expected primary-expression before 'long'
    1 | #define int long long
      |             ^~~~
a.cc:14:14: note: in expansion of macro 'int'
   14 |     multiset<int> use,rest;
      |              ^~~
a.cc:16:20: error: 'v' was not declared in this scope
   16 |         base += xa[v[i]];
      |                    ^
a.cc:17:9: error: 'rest' was not declared in this scope
   17 |         rest.insert(za[v[i]]-xa[v[i]]);
      |         ^~~~
a.cc:24:9: error: 'rest' was not declared in this scope
   24 |         rest.insert(za[v[i]]-xa[v[i]]);
      |         ^~~~
a.cc:24:24: error: 'v' was not declared in this scope
   24 |         rest.insert(za[v[i]]-xa[v[i]]);
      |                        ^
a.cc:29:9: error: 'use' was not declared in this scope
   29 |         use.insert(v1);
      |         ^~~
a.cc: In function 'void solve2()':
a.cc:36:5: error: 'multiset' was not declared in this scope
   36 |     multiset<int> use,rest;
      |     ^~~~~~~~
a.cc:36:5: note: 'std::multiset' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
a.cc:1:13: error: expected primary-expression before 'long'
    1 | #define int long long
      |             ^~~~
a.cc:36:14: note: in expansion of macro 'int'
   36 |     multiset<int> use,rest;
      |              ^~~
a.cc:38:20: error: 'v' was not declared in this scope
   38 |         base += ya[v[i]];
      |                    ^
a.cc:39:9: error: 'rest' was not declared in this scope
   39 |         rest.insert(za[v[i]]-ya[v[i]]);
      |         ^~~~
a.cc:45:9: error: 'rest' was not declared in this scope
   45 |         rest.insert(za[v[i]]-ya[v[i]]);
      |         ^~~~
a.cc:45:24: error: 'v' was not declared in this scope
   45 |         rest.insert(za[v[i]]-ya[v[i]]);
      |                        ^
a.cc:50:9: error: 'use' was not declared in this scope
   50 |         use.insert(v1);
      |         ^~~
a.cc: At global scope:
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   55 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:56:5: error: 'cin' was not declared in this scope
   56 |     cin >> x >> y >> z;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define int long long
a.cc:60:9: error: 'v' was not declared in this scope
   60 |         v.push_back(i);
      |         ^
a.cc:62:10: error: 'v' was not declared in this scope
   62 |     sort(v.begin(),v.end(),cmp);
      |          ^
a.cc:62:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   62 |     sort(v.begin(),v.end(),cmp);
      |     ^~~~
      |     short
a.cc:64:5: error: 'reverse' was not declared in this scope
   64 |     reverse(v.begin(),v.end());
      |     ^~~~~~~
a.cc:70:42: error: 'max' was not declared in this scope
   70 |     for (int i = x; i <= n-y; i++) ans = max(ans1[i]+ans2[i+1],ans);
      |                                          ^~~
a.cc:71:5: error: 'cout' was not declared in this scope
   71 |     cout << ans;
      |     ^~~~
a.cc:71:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'