Language: C++

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

class Shop
{
  public:
    int money;
    int stock;

    Shop(int m, int s)
    {
        money = m;
        stock = s;
    }

    bool operator<(const Shop &otherShop) const
    {
        return money < othershop.money;
    }
};

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N), B(M);

    for (int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
    }

    vector<Shop> shopList(N);

    for (int i = 0; i < N; i++)
    {
        shopList[i] = Shop(A[i], B[i]);
    }
    sort(shopList.begin(), shopList.end());

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += shopList.money * min(shopList.stock, M);
        m -= shopList.stock;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In member function 'bool Shop::operator<(const Shop&) const':
a.cc:18:24: error: 'othershop' was not declared in this scope; did you mean 'otherShop'?
   18 |         return money < othershop.money;
      |                        ^~~~~~~~~
      |                        otherShop
a.cc: In function 'int main()':
a.cc:41:5: error: 'll' was not declared in this scope
   41 |     ll ans = 0;
      |     ^~
a.cc:44:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         ans += shopList.money * min(shopList.stock, M);
      |         ^~~
      |         abs
a.cc:44:25: error: 'class std::vector<Shop>' has no member named 'money'
   44 |         ans += shopList.money * min(shopList.stock, M);
      |                         ^~~~~
a.cc:44:46: error: 'class std::vector<Shop>' has no member named 'stock'
   44 |         ans += shopList.money * min(shopList.stock, M);
      |                                              ^~~~~
a.cc:45:9: error: 'm' was not declared in this scope
   45 |         m -= shopList.stock;
      |         ^
a.cc:45:23: error: 'class std::vector<Shop>' has no member named 'stock'
   45 |         m -= shopList.stock;
      |                       ^~~~~
a.cc:47:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   47 |     cout << ans << endl;
      |             ^~~
      |             abs
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:61,
                 from /usr/include/c++/14/bits/stl_algo.h:69,
                 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_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Shop; _Args = {}]':
/usr/include/c++/14/bits/stl_uninitialized.h:643:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Shop*; _Size = long unsigned int; bool _TrivialValueType = false]'
  643 |                 std::_Construct(std::__addressof(*__cur));
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:712:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Shop*; _Size = long unsigned int]'
  710 |       return __uninitialized_default_n_1<__is_trivial(_ValueType)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                                          && __can_fill>::
      |                                          ~~~~~~~~~~~~~~~~
  712 |         __uninit_default_n(__first, __n);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:779:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = Shop*; _Size = long unsigned int; _Tp = Shop]'
  779 |     { return std::__uninitialized_default_n(__first, __n); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1720:36:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = Shop; _Alloc = std::allocator<Shop>; size_type = long unsigned int]'
 1720 |           std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1721 |                                            _M_get_Tp_allocator());
      |                                            ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:558:9:   required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = Shop; _Alloc = std::allocator<Shop>; size_type = long unsigned int; allocator_type = std::allocator<Shop>]'
  558 |       { _M_default_initialize(__n); }
      |         ^~~~~~~~~~~~~~~~~~~~~
a.cc:33:28:   required from here
   33 |     vector<Shop> shopList(N);
      |                            ^
/usr/include/c++/14/bits/stl_construct.h:119:7: error: no matching function for call to 'Shop::Shop()'
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'Shop::Shop(int, int)'
   10 |     Shop(int m, int s)
      |     ^~~~
a.cc:10:5: note:   candidate expects 2 arguments, 0 provided
a.cc:4:7: note: candidate: 'constexpr Shop::Shop(const Shop&)'
    4 | class Shop
      |       ^~~~
a.cc:4:7: note:   candidate expects 1 argument, 0 provided
a.cc:4:7: note: candidate: 'constexpr Shop::Shop(Shop&&)'
a.cc:4:7: note:   candidate expects 1 argument, 0 provided