Language: C++

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

int main() {
	
	
	
	unsigned long long n, m, ans = 0, mi = 99999999999;
    cin >> n >> m;
    vector<unsigned int> a(n);
    for(int i = 0; i < n; i++){
    	unsigned long long t;
        cin >> t;
        a.at(i) = t;
        mi = min(mi, t);
    }

    for(unsigned long long j = 1; j <= m; j++){
        long t, u;
        cin >> t >> u;
        if(mi >= u){
        	continue;
        }
        t = min(t, n);
        mi = min(mi, a[n]);
        vector<unsigned long long> v(t, u);
    	copy(v.begin(), v.end(), back_inserter(a));
    }
    sort(a.begin(), a.end(), std::greater<unsigned long long>() );

    for(long long int i = 0; i < n; i++){
        ans += a.at(i);
    }


    cout << ans << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: error: no matching function for call to 'min(long int&, long long unsigned int&)'
   24 |         t = min(t, n);
      |             ~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:24:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long unsigned int')
   24 |         t = min(t, n);
      |             ~~~^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:24:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   24 |         t = min(t, n);
      |             ~~~^~~~~~
a.cc:25:17: error: no matching function for call to 'min(long long unsigned int&, __gnu_cxx::__alloc_traits<std::allocator<unsigned int>, unsigned int>::value_type&)'
   25 |         mi = min(mi, a[n]);
      |              ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:25:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and '__gnu_cxx::__alloc_traits<std::allocator<unsigned int>, unsigned int>::value_type' {aka 'unsigned int'})
   25 |         mi = min(mi, a[n]);
      |              ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:25:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   25 |         mi = min(mi, a[n]);
      |              ~~~^~~~~~~~~~