Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<long long, int>> k[n];
  rep(i,n){
    long long y;
    int q;
    cin >> y >> q;
    pair<long long, int> s;
    s=make_pair(y,q);
    k[i]=s;
  }
  sort(k.begin(),k.end());
  long long ans=0;
  int c=0;
  while(m>0){
    int z=k[c].second;
    long long x=k[c].first;
    if(z<=m){
      m-=z;
      ans+=x*z;
    }
    else{
      z=m;
      m=0;
      ans+=z*x;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: no match for 'operator=' (operand types are 'std::vector<std::pair<long long int, int> >' and 'std::pair<long long int, int>')
   14 |     k[i]=s;
      |          ^
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, int>; _Alloc = std::allocator<std::pair<long long int, int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::pair<long long int, int>' to 'const std::vector<std::pair<long long int, 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, int>; _Alloc = std::allocator<std::pair<long long int, 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 'std::pair<long long int, int>' to 'std::vector<std::pair<long long int, 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, int>; _Alloc = std::allocator<std::pair<long long int, 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 'std::pair<long long int, int>' to 'std::initializer_list<std::pair<long long int, int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:16:10: error: request for member 'begin' in 'k', which is of non-class type 'std::vector<std::pair<long long int, int> > [n]'
   16 |   sort(k.begin(),k.end());
      |          ^~~~~
a.cc:16:20: error: request for member 'end' in 'k', which is of non-class type 'std::vector<std::pair<long long int, int> > [n]'
   16 |   sort(k.begin(),k.end());
      |                    ^~~
a.cc:20:16: error: 'class std::vector<std::pair<long long int, int> >' has no member named 'second'
   20 |     int z=k[c].second;
      |                ^~~~~~
a.cc:21:22: error: 'class std::vector<std::pair<long long int, int> >' has no member named 'first'
   21 |     long long x=k[c].first;
      |                      ^~~~~