Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,tmp1,tmp2,get;
  long int cost;
  vector<int> A;
  vector<int> B;
  
  cin >> N >> M;
  for(int i=0;i<N;i++){
    cin >> tmp1 >>tmp2;
    A.push_back(tmp1);
    B.push_back(tmp2);
  }
  
  cost=0;
  get=0;
  int min,tmp_num;
  while{
    min= *min_element(A.begin(),A.end());
    tmp_num = B[min];
    if(tmp_num >= (M-get)){
      cost += A[min]*(M-get);
      break;
    }else{
      cost += A[min]*B[min];
      get += A[min];
      A.erase(min);
      B.erase(min);
    }
  }(get=>M);
  
  cout << cost;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: expected '(' before '{' token
   20 |   while{
      |        ^
      |        (
a.cc:20:8: error: expected primary-expression before '{' token
a.cc:20:8: error: expected ')' before '{' token
   20 |   while{
      |        ^
      |        )
a.cc:29:14: error: no matching function for call to 'std::vector<int>::erase(int&)'
   29 |       A.erase(min);
      |       ~~~~~~~^~~~~
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:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:30:14: error: no matching function for call to 'std::vector<int>::erase(int&)'
   30 |       B.erase(min);
      |       ~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:32:9: error: expected primary-expression before '>' token
   32 |   }(get=>M);
      |         ^