Language: C++

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

#define ll long long
#define INF 99999999
int main()
{
    double a,b;
    cin >> a >> b;
    vector<double> c(a);
    vector<double> d(a);
    for(double i = 0;i < a;i++)
    {
        cin >> c[i] >> d[i];
    }
    double num;
    double tmp;
    double ans = 0;
    for(double j = 0;j < c.size();j++)
    {
        num = INF;
        for(double i = 0;i < c.size();i++)
        {
            if(num > c[i])
            {
                num = c[i];
                tmp = i;
            }
            
        }
        
        flag[tmp] = false;
        if(b > d[tmp])
        {
            ans += c[tmp] * d[tmp];
            b -= d[tmp];
            //cout <<"ans is" <<  ans << " and b is " << b << endl;
        }
        else
        {
            ans += c[tmp] * b;
            break;
        }
        remove(c,tmp);
        remove(d,tmp);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'flag' was not declared in this scope
   32 |         flag[tmp] = false;
      |         ^~~~
a.cc:44:15: error: no matching function for call to 'remove(std::vector<double>&, double&)'
   44 |         remove(c,tmp);
      |         ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&)'
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::remove(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  224 | remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note:   candidate expects 4 arguments, 2 provided
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
/usr/include/stdio.h:158:12: note:   candidate expects 1 argument, 2 provided
a.cc:45:15: error: no matching function for call to 'remove(std::vector<double>&, double&)'
   45 |         remove(d,tmp);
      |         ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&)'
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::remove(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  224 | remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
/usr/include/stdio.h:158:12: note:   candidate expects 1 argument, 2 provided