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

int main() {
	map<int, int> energy_price_map;
	int N, M;
	scanf("%d %d", &N, &M);

	int A, B;
	while ((int)energy_price_map.size() < N) {
		cin >> A;
		cin >> B;
		energy_price_map.insert(make_pair(A,B));
	}

	int bought_cnt = 0;
	int needed_money = 0;
	for (auto shop_info : energy_price_map) {
		int price = shop_info.first;
		int count = shop_info.second;
		for (int ii = 0; ii < count; ii++) {
			needed_money += price;
			bought_cnt++;
			if (bought_cnt == M) goto END;
		}
	}
END:
	printf("%d", needed_money);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'map' was not declared in this scope
    2 |         map<int, int> energy_price_map;
      |         ^~~
a.cc:2:13: error: expected primary-expression before 'int'
    2 |         map<int, int> energy_price_map;
      |             ^~~
a.cc:4:9: error: 'scanf' was not declared in this scope
    4 |         scanf("%d %d", &N, &M);
      |         ^~~~~
a.cc:7:21: error: 'energy_price_map' was not declared in this scope
    7 |         while ((int)energy_price_map.size() < N) {
      |                     ^~~~~~~~~~~~~~~~
a.cc:8:17: error: 'cin' was not declared in this scope
    8 |                 cin >> A;
      |                 ^~~
a.cc:10:41: error: 'make_pair' was not declared in this scope
   10 |                 energy_price_map.insert(make_pair(A,B));
      |                                         ^~~~~~~~~
a.cc:15:31: error: 'energy_price_map' was not declared in this scope
   15 |         for (auto shop_info : energy_price_map) {
      |                               ^~~~~~~~~~~~~~~~
a.cc:25:9: error: 'printf' was not declared in this scope
   25 |         printf("%d", needed_money);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main() {
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

int main()
{
  int n, m, i, j;
  cin >> n >> m;

  long int a[n];
  int b[n];

  for(i=0; i<n; i++){
    cin >> a[i] >> b[i];
  }

//for(i=0; i<n; i++)  cout << a[i] << endl;

  long int dp[m+1];
  int min_index = 0;
  long int minv = a[0];
  for(j=1; j<n; j++){
    if(minv > a[j]){
      minv = a[j];
      min_index = j;
    }
  }
  dp[1] = a[min_index];

  b[min_index]--;

  for(i=1; i<m; i++){
  //  cout << dp[i] << endl;
    for(k=; k<n; k++){
      if(b[k]!=0) break;
    }
    minv = a[k];
    min_index = k;
    for(j=k+1; j<n; j++){
      if(minv > a[j] && b[j]!=0){
        minv = a[j];
        min_index = j;
      }
    }

    dp[i+1] = dp[i] + a[min_index];
    b[min_index]--;
  }

  cout << dp[m];

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'k' was not declared in this scope
   36 |     for(k=; k<n; k++){
      |         ^
a.cc:36:11: error: expected primary-expression before ';' token
   36 |     for(k=; k<n; k++){
      |           ^
a.cc:39:14: error: 'k' was not declared in this scope
   39 |     minv = a[k];
      |              ^
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

    int N,M,s,o,tmp,ans;
    int[] A,B,Rank;

    N=sc.nextInt();
    M=sc.nextInt();

    A=new int[N];
    B=new int[N];
    Rank=new int[N];

    for(s=0;s<N;s++){
      A[s]=sc.nextint();
      B[s]=sc.nextint();
    }
    for(s=0;s<N;s++){
      Rank[s]=0;
      for(o=0;o<N;o++){
        if(A[s]>A[o]){
          Rank[s]++;
        }
      }
    }

    for(s=0,ans=0;M!=0;s++){
      for(o=0;o<N;o++){
        if(Rank[o]==s){
          if(M>B[s]){
            ans=ans+A[o]*B[o];
            M-=B[s];
          }else{
            ans=ans+A[o]*M;
            M=0;
          }
        }
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:18: error: cannot find symbol
      A[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:19: error: cannot find symbol
      B[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
2 errors
Language: Java

import java.util.*;

public class Energy_Drink_Collector{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

    int N,M,s,o,tmp,ans;
    int[] A,B,Rank;

    N=sc.nextInt();
    M=sc.nextInt();

    A=new int[N];
    B=new int[N];
    Rank=new int[N];

    for(s=0;s<N;s++){
      A[s]=sc.nextint();
      B[s]=sc.nextint();
    }
    for(s=0;s<N;s++){
      Rank[s]=0;
      for(o=0;o<N;o++){
        if(A[s]>A[o]){
          Rank[s]++;
        }
      }
    }

    for(s=0,ans=0;M!=0;s++){
      for(o=0;o<N;o++){
        if(Rank[o]==s){
          if(M>B[s]){
            ans=ans+A[o]*B[o];
            M-=B[s];
          }else{
            ans=ans+A[o]*M;
            M=0;
          }
        }
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:3: error: class Energy_Drink_Collector is public, should be declared in a file named Energy_Drink_Collector.java
public class Energy_Drink_Collector{
       ^
Main.java:18: error: cannot find symbol
      A[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:19: error: cannot find symbol
      B[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
3 errors
Language: Java

import java.util.*;

public class Energy_Drink_Collector{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

    int N,M,s,o,tmp,ans;
    int[] A,B,Rank;

    N=sc.nextInt();
    M=sc.nextInt();

    A=new int[N];
    B=new int[N];

    for(s=0;s<N;s++){
      A[s]=sc.nextint();
      B[s]=sc.nextint();
    }

/*
    for(s=0;s<N-1;s++){
      for(o=s+1;o<N;o++){
        if(A[s]>A[o]){
          tmp=A[s];
          A[s]=A[o];
          A[o]=tmp;
          tmp=B[s];
          B[s]=B[o];
          B[o]=tmp;
        }
      }
    }


    for(s=0,ans=0;s<N&&M!=0;s++){
      if(M>B[s]){
        ans=ans+A[s]*B[s];
        M-=B[s];
      }else{
        ans=ans+A[s]*M;
        break;
      }
    }


*/
    for(s=0;s<N;s++){
      Rank[s]=0;
      for(o=0;o<N;o++){
        if(A[s]>A[o]){
          Rank[s]++;
        }
      }
    }

    for(s=0,ans=0;M!=0;s++){
      for(o=0;o<N;o++){
        if(Rank[o]==s){
          if(M>B[s]){
            ans=ans+A[o]*B[o];
            M-=B[s];
          }else{
            ans=ans+A[o]*M;
            M=0;
          }
        }
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:3: error: class Energy_Drink_Collector is public, should be declared in a file named Energy_Drink_Collector.java
public class Energy_Drink_Collector{
       ^
Main.java:17: error: cannot find symbol
      A[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:18: error: cannot find symbol
      B[s]=sc.nextint();
             ^
  symbol:   method nextint()
  location: variable sc of type Scanner
3 errors
Language: C++

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

int main(){
    long N, M;
    cin >> N >> M;
    vector<pair<long, long>> S(N);
    for(auto& i : S)cin >> i.first >> i.second;
    
    long ans(0);
    
    sort(S.begin(), S.end());
    for_each(S.begin(), S.end(), [&M, ans](auto a){long k = min(M, a.second); ans += k * a.first; M -= k;});
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In instantiation of 'main()::<lambda(auto:28)> [with auto:28 = std::pair<long int, long int>]':
/usr/include/c++/14/bits/stl_algo.h:3786:5:   required from '_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Funct = main()::<lambda(auto:28)>]'
 3786 |         __f(*__first);
      |         ~~~^~~~~~~~~~
a.cc:13:13:   required from here
   13 |     for_each(S.begin(), S.end(), [&M, ans](auto a){long k = min(M, a.second); ans += k * a.first; M -= k;});
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:13:83: error: assignment of read-only variable 'ans'
   13 |     for_each(S.begin(), S.end(), [&M, ans](auto a){long k = min(M, a.second); ans += k * a.first; M -= k;});
      |                                                                               ~~~~^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

#define int long long

using namespace std;

int main()
{
	int N, M; cin >> N >> M;
	int * A = (int *)malloc(sizeof(int) * M);
	int * B = (int *)malloc(sizeof(int) * M);
	for (int i = 0; i < N;i++) {
		cin >> A[i] >> B[i];
	}
	int ans = 0;
	while (1) {
		int min = 100000000000 , id;
		for (int i = 0; i < N;i++) {
			if (min > A[i] && B[i] > 0) { min = A[i];id = i; }
		}
		if (B[id] >= M) {
			ans += M * A[id];
			break;
		}
		else {
			ans += B[id] * A[id];
			M -= B[id];
			B[id] = 0;
		}
	}

	cout << ans << endl;
}

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

#include <iostream>


#define int long 

using namespace std;

void main()
{
	int N, M; cin >> N >> M;
	int * A = (int *)malloc(sizeof(int) * M);
	int * B = (int *)malloc(sizeof(int) * M);
	for (int i = 0; i < N;i++) {
		cin >> A[i] >> B[i];
	}
	int ans = 0;
	while (1) {
		int min = 100000000000 , id;
		for (int i = 0; i < N;i++) {
			if (min > A[i] && B[i] > 0) { min = A[i];id = i; }
		}
		if (B[id] >= M) {
			ans += M * A[id];
			break;
		}
		else {
			ans += B[id] * A[id];
			M -= B[id];
			B[id] = 0;
		}
	}

	cout << ans << endl;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | void main()
      | ^~~~
Language: C++

#include <iostream>
#include <vector>

#define int long long

using namespace std;
void main()
{
	int N, M; cin >> N >> M;
	int * A = (int *)malloc(sizeof(int) * M);
	int * B = (int *)malloc(sizeof(int) * M);
	for (int i = 0; i < N;i++) {
		cin >> A[i] >> B[i];
	}
	int ans = 0;
	while (1) {
		int min = 100000000000 , id;
		for (int i = 0; i < N;i++) {
			if (min > A[i] && B[i] > 0) { min = A[i];id = i; }
		}
		if (B[id] >= M) {
			ans += M * A[id];
			break;
		}
		else {
			ans += B[id] * A[id];
			M -= B[id];
			B[id] = 0;
		}
	}

	cout << ans << endl;
}

Compiler output:
a.cc:7:1: error: '::main' must return 'int'
    7 | void main()
      | ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

struct node{

	long long int a,b;

};

bool cmp(node e,node f)

{

	if(e.a!=f.a)

	return e.a<f.a;

	else

	return e.b>f.b;

}

int main(){

long long int n,m,y=0;

cin>>n>>m;

node d[n+1];

for(int i=1;i<=n;i++)

cin>>d[i].a>>d[i].b;

sort(d+1,d+n+1,cmp);

for(int i=1;i<=n;i++){

	if(d[i].b<m)

	{

		y+=d[i].a*d[i].b;

		m-=d[i].b;

	}

	else

	{

		y+=d[i].a*m;

		break;

	}

}

cout<<y;
  return

}



Compiler output:
a.cc: In function 'int main()':
a.cc:66:1: error: expected primary-expression before '}' token
   66 | }
      | ^
a.cc:64:9: error: expected ';' before '}' token
   64 |   return
      |         ^
      |         ;
   65 | 
   66 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct node{
	long long int a,b;
}
bool cmp(node e,node f)
{
	if(e.a!=f.a)
	return e.a<f.a;
	else
	return e.b>f.b;
}
int main(){
long long n,m,y=0;
cin>>n>>m;
node d[n+1];
for(int i=1;i<=n;i++)
cin>>d[i].a>>d[i].b;
sort(d+1,d+n+1,cmp);
for(int i=1;i<=n;i++){
	if(d[i].b<m)
	{
		y+=d[i].a*d[i].b;
		m-=d[i].b;
	}
	else
	{
		y+=d[i].a*m;
		break;
	}
}
cout<<y;
}

Compiler output:
a.cc:5:2: error: expected ';' after struct definition
    5 | }
      |  ^
      |  ;
Language: C++

include<stdio.h>

int main(void){
	int n,m;
	int a[100000];
	int b[100000];

	int min,cur;
	int min_num;
	int i,j;
	int buff;

	int count;
	int cost;
	scanf("%d %d",&n,&m);


	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
	}

	for(i=0;i<n-1;i++){
		min = a[i];
		for(j=i+1;j<n;j++){
			cur = a[j];
			if(min>cur){
				min = cur;	min_num = j;
			}
		}
		buff = a[i];	a[i] = a[min_num];	a[min_num] = buff;
		buff = b[i];	b[i] = b[min_num];	b[min_num] = buff;
//		printf("%d <> %d\n\n",i,min_num);
	}
/*
	for(i=0;i<n;i++){
		printf("%d %d\n",a[i],b[i]);
	}
	*/
	count = 0;
	i = 0;
	cost = 0;
	while(count < m){
		if( m  >= count + b[i]){
			cost += a[i] * b[i];
//			printf("%d : %d\n",i,cost);
			count += b[i];
		}else{
			cost += (m - count ) * a[i];
		//	printf("%d : %d\n",i,cost);
			count += (m-count);
		}
		i++;
	}

	printf("%d\n",cost);

	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>

using namespace std;

struct store {
	long A;
	int B;
};

bool cmp(const store &left, const store &right) {
	if (left.A > right.A) {
		return false;
	}
	else {
		return true;
	}
}

int main(void)
{
	int N, M;
	int i;
	int need;
	long ans = 0;

	cin >> N >> M;
	store *input = new store[N + 1];

	for (i = 0; i < N; i++) {
		cin >> input[i].A >> input[i].B;
	}
	input[N].A = LONG_MAX;
	input[N].B = 1;

	sort(input, input+N, cmp);
	
	need = M;
	for (i = 0; i < N; i++) {
		if (input[i].B >= need) {
			ans = ans + input[i].A * need;
			cout << ans << endl;
			return 0;
		}
		else {
			need = need - input[i].B;
			ans = ans + input[i].A*input[i].B;
		}
	}


	delete input;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: 'LONG_MAX' was not declared in this scope
   35 |         input[N].A = LONG_MAX;
      |                      ^~~~~~~~
a.cc:5:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 |
Language: C

#include<cstdio>
#include<algorithm>
using namespace std;
struct node{
	int yen,ed;
};
bool cmp(node x,node y){
	return x.yen<=y.yen;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	node a[n];
	for(int i=0;i<n;++i)
		scanf("%d%d",&a[i].yen,&a[i].ed);
	sort(a,a+n,cmp);
	long long sum=0;
	int j=0;
	while(m>=0&&j<n){
		if(a[j].ed>=m)
			sum+=a[j].yen*m;
		else
			sum+=a[j].yen*a[j].ed;
		m-=a[j].ed;
		++j;
	}
	printf("%lld",sum);
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef struct node
{
	long long costs;
	long long totol;
}Ins;
bool MyCmp(const Ins &a,const Ins &b)
{
	return a.costs<b.costs;
}
Ins a[10005];
int main()
{
	long long n,m,s=0;
	long long scanf("%lld %lld",&n,&m);
	for(int i=0;i<n;i++)
	{
		long long scanf("%lld %lld",&a[i].costs,&a[i].totol);
	}
	sort(a,a+n,MyCmp);
	int i=0;
	while(m)
	{
		//printf("\n%d %d\n",s,m);
		if(a[i].totol>=m)
		{
			s+=m*a[i].costs;
			break;
		}
		s+=a[i].totol*a[i].costs;
		m-=a[i].totol;
		i++;
	}
	printf("%lld",s);
	return 0;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:16:42: error: expression list treated as compound expression in initializer [-fpermissive]
   16 |         long long scanf("%lld %lld",&n,&m);
      |                                          ^
a.cc:16:42: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   16 |         long long scanf("%lld %lld",&n,&m);
      |                                          ^
      |                                          |
      |                                          long long int*
a.cc:19:68: error: expression list treated as compound expression in initializer [-fpermissive]
   19 |                 long long scanf("%lld %lld",&a[i].costs,&a[i].totol);
      |                                                                    ^
a.cc:19:68: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   19 |                 long long scanf("%lld %lld",&a[i].costs,&a[i].totol);
      |                                                                    ^
      |                                                                    |
      |                                                                    long long int*
Language: C

#include <stdio.h>
#include <time.h>

int main(){
	
	int N,M;
	
	scanf("%d %d",&N,&M);
	
	int A[N][2];
	
	for(int i=0;i<N;i++){
		for(int j=0;j<2;j++){
			scanf("%d",&A[i][j]);
		}
	}
	
	int q;
	int coin=0;
	int i;
	while(M!=0){
		int tmp = A[0][0];
		q=0;
		for(i=1;i<N;i++){
			if(A[i][0]<tmp){
				tmp = A[i][0];
				q=i;
			}
		}
		if(M>=A[q][1]){
			coin += tmp*A[q][1];
			M -= A[q][1];
		}else{
			coin + = tmp*M;
			M = 0;
		}	
		A[q][0]=1000000001;
	}
	
	printf("%d",coin);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:32: error: expected expression before '=' token
   34 |                         coin + = tmp*M;
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

struct drink {
    long price;
    int num;
};

int main() {
    int N, M;
    cin >> N, cin >> M;
    vector<drink> D;
    for (int i = 0; i < N; ++i) {
        long price;
        int num;
        cin >> price, cin >> num;
        D.push_back(drink{price, num});
    }
    sort(D.begin(), D.end(), [](const drink& x, const drink& y) { return x.price < y.price; });
    long money = 0;
    int got = 0;
    for (int i = 0; i < N && got < M; ++i) {
        int toget = min(D[i].num, M - got);
        got += toget;
        money += D[i].price * toget;
    }
    cout << money << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'vector' was not declared in this scope
   14 |     vector<drink> D;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:14:17: error: expected primary-expression before '>' token
   14 |     vector<drink> D;
      |                 ^
a.cc:14:19: error: 'D' was not declared in this scope
   14 |     vector<drink> D;
      |                   ^
Language: Java


import java.util.*;
public class Mainn {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		Map<Integer , Integer> shopMap = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < N; i++) {
			Long shop = sc.nextLong();
			Long value = sc.nextLong();
			shopMap.put(Integer.valueOf(shop.toString()), Integer.valueOf(value.toString()));
		}
		long los = 0;
		for (Integer price: shopMap.keySet()) {
			int items = shopMap.get(price);
			for (;items > 0  && M > 0; --M , --items) {
				los += price;
			}
			if (M == 0) {
				break;
			}
		}
		System.out.println(los);
	}

}


Compiler output:
Main.java:3: error: class Mainn is public, should be declared in a file named Mainn.java
public class Mainn {
       ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
#define INF 100000000

struct Drink{
	int A;
	int B;

	Drink(int tmpA,int tmpB){
		A = tmpA;
		B = tmpB;
	}
	bool operator<(const Drink &another) const{
		return A < another.A;
	}
};

int main(){
	int N,M;
	int count = 0;
	long long sum = 0;
	int tmpA,tmpB;
	cin >> N >> M;
	vector<Drink> Dr;

	for(int i=0;i<N;i++){
		cin >> tmpA >> tmpB;
		Dr.push_back(Drink(tmpA,tmpB));
	}
	sort(Dr.begin(),Dr.end());
	auto itr = Dr.begin();

	while(count != M){
		if(count + itr->B >= M){
			sum += (long long)itr->A * (M-count);
			count = M;
		}else{
			count += itr->B;
			sum += (long long)itr->A * (itr->B);
		}
		++itr;
	}
	cout << sum << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'vector' was not declared in this scope
   25 |         vector<Drink> Dr;
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:25:21: error: expected primary-expression before '>' token
   25 |         vector<Drink> Dr;
      |                     ^
a.cc:25:23: error: 'Dr' was not declared in this scope
   25 |         vector<Drink> Dr;
      |                       ^~
Language: C++

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

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

    struct shop{
        int price;
        int num;
    };

    vector<shop> shops(N);

    for(int i =0; i < N; i++)
    {
        cin >> shops.at(i).price >> shops.at(i).num;
    }
    sort(shops.begin(), shops.end(), [](const shop &x, const shop &y){return x.price < y.price;});

    int numOfDrinks = 0;
    int j = -1;
    while(numOfDrinks < M)
    {
        j ++;
        numOfDrinks += shops.at(j).num;
    }
    long sumOfPrice = 0;
    for(int i = 0; i < j + 1; i++)
    {
        sumOfPrice += (long)shops.at(i).price * (long)shops.at(i).num;
    }
    sumOfPrice -= (long)shops.at(j).price * (long)(numOfDrinks - M);
    
    cout << sumOfPrice << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |     sort(shops.begin(), shops.end(), [](const shop &x, const shop &y){return x.price < y.price;});
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include <utility>

using namespace std;

int main() {

	int M, N;
	cin >> N >> M;

	vector<pair<int,int>> price_list;
	//vector<long long> howmuch;
	price_list.resize(N);
	
	for (auto i = 0; i < N; i++) {
		pair<int, int> temp;
		scanf_s("%d %d", &temp.first, &temp.second);
		price_list[i] = temp;
		
	}

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


	int num = 0;
	long long ans = 0;
	for (auto store = 0; store < N; store++) {
		num += price_list[store].second;
		if (num > M) {
			num -= price_list[store].second;
			ans += (long long)price_list[store].first * (long long)(M - num);
			break;
		}
		else {
			ans += (long long)price_list[store].first * (long long)price_list[store].second;
		}

	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   21 |                 scanf_s("%d %d", &temp.first, &temp.second);
      |                 ^~~~~~~
      |                 scanf
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

    int N,M,s,o,tmp,ans;
    int[] A,B;

    N=sc.nextInt();
    M=sc.nextInt();

    for(s=0;s<N;s++){
      A[s]=sc.nextInt();
      B[s]=sc.nextInt();
    }

    for(s=0;s<N-1;s++){
      for(o=s+1;o<N;o++){
        if(A[s]>A[o]){
          tmp=A[s];
          A[s]=A[o];
          A[o]=tmp;
          tmp=B[s];
          B[s]=B[o];
          B[o]=tmp;
        }
      }
    }

    for(s=0,ans=0;s<N||M==0;s++){
      if(M>B[s]){
        ans=ans+A[s]*B[s];
        M-=B[s];
      }else{
        ans=ans+A[s]*M;
        break;
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:14: error: variable A might not have been initialized
      A[s]=sc.nextInt();
      ^
Main.java:15: error: variable B might not have been initialized
      B[s]=sc.nextInt();
      ^
Main.java:20: error: variable A might not have been initialized
        if(A[s]>A[o]){
           ^
Main.java:24: error: variable B might not have been initialized
          tmp=B[s];
              ^
Main.java:32: error: variable B might not have been initialized
      if(M>B[s]){
           ^
Main.java:33: error: variable A might not have been initialized
        ans=ans+A[s]*B[s];
                ^
Main.java:36: error: variable A might not have been initialized
        ans=ans+A[s]*M;
                ^
7 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

    int N,M,s,o,tmp,ans;
    int[] A,B;

    N=sc.nextInt();
    M=sc.nextInt();

    for(s=0;s<N;s++){
      A[s]=sc.nextInt();
      B[s]=sc.nextInt();
    }

    for(s=0;s<N-1;s++){
      for(o=s+1,;o<N;o++){
        if(A[s]>A[o]){
          tmp=A[s];
          A[s]=A[o];
          A[o]=tmp;
          tmp=B[s];
          B[s]=B[o];
          B[o]=tmp;
        }
      }
    }

    for(s=0,ans=0;s<N||M==0;s++){
      if(M>B[s]){
        ans=ans+A[s]*B[s];
        M-=B[s];
      }else{
        ans=ans+A[s]*M;
        break;
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:19: error: illegal start of expression
      for(o=s+1,;o<N;o++){
                ^
1 error
Language: Java


import java.util.*;
public class Mainn {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		Map<Integer , Integer> shopMap = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < N; i++) {
			int shop = sc.nextInt();
			int value = sc.nextInt();
			shopMap.put(Integer.valueOf(shop), Integer.valueOf(value));
		}
		long los = 0;
		for (Integer price: shopMap.keySet()) {
			int items = shopMap.get(price);
			for (;items > 0  && M > 0; --M , --items) {
				los += price;
			}
			if (M == 0) {
				break;
			}
		}
		System.out.println(los);
	}

}


Compiler output:
Main.java:3: error: class Mainn is public, should be declared in a file named Mainn.java
public class Mainn {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int m=scan.nextInt();
    List<Integer> a=new ArrayList<>();
    List<Integer> b=new ArrayList<>();
    for(int i=0;i<n;i++){
      a.add(scan.nextInt());
      b.add(scan.nextInt());
    }
    List<Integer> cop=new ArrayList<>();
    Collections.sort(cop);
    long ans=0L;
    int i=0;
    int sum=0;
    int index;
    int x,y;
    while(sum<m){
      i++;
      x=cop.get(i);
      index=a.indexOf(x);
      y=b.get(index);
      sum+=y;
      ans+=(long)(x*y);
    }
    ans-=(long)(x*(sum-m));
    System.out.println(ans);
  }
}

Compiler output:
Main.java:31: error: variable x might not have been initialized
    ans-=(long)(x*(sum-m));
                ^
1 error
Language: C++

#include <iostream.h>
using namespace std;
int in(void){int x;cin>>x;return x;}
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define ll long long int
long long int dx[4]={1,0,-1,0};
long long int dy[4]={0,1,0,-1};
int D[2]={1,-1};
int main() {
  ll  n,k;
  cin>>n>>k;
  ll  x[n][2];//金、数
  rep(i,0,n)cin>>x[i][0]>>x[i][1];
  rep(i,0,n){
    rep(j,i+1,n){
      if(x[i][0]>x[j][0]){
        swap(x[i][1],x[j][1]);
        swap(x[i][0],x[j][0]);
      }
    }
  }
  ll have=0,ans=0;
  rep(i,0,n){
    ll  q=0;
    if(x[i][1]+have>k){
      q=k-have;
      ans+=q*x[i][0];
      break;
    }else{
      q=x[i][1];
      have+=q;
      ans+=q*x[i][0];
    }
  }
  cout<<ans;
return 0;
}



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

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

#define ll long long

struct drink {
    ll a;
    ll b;
};

bool cmp(const drink &d1, const drink &d2) {
    return d1.a < d2.a;
}

ll main() {
    ll N, M;
    scanf("%lld %lld", &N, &M);
    vector<drink> d;
    d.resize(N);
    for(ll i = 0;i < N;i++) {
        scanf("%lld %lld", &d[i].a, &d[i].b);
    }

    sort(d.begin(), d.end(), cmp);

    ll count = 0;
    ll money = 0;

    for(ll i = 0;i < N;i++) {
        if(M < count + d[i].b) {
            money += d[i].a*(M - count);
            count += M - count;
        }else{
            money += d[i].a*d[i].b;
            count += d[i].b;
        }
    }

    printf("%lld\n", money);
    return 0;
}

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

a, b = map(int, input().split())

A = []

for i in range(a):
    c= list(map(int, input().split()))
    A.append(c)

ans = 0

A.sort(key=lambda x:x[0])


for j in range(a+1):
    if(b - A[j][1] >=0):
        ans += A[j][0] * A[j][1]
        b -= A[j][1]
    else:
        ans += A[j][0] * b
        b = 0
    if(b == 0):
        break
    
print(ans)

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

#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>

#pragma region _define

#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n,option) f(i,0,n)cout<<v[i]<<option;
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INF 1<<29

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b)*b);
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		//ret %= 1000000007;
	}
	return ret;
}

#pragma endregion

/************************************************************************/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);

	int n, m;
	cin >> n >> m;
	vi A(n), B(n);
	f_v2I(A, B, n);
	v_pi p(n);
	f(i, 0, n) {
		p[i] = { A[i],B[i] };
	}
	sort(all(p));
	__int64 sum = 0;
	LL i = 0;
	LL memo;
	while (true) {
		sum += (p[i].first*p[i].second);
		m -= p[i].second;
		if (m <= 0) {
			memo = p[i].first;
			break;
		}
		i++;
	}
	sum -= (memo * m *(-1));
	cout << sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
  101 |         __int64 sum = 0;
      |         ^~~~~~~
      |         __ynf64
a.cc:105:17: error: 'sum' was not declared in this scope
  105 |                 sum += (p[i].first*p[i].second);
      |                 ^~~
a.cc:113:9: error: 'sum' was not declared in this scope
  113 |         sum -= (memo * m *(-1));
      |         ^~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
	long long n, m, c, s=0;
	cin >> n >> m >> c;
	long long b[m+1], a[n+1][m+1];
	
	for(int i=1; i<=n+1; i++)
	{
		if(i==1)
		{
			for(int j=1; j<=m; j++)
				cin >> b[j];
		}	
		else
		{
			for(int)
		}    
	}
}





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

struct node
{

	long long int a,b;

};

bool cmp(node e,node f)
{
	if(e.a!=f.a)

	return e.a<f.a;

	else

	return e.b>f.b;

}

int main()
{
	
	long long int n,m,y=0;
	
	cin>>n>>m;
	
	node d[n+1];
	
	for(int i=1;i<=n;i++)
	   cin >> d[i].a>> d[i].b;
	
	sort(d+1, d+n+1, cmp);
	
	for(int i=1;i<=n;i++)
	{
		if(d[i].b<m)
		{
	
			y+=d[i].a*d[i].b;
	
			m-=d[i].b;
	
		}
		else
		{
			y+=d[i].a*m;
			break;
		}
	}
	cout<<y;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:32: error: expected unqualified-id before ')' token
   19 |                         for(int)
      |                                ^
a.cc:19:32: error: expected ';' before ')' token
   19 |                         for(int)
      |                                ^
      |                                ;
a.cc:19:32: error: expected primary-expression before ')' token
a.cc:19:32: error: expected ';' before ')' token
   19 |                         for(int)
      |                                ^
      |                                ;
a.cc:20:17: error: expected primary-expression before '}' token
   20 |                 }
      |                 ^
a.cc: At global scope:
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: Java

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;


public class EnergyDrinkCollector {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N,M;
		N= sc.nextInt();
		M = sc.nextInt();
		ArrayList<AbstractMap.SimpleEntry<Long,Integer>> list = new ArrayList<AbstractMap.SimpleEntry<Long,Integer>>();
		for(int i = 0; i<N; i++) {
			list.add( new AbstractMap.SimpleEntry<Long, Integer>(sc.nextLong(),sc.nextInt()) );
		}
		list.sort(Comparator.comparing(AbstractMap.SimpleEntry::getKey));
		long ans = 0;
		int count = 0;
		for(AbstractMap.SimpleEntry<Long,Integer> pair : list) {
			if(pair.getValue() < M-count) {
				count += pair.getValue();
				ans += pair.getKey()*pair.getValue();
			} else {
				ans += (M-count) * pair.getKey();
				break;
			}
		}
		System.out.println(ans);
	}

}


Compiler output:
Main.java:7: error: class EnergyDrinkCollector is public, should be declared in a file named EnergyDrinkCollector.java
public class EnergyDrinkCollector {
       ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

import javafx.util.Pair;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N,M;
		N= sc.nextInt();
		M = sc.nextInt();
		ArrayList<Pair<Long,Integer>> list = new ArrayList<Pair<Long,Integer>>();
		for(int i = 0; i<N; i++) {
			list.add( new Pair<Long, Integer>(sc.nextLong(),sc.nextInt()) );
		}
		list.sort(Comparator.comparing(Pair::getKey));
		long ans = 0;
		int count = 0;
		for(Pair<Long,Integer> pair : list) {
			if(pair.getValue() < M-count) {
				count += pair.getValue();
				ans += pair.getKey()*pair.getValue();
			} else {
				ans += (M-count) * pair.getKey();
				break;
			}
		}
		System.out.println(ans);
	}

}


Compiler output:
Main.java:5: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:14: error: cannot find symbol
		ArrayList<Pair<Long,Integer>> list = new ArrayList<Pair<Long,Integer>>();
		          ^
  symbol:   class Pair
  location: class Main
Main.java:14: error: cannot find symbol
		ArrayList<Pair<Long,Integer>> list = new ArrayList<Pair<Long,Integer>>();
		                                                   ^
  symbol:   class Pair
  location: class Main
Main.java:16: error: cannot find symbol
			list.add( new Pair<Long, Integer>(sc.nextLong(),sc.nextInt()) );
			              ^
  symbol:   class Pair
  location: class Main
Main.java:18: error: cannot find symbol
		list.sort(Comparator.comparing(Pair::getKey));
		                               ^
  symbol:   variable Pair
  location: class Main
Main.java:21: error: cannot find symbol
		for(Pair<Long,Integer> pair : list) {
		    ^
  symbol:   class Pair
  location: class Main
6 errors
Language: C

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

bool ope(pair<int,int>a, pair<int, int>b){
    return a.first < b.first;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int,int>> AB(N);
    for(int i=0; i<N; i++){
        int a,b;
        cin >> a >> b;
        AB[i] = make_pair(a,b);
    }
    sort(AB.begin(),AB.end(),ope);

    ll ans=0LL;
    for(int i=0; M>0; i++){
        if(AB[i].second<=M){
            ans += (ll)AB[i].first * (ll)AB[i].second;
            M-=AB[i].second;
        }else{
            ans += (ll)AB[i].first * (ll)M;
            M=0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'Ab' was not declared in this scope; did you mean 'AB'?
   22 |       count += Ab[i].second;
      |                ^~
      |                AB
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        String line;
        BigInteger n, m;
        line = br.readLine();
//        System.err.println(line);
        st = new StringTokenizer(line);
        n = new BigInteger(st.nextToken());
        m = new BigInteger(st.nextToken());
        Pair p[] = new Pair[n.intValue()];
        for (int i = 0; i < n.intValue(); i++) {
            line = br.readLine();
//            System.err.println(line);
            st = new StringTokenizer(line);
            p[i] = new Pair();
            p[i].a = new BigInteger(st.nextToken());
//            System.err.println(p[i].a);
            p[i].b = new BigInteger(st.nextToken());
//            System.err.println(p[i].b);
        }
        Arrays.sort(p, new Comparator<Pair>() {
            @Override
            public int compare(Pair o1, Pair o2) {
                return o1.a.subtract(o2.a).signum();
            }
        });
//        for (int i = 0; i < n.intValue(); i++) {
//            System.err.println(p[i].a + " " + p[i].b);
//        }
        BigInteger cur = BigInteger.ZERO, res = BigInteger.ZERO;
        int i = 0;
        while (!cur.equals(m)) {
            BigInteger mn = m.subtract(cur);
            BigInteger x = p[i].b;
            if (x.subtract(mn).signum() < 0) {
                mn = x;
            }
            cur = cur.add(mn);
            res = res.add(mn.multiply(p[i].a));
            i++;
        }
        System.out.println(res);
    }
}

class Pair {
    BigInteger a, b;


}


Compiler output:
Main.java:9: error: class C is public, should be declared in a file named C.java
public class C {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmax(ll x, ll y)
{
    if (x > y)
        return x;
    else
        return y;
}

double dist(int i, int j)
{
    double ans;
    ans = sqrt(i * i + j * j);
    return ans;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{
    int n = av.size();
    vector<ll> av2, bv2;
    for (int i = 0, max = INT_MIN; i < n; i++)
    {
        int k = 0, min = INT_MAX;
        for (int j = 0; j < n; j++)
        {
            if (max < av[j] && av[j] < min)
            {
                k = j;
                min = av[j];
            }
        }
        av2.push_back(av[k]);
        bv2.push_back(bv[k]);
        max = av[k];
    }
    av = av2;
    bv = bv2;
}

int main()
{
    ll N,M; cin >> N >> M;
    vector<ll> A(N), B(N);
    REP(i,N){
        cin >> A[i] >> B[i];
    }

    sort2vectors(A,B);

    ll ans=0, res=0;
    //resは現状持っている本数
    //Mは現状買わなければならない本数
    REP(i,N){
        if(res+B[i]>=M){
            ans+=A[i]*M;
            break;
        }else{
            res+=B[i];
            ans+=A[i]*B[i];
            M-=B[i];
        }
        //cout << "M= " << M << " res= " << res << " ans= " << ans << endl;
    }
    
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'void sort2vectors(std::vector<long long int>&, std::vector<long long int>&)':
a.cc:52:27: error: 'INT_MIN' was not declared in this scope
   52 |     for (int i = 0, max = INT_MIN; i < n; i++)
      |                           ^~~~~~~
a.cc:10:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include <cmath>
  +++ |+#include <climits>
   10 | #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
a.cc:54:26: error: 'INT_MAX' was not declared in this scope
   54 |         int k = 0, min = INT_MAX;
      |                          ^~~~~~~
a.cc:54:26: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

struct shop {
    long long int price;
    long long int num;
};

int main() {

    long long int N, M;
    cin >> N >> M;

    vector<shop> shops;

    long long int a, b;
    for (int i = 0; i < N; i++) {
        cin >> a >> b;
        shop s;
        s.price = a;
        s.num = b;
        shops.push_back(s);
    }

    sort(shops.begin(), shops.end(),
         [](const shop& x, const shop& y) {return x.price < y.price;});

    long long int sum = 0;
    long long int num = 0;
    for (int i = 0; i < N; i++) {
        if (num + shops[i].num >= M) {
            sum += (M - num) * shops[i].price;
            break;
        }
        else {
            num += shops[i].num;
            sum += shops[i].price * shops[i].num;
        }
    }

    cout << sum << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'vector' was not declared in this scope
   17 |     vector<shop> shops;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <cmath>
  +++ |+#include <vector>
    4 | #include <iostream>
a.cc:17:16: error: expected primary-expression before '>' token
   17 |     vector<shop> shops;
      |                ^
a.cc:17:18: error: 'shops' was not declared in this scope; did you mean 'shop'?
   17 |     vector<shop> shops;
      |                  ^~~~~
      |                  shop
Language: C++

//************************
//** author  :  Alex Hu **
//************************

//  _______        __________         ________        __
//  \      \   ____\______   \ ____  /  _____/  _____/  |_
//  /   |   \ /  _ \|       _// __ \/   \  ____/ __ \   __\
// /    |    (  <_> )    |   \  ___/\    \_\  \  ___/|  |
// \____|__  /\____/|____|_  /\___  >\______  /\___  >__|
//         \/              \/     \/        \/     \/

#include<bits/stdc++.h>

using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mkp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define fi first
#define se second
#define sqr(a) ((a)*(a))

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const ll mod=1e9+7;
const int INF=0x3f3f3f3f;

const LL MOD=1e9+7;

ll n,m,ans=0;
vector<pii> v;

int main()
{
	cin>>n>>m;
	rept(i,0,n)
	{
		int x,y;
		cin>>x>>y;
		v.pb(mkp(x,y));
	}
	sort(v.begin(),v.end());
	rept(i,0,v.size())
	{
		if (v[i].se>=m)
		{
			ans+=v[i].fi*m;
			cout<<ans<<endl;
			return 0;
		}
		ans+=v[i].se*v[i].fi;
		m-=v[i].se;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:31:7: error: 'LL' does not name a type; did you mean 'll'?
   31 | const LL MOD=1e9+7;
      |       ^~
      |       ll
Language: C++

nums = list(map(int, input().split()))
N, M = nums[0], nums[1]
A = [0 for _ in range(N)]
B = [0 for _ in range(N)]

for i in range(N):
    nums = list(map(int, input().split()))
    A[i], B[i] = nums[0], nums[1]

import numpy as np
inds = np.argsort(A)
ans = 0
rem = M
i = 0
while rem > 0:
    num = min(B[inds[i]], rem)
    ans += A[inds[i]] * num
    rem -= num
    i += 1

print(ans)

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

#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;



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

	ll N, M;
	cin >> N >> M;

	vector<P> AB(N, P(0, 0));
	for (ll i = 0; i < N; ++i)
	{
		cin >> AB[i].first >> AB[i].second;
	}

	sort(AB.begin(), AB.end());
	//reverse(AB.begin(), AB.end());

	ll pay = 0;
	ll m = 0;
	for (ll i = 0; i < N; ++i)
	{
		while (true)
		{
			if (AB[i].second > 0)
			{
				pay += AB[i].first;
				m++;
				AB[i].second--;
			}
			else
			{
				break;
			}

			if (m >= M)
			{
				break;
			}
		}

		if (m >= M)
		{
			break;
		}
	}

	cout << pay << endl;

	\\system("pause");
}

Compiler output:
a.cc:82:9: error: stray '\' in program
   82 |         \\system("pause");
      |         ^
a.cc:82:10: error: stray '\' in program
   82 |         \\system("pause");
      |          ^
Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if ONLINE_JUDGE
#define tr(...)
#define endl '\n'
#else
#include "../../tr.h"
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, m;

P a[N];

int32_t main(){_

   cin>>n>>m;

   for (int i = 0; i < n; ++i)
   {
      cin>>a[i].F>>a[i].S;
   }  

   sort(a, a+n);

   int ans = 0, rem = m;

   for (int i = 0; i < n; ++i)
   {
      ans += min(rem, a[i].S) * a[i].F;
      rem -= min(rem, a[i].S);
   }

   cout<<ans;
   #warning make sure N size is correct!
   return 0;
}

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

/*
   Author : tarang
*/
#include<bits/stdc++.h>
#define ll long long
#defirn endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define PI = acos(-1)
using namespace std ;
ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll f(ll x){
	if(x%4 == 0){
		return x ;
	}
	else if(x%4 == 1){
		return 1 ;
	}
	else if(x%4 == 2){
		return (x+1) ;
	}
	else return 0 ;
}
int main(){
	 fastio ; 
	 ll a , b ;
	 cin >> a >> b ;
	 cout << (f(b)^f(a-1)) << endl;
}


Compiler output:
a.cc:6:2: error: invalid preprocessing directive #defirn; did you mean #define?
    6 | #defirn endl "\n"
      |  ^~~~~~
      |  define