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

#include<iostream>
using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  
  int A[n],B[n];
  
  int sum=0;
  int ans=0;
  
  for(int i=0; i<n; i++){
    cin >> A[i] >> B[i];
  }
  
  int min;
  
  while(sum<m){
    int a=100001;
    int b;
    int c=m-sum;
    
  	for (int i=0;i<n;i++){
      if (A[i]>100000+min)
        A[i] -=100000;
      if(a>A[i]){
        a=A[i];
        A[i]+=100000
      	b=B[i];
      }
    }
    
    if(b>c)
      b=c;
    sum += b;
    ans += a*b;
    min=a;
    }
  }
  
  cout << ans;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: expected ';' before 'b'
   30 |         A[i]+=100000
      |                     ^
      |                     ;
   31 |         b=B[i];
      |         ~            
a.cc: At global scope:
a.cc:43:3: error: 'cout' does not name a type
   43 |   cout << ans;
      |   ^~~~
a.cc:45:3: error: expected unqualified-id before 'return'
   45 |   return 0;
      |   ^~~~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  
  int A[n],B[n];
  
  int sum=0;
  int ans=0;
  
  for(int i=0; i<n; i++){
    cin >> A[i] >> B[i];
  }
  while(sum<m){
    int a;
    int b=100001;
    int c=m-sum;
  	for (int i=0;i<n;i++){
      if(b>B[i]){
        a=A[i];
      	b=B[i];
      }
    }
    
    if(b>c)
      b=c;
    sum += b;
    ans += a*b;
    #include<iostream>
using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  
  int A[n],B[n];
  
  int sum=0;
  int ans=0;
  
  for(int i=0; i<n; i++){
    cin >> A[i] >> B[i];
  }
  while(sum<m){
    int a;
    int b=100001;
    int c=m-sum;
  	for (int i=0;i<n;i++){
      if(b>B[i]){
        a=A[i];
      	b=B[i];
      }
    }
    
    if(b>c)
      b=c;
    sum += b;
    ans += a*b;
    
    
    for(int i=0;i<n;i++){
      if(B[i]==b)
        B[i] +=100000;
    }
  }
  
  cout << ans;
  
  return 0;
}


  }
  
  cout << ans;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main()
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main()
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:36:1: error: a function-definition is not allowed here before '{' token
   36 | {
      | ^
Language: Java

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class EnergyDrinkCollector {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		int[] b = new int[n];
		int[] a = new int[n];

		//long tmp = 0;
		int count = 0;
		long money = 0;

		Map<Integer,Integer> map = new TreeMap<Integer, Integer>();
		for (int i = 0; i < n; i++) {
			map.put(sc.nextInt(),sc.nextInt());
		}


//		for (int i = 0; i < a.length -1; i++) {
//			for (int j = a.length - 1; j > i ; j--) {
//				if (a[j] < a[j-1]) {
//					tmp = a[j-1];
//					a[j-1] = a[j];
//					a[j] = tmp;
//
//					tmp = b[j-1];
//					b[j-1] = b[j];
//					b[j] = tmp;
//				}
//			}
//		}

		for (Map.Entry<Integer, Integer> me : map.entrySet()) {
			//System.out.println(a[i]);
			count += me.getValue();
			if (count < m) {
				money += me.getKey() * me.getValue();

			} else if (count == m) {
				money += me.getKey() * me.getValue();
				break;

			} else {
				money +=  me.getKey() * (m - (count - me.getValue())) ;
				break;
			}

		}

		System.out.println(money);

	}

}




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

#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int n,m; cin >> n >> m;
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
    }
    vector<pair<int, int>> ab(n);
    for(int i=0; i<n; i++){
        an[i] = make_pair(a[i], b[i]);
    }
    sort(ab.begin(), ab.end());
    long long ans=0;
    for(int i=0; i<n; i++){
        //.second()はpair要素の2つ目を指す
        int buy = min(m,ab[i].second());
        ans+=(long long)buy*ab[i].first();
        m-=buy;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'an' was not declared in this scope; did you mean 'ab'?
   15 |         an[i] = make_pair(a[i], b[i]);
      |         ^~
      |         ab
a.cc:21:37: error: expression cannot be used as a function
   21 |         int buy = min(m,ab[i].second());
      |                         ~~~~~~~~~~~~^~
a.cc:22:40: error: expression cannot be used as a function
   22 |         ans+=(long long)buy*ab[i].first();
      |                             ~~~~~~~~~~~^~
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int n,m;
  int A[n],B[n];
  
  int sum=0;
  int ans=0;
  
  for(int i=0; i<n; i++){
    cin >> A[i] >> B[i];
  }
  while(sum<m){
    int a;
    int b=B[0];
  	for (i=0;i<n;i++){
      if(b>B[i]){
        a=A[i];
      	b=B[i];
      }
    }
    
    c = a*b;
    sum += b;
    
    for(i=0;i<n;i++){
      if(B[i]==b)
        B[i] +=100000;
    }
    
    
    
  

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'i' was not declared in this scope
   18 |         for (i=0;i<n;i++){
      |              ^
a.cc:25:5: error: 'c' was not declared in this scope
   25 |     c = a*b;
      |     ^
a.cc:28:9: error: 'i' was not declared in this scope
   28 |     for(i=0;i<n;i++){
      |         ^
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int n,m;
  int A[n],B[n];
  
  int sum=0;
  int ans=0;
  
  for(int i=0; i<n; i++){
    cin >> A[i] >> B[i];
  }
  while(sum<m){
    int c;
  	for (i=0;i<n;i++){
      int a;
      int b=B[0];
      if(b>B[i]){
        a=A[i];
      	b=B[i];
      }
    }
    for(i=0;i<n;i++){
      if(B[i]==b)
        B[i] +=100000;
    }
    c = a*b;
    sum += b 
    
    
  

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'i' was not declared in this scope
   17 |         for (i=0;i<n;i++){
      |              ^
a.cc:25:9: error: 'i' was not declared in this scope
   25 |     for(i=0;i<n;i++){
      |         ^
a.cc:26:16: error: 'b' was not declared in this scope
   26 |       if(B[i]==b)
      |                ^
a.cc:29:9: error: 'a' was not declared in this scope
   29 |     c = a*b;
      |         ^
a.cc:29:11: error: 'b' was not declared in this scope
   29 |     c = a*b;
      |           ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: Java

import java.util.List
import java.util.Arrays;;
import java.util.Map;
import java.util.HashMap;
import java.util.Scanner;

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        Map<Long, Long> drink = new HashMap<>();
        for (int i = 0; i < n; i++) {
            drink.put(sc.nextLong(), sc.nextLong());
        }

        Object[] drink_money = drink.keySet().toArray();
        Arrays.sort(drink_money);
        long bottle = 0;
        long money = 0;


        for (int i = 0; i < n; i++) {
            long d_money = Integer.valueOf(String.valueOf(drink_money[i]));
            long d_bottle = Integer.valueOf(String.valueOf(drink.get(d_money)));
            if (bottle + d_bottle <= m) {
                System.out.println(d_money + " " + d_bottle);
                bottle += d_bottle;
                money += d_money * d_bottle;
            } else {
                System.out.println(d_money + " " + (m - bottle));
                money += d_money * (m - bottle);
                break;
            }
        }
        System.out.println(money);

    }
}


Compiler output:
Main.java:1: error: ';' expected
import java.util.List
                     ^
Main.java:2: error: extraneous semicolon
import java.util.Arrays;;
                        ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
void _sort(long int *arr,int *arr2,int front,int end){
	if(front<end){
		int i,j,index=front,pivot=arr[end],tmp;
		for(i=front;i<end;i++){
			if(arr[i]<pivot){
				tmp=arr[i];
				arr[i]=arr[index];
				arr[index]=tmp;
				tmp=arr2[i];
				arr2[i]=arr2[index];
				arr2[index]=tmp;
				index++;
			}
		}
		tmp=arr[i];
		arr[i]=arr[index];
		arr[index]=tmp;
		tmp=arr2[i];
		arr2[i]=arr2[index];
		arr2[index]=tmp;
		_sort(arr,arr2,front,index-1);
		_sort(arr,arr2,index+1,end);
	}
}

int main() {
    int n,m,i;
    scanf("%d %d",&n,&m);
    long int sum=0;
    long int *yen=(long int*)malloc(n*sizeof(long int));
    int *can=(int*)malloc(n,sizeof(int));
    for(i=0;i<n;i++){
        scanf("%ld %d",&yen[i],&can[i]);
    }
    _sort(yen,can,0,n-1);
    i=0;
    while(m>0){
        if(can[i]<m){
            sum+=(long int)can[i]*yen[i];
            m-=can[i];
        } else {
            sum+=(long int)yen[i]*m;
            m=0;
        }
        i++;
    }
    printf("%ld",sum);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:26: error: too many arguments to function 'void* malloc(size_t)'
   33 |     int *can=(int*)malloc(n,sizeof(int));
      |                    ~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:672:14: note: declared here
  672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
      |              ^~~~~~
Language: C++

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



int main(){
  int N,M;
  cin>>N>>M;
  map<int,int> mp;
  int a,b;
  for(int i=0;i<N;i++){
    cin>>a>>b;
    mp[a]=b;
  }
  int nokori=M;
  long long int cost=0;
  long long int A,B;
  for(auto itr=mp.begin();itr != mp.end();itr++){
    A=itr->first;
　　 B=itr->second;
    if(nokori > B){
      cost += A*B;
      nokori -= B;
    }
    else{
      cost += A*nokori;
      nokori = 0;
      cout << cost <<endl;
      return 0;
    }
  }
}


Compiler output:
a.cc:20:1: error: extended character 　 is not valid in an identifier
   20 | 　　 B=itr->second;
      | ^
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:20:1: error: '\U00003000\U00003000' was not declared in this scope
   20 | 　　 B=itr->second;
      | ^~~~
Language: C++

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

#define ll long long
#define INF 99999999
int main()
{
    double a,b;
    cin >> a >> b;
    double tmp1,tmp2;
    vector<pair <double,double> > c(a);
    for(double i = 0;i < a;i++)
    {
        cin >> c[i].first >> c[i].second;
    }
    double ans = 0;
    sort(c.begin(),c.end());
    for(double i = 0;i < c.size();i++)
    {
        if(c[i].second > b)
        {
            ans += c[i].first * c[i].second;
            b -= c[i].second;
        else
        {
            ans += c[i].first + b;
            cout << ans << endl;
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: expected '}' before 'else'
   24 |         else
      |         ^~~~
a.cc:21:9: note: to match this '{'
   21 |         {
      |         ^
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>
 
using namespace std;
 
int main()
{
	long N,M;
	cin >> N >> M;
	map<long,long> B;
	for(int i=0;i<N;i++)
	{
		int t;
		cin >> t >> B[t];
	}
	
	long d = M;
	long sum = 0;
	auto map<long, long>::iterator tkb = begin(B); 
	for(int p=0;p<N;p++)
	{	

		pair<const long, long> q = *tkb;
    		const long& A = q.first;
 	   	long& BB = q.second;
		if(BB>=d)
		{
			sum = sum + A*d;
			break;
			
		}
		else if(BB<d)
		{
			d = d - BB;
			sum = sum + A*BB;
		}
		tkb = next(tkb,1);
 
	}
	cout << sum << endl;
 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: qualified-id in declaration before 'tkb'
   31 |         auto map<long, long>::iterator tkb = begin(B);
      |                                        ^~~
a.cc:35:45: error: 'tkb' was not declared in this scope
   35 |                 pair<const long, long> q = *tkb;
      |                                             ^~~
Language: C++

#include<iostream>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  int drink[100001][2];
  for (int i = 0; i < N; i ++) cin >> drink[i][0] >> drink[i][1];
  for (int i = 0; i < N; i ++) {
    for (int i = 1; i < N; i ++) {
      if (drink[i - 1] > drink[i]) {
        swap(drink[i][0], drink[i - 1][0]);
        swap(drink[i][1], drink[i - 1][1]);
      }
    }
  }
  int ans = 0;
  int no = 0;
  int i = 0;
  while(no < M) {
    ans += drink[i][1] * drink[i][0];
    no += drink[i][0];
    i ++;
  }
  i --;
  ans -= (no - M) * drink[i][0];
  cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: expected '}' at end of input
   26 |   cout << ans << endl;
      |                       ^
a.cc:3:13: note: to match this '{'
    3 | int main () {
      |             ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

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

        long[][] dp = new long[M][N];
        for(int i= 0; i<M;i++)
            Arrays.fill(dp[i],-1);
        long res = rec(A,B,,dp, M, 0 );

        System.out.println(res);

    }

    static long rec(int[] A , int[] B,long[][] dp, int m , int shop){
        if(dp[m][shop] != -1) return dp[m][shop];
        if(m == 0) return 0;
        if(shop==A.length) return Long.MAX_VALUE/10 ;
        long minPay = Long.MAX_VALUE;
        for(int i=0 ; i<= B[shop];i++){//bottles
            if(m-i>=0){
                long pay =  (long)i * A[shop];
                pay += rec(A,B, m-i , shop+1);
                minPay  = pay<minPay? pay: minPay;
            }
        }
        dp[m][shop]=minPay;
        return minPay;
    }


}


Compiler output:
Main.java:21: error: illegal start of expression
        long res = rec(A,B,,dp, M, 0 );
                           ^
1 error
Language: C++

#include <iostream>

long N, M, A[1000000], B[100000], min = 9223372036854775807, j, sum, l, count = 0, o;
int main()
{
	std::cin >> N >> M;
	for(int i = 1; i <= N; i++)
	{
		std::cin >> A[i] >> B[i];
	}
	while(count < M-1)
	{
		min = 9223372036854775807;
		j = 0;
		for(int i = 1; i <= M; i++)
		{
			if(min > A[i])
			{
				min = A[i];
				j = i;
			}
		}
		o = count + B[j];
		//std::cout << o <<std::endl;
		if(M < o)
		{
			l = M - count;
			count += l;
			sum += A[j] * l;
		}else 
		{
			count += B[j];
			sum += A[j] * B[j];
		}
		A[j] = 9223372036854775807;
	}
	if(N == 1)
	{
		o = N * M；
		std::cout << o;
	}else
	{
	std::cout << sum;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: 'M\U0000ff1b' was not declared in this scope
   39 |                 o = N * M；
      |                         ^~~
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>
 
using namespace std;
 
int main()
{
	long N,M;
	cin >> N >> M;
	map<long,long> B;
	for(int i=0;i<N;i++)
	{
		int t;
		cin >> t >> B[t];
	}
	
	long d = M;
	long sum = 0;

	for(int p=0;p<N;p++)
	{	
			auto map<long, long>::iterator tkb = begin(B); 
		pair<const long, long> q = *tkb;
    		const long& A = q.first;
 	   	long& BB = q.second;
		if(BB>=d)
		{
			sum = sum + A*d;
			break;
			
		}
		else if(BB<d)
		{
			d = d - BB;
			sum = sum + A*BB;
		}
		tkb = next(tkb,1);
 
	}
	cout << sum << endl;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:56: error: qualified-id in declaration before 'tkb'
   34 |                         auto map<long, long>::iterator tkb = begin(B);
      |                                                        ^~~
a.cc:35:45: error: 'tkb' was not declared in this scope
   35 |                 pair<const long, long> q = *tkb;
      |                                             ^~~
Language: C

#include <stdio.h>
#include <string.h>
int main() {
  int N;
  int M;
  int AB[100001][3];
  scanf("%d %d",&N &M);

  int i;
  int j;
  for ( i = 0; i < N; ++i) {
    for ( j = 0; j < 2; ++j) {
    scanf("%d", &AB[i][j]);
    }
  }

  int temp1 = AB[0][0];
  int temp2 = AB[0][0];
  for ( i = 0; i < N; ++i) {
    for	(j = i+1; j < N; ++j) {
      if (AB[i][0] < temp1) {
        temp1 = AB[i][0];
        temp2 = AB[i][1];
        AB[i][0] = AB[j][0];
        AB[i][1] = AB[j][1];
        AB[j][0] = temp1;
        AB[j][1] = temp2;
      }
    }
  }

  int total = AB[i][1];
  int ans = 0;
  for ( i = 0; i < N; ++i) {
    if (total > M) {
      ans += a[i][0]*(M-total);
      break;
    } else {
      ans += a[i][0]*a[i][1];
      total += AB[i+1][1];
    }
  }
  printf("%d\n",ans);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:20: error: invalid operands to binary & (have 'int *' and 'int')
    7 |   scanf("%d %d",&N &M);
      |                 ~~ ^
      |                 |
      |                 int *
main.c:36:14: error: 'a' undeclared (first use in this function)
   36 |       ans += a[i][0]*(M-total);
      |              ^
main.c:36:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>

long N, M, A[1000000], B[100000], min = 9223372036854775807, j, sum, l, count = 0, o;
int main()
{
	std::cin >> N >> M;
	for(int i = 1; i <= N; i++)
	{
		std::cin >> A[i] >> B[i];
	}
	while(count < M-1)
	{
		min = 9223372036854775807;
		j = 0;
		for(int i = 1; i <= M; i++)
		{
			if(min > A[i])
			{
				min = A[i];
				j = i;
			}
		}
		o = count + B[j];
		//std::cout << o <<std::endl;
		if(M < o)
		{
			l = M - count;
			count += l;
			sum += A[j] * l;
		}else 
		{
			count += B[j];
			sum += A[j] * B[j];
		}
		A[j] = 9223372036854775807;
	}
	if(N == 1)
	{
		o = N * M
		std::cout << o;
	}else
	{
	std::cout << sum;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: expected ';' before 'std'
   39 |                 o = N * M
      |                          ^
      |                          ;
   40 |                 std::cout << o;
      |                 ~~~
Language: C

#include <stdio.h>

int main(void) {
    int N,M;
    int money;
    int all = 0;

    scanf("%d %d",&N,&M);

    while(true){
        int price,num;
        scanf("%d %d",&price,&num);
        if((M - all) < num){
            money += price * (M- all);
        }else{
            money += price*num;
            all += num;
        }
    }
    printf("%d",money);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:11: error: 'true' undeclared (first use in this function)
   10 |     while(true){
      |           ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:10:11: note: each undeclared identifier is reported only once for each function it appears in
   10 |     while(true){
      |           ^~~~
Language: C++

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

struct goods {
  int price;
  int num;
  
  bool operator<( const goods& right ) const {
        return price == right.price ? num < right.num : price < right.price;
  }

} ;
  
int main() {
  vector<goods> data_array();
  
  int N, M;
  long cost = 0;
  int count = 0;
  cin >> N >> M;
  
  for (int i = 0; i < N; ++i) {
    scanf("%d", &data_array[i].price);
    scanf("%d", &data_array[i].num);
  }
  
  sort(data_array.begin(), data_array.end());
  
  for (int i = 0; i < N; ++i) {
       for (int j = 0; j < data_array[i].num; ++j) {
         cost += data_array[i].price;
         count++;
         if (count >= M) {
           break;
         }
       }
       if (count >= M) {
         break;
       }
  }
  
  cout << cost << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   17 |   vector<goods> data_array();
      |                           ^~
a.cc:25:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   25 |     scanf("%d", &data_array[i].price);
      |                              ^
a.cc:25:32: error: request for member 'price' in '*(data_array + ((sizetype)i))', which is of non-class type 'std::vector<goods>()'
   25 |     scanf("%d", &data_array[i].price);
      |                                ^~~~~
a.cc:26:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |     scanf("%d", &data_array[i].num);
      |                              ^
a.cc:26:32: error: request for member 'num' in '*(data_array + ((sizetype)i))', which is of non-class type 'std::vector<goods>()'
   26 |     scanf("%d", &data_array[i].num);
      |                                ^~~
a.cc:29:19: error: request for member 'begin' in 'data_array', which is of non-class type 'std::vector<goods>()'
   29 |   sort(data_array.begin(), data_array.end());
      |                   ^~~~~
a.cc:29:39: error: request for member 'end' in 'data_array', which is of non-class type 'std::vector<goods>()'
   29 |   sort(data_array.begin(), data_array.end());
      |                                       ^~~
a.cc:32:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |        for (int j = 0; j < data_array[i].num; ++j) {
      |                                        ^
a.cc:32:42: error: request for member 'num' in '*(data_array + ((sizetype)i))', which is of non-class type 'std::vector<goods>()'
   32 |        for (int j = 0; j < data_array[i].num; ++j) {
      |                                          ^~~
a.cc:33:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |          cost += data_array[i].price;
      |                              ^
a.cc:33:32: error: request for member 'price' in '*(data_array + ((sizetype)i))', which is of non-class type 'std::vector<goods>()'
   33 |          cost += data_array[i].price;
      |                                ^~~~~
Language: C

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

struct Drink{
	int A;
	int B;
};

int desc(const void *a, const void *b){
	struct Drink *A = (struct Drink *)a;
	struct Drink *B = (struct Drink *)b;
	return B->A - A->A;

}

int main(){
	int N, M, *A, *B, i, j, count = 0, sum = 0;

	struct Drink *d;

	scanf("%d%d", &N, &M);
	d->A = (int *)malloc(sizeof(int)*N);
	d->B = (int *)malloc(sizeof(int)*N);
	for(i = 0; i < N; i++){
		scanf("%d%d", &(d->A[i]), &(d->B[i]));
	}

	qsort(d->A, sizeof(d->A)/sizeof(int), sizeof(int), desc);
	
	for(i = 0; i < N; i++){
		for(j = 0; j < d.->B[i]; j++){
			sum += d->A[i];
			count++;
			if(count == M){ break; }
		}
		if(count == M){ break; }
	}

	printf("%d", sum);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:14: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   22 |         d->A = (int *)malloc(sizeof(int)*N);
      |              ^
main.c:23:14: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   23 |         d->B = (int *)malloc(sizeof(int)*N);
      |              ^
main.c:25:37: error: subscripted value is neither array nor pointer nor vector
   25 |                 scanf("%d%d", &(d->A[i]), &(d->B[i]));
      |                                     ^
main.c:25:49: error: subscripted value is neither array nor pointer nor vector
   25 |                 scanf("%d%d", &(d->A[i]), &(d->B[i]));
      |                                                 ^
main.c:28:16: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   28 |         qsort(d->A, sizeof(d->A)/sizeof(int), sizeof(int), desc);
      |               ~^~~
      |                |
      |                int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:31:34: error: expected identifier before '->' token
   31 |                 for(j = 0; j < d.->B[i]; j++){
      |                                  ^~
main.c:32:36: error: subscripted value is neither array nor pointer nor vector
   32 |                         sum += d->A[i];
      |                                    ^
Language: C

#include<stdio.h>

#define LARGEST 10*10*10*10*10

int main(void){
  
  int N,M;
  int A[LARGEST],B[LARGEST];
  int i,j,tmp_A,tmp_B,need_money = 0;
  
  scanf("%d %d",&N,&M);
  
  for(i = 0;i < N;i++){
   scanf("%d %d",&A[i],&B[i]); 
  }
  
  for(i = 0;i < N;i++){
    for(j = i + 1;j < N,j++){
      if(A[i] > A[j]){
        tmp_A = A[i];
        A[i] = A[j];
        A[j] = tmp_A;
       
        tmp_B = B[i];
        B[i] = B[j];
        B[j] = tmp_B;
      }
    }
  }
  
  i = 0;
  
  while(N > 0){
    if(B[i] < N){
      need_money += A[i]*B[i];
      N -= B[i];
      i++;
    }else{
      need_money += A[i]*N;
      N -= N;
    }
  }
  
  printf("%d"need_money);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:28: error: expected ';' before ')' token
   18 |     for(j = i + 1;j < N,j++){
      |                            ^
      |                            ;
main.c:44:14: error: expected ')' before 'need_money'
   44 |   printf("%d"need_money);
      |         ~    ^~~~~~~~~~
      |              )
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;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
    unsigned long long price=0.0,a,b,sum=0,t,y,i,n,m;cin>>n>>m;
    vector<int> c;
    map<int,int> d;
    d.clear();
    for(i=0;i<n;i++){
        cin>>a>>b;
        if(!binary_search(c.begin(), c.end(), a)){
            c.push_back(a);
        }
        d[a] += b;
        sort(c.begin(),c.end());
    }
    for(i=0;i<n;i++){
        if(sum+d[c[i]]>m){
            for(y=1;y<=d[c[i]];y++){
                price+=c[i];
                sum++;
                if(sum>=m){
                    cout<<price<<endl;
                    return 0;
                }     
            }       
        } else {
            sum+=d[c[i]];
            price+=c[i]*d[c[i]];
        }
        }
        
    }
}

Compiler output:
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>
 
using namespace std;
 
int main()
{
	long N,M;
	cin >> N >> M;
	map<long,long> B;
	for(int i=0;i<N;i++)
	{
		int t;
		cin >> t >> B[t];
	}
	
	long d = M;
	long sum = 0;
	auto map<long, long>::iterator tkb = begin(B); 
	for(int p=0;p<N;p++)
	{	
		pair<const long, long> q = *tkb;
    		const long& A = q.first;
 	   	long& BB = q.second;
		if(BB>=d)
		{
			sum = sum + A*d;
			break;
			
		}
		else if(BB<d)
		{
			d = d - BB;
			sum = sum + A*BB;
		}
		tkb = next(tkb,1);
 
	}
	cout << sum << endl;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: qualified-id in declaration before 'tkb'
   31 |         auto map<long, long>::iterator tkb = begin(B);
      |                                        ^~~
a.cc:34:45: error: 'tkb' was not declared in this scope
   34 |                 pair<const long, long> q = *tkb;
      |                                             ^~~
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>
 
using namespace std;
 
int main()
{
	long N,M;
	cin >> N >> M;
	map<long,long> B;
	for(int i=0;i<N;i++)
	{
		int t;
		cin >> t >> B[t];
	}
	
	long d = M;
	long sum = 0;
	auto map<long, long>::iterator tkb = begin(B); 
	for(int p=0;p<N;p++)
	{	
		pair<const long, long> q = *tkb;
    		const long& A = q.first;
 	   	long& BB = q.second;
		if(BB>=d)
		{
			sum = sum + A*d;
			break;
			
		}
		else if(BB<d)
		{
			d = d - BB;
			sum = sum + A*BB;
		}
		iter = next(iter,1);
 
	}
	cout << sum << endl;
 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: qualified-id in declaration before 'tkb'
   31 |         auto map<long, long>::iterator tkb = begin(B);
      |                                        ^~~
a.cc:34:45: error: 'tkb' was not declared in this scope
   34 |                 pair<const long, long> q = *tkb;
      |                                             ^~~
a.cc:48:17: error: 'iter' was not declared in this scope
   48 |                 iter = next(iter,1);
      |                 ^~~~
Language: C++

#include<string>
#include<sstream>
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<ios>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<type_traits>
#include<random>
#include<vector>
#include<map>
 
using namespace std;
 
int main()
{
	long N,M;
	cin >> N >> M;
	map<long,long> B;
	for(int i=0;i<N;i++)
	{
		int t;
		cin >> t >> B[t];
	}
	
	long d = M;
	long sum = 0;
	auto map<long, long>::iterator iter = begin(B); 
	for(int p=0;p<N;p++)
	{	
		pair<const long, long> q = *iter;
    		const long& A = q.first;
 	   	long& BB = q.second;
		if(BB>=d)
		{
			sum = sum + A*d;
			break;
			
		}
		else if(BB<d)
		{
			d = d - BB;
			sum = sum + A*BB;
		}
		iter = next(iter,1);
 
	}
	cout << sum << endl;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: qualified-id in declaration before 'iter'
   31 |         auto map<long, long>::iterator iter = begin(B);
      |                                        ^~~~
a.cc:34:45: error: 'iter' was not declared in this scope
   34 |                 pair<const long, long> q = *iter;
      |                                             ^~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
	map<unsigned long long, unsigned long long> energy_price_map;
	int N, M;
	scanf_s("%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));
	}

	unsigned long long bought_cnt = 0;
	unsigned long long needed_money = 0;
	unsigned long long price = 0;
	unsigned long long count = 0;
	for (auto shop_info : energy_price_map) {
		price = shop_info.first;
		count = shop_info.second;
		needed_money += M > count ? price*count : price*M;
		if (M -= count <= 0) break;

	}

	printf("%llu", needed_money);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d %d", &N, &M);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<cstdio>
#include<algorithm>
 
int main(int argc, char const *argv[]) {
  int n,m;
  long ans=0;
  scanf("%d %d",&n,&m);
  int a[n],b[n];
  for(int i = 0 ;i<n;i++){
    scanf("%d %d",&a[i],&b[i])
  }
  for(int i=0;i<n;i++){
    int min = i;
    for(int j=i+1;j<n;j++){
      if(a[min]>a[j]){
        int box=a[min];
        a[min]=a[j];
        a[j]=box;
        box=b[min];
        b[min]=b[j];
        b[j]=box;
        b[min]=box;
        min=j;
      }
    }
  }
  int buycount=0;
  for(int i=0;i<n;i++){
    if(buycount+b[i]<=m){
      ans+=a[i]*b[i];
      buycount+=b[i];
    }else{
      ans+=(m-buycount)*a[i];
    }
  }
  printf("%d",ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:10:31: error: expected ';' before '}' token
   10 |     scanf("%d %d",&a[i],&b[i])
      |                               ^
      |                               ;
   11 |   }
      |   ~
Language: C++

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

int main()
{
  long long int n, m;
  cin >> n >> m;
  vector<pair<long long int, long long int>> vec(n);
  long long int a,b;
  for(long long int i = 0; i < n; i++) {
    cin >> a >> b;
    vec.at(i).first = a;
    vec.at(i).second = b;
  }
  sort(vec.begin(), vec.end());
  long long int ans =0;
  lobg long int i = 0;
  while(true) {
    if(vec.at(i).first <= m) {
      ans += vec.at(i).first * vec.at(i).second;
      m -= vec.at(i).first;
      i++;
    }
    else if(m > 0 && vec.at(i).first >= m) {
      ans += m * vec.at(i).second;
      m -= vec.at(i).first;
      i++;
      break;
    }
    if(m == 0)
      break;
  }
  cout << ans << endl;
    
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'lobg' was not declared in this scope; did you mean 'long'?
   18 |   lobg long int i = 0;
      |   ^~~~
      |   long
a.cc:20:15: error: 'i' was not declared in this scope
   20 |     if(vec.at(i).first <= m) {
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <vector<int>> aa;
bool cmp(vector<int>a,vector<int>b){
	return a[0]<b[0];
}
int main(){
	cin.tie(0);
	cin.sys_with_stdio(false);
	int n,m;
	cin>>n>>m;
	aa.assign(n,vector<int>(2,0));
	for(int i=0;i<n;i++){
		int a,b;
		for(int j=0;j<2;j++){
			cin>>aa[i][j];
		}
	}
	sort(aa.begin(),aa.end(),cmp);
	long long int cost=0;
	for(int i=0;i<n;i++){
		cost+= (long long int )min(m,a[i][1])*aa[i][0;
		m-=min(m,aa[i][1]);
		if(!n) break;
	}
	cout<<cost<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'std::istream' {aka 'class std::basic_istream<char>'} has no member named 'sys_with_stdio'; did you mean 'sync_with_stdio'?
   11 |         cin.sys_with_stdio(false);
      |             ^~~~~~~~~~~~~~
      |             sync_with_stdio
a.cc:24:46: error: 'a' was not declared in this scope
   24 |                 cost+= (long long int )min(m,a[i][1])*aa[i][0;
      |                                              ^
a.cc:24:62: error: expected ']' before ';' token
   24 |                 cost+= (long long int )min(m,a[i][1])*aa[i][0;
      |                                                              ^
      |                                                              ]
Language: C++

#include <iostream>
using namespace std;

void pairSort(long long a[], long long b[], long long n);

int main() {
    long long n, m;
    long long *a, *b;

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

    pairSort(a, b, n);

    long long totalNumber = 0;
    long long totalPrice = 0;

    for (long long i = 0; i < n; i++) {
        for (long long j = 0; j < b[i]; j++) {
            if (totalNumber < m) {
                totalNumber++;
                totalPrice += a[i];
            } else {
                break;
            }
        }
    }
    cout << totalPrice << endl;
}

void pairSort(long long a[], long long b[], long long n) {
    for (int i = n - 1; i >= 1; i--) {
        for(int j = i - 1; j >= 0; j--) {
            if (a[i] < a[j]) {
                int temp1 = a[i];
                int temp2 = b[i];
                a[i] = a[j];
                b[i] = b[j];
                a[j] = temp1;
                b[j] = temp2;
            }
        }
    }
}

oid pairSort(long long a[], long long b[], long long n) {
    bool flag = 1;
    for (long long i = 0; flag; i++) {
        flag = 0;
        for (long long j = n - 1; j >= i + 1; j--) {
            if (a[j] < a[j - 1]) {
                long long temp1 = a[j];
                long long temp2 = b[j];
                a[j] = a[j - 1];
                b[j] = b[j - 1];
                a[j - 1] = temp1;
                b[j - 1] = temp2;
                flag = 1;
            }
        }
    }
}


Compiler output:
a.cc:50:1: error: 'oid' does not name a type; did you mean 'void'?
   50 | oid pairSort(long long a[], long long b[], long long n) {
      | ^~~
      | void
Language: Java

import java.util.*;

public class Main {

    public static class Shop implements Comparable<Shop> {
        long price;
        long sum;

        @Override
        public int compareTo(Shop shop) {
            return (int)(this.price - shop.price);
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String in[];
        int row, idx;
        long m, ret;

        in = scanner.nextLine().split(" ");
        row = Integer.parseInt(in[0]);
        m = Integer.parseInt(in[1]);

        ArrayList<Shop> list = new ArrayList<>();
        for (int i = 0; i < row; i++) {
            in = scanner.nextLine().split(" ");
            Shop shop = new Drink.Shop();
            shop.price = Integer.parseInt(in[0]);
            shop.sum = Integer.parseInt(in[1]);
            list.add(shop);
        }

        Collections.sort(list);
        ret = 0;
        for (int i = 0; i < row; i++) {
            Shop shop = list.get(i);
            if (m > shop.sum) {
                ret += shop.price * shop.sum;
                m -= shop.sum;
            } else {
                ret += shop.price * m;
                break;
            }
        }

        System.out.println(ret);
    }
}

Compiler output:
Main.java:27: error: package Drink does not exist
            Shop shop = new Drink.Shop();
                                 ^
1 error
Language: C++

#define p 10000
using namespace std;

void swap(int *x,int *y){
	int temp=*x;
	*x=*y;
	*y=temp;
}

void swapl(long long int *x,long long int *y){
	long long int temp=*x;
	*x=*y;
	*y=temp;
}

int main(){
	int N,M;
	long long int A[p];
	int B[p];
	int i,j;
	int sum=0;
	long long int min=0;
	int min_i;
	int x=0;
	
	cin >> N >> M;
	
	for(i=0;i<N;i++){
		cin >> A[i] >> B[i];
	}
	
	for(j=0;j<N;j++){
		min=A[j];
		min_i=j;
		for(i=j+1;i<N;i++){
			if(A[i]<min){
				min=A[i];
				min_i=i;
			}
		}
		swapl(&A[j],&A[min_i]);
		swap(&B[j],&B[min_i]);
	}
	
	for(i=0;i<N;i++){	
		for(j=0;j<B[i];j++){
			sum+=A[i];
			x++;
			if(x==M){
				cout << sum << endl;
				break;
			}
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'cin' was not declared in this scope
   26 |         cin >> N >> M;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define p 10000
a.cc:50:33: error: 'cout' was not declared in this scope
   50 |                                 cout << sum << endl;
      |                                 ^~~~
a.cc:50:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:48: error: 'endl' was not declared in this scope
   50 |                                 cout << sum << endl;
      |                                                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define p 10000
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
	map<unsigned long long, unsigned long long> energy_price_map;
	int N, M;
	scanf_s("%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));
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d %d", &N, &M);
      |         ^~~~~~~
      |         scanf
Language: C++

void swap(int *x,int *y){
	int temp=*x;
	*x=*y;
	*y=temp;
}

void swapl(long long int *x,long long int *y){
	long long int temp=*x;
	*x=*y;
	*y=temp;
}

int main(){
	int N,M;
	int A[p];
	int B[p];
	int i,j;
	int sum=0;
	long long int min=0;
	int min_i;
	int x=0;
	
	cin >> N >> M;
	
	for(i=0;i<N;i++){
		cin >> A[i] >> B[i];
	}
	
	for(j=0;j<N;j++){
		min=A[j];
		min_i=j;
		for(i=j+1;i<N;i++){
			if(A[i]<min){
				min=A[i];
				min_i=i;
			}
		}
		swapl(&A[j],&A[min_i]);
		swap(&B[j],&B[min_i]);
	}
	
	for(i=0;i<N;i++){	
		for(j=0;j<B[i];j++){
			sum+=A[i];
			x++;
			if(x==M){
				cout << sum << endl;
				break;
			}
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'p' was not declared in this scope
   15 |         int A[p];
      |               ^
a.cc:23:9: error: 'cin' was not declared in this scope; did you mean 'min'?
   23 |         cin >> N >> M;
      |         ^~~
      |         min
a.cc:26:24: error: 'A' was not declared in this scope
   26 |                 cin >> A[i] >> B[i];
      |                        ^
a.cc:26:32: error: 'B' was not declared in this scope
   26 |                 cin >> A[i] >> B[i];
      |                                ^
a.cc:30:21: error: 'A' was not declared in this scope
   30 |                 min=A[j];
      |                     ^
a.cc:39:23: error: 'B' was not declared in this scope
   39 |                 swap(&B[j],&B[min_i]);
      |                       ^
a.cc:43:27: error: 'B' was not declared in this scope
   43 |                 for(j=0;j<B[i];j++){
      |                           ^
a.cc:44:30: error: 'A' was not declared in this scope
   44 |                         sum+=A[i];
      |                              ^
a.cc:47:33: error: 'cout' was not declared in this scope
   47 |                                 cout << sum << endl;
      |                                 ^~~~
a.cc:47:48: error: 'endl' was not declared in this scope
   47 |                                 cout << sum << endl;
      |                                                ^~~~
Language: Java


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
//import org.apache.commons.lang3.StringUtils;
 
 
/**
 *
 * @author aj
 */
public class C121 {
    
    public static void main(String[] args){
        try {
            //Scanner sc = new Scanner(System.in);
            BufferedInputStream bf = new BufferedInputStream(System.in);
            BufferedReader in = new BufferedReader(
                    new InputStreamReader(bf, StandardCharsets.UTF_8));
            OutputStream out = new BufferedOutputStream ( System.out );
            String[] nmc = in.readLine().split(" ");
            int n = Integer.parseInt(nmc[0]);
            int m = Integer.parseInt(nmc[1]);
            
            TreeMap<Long,List<Integer>> map = new TreeMap();
            long c = 0;
            long[] a = new long[n];
            long[] b = new long[n];
            for(int i=0;i<n;i++){
                
                String[] ab = in.readLine().split(" ");
                a[i] = Integer.parseInt(ab[0]);
                b[i] = Integer.parseInt(ab[1]);
                if  (map.get(a[i])==null) map.put(a[i], new LinkedList());
                map.get(a[i]).add(i);
            }
            int nc = 0;
            
            for(long key:map.keySet()){
                for(int i:map.get(key)){
                    c += Math.min(m, b[i])*key;
                    m -= Math.min(m, b[i]);
                }
            }

            out.write((c+"\n").getBytes());
            out.flush();
        }catch(Exception ex){
            ex.printStackTrace();
        }
        
    }
    
    
    
}

Compiler output:
Main.java:18: error: class C121 is public, should be declared in a file named C121.java
public class C121 {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
vector<pair<ll,ll> > cost;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,m; cin>>n>>m;
	cost.resize(n);
	for(int i=0; i<n; i++) {
		cin>>cost[i].first>>cost[i].second;
	}
	sort(cost.begin(),cost.end());
	ll anss=0;

	int j=0;
	while(m) {
		ll ans=min(cost[j].second,m);
		//cout<<ans<<endl;
		m-=ans;
		anss+=1ll*ans*cost[j].first;
		j++;
	}

	cout<<anss<<endl;


	return 0;
}


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