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

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> Pi;
typedef queue<Pi> QPi;
typedef pair<ll, ll> Pll;
typedef queue<Pll> QPll;
typedef vector<vi> Graph;
const int mod = 1000000007;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n,m,a,b;
  cin >> n >> m;
  Pi ab;
  REP(i,n) {
    cin >> a >> b;
    ab.emplace_back(a,b);
  }
  sort(ALL(ab));
  ll ans=0;
  int j=0;
  while(1) {
    if(ab.second[j]>m) {
      ans+=m*ab.first[j];
      break;
    } else {
      ans+=ab.second[j]*ab.first[j];
    }
    j++;
    m-=ab.second[j]
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:8: error: 'Pi' {aka 'struct std::pair<int, int>'} has no member named 'emplace_back'
   48 |     ab.emplace_back(a,b);
      |        ^~~~~~~~~~~~
a.cc:4:20: error: 'Pi' {aka 'struct std::pair<int, int>'} has no member named 'begin'
    4 | #define ALL(v) (v).begin(), (v).end()
      |                    ^~~~~
a.cc:50:8: note: in expansion of macro 'ALL'
   50 |   sort(ALL(ab));
      |        ^~~
a.cc:4:33: error: 'Pi' {aka 'struct std::pair<int, int>'} has no member named 'end'
    4 | #define ALL(v) (v).begin(), (v).end()
      |                                 ^~~
a.cc:50:8: note: in expansion of macro 'ALL'
   50 |   sort(ALL(ab));
      |        ^~~
a.cc:54:17: error: invalid types 'int[int]' for array subscript
   54 |     if(ab.second[j]>m) {
      |                 ^
a.cc:55:22: error: invalid types 'int[int]' for array subscript
   55 |       ans+=m*ab.first[j];
      |                      ^
a.cc:58:21: error: invalid types 'int[int]' for array subscript
   58 |       ans+=ab.second[j]*ab.first[j];
      |                     ^
a.cc:58:33: error: invalid types 'int[int]' for array subscript
   58 |       ans+=ab.second[j]*ab.first[j];
      |                                 ^
a.cc:61:17: error: invalid types 'int[int]' for array subscript
   61 |     m-=ab.second[j]
      |                 ^
Language: C++

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

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A,B;
    for(ll i = 0; i < N; i++) {
        ll a,b;
        cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }

    map<ll, ll> p;
    for(ll i = 0; i < N; i++) {
        p[A[i]] = B[i];
    }
    sort(A.begin(), A.end());
    int count = 0;
    int t = 0;

    ll ans = 0;
    while(count < M) {
        count += p[A[t]];
        ans += (A[t] * p[A[t]);
        t += 1;

        }
    if(count > M) {
        ans -= (count - M) * A[t - 1];
    }
       

    cout << ans;
    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: expected ']' before ')' token
   28 |         ans += (A[t] * p[A[t]);
      |                              ^
      |                              ]
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N,M;
    cin >> N >> M;
    pair<int,int> p[N];
    rep(i,N){
        int x,y;
        cin >> x >> y;
        p[i]({x,y});
    }
    sort(p,p+N);
    long long ans=0;
    rep(i,N){
        int d=min(M,p[i].first);
        ans+=(long long) d*p[i].second;
        if(M==0) break;
        M-=d;

    }
    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: no match for call to '(std::pair<int, int>) (<brace-enclosed initializer list>)'
   19 |         p[i]({x,y});
      |         ~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N,M;
    cin >> N >> M;
    pair<int,int> p[N];
    rep(i,N){
        int x,y
        cin >> x >> y;
        p[i]({x,y});
    }
    sort(p,p+N);
    long long ans=0;
    rep(i,N){
        int d=min(M,p[i].first);
        ans+=(long long) d*p[i].second;
        if(M==0) break;
        M-=d;

    }
    cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected initializer before 'cin'
   18 |         cin >> x >> y;
      |         ^~~
a.cc:19:17: error: 'y' was not declared in this scope
   19 |         p[i]({x,y});
      |                 ^
a.cc:19:13: error: no match for call to '(std::pair<int, int>) (<brace-enclosed initializer list>)'
   19 |         p[i]({x,y});
      |         ~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

const int MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); ++i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;
// TOP
void 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 sum;
	sum = 0;
	rep(i, n)
	{
		if (m > V.at(i).second)
		{
			m -= V.at(i).second;
			sum += V.at(i).first * V.at(i).second;
		}
		else
		{
			sum += V.at(i).first * m;
			break;
		}
	}
	cout << sum << endl;
}
// END

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Compiler output:
a.cc:3:10: fatal error: boost/algorithm/string/classification.hpp: No such file or directory
    3 | #include <boost/algorithm/string/classification.hpp>  // is_any_of
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main(){
    int N , M;
    cin >> N >> M;
    pair <int , int> AB[N];
    for(int i = 0; i < N; i++){
        cin >> AB[i].first >> AB[i].second;
    }
    sort(AB , AB + N);
    int k = 0;
    ll ans = 0;
    for(int i = 0; i < M; i++){
        if(AB[k].second == 0) {
            k++;
        }
        AB[k].second--;
        ans += AB[k].first;
  }
  cout << ans << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: expected '}' at end of input
   21 |   cout << ans << endl;
      |                       ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	d := make([]pair, n)
	for i := 0; i < n; i++ {
		a, b := scanInt(), scanInt()
		d[i] = pair{a, b}
	}
	sort.Slice(d, func(i, j int) bool {
		return d[i].a < d[j].a
	})

	ans := 0
	for i := 0; i < n; i++ {
		if m-d[i].b >= 0 {
			ans += d[i].b*d[i].a
			m -= d[i].b
		} else {
			ans += m*d[i].a
			break
		}
	}
	fmt.Fprintln(wr, ans)
}

type pair struct {
	a, b int
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:14:1: error: 'func' does not name a type
   14 | func scanRunes() []rune    { return []rune(scanString()) }
      | ^~~~
a.cc:15:1: error: 'func' does not name a type
   15 | func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
      | ^~~~
a.cc:16:1: error: 'func' does not name a type
   16 | func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
      | ^~~~
a.cc:17:1: error: 'func' does not name a type
   17 | func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }
      | ^~~~
a.cc:19:1: error: 'func' does not name a type
   19 | func scanInts(n int) []int {
      | ^~~~
a.cc:27:1: error: 'func' does not name a type
   27 | func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }
      | ^~~~
a.cc:27:28: error: expected unqualified-id before ')' token
   27 | func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }
      |                            ^
a.cc:29:1: error: 'func' does not name a type
   29 | func abs(a int) int {
      | ^~~~
a.cc:35:1: error: 'func' does not name a type
   35 | func min(a, b int) int {
      | ^~~~
a.cc:41:1: error: 'func' does not name a type
   41 | func max(a, b int) int {
      | ^~~~
a.cc:49:1: error: 'func' does not name a type
   49 | func main() {
      | ^~~~
a.cc:78:1: error: 'type' does not name a type; did you mean 'typeof'?
   78 | type pair struct {
      | ^~~~
      | typeof
Language: C++

#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<cmath>
using namespace std;


int main() {
	long long int n, m;
	long long int f, s;
	long long int sum = 0;
	cin >> n >> m;
	
	vector<pair<long long int, long long int>> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> f >> s;
		a[i] = make_pair(f, s);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n; i++)
	{
		if (a[i].second < m)
		{
			m -= a[i].second;
			sum += a[i].second*a[i].first;
		}
		else
		{
			sum += a[i].first*m;
			break;
		}
	}

	cout << sum << endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   25 |         sort(a.begin(), a.end());
      |         ^~~~
      |         sqrt
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include<map>
#include<set>
using namespace std;
 
int main() {
    long long n,m;
    cin >> n >> m;
    vector<pair<long long,long long>> v;
    for (long long t i = 0;i < n;i++) {
        long long a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());
    long long ans=0;
    long long j = 0;
    while (m > 0) {
        ans += v[j].first * v[j].second;
        m -= v[j].second;
        j++;
    }
    ans += v[j - 1].first * m;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: expected ';' before 'i'
   20 |     for (long long t i = 0;i < n;i++) {
      |                     ^~
      |                     ;
a.cc:20:22: error: 'i' was not declared in this scope
   20 |     for (long long t i = 0;i < n;i++) {
      |                      ^
a.cc:20:33: error: expected ')' before ';' token
   20 |     for (long long t i = 0;i < n;i++) {
      |         ~                       ^
      |                                 )
a.cc:20:34: error: 'i' was not declared in this scope
   20 |     for (long long t i = 0;i < n;i++) {
      |                                  ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

using pll=pair<long long,long long>
int main(){
    int N;
    long long M;
    cin>>N>>M;
    vector<pll>v(N);
    for(int i=0;i<N;i++)cin>>v[i].first>>v[i].second;
    sort(v.begin(),v.end());

    long long res=0;
    for(int i=0;i<N&&M>0;i++){
        res+=v[i].first*min(M,v[i].second);
        M-=min(M,v[i].second);
    }
    cout<<res<<endl;
}

Compiler output:
a.cc:6:11: error: two or more data types in declaration of 'type name'
    6 | using pll=pair<long long,long long>
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    long long M;
    cin >> N >> M;
    vector<pll> v(N);
    for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
    sort(v.begin(), v.end());

    long long res = 0;
    for (int i = 0; i < N && M > 0; ++i) {
        res += v[i].first * min(M, v[i].second);
        M -= min(M, v[i].second);
    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: 'pll' was not declared in this scope; did you mean 'll'?
   26 |     vector<pll> v(N);
      |            ^~~
      |            ll
a.cc:26:15: error: template argument 1 is invalid
   26 |     vector<pll> v(N);
      |               ^
a.cc:26:15: error: template argument 2 is invalid
a.cc:27:41: error: invalid types 'int[int]' for array subscript
   27 |     for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
      |                                         ^
a.cc:27:55: error: invalid types 'int[int]' for array subscript
   27 |     for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
      |                                                       ^
a.cc:28:12: error: request for member 'begin' in 'v', which is of non-class type 'int'
   28 |     sort(v.begin(), v.end());
      |            ^~~~~
a.cc:28:23: error: request for member 'end' in 'v', which is of non-class type 'int'
   28 |     sort(v.begin(), v.end());
      |                       ^~~
a.cc:32:17: error: invalid types 'int[int]' for array subscript
   32 |         res += v[i].first * min(M, v[i].second);
      |                 ^
a.cc:32:37: error: invalid types 'int[int]' for array subscript
   32 |         res += v[i].first * min(M, v[i].second);
      |                                     ^
a.cc:33:22: error: invalid types 'int[int]' for array subscript
   33 |         M -= min(M, v[i].second);
      |                      ^
Language: C++

#pragma GCC optimize ("Ofast")

#pragma GCC target ("avx2, tune=native")

#include <x86intrin.h>

#include <bits/stdc++.h>

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    int N, M;

    cin >> N >> M;

    pair<int, int> S[N];

    for (int i = 0; i < N; i++)

        cin >> S[i].first >> S[i].second;

    sort(S, S + N);

    long long res = 0;

    for (int i = 0; i < N; i++) {

        if (S[i].second >= M) {

            res += S[i].first * M;

            break;

        }

        res += S[i].first * S[i].second;

        M -= S[i].second;

    }

    cout << res;

    return 0;

}

Compiler output:
cc1plus: error: attribute 'target' argument ' tune=native' is unknown
cc1plus: error: attribute 'target' argument ' tune=native' is unknown
Language: C++

#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2, fma")

#include <x86intrin.h>
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    pair<int, int> S[N];
    for (int i = 0; i < N; i++)
        cin >> S[i].first >> S[i].second;
    sort(S, S + N);
    long long res = 0;
    for (int i = 0; i < N; i++) {
        if (S[i].second >= M) {
            res += S[i].first * M;
            break;
        }
        res += S[i].first * S[i].second;
        M -= S[i].second;
    }
    cout << res;
    return 0;
}

Compiler output:
cc1plus: error: attribute 'target' argument ' fma' is unknown
cc1plus: error: attribute 'target' argument ' fma' is unknown
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
int main(){
    int n,m;
    ll ttl=0;
    cin>>n>>m;
    ll v[n],l[n],vc[n];
    rep(i,0,n){
      cin>>v[i]>>l[i];
      vc[i]=v[i];
    }
    sort(vc,vc+n);
  	int cn=0
    while(true){
      	rep(i,0,n){
          if(v[cn]==vc[i]){
            if(m<=l[i]){
                ttl+=m*v[m];
                break;
            }else{
                ttl+=l[i]*v[i];
                m-=l[i];
                v[i]=0;
            }
          }
        }
      	cn++;
    }
    cout<<ttl<<endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected ',' or ';' before 'while'
   17 |     while(true){
      |     ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool shop_sort(const <pair<int, int>> &a, const <pair<int, int>> &b){
  return a.first < b.first;
}

int main()
{
  int N, M;
  cin >> N >> M;
  vector <pair <int, int>> shop(N);
  for (int i = 0; i < N; i++) {
    cin >> shop[i].first >> shop[i].second;
  }
  sort(shop.begin(), shop.end());
  
  long long ans = 0;
  int energy = M;
  for (int i = 0; i < N; i++) {
    if (energy >= shop[i].second) {
      ans += shop[i].second * shop[i].first;
      energy -= shop[i].second;
    } else {
      ans += energy * shop[i].first;
      energy -= energy;
    }
    if (energy <= 0) break;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:5:16: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]
    5 | bool shop_sort(const <pair<int, int>> &a, const <pair<int, int>> &b){
      |                ^~~~~
a.cc:5:22: error: expected ',' or '...' before '<' token
    5 | bool shop_sort(const <pair<int, int>> &a, const <pair<int, int>> &b){
      |                      ^
a.cc: In function 'bool shop_sort(int)':
a.cc:6:10: error: 'a' was not declared in this scope
    6 |   return a.first < b.first;
      |          ^
a.cc:6:20: error: 'b' was not declared in this scope
    6 |   return a.first < b.first;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  long long int a,b;
  cin>>a>>b;
  vector<pair<long long int,long long int>>c[a];
  rep(i,a){
    long long int e,d;
    cin>>e>>d;
    c[i].first=e;
    c[i].secomd=d;
  }
  long long int f=0,g=0;
  sort(c.begin(), c.end());
  rep(i,a){
    g+=c[i].first*min(c[i].secomd,b);
    b-=min(c[i].secomd,b);
    if(b<1)break;
  }
  cout<<g;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   12 |     c[i].first=e;
      |          ^~~~~
a.cc:13:10: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'secomd'
   13 |     c[i].secomd=d;
      |          ^~~~~~
a.cc:16:10: error: request for member 'begin' in 'c', which is of non-class type 'std::vector<std::pair<long long int, long long int> > [a]'
   16 |   sort(c.begin(), c.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'c', which is of non-class type 'std::vector<std::pair<long long int, long long int> > [a]'
   16 |   sort(c.begin(), c.end());
      |                     ^~~
a.cc:18:13: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   18 |     g+=c[i].first*min(c[i].secomd,b);
      |             ^~~~~
a.cc:18:28: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'secomd'
   18 |     g+=c[i].first*min(c[i].secomd,b);
      |                            ^~~~~~
a.cc:19:17: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'secomd'
   19 |     b-=min(c[i].secomd,b);
      |                 ^~~~~~
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 P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n, m; cin >> n >> m;
  vector<P> v(n);
  rep(i, n) {
    int x, y; cin >> x >> y;
    v[i].first = x;
    v[i].second = y;
  }
  sort(v.begin(), v.end());
  ll ans = 0;
  ll count = 0;
  for(int i = 0; ; ++i)　{
    for(int j = 0; j < v[i].second; ++j) {
      ++count;
      ans += v[i].first;
      if(count == m) {
	cout << ans;
	return 0;
      }
    }
  }
}


Compiler output:
a.cc:24:24: error: extended character 　 is not valid in an identifier
   24 |   for(int i = 0; ; ++i)　{
      |                        ^
a.cc: In function 'int main()':
a.cc:24:24: error: '\U00003000' was not declared in this scope
   24 |   for(int i = 0; ; ++i)　{
      |                        ^~
Language: Java

import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long[] a = new long[n];
    long[] b = new long[n];

    for (long i = 0; i < n; i++) {
      a[i] = sc.nextLong();
      b[i] = sc.nextLong();
    }

    Map<Long,Long> map = new TreeMap<>();

    for (long i = 0; i < n; i++) {
      if (map.containsKey(a[i])) {
        map.put(a[i],map.get(a[i])+b[i]);
      } else {
        map.put(a[i],b[i]);
      }
    }

    long count = 0;
    long sum = 0;

    for (long i : map.keySet()) {
      if (count > m) {
        break;
      }

      if (count+map.get(i) <= m) {
        sum += i*map.get(i);
      } else {
        sum += (m-count)*i;
      }

      count += map.get(i);

    }

    System.out.println(sum);

  }
}


Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from long to int
      a[i] = sc.nextLong();
        ^
Main.java:15: error: incompatible types: possible lossy conversion from long to int
      b[i] = sc.nextLong();
        ^
Main.java:21: error: incompatible types: possible lossy conversion from long to int
      if (map.containsKey(a[i])) {
                            ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
        map.put(a[i],map.get(a[i])+b[i]);
                  ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
        map.put(a[i],map.get(a[i])+b[i]);
                               ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
        map.put(a[i],map.get(a[i])+b[i]);
                                     ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
        map.put(a[i],b[i]);
                  ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
        map.put(a[i],b[i]);
                       ^
8 errors
Language: C++

 #include<bits/stdc++.h>

using namespace std;

int main(){
 int N,M;
 cin >> N >> M;
 
 vector<long int> A(N);
 vector<long int> B(N);
 map<long int,long int> C;
 for(int i = 0; i < N; i++) { cin >> A[i] >> B[i];}

 sort(A.begin(),A.end());

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

  long int count = 0;
 for(int i = 0; i < N; i++){
   if(count + C[A[i]] <= M) { count += C[A[i]]; ans = ans + A[i] * C[A[i]]; }
   else if(count + C[A[i]] > M && count < M){ count += (M - count); ans = ans + A[i] * (M - count); }
   else{ break; }
 }



 return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:22:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |    if(count + C[A[i]] <= M) { count += C[A[i]]; ans = ans + A[i] * C[A[i]]; }
      |                                                 ^~~
      |                                                 abs
a.cc:23:69: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |    else if(count + C[A[i]] > M && count < M){ count += (M - count); ans = ans + A[i] * (M - count); }
      |                                                                     ^~~
      |                                                                     abs
Language: C++

 #include<bits/stdc++.h>

using namespace std;

int main(){
 int N,M;
 cin >> N >> M;
 
 vector<long int> A(N);
 vector<long int> B(N);
 map<long int,long int> C;
 for(int i = 0; i < Q; i++) { cin >> A[i] >> B[i];}

 sort(A.begin(),A.end());

 for(int i = 0; i < Q; i++){
   C[A[i]] = B[i];
 }

  long int count = 0;
 for(int i = 0; i < Q; i++){
   if(count + C[A[i]] <= M) { count += C[A[i]]; ans = ans + A[i] * C[A[i]]; }
   else if(count + C[A[i]] > M && count < M){ count += (M - count); ans = ans + A[i] * (M - count); }
   else{ break; }
 }



 return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'Q' was not declared in this scope
   12 |  for(int i = 0; i < Q; i++) { cin >> A[i] >> B[i];}
      |                     ^
a.cc:16:21: error: 'Q' was not declared in this scope
   16 |  for(int i = 0; i < Q; i++){
      |                     ^
a.cc:21:21: error: 'Q' was not declared in this scope
   21 |  for(int i = 0; i < Q; i++){
      |                     ^
a.cc:22:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |    if(count + C[A[i]] <= M) { count += C[A[i]]; ans = ans + A[i] * C[A[i]]; }
      |                                                 ^~~
      |                                                 abs
a.cc:23:69: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |    else if(count + C[A[i]] > M && count < M){ count += (M - count); ans = ans + A[i] * (M - count); }
      |                                                                     ^~~
      |                                                                     abs
Language: C++

#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int main(){
    int n, m; cin >> n >> m;
    vector<pair<int, int>> v(n);
    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        v[i] = make_pair(a, b);
    }
    sort(v.begin(), v.end());
    long long ans = 0, sum = 0, flag = 0;
    for (int i = 0; i < n; i++) {
        if (flag) break;
        while (v[i].second) {
            if (sum == m) {flag = 1; break;}
            ans += v[i].first;
            v[i].second--;
            sum++;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'cin' was not declared in this scope
    7 |     int n, m; cin >> n >> m;
      |               ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << ans << endl;
      |     ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:20: error: 'endl' was not declared in this scope
   24 |     cout << ans << endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <vector>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include "pch.h"
#include <iostream>
#include <string>
#include <map>

using namespace std;

void C_120()
{
	string S;
	cin >> S;

	int count_0 = 0, count_1 = 0;
	for (int i = 0; i < (int)S.length(); ++i)
	{
		if (S[i] - '0' == 0) ++count_0;
		else ++count_1;
	}

	if (count_0 > count_1) cout << count_1 * 2 << endl;
	else cout << count_0 * 2 << endl;
	return;
}

void C_121()
{
	int N, M;
	cin >> N >> M;

	map<int, int> drink;
	for (int i = 0; i < N; ++i)
	{
		int A, B;
		cin >> A >> B;

		if (drink.count(A) == 0) drink[A] += B;
    else drink.insert(A, B);
	}

  int cost_sum = 0;
  for (map<int, int>::iterator itr = drink.begin(); itr != drink.end(); ++itr)
  {
    int cost = itr->first;
    int stock = itr->second;

    if (M <= stock)
    {
      cost_sum += cost * M;
      break;
    }
    else
    {
      M -= stock;
      cost_sum += cost * stock;
    }
  }
  cout << cost_sum << endl;
}

int main()
{
	//C_120();
  C_121();
}


Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

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

int main(){
	int n,m;cin >> n >> m;
	vector<pair<long long int, long long  int>> vp;
	long long int ans = 0;
	for(int i = 0;i < n;i++){
		long long int a, b;cin >> a >> b;
		vp.push_back({a, b});
	}
	sort(vp.begin(), vp.end());
	for(int i = 0;i < n;i++){
		if(m > vp[i].second){
			m -= vp[i].second;
			ans += vp[i].second * vp[i].first;
		}
		else return cout << ans + m * vp[i].first;
	}
}
// make pair, tuple
// make pair, tuple
// 
// __gcd(int, int);
// lcm = a * b / __gcd(a, b);
// 
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }
// 
// #Count leading & trailing zero of an integer bits
// __builtin_clz(n);
// __builtin_clzll(n);
//
// #Count 1s bits of an integer
// __builtin_popcount(n);
// __builtin_popcountll(n);
//
// #Error checking
// assert(n == 3);
// 
// #Error Printing
// cerr << "Some thing";

// #binary exponentiation
// long long binpow(long long a, long long b) {
//     long long res = 1;
//     while (b > 0) {
//         if (b & 1)
//             res = res * a;
//         a = a * a;
//         b >>= 1;
//     }
//     return res;
// }


Compiler output:
a.cc: In function 'int main()':
a.cc:18:34: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' in return
   18 |                 else return cout << ans + m * vp[i].first;
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
Language: C++

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

int main() {
  int64_t n, m, s = 0, t = 0;
  cin >> n >> m;
  vector<pair<int64_t, int64_t>> v(n);
  rep(i, n) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  rep(i, n){
    if(t + v[i].second >= m){
      s += (m-t) * v[i].first;
      break;
    }
    else{
      s += v[i].first * v[i].second;
      t += v[i].second;
  }
  cout << s << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    vector<long long> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    pair<long long, long long> p[n];
    for(int i = 0; i < n; i++) p[i] = pair<long long, long long> (a[i], b[i]);
    sort(p, p+n);
    long long ans = 0;
    int count = 0;
    for(int i = 0; i < n; i++) {
       int buy = min(m, p[i].second);
       ans = (long long)buy * p[i].first;
       m -= buy;
    }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: no matching function for call to 'min(int&, long long int&)'
   14 |        int buy = min(m, p[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: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:14:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   14 |        int buy = min(m, p[i].second);
      |                  ~~~^~~~~~~~~~~~~~~~
/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:14:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |        int buy = min(m, p[i].second);
      |                  ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    vector<long long> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    pair<long long, long long> p[n];
    for(int i = 0; i < n; i++) p[i] = pair<long long, long long> (a[i], b[i]);
    sort(p, p+n);
    long long ans = 0;
    int count = 0;
    for(int i = 0; i < n; i++) {
       int buy = min(m, p[i].second);
       ans = buy * p[i].first;
       m -= buy;
    }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: no matching function for call to 'min(int&, long long int&)'
   14 |        int buy = min(m, p[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: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:14:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   14 |        int buy = min(m, p[i].second);
      |                  ~~~^~~~~~~~~~~~~~~~
/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:14:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |        int buy = min(m, p[i].second);
      |                  ~~~^~~~~~~~~~~~~~~~
Language: C++

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

int	main() {
 int	N,M;
 cin >> N >> M;
 vector<int>	a(M),b(M);
  
  // 栄養ドリンクの値段と本数
  for (int i=0;i<N,i++){
    cin >> a.at(i) >> b.at(i);
  }
  
  // 一番大きいものを求める
  vector<int> order(M);
  int	tmp;
  for (int i=0;i<N-1;i++) {
	  if ( order(i) < order(i+1) ) {
      	tmp = order(i);
        order(i) = order(i+1);
        order(i+1) = tmp;
      }
  }
  
  // debug出力
  for (int i=0;i<N;i++) {
  	cout << order(i) << endl;
  }
  
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: expected ';' before ')' token
   10 |   for (int i=0;i<N,i++){
      |                       ^
      |                       ;
a.cc:18:21: error: no match for call to '(std::vector<int>) (int&)'
   18 |           if ( order(i) < order(i+1) ) {
      |                ~~~~~^~~
a.cc:18:32: error: no match for call to '(std::vector<int>) (int)'
   18 |           if ( order(i) < order(i+1) ) {
      |                           ~~~~~^~~~~
a.cc:19:20: error: no match for call to '(std::vector<int>) (int&)'
   19 |         tmp = order(i);
      |               ~~~~~^~~
a.cc:20:14: error: no match for call to '(std::vector<int>) (int&)'
   20 |         order(i) = order(i+1);
      |         ~~~~~^~~
a.cc:20:25: error: no match for call to '(std::vector<int>) (int)'
   20 |         order(i) = order(i+1);
      |                    ~~~~~^~~~~
a.cc:21:14: error: no match for call to '(std::vector<int>) (int)'
   21 |         order(i+1) = tmp;
      |         ~~~~~^~~~~
a.cc:27:22: error: no match for call to '(std::vector<int>) (int&)'
   27 |         cout << order(i) << endl;
      |                 ~~~~~^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll> > drink;
  for (int i = 0; i < N; i++) {
    ll A, B;
    cin >> A >> B;
    drink.push_back(make_pair(A, B));
  }

  sort(drink.begin(), drink.end());

  ll ans = 0, sum = 0;
  for (int i = 0; i < N; i++) {
    if (sum + drink[i].second >= M) {
      ans += (M - sum) * drink[i].first;
      break;
    } else {
      ans += drink[i].first * drink[i].second;
    }
    sum += drink[i].second;
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |   sort(drink.begin(), drink.end());
      |   ^~~~
      |   short
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <limits>
#include <cmath>
#include <numeric>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

long long gcd(long long a, long long b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}

int main() {
	long N, M;
	map<long long, long long> AB;

	cin >> N >> M;
	long long tmp, tmp1;
	for (long i = 0; i < N; i++) {
		cin >> tmp >> tmp1;
		 AB.insert(make_pair(tmp, tmp1));
	}
	long long res = 0;
	auto begin = AB.begin(), end = AB.end();
	for (auto iter = begin; iter != end; iter++) {
		for (long i = 0; i < iter->second; i++) {
			--M;
			res = res + iter->first;
			if (M == 0) {
				break;
			}
		}
		if (M == 0) {
			break;
		}
	}

	cout << res << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<iterator>

using namespace std;
bool sortit(const pair<int,int>&a, const pair<int,int>&b){
	return (a.first < b.first);
}
int main(){
	int n,m;
	cin >> n >> m;
  	// insertion into two arrays
  	int arr1[n], arr2[n];
  vector<pair<int,int>> vec;
  	for (int i = 0 ; i << n; i++)
    {
      cin >> arr1[i] >> arr2[i];
      vec.push_back(make_pair(arr1[i],arr2[i]));
    }
  	// sorting vector on basis of first element
  	sort(vec.begin(), vec.end(), sortit);
  // main code
  long int res =0;
  int i = 0;
  while (m != 0){
  	if(vec[i].second < m) {
    	res += (vec[i].first)*(vec[i].second);
      m = m - vec[i].second;
    }
    else {
    	res += (vec[i].first)*m;
      	m = 0;
    }
    i++;
  }
  cout << res<<'\n';

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(vec.begin(), vec.end(), sortit);
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<iterator>

using namespace std;
bool sortit(const pair<int,int>&a, const pair<int,int>&b){
	return (a.first < b.first);
}
int main(){
	int n,m;
	cin >> n >> m;
  	// insertion into two arrays
  	int arr1[n], arr2[n];
  vector<pair<int,int>> vec;
  	for (int i = 0 ; i << n; i++)
    {
      cin >> arr1[i] >> arr2[i];
      vec.push_back(make_pair(arr1[i],arr2[i]));
    }
  	// sorting vector on basis of first element
  	sort(vec.begin(), vec.end(), sortit);
  // main code
  long int res =0;
  while (m != 0){
  	if(vec[i].second < m) {
    	res += (vec[i].first)*(vec[i].second);
      m = m - vec[i].second;
    }
    else {
    	res += (vec[i].first)*m;
      	m = 0;
    }
    i++;
  }
  cout << res<<'\n';

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(vec.begin(), vec.end(), sortit);
      |         ^~~~
      |         short
a.cc:26:16: error: 'i' was not declared in this scope
   26 |         if(vec[i].second < m) {
      |                ^
a.cc:34:5: error: 'i' was not declared in this scope
   34 |     i++;
      |     ^
Language: C++

#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
	int n,m,b;
	long long ans=0,a[100001];
	map<int,int>mp;
	cin>>n>>m;
	for(rsize_t i=0;i<n;i++){
		cin>>a[i]>>b;
		mp[a[i]]+=b;
	}
	sort(a,a+n);
	for(rsize_t i=0;i<n;i++){
		if(mp[a[i]]<m){
			ans+=a[i]*mp[a[i]];
			m-=mp[a[i]];
		}
		else{
			ans+=m*a[i];
			break;
		}
	}
	cout<<ans;
	cin.get();
	cin.get();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'rsize_t' was not declared in this scope; did you mean 'ssize_t'?
   11 |         for(rsize_t i=0;i<n;i++){
      |             ^~~~~~~
      |             ssize_t
a.cc:11:25: error: 'i' was not declared in this scope
   11 |         for(rsize_t i=0;i<n;i++){
      |                         ^
a.cc:16:13: error: 'rsize_t' was not declared in this scope; did you mean 'ssize_t'?
   16 |         for(rsize_t i=0;i<n;i++){
      |             ^~~~~~~
      |             ssize_t
a.cc:16:25: error: 'i' was not declared in this scope
   16 |         for(rsize_t i=0;i<n;i++){
      |                         ^
Language: C++

N,M = map(int,input().split())
AB = [tuple(int(i) for i in input().split()) for j in range(N)]
AB.sort()
ans = 0
for i in range(N):
	a,b = AB[i]
	if M-b > 0:
		ans += a*b
		M -= b
	else:
		ans += M*b
		break
print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,M = map(int,input().split())
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <map>

using namespace std;


int main(){
long long n,m;
cin>>n>>m;
map<int,int> mm;
vector<int> v;
long long ans=0;
for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    mm[a]=b;
   v.push_back(a);
}
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++){
    if(mm[v[i]]>=m){
        ans+=m*v[i];
        cout<<ans;
        return 0;
    }
    else{
        ans+=mm[v[i]]*v[i];
        m-=mm[v[i]];
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

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

long long main() {
    long long N, M;
    cin >> N >> M;
    vector<vector<long long>> AB(N, vector<long long>(2));
    for (long long i = 0; i < N; i++) cin >> AB.at(i).at(0) >> AB.at(i).at(1);
    sort(AB.begin(), AB.end());
    long long ans = 0;
    for (long long i = 0; i < N; i++) {
        long long a = AB.at(i).at(0);
        long long b = AB.at(i).at(1);
        if (M <= b) {
            ans += a * M;
            break;
        } else {
            ans += a * b;
            M -= b;
        }
    }
    cout << ans << endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'