Language: C++

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;};
void qmod(ll &a,ll b){a=(a*b)%MOD;};
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,o;
  ll result=0,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  ll result2=INF;
  bool judge = true;
  ll n,x;cin>>n>>x;
  vector<ll> b(n),l(n),u(n);
  for(i=0;i<n;i++){
    cin>>b[i]>>l[i]>>u[i];
  }
  vector<pair<ll,ll>> a(n);//評価値
  vector<pair<ll,ll>> k(n);
  ll sum=0;//全てをLに合わせた時の青木君
  for(i=0;i<n;i++){
    a[i]={u[i]*x-(u[i]-l[i])*b[i], i};
    k[i]={l[i],i};
    sum+=l[i]*b[i];
  }
  
  vector<int> p(n);
  sort(ALLR(a));
  sort(ALLR(k));
  for(i=0;i<n;i++){
    if(a[i].first<=sum){
      sum-=a[i].first;
      result+=x;
      p[a[i].second]=1;
    }
    else{
      sum-=a[i].first;
      result+=x;
      p[a[i].second]=1;
      ll t;
      for(o=0;o<n;o++){
        if(p[k[o].second]==0){
          t=k[o].second;
          break;
        }
      }
      if(o>n)k=1;
      
      for(int q=0;q<=i;q++){
        sum+=a[q].first;
      ll tt=a[q].second;
      for(j=0;j<=x;j++){
        if(sum<=j*l[t])break;
        if(sum+b[t]*(u[t]-l[t])<=j*u[t])break;
      }
      buf=j;
      
      for(j=0;j<=x;j++){
        if(sum<=j*l[tt])break;
        if(sum+b[tt]*(u[tt]-l[tt])<=j*u[tt])break;
      }
      sum-=a[q].first;
      chmin(result2,result+min(buf,j));
      break;
    }
    
    }
    //cout<<sum<<endl;
  }
  
  cout<<result2<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:16: error: no match for 'operator=' (operand types are 'std::vector<std::pair<long long int, long long int> >' and 'int')
   62 |       if(o>n)k=1;
      |                ^
In file included from /usr/include/c++/14/vector:72,
                 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/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<std::pair<long long int, long long int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::pair<long long int, long long int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<std::pair<long long int, long long int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~