criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

int main() {
  int N,M;
  cin>>N>>M;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    cin>>B.at(i);
  }
  vector<pair<int,int>> drink;
  for(int i=0;i<N;i++){
    drink.push_back(A.at(i),B.at(i));
  }
  
  sort(drink.begin(),drink.end());
  long long ans=0LL;
  
  int j=0;
  while(M!=0){
    if(drink.at(j).second==0)
      j++;
    else{
      drink.at(j).second--;
      ans+=drink.at(j).first;
      M--;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   14 |     drink.push_back(A.at(i),B.at(i));
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
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:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; value_type = std::pair<int, int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
#define int long long
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    pair<int,int>P;
    int N, M; cin >> N >> M;
    rep(i, N) {
    	int A,B;
        cin >> A >> B;
        make_pair(A, B);
    }
    long long ans = 0;
    sort(P.begin(), P.end());
    rep(i, M) {
        if (P.second == 0)tie(P.first, P.second);
        ans += P.first;
        P.second--;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:12: error: 'struct std::pair<long long int, long long int>' has no member named 'begin'
   69 |     sort(P.begin(), P.end());
      |            ^~~~~
a.cc:69:23: error: 'struct std::pair<long long int, long long int>' has no member named 'end'
   69 |     sort(P.begin(), P.end());
      |                       ^~~
Language: C++

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    pair<int,int>P;
    int N, M; cin >> N >> M;
    rep(i, N) {
    	int A,B;
        cin >> A >> B;
        make_pair(A, B);
    }
    long long ans = 0;
    sort(P.first.begin(), P.first.end());
    rep(i, M) {
        if (P.second == 0)tie(P.first, P.second);
        ans += P.first;
        P.second--;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:18: error: request for member 'begin' in 'P.std::pair<int, int>::first', which is of non-class type 'int'
   68 |     sort(P.first.begin(), P.first.end());
      |                  ^~~~~
a.cc:68:35: error: request for member 'end' in 'P.std::pair<int, int>::first', which is of non-class type 'int'
   68 |     sort(P.first.begin(), P.first.end());
      |                                   ^~~
Language: C++

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    pair<int,int>P;
    int N, M; cin >> N >> M;
    vector<int>A(N);
    vector<int>B(N);
    vector<int>C(N);
    rep(i, N) {
        make_pair(A[i], B[i]);
        cin >> A[i] >> B[i];
    }
    long long ans = 0;
    sort(P.first.begin(), P.first.end());
    rep(i, M) {
        if (P.second == 0)tie(P.first, P.second);
        ans += P.first;
        P.second--;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:18: error: request for member 'begin' in 'P.std::pair<int, int>::first', which is of non-class type 'int'
   70 |     sort(P.first.begin(), P.first.end());
      |                  ^~~~~
a.cc:70:35: error: request for member 'end' in 'P.std::pair<int, int>::first', which is of non-class type 'int'
   70 |     sort(P.first.begin(), P.first.end());
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>>AB(N);
  for(int X=0;X<N;X++){
    int A,B;
    cin>>A>>B;
    p[X]=make_pair(A,B);
  }
  sort(AB.begin(),AB.end());
  int K=0;
  int F=0;
  for(int X=0;X<N;X++){
    int C,D;
    tie(C,D)=AB[X];
    if(F+D<=M){
      K+=C*D;
      F+=D;
    }
    else{
      K+=C*(M-F);
      F+=M-F;
      break;
    }
  }
  cout<<K<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'p' was not declared in this scope
   11 |     p[X]=make_pair(A,B);
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define int long long
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
    int N,M;
    cin >> N >> M;
    vector<P>AB(N);
    for(int i = 0; i < N; i++) {
        cin >> AB[i].first >> AB[i].second;
    }
    sort(AB.begin(),AB.end());
    int ans = 0;
    int cnt = 0;
    while(M) {
        if(M >= AB[cnt].second) {
            M-=AB[cnt].second;
            ans+=AB[cnt].first*AB[cnt].second;
            cnt++;
        }
        else {
            ans+=AB[cnt].first*M;
            M = 0;
        }
    }
    cout << ans << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++


// C - Energy Drink Collector

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

pair<ll, ll> P[100000];

int main() {
	int N, M;
	cin >> N >> M;

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

	sort(P, P+N);

	ll ans = 0;
	ll m = 0;
	for (int i=0; i<N+ i++) {
		ll A = P[i].first;
		ll B = P[i].second;
		if (m + B < M) {
			ans += A*B;
			m += B;
		} else {
			while (m < M) {
				ans += A;
				m += 1;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:31: error: expected ';' before ')' token
   27 |         for (int i=0; i<N+ i++) {
      |                               ^
      |                               ;
Language: C++

#include <iostream>
#include <vector>
#include<algorithm>
#include<pair>
using namespace std;
//imit
int main(void){
    long n,m;
    cin >> n >> m;
    
    vector<pair<long,long>> vec(n);//??
    
    for(int i = 0;i K n;i++){
          cin >> vec[i].first >> vec[i].second;
    }
    
    sort(vec.begin(),vec.end());//??
    
    long ans = 0;
    
    for(int i = 0;i < n;i++){
          ans += vec[i].first * min(m,vec[i].second);
          m -= min(vec[i].second,m);
          if(m == 0)break;
    }
    cout << ans << endl;
}


Compiler output:
a.cc:4:9: fatal error: pair: No such file or directory
    4 | #include<pair>
      |         ^~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b)
{
   return *(int*)a-*(int*)b;
}

int main(void)
{
   int n, m, i, a[100000][2];
   long long int m, s=0, t=0;

   scanf("%d%lld",&n,&m);
   for(i=0;i<n;i++)
      scanf("%d%d",&a[i][0],&a[i][1]);

   qsort(a,n,sizeof(int)*2,cmp);

   for(i=0;i<n;i++){
      if(t+a[i][1]<m){
         s+=a[i][0]*a[i][1];
         t+=a[i][1];
      }
      else{
         s+=a[i][0]*(m-t);
         printf("%lld\n",s);
         return 0;
      }
   }
}

Compiler output:
main.c: In function 'main':
main.c:12:18: error: conflicting types for 'm'; have 'long long int'
   12 |    long long int m, s=0, t=0;
      |                  ^
main.c:11:11: note: previous declaration of 'm' with type 'int'
   11 |    int n, m, i, a[100000][2];
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i = 0; i < (n); i++)
typedef pair<ll,ll> P;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}



int main(){
  ll n,m;
  cin >> n >> m;

  map<ll,ll> mp;
  rep(i,n){
    ll a,b;
    cin >> a >> b;
    mp[a] += b;
  }

  ll ans = 0;
  for(auto it : mp){
    ll c = it.first;
    ll b = it_.second;

    if(b>=m){
      b = m;
      ans += c*m;
      cout << ans << endl;
      break;
    }else{
      m-=b;
      ans += c*b;
    }
  }


  return 0;
} 



Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: 'it_' was not declared in this scope; did you mean 'it'?
   26 |     ll b = it_.second;
      |            ^~~
      |            it
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector< pair<ll, ll> > p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
	int N, M;
	cin >> N >> M;
	map<ll, vector<int> > s; // 店
	rep(i, N) {
		ll a;
		int b;
		cin >> a >> b;
		s[a].push_back(b);
	}



	ll ans = 0;
	for(auto itr : s) {
		int price = itr.first;
		vector<int> stacks = itr.second;
		sort(stacks.start(), stacks.end());
		if (M == 0) break;
		rep (i, stacks.size()) {
			if (M - stacks[i] >= 0) {
				ans += (itr.first * stacks[i]);
				M -= stacks[i];
				continue;
			}
			rep(j, stacks[i]) {
				ans += itr.first;
				M -= 1;
				if (M == 0) {
					cout << ans << endl;
					return 0;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
  int n,m;
  vector<pair<int,int>> p(n);
  for (int i=0;i<n;++i) cin >> p.first[i] >> p.second[i];
  sort(p.begin(),p.end());
  
  long long ans=0;
  for (int i=0;i<n;++i){
    int buy = min(m,p.second);
    ans += buy*p.first;
    m-=buy;
  }
  cout << ans << endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:34: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 |   for (int i=0;i<n;++i) cin >> p.first[i] >> p.second[i];
      |                                  ^~~~~
a.cc:7:48: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    7 |   for (int i=0;i<n;++i) cin >> p.first[i] >> p.second[i];
      |                                                ^~~~~~
a.cc:12:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   12 |     int buy = min(m,p.second);
      |                       ^~~~~~
a.cc:13:18: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   13 |     ans += buy*p.first;
      |                  ^~~~~
Language: C++

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

int main(){
  int n,m;
  vector<pair<int,int>> p(n);
  for (int i=0;i<n;++i) cin >> p.first >> p.second;
  sort(p.begin(),p.end());
  
  long long ans=0;
  for (int i=0;i<n;++i){
    int buy = min(m,p.second);
    ans += buy*p.first;
    m-=buy;
  }
  cout << ans << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:34: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
    7 |   for (int i=0;i<n;++i) cin >> p.first >> p.second;
      |                                  ^~~~~
a.cc:7:45: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    7 |   for (int i=0;i<n;++i) cin >> p.first >> p.second;
      |                                             ^~~~~~
a.cc:12:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   12 |     int buy = min(m,p.second);
      |                       ^~~~~~
a.cc:13:18: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   13 |     ans += buy*p.first;
      |                  ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<long long,long long> P;

int main() {
    long long N,M;
    cin >> N >> M;
    vector<P>A(N);
    for(long long i = 0; i < N; i++) {
        long longa,b;
        cin >> a >> b;
        A[i].first = a;
        A[i].second = b;
    }
    sort(A.begin(),A.end());
    long long ans = 0;
    long long cnt = 0;
    while(M != 0) {
        if(M > A[cnt].second) {
            ans+=A[cnt].first*A[cnt].second;
            M-=A[cnt].second;
        }
        else {
            ans+=M*A[cnt].first;
            M = 0;
        }
        cnt++;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a >> b;
      |                ^
Language: C++

#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main(){
  ll n,m; cin>>n>>m;
  vector<pair<ll ll>> v(n);
  
  rep(i,n){
   cin>>v.at(i).first>>v.at(i).second;
  }
  sort(v.begin(),v.end());
  ll i=0,ans=0;
  while(true){
    
    if(m>v.at(i).second){
      m-=v.at(i).second;
      ans+=v.at(i).first*v.at(i).second;
      i++;
    }
    else{
      ans+=m*v.at(i).first;
      m=0;
    }
    if(m==0){break;}
  
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: two or more data types in declaration of 'type name'
    9 |   vector<pair<ll ll>> v(n);
      |               ^~
a.cc:9:18: error: wrong number of template arguments (1, should be 2)
    9 |   vector<pair<ll ll>> v(n);
      |                  ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:9:20: error: template argument 1 is invalid
    9 |   vector<pair<ll ll>> v(n);
      |                    ^~
a.cc:9:20: error: template argument 2 is invalid
a.cc:12:11: error: request for member 'at' in 'v', which is of non-class type 'int'
   12 |    cin>>v.at(i).first>>v.at(i).second;
      |           ^~
a.cc:12:26: error: request for member 'at' in 'v', which is of non-class type 'int'
   12 |    cin>>v.at(i).first>>v.at(i).second;
      |                          ^~
a.cc:14:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   14 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:14:20: error: request for member 'end' in 'v', which is of non-class type 'int'
   14 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:18:12: error: request for member 'at' in 'v', which is of non-class type 'int'
   18 |     if(m>v.at(i).second){
      |            ^~
a.cc:19:12: error: request for member 'at' in 'v', which is of non-class type 'int'
   19 |       m-=v.at(i).second;
      |            ^~
a.cc:20:14: error: request for member 'at' in 'v', which is of non-class type 'int'
   20 |       ans+=v.at(i).first*v.at(i).second;
      |              ^~
a.cc:20:28: error: request for member 'at' in 'v', which is of non-class type 'int'
   20 |       ans+=v.at(i).first*v.at(i).second;
      |                            ^~
a.cc:24:16: error: request for member 'at' in 'v', which is of non-class type 'int'
   24 |       ans+=m*v.at(i).first;
      |                ^~
Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<>>que;
  for(int i=0;i<n:i++){
    ll a,b;cin>>a>>b;
    que.push(mp(a,b));
  }
  ll ans = 0;
  while(!que.empty()){
    ll va = que.top().F;
    ll num = que.top().S;
    que.pop();
    if(num >= m){
      ans += m * va;
      break;
    }else{
      m-=num;
      ans += num*va;
    }
  }
  cout<<ans<<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   25 |   for(int i=0;i<n:i++){
      |               ^
a.cc:25:18: error: found ':' in nested-name-specifier, expected '::'
   25 |   for(int i=0;i<n:i++){
      |                  ^
      |                  ::
a.cc:25:17: error: 'n' is not a class, namespace, or enumeration
   25 |   for(int i=0;i<n:i++){
      |                 ^
a.cc:30:3: error: expected primary-expression before 'while'
   30 |   while(!que.empty()){
      |   ^~~~~
a.cc:29:14: error: expected ')' before 'while'
   29 |   ll ans = 0;
      |              ^
      |              )
   30 |   while(!que.empty()){
      |   ~~~~~       
a.cc:25:6: note: to match this '('
   25 |   for(int i=0;i<n:i++){
      |      ^
a.cc:42:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<ll, ll> pll;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll n, m;
    cin >> n >> m;
    vector<pll> v(n);
    ll a, b;
    for (int i = 0; i < n; i++) {cin >> a >> b; v[i] = pll(a, b);}
    sort(v.begin(), v.end());
    int total = 0;
    for (int i = 0; i < n; i++) {
        int cnt = min(m, v[i].second);
        m = max(0, m - v[i].second);
        total += cnt * v[i].first;
    }
    cout << total << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: no matching function for call to 'max(int, ll)'
   26 |         m = max(0, m - v[i].second);
      |             ~~~^~~~~~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   26 |         m = max(0, m - v[i].second);
      |             ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |         m = max(0, m - v[i].second);
      |             ~~~^~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
public class Main {    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();        
		int m = sc.nextInt();       
        Data [] d = new Data [n];
        for(int i=0;i<n;i++){int A = sc.nextInt();
                             int B = sc.nextInt();
                             d[i] = new Data(A,B);                            
                            }
        Arrays.sort(d, new Comparator<Data>() {
            public int compare(Data d1, Data d2) {
                return d1.getA() - d2.getA();
            }
        }); 
        long ans = 0;
        int count = 0;
        int point = 0;
        while(count<m){ans+=d[i].getA();
                       count++;
                       if(count==d[point].getB()){point++;count=0;}
                      }
        System.out.println(ans);
	}
}
class Data{
    private int a;
    private int b;
    public Data(int a, int b) {
        this.a = a;
        this.b = b;
    }
    public int getA() {
        return a;
    }
    public int getB() {
        return b;
    }
}

Compiler output:
Main.java:22: error: cannot find symbol
        while(count<m){ans+=d[i].getA();
                              ^
  symbol:   variable i
  location: class Main
1 error
Language: Java

import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
public class Main {    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();        
		int m = sc.nextInt();       
        Data [] d = new Data [n];
        for(int i=0;i<n;i++){int A = sc.nextInt();
                             int B = sc.nextInt();
                             d[i] = new Data(A,B);                            
                            }
        Arrays.sort(d, new Comparator<Data>() {
            public int compare(Data d1, Data d2) {
                return d1.getA() - d2.getA();
            }
        }); 
        long ans = 0;
        int count = 0;
        int point = 0;
        while(count<m)){ans+=d[i].getA();
                        count++;
                        if(count==d[point].getB()){point++;count=0;}
                       }
        System.out.println(ans);
	}
}
class Data{
    private int a;
    private int b;
    public Data(int a, int b) {
        this.a = a;
        this.b = b;
    }
    public int getA() {
        return a;
    }
    public int getB() {
        return b;
    }
}

Compiler output:
Main.java:22: error: illegal start of expression
        while(count<m)){ans+=d[i].getA();
                      ^
1 error
Language: Java

import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
public class Main {    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();        
		int m = sc.nextInt();       
        Data [] d = new Data [m];
        for(int i=0;i<m;i++){int B = sc.nextInt();
                             int C = sc.nextInt();
                             d[i] = new Data(A,B);                            
                            }
        Arrays.sort(d, new Comparator<Data>() {
            public int compare(Data d1, Data d2) {
                return d1.getA() - d2.getA();
            }
        }); 
        long ans = 0;
        int count = 0;
        for(int i=0;i<n;i++){if(d[i].getB()<m-count){ans+=d[i].getA()*d[i].getB();
                                                    count+=d[i].getB();}
                             else{ans+=d[i].getA()*m-count;break;}
                            }
        System.out.println(ans);
	}
}
class Data{
    private int a;
    private int b;
    public Data(int a, int b) {
        this.a = a;
        this.b = b;
    }
    public int getA() {
        return a;
    }
    public int getB() {
        return b;
    }
}

Compiler output:
Main.java:12: error: cannot find symbol
                             d[i] = new Data(A,B);                            
                                             ^
  symbol:   variable A
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    pair<int,int> d[n];
    for(int i=0;i<n;i++)cin >> d[i].first >> d[i].second;
    sort(d,d+n);
    long long sum=0;
    for(int i=0;m>0;i++){
        if(m>=d[i].second){
            sum+=d[i].second*d[i].first;
            m-=d[i].second;
        }
        else{
            sum+=b*d[i].second;
            m=0;
        }
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'b' was not declared in this scope
   16 |             sum+=b*d[i].second;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    pair<int,int> d[n];
    for(int i=0;i<n;i++)cin >> d[i].first >> d[i].second;
    sort(d,d+n);
    long long sum=0;
    for(int i=0;m>0;i++){
        if(m>=d[i].second){
            sum+=d[i].second*d[i].first;
            m-=d[i].second;
        }
        else{
            sum+=b+d[i].second;
            m=0;
        }
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'b' was not declared in this scope
   16 |             sum+=b+d[i].second;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    pair<int,int> d[n];
    for(int i=0;i<n;i++)cin >> d[i].first >> d[i].second;
    sort(d,d+n);
    long long sum=0;
    for(int i=0;b>0;i++){
        if(b>=d[i].second){
            sum+=d[i].second*d[i].first;
            b-=d[i].second;
        }
        else{
            sum+=b+d[i].second;
            b=0;
        }
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'b' was not declared in this scope
   10 |     for(int i=0;b>0;i++){
      |                 ^
Language: C

#include <stdio.h>
int main()
{
  long long int N, M;
  long long int AB[100000][2];
  long long int A, B, total, result;
  int i, j, index;
  
  scanf("%d %d", &N, &M);
  for(i = 0; i < N; ++i){
    scanf("%lld %lld", &AB[i][0], &AB[i][1]);
    index = i;
    while((index > 0) && (A[index][0] < A[index - 1][0])){
      A = AB[index][0];
      B = AB[index][1];
      AB[index][0] = AB[index - 1][0];
      AB[index][1] = AB[index - 1][1];
      AB[index - 1][0] = A;
      AB[index - 1][1] = B;
      --index;
    }
  }
  total = 0;
  result = 0;
  for(i = 0; i < N; ++i){
    for(j = 0; j < M; ++j){
      ++total;
      result += AB[i][0];
      
      if(total == M){
        printf("%lld\n", result);
        return 0;
      }
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:13:28: error: subscripted value is neither array nor pointer nor vector
   13 |     while((index > 0) && (A[index][0] < A[index - 1][0])){
      |                            ^
main.c:13:42: error: subscripted value is neither array nor pointer nor vector
   13 |     while((index > 0) && (A[index][0] < A[index - 1][0])){
      |                                          ^
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n),b(n);
  for (int i=0;i<n;++i) cin >> a[i] >> b[i];
  
  map<int, long long> mp;
  for (int i=0;i<n;++i){
    //a円のお店にはb個追加された
    if (mp.find(a[i])) mp[a[i]]+=b[i];
    else mp[a[i]]=b[i];
  }
  
  long long ans=0;
  for (auto shop:mp){
    long long buy=min((long long)m, shop.second);
    ans+=buy*shop.first;
    m-=(int)buy;
  }
  cout << ans << endl;
}
//treemap→順番がソートされる
//hashmap→順番がソートされない
    


Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: could not convert 'mp.std::map<int, long long int>::find((*(const std::map<int, long long int>::key_type*)(& a.std::vector<int>::operator[](((std::vector<int>::size_type)i)))))' from 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} to 'bool'
   13 |     if (mp.find(a[i])) mp[a[i]]+=b[i];
      |         ~~~~~~~^~~~~~
      |                |
      |                std::map<int, long long int>::iterator {aka std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator}
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n),b(n);
  for (int i=0;i<n;++i) cin >> a[i] >> b[i];
  
  map<int, long long> mp;
  for (int i=0;i<n;++i){
    //a円のお店にはb個追加された
    if (mp.find[a[i]]) mp[a[i]]+=b[i];
    else mp[a[i]]=b[i];
  }
  
  long long ans=0;
  for (auto shop:mp){
    long long buy=min((long long)m, shop.second);
    ans+=buy*shop.first;
    m-=(int)buy;
  }
  cout << ans << endl;
}
//treemap→順番がソートされる
//hashmap→順番がソートされない
    


Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: invalid types '<unresolved overloaded function type>[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   13 |     if (mp.find[a[i]]) mp[a[i]]+=b[i];
      |                ^
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n),b(n);
  for (int i=0;i<n;++i) cin >> a[i] >> b[i];
  
  map<int, long long> m;
  for (int i=0;i<n;++i){
    //a円のお店にはb個追加された
    if (m.find[a[i]]) m[a[i]]+=b[i];
    else m[a[i]]=b[i];
  }
  
  long long ans=0;
  for (auto shop:m){
    long long buy=min((long long)m, shop.second);
    ans+=buy*shop.first;
    m-=(int)buy;
  }
  cout << ans << endl;
}
//treemap→順番がソートされる
//hashmap→順番がソートされない
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: conflicting declaration 'std::map<int, long long int> m'
   10 |   map<int, long long> m;
      |                       ^
a.cc:5:9: note: previous declaration as 'int m'
    5 |   int n,m;
      |         ^
a.cc:13:11: error: request for member 'find' in 'm', which is of non-class type 'int'
   13 |     if (m.find[a[i]]) m[a[i]]+=b[i];
      |           ^~~~
a.cc:13:24: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   13 |     if (m.find[a[i]]) m[a[i]]+=b[i];
      |                        ^
a.cc:14:11: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   14 |     else m[a[i]]=b[i];
      |           ^
a.cc:18:18: error: 'begin' was not declared in this scope
   18 |   for (auto shop:m){
      |                  ^
a.cc:18:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:18:18: error: 'end' was not declared in this scope
   18 |   for (auto shop:m){
      |                  ^
a.cc:18:18: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
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, A, B, cnt=0;
  long long Sum=0,
  cin >> N >> M;
  vector<pair<int, int>> P(N);
  rep(i, N){
    cin >> A >> B;
    P[i]=make_pair(A, B);
  }
  sort(P.begin(), P.end());
  rep(i, N){
    rep(j, P[i].second){
      Sum+=P[i].first;
      cnt++;
      if(cnt==M) break;
    }
    if(cnt==M) break;
  }
  cout << Sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: expected initializer before '>>' token
    8 |   cin >> N >> M;
      |       ^~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> x(n);
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        x[i].first = a;
        x[i].second = b;
    }
    ll ans = 0;
    sort(x.begin,x.end);
    ll i = 0;
    while(m > 0 && i < n){
        if(m-x[i].second >= 0){ 
            ans += x[i].first*x[i].second;
            m -= x[i].second;
        }
        else{
            ans += x[i].first*m;
        }
        i++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   18 |     sort(x.begin,x.end);
      |     ~~~~^~~~~~~~~~~~~~~
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:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:18:9: note:   couldn't deduce template parameter '_RAIter'
   18 |     sort(x.begin,x.end);
      |     ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793: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:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> x(n);
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        x[i].first = a;
        x[i].second = b;
    }
    ll ans = 0;
    sort(x.first,x.second);
    ll i = 0;
    while(m > 0 && i < n){
        if(m-x[i].second >= 0){ 
            ans += x[i].first*x[i].second;
            m -= x[i].second;
        }
        else{
            ans += x[i].first*m;
        }
        i++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   18 |     sort(x.first,x.second);
      |            ^~~~~
a.cc:18:20: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   18 |     sort(x.first,x.second);
      |                    ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> x(n);
    repaa(i,n){
        ll a,b;
        cin >> a >> b;
        x[i].first = a;
        x[i].second = b;
    }
    ll ans = 0;
    sort(x.first,x.second);
    ll i = 0;
    while(m > 0 && i < n){
        if(m-x[i].second >= 0){ 
            ans += x[i].first*x[i].second;
            m -= x[i].second;
        else{
            ans += x[i].first*m;
        }
        i++;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'i' was not declared in this scope
   11 |     repaa(i,n){
      |           ^
a.cc:11:5: error: 'repaa' was not declared in this scope
   11 |     repaa(i,n){
      |     ^~~~~
a.cc:18:12: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   18 |     sort(x.first,x.second);
      |            ^~~~~
a.cc:18:20: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   18 |     sort(x.first,x.second);
      |                    ^~~~~~
a.cc:24:9: error: expected '}' before 'else'
   24 |         else{
      |         ^~~~
a.cc:21:31: note: to match this '{'
   21 |         if(m-x[i].second >= 0){
      |                               ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> x(n);
    repaa(i,n){
        ll a,b;
        cin >> a >> b;
        x[i].first = a;
        x[i].second = b;
    }
    ll ans = 0;
    sort(x.first,x.second);
    ll i = 0;
    while(m > 0 && i < n){
        if(m-b[i] >= 0){ 
            ans += a[i]*b[i];
            m -= b[i];
        else{
            ans += a[i]*m;
        }
        i++;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'i' was not declared in this scope
   11 |     repaa(i,n){
      |           ^
a.cc:11:5: error: 'repaa' was not declared in this scope
   11 |     repaa(i,n){
      |     ^~~~~
a.cc:18:12: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   18 |     sort(x.first,x.second);
      |            ^~~~~
a.cc:18:20: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   18 |     sort(x.first,x.second);
      |                    ^~~~~~
a.cc:21:14: error: 'b' was not declared in this scope
   21 |         if(m-b[i] >= 0){
      |              ^
a.cc:22:20: error: 'a' was not declared in this scope
   22 |             ans += a[i]*b[i];
      |                    ^
a.cc:24:9: error: expected '}' before 'else'
   24 |         else{
      |         ^~~~
a.cc:21:24: note: to match this '{'
   21 |         if(m-b[i] >= 0){
      |                        ^
a.cc:25:20: error: 'a' was not declared in this scope
   25 |             ans += a[i]*m;
      |                    ^
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  ll n,m;
  cin>>n>>m;
  ll a[n],b[n];
  vector<pair<ll,ll>> v(n);
  rep(i,n){
    cin>>a[i]>>b[i];
    v(i)={ a[i] , b[i] };
  }
  sort(v.begin(),v.end());
  ll buy=m;
  ll money=0;
  rep(i,n){
    if(buy<=v[i].second){
      money+=v[i].first*buy;
      break;
    }else{
      buy-=v[i].second;
      money+=v[i].first*v[i].second;
    }
  }
  cout<<money;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:6: error: no match for call to '(std::vector<std::pair<long long int, long long int> >) (int&)'
   22 |     v(i)={ a[i] , b[i] };
      |     ~^~~