criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long M = sc.nextLong();
        long count_opt =0;
        long price_opt =0;
        ArrayList<Drink> List = new ArrayList<>();
        for(int a=0;a<N;a++){
            long price = sc.nextLong();
            long count = sc.nextLong();
            Drink d = new Drink(price,count);
            List.add(d);
        }
        Collections.sort(List, new Comparator<Drink>() {
            @Override
            public int compare(Drink o1, Drink o2) {
                return o1.price<=o2.price ? -1:1;
            }
        });

        for(Drink d:List){
            if(count_opt+d.count>=M){
                price_opt += (M-count_opt)*d.price;
                break;
            }
            count_opt+=d.count;
            price_opt+=d.count*d.price;
        }
        System.out.println(price_opt);
    }
}

Compiler output:
Main.java:9: error: cannot find symbol
        ArrayList<Drink> List = new ArrayList<>();
                  ^
  symbol:   class Drink
  location: class Main
Main.java:13: error: cannot find symbol
            Drink d = new Drink(price,count);
            ^
  symbol:   class Drink
  location: class Main
Main.java:13: error: cannot find symbol
            Drink d = new Drink(price,count);
                          ^
  symbol:   class Drink
  location: class Main
Main.java:16: error: cannot find symbol
        Collections.sort(List, new Comparator<Drink>() {
                                              ^
  symbol:   class Drink
  location: class Main
Main.java:18: error: cannot find symbol
            public int compare(Drink o1, Drink o2) {
                               ^
  symbol: class Drink
Main.java:18: error: cannot find symbol
            public int compare(Drink o1, Drink o2) {
                                         ^
  symbol: class Drink
Main.java:23: error: cannot find symbol
        for(Drink d:List){
            ^
  symbol:   class Drink
  location: class Main
7 errors
Language: Java

import java.util.*;
public class Main121 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		int M = sc.nextInt();
		
		long[] A = new long[N];
		
		long[] B = new long[N];
		
		for(int i=0;i<N;i++){
			
			A[i] = sc.nextLong();
			
			B[i] = sc.nextLong();
		}
		
		for(int i=0;i<N-1;i++){
			
			for(int j=i+1;j<N;j++){
				
				if(A[j]<A[i]){
					
					long tempA = A[i];
					
					A[i] = A[j];
					
					A[j] = tempA;
					
					long tempB = B[i];
					
					B[i] = B[j];
					
					B[j] = tempB;
									
				}
			}
		}
		
		long ans = 0;
		
		long k = 0;
		
		int i = 0;
		
		while(k<M){
			
			if(k+B[i]<=M){
				
				ans += A[i]*B[i];
				
				k += B[i];
								
			}else{
				
				for(;k<M;k++){
					
					ans += A[i];
									}
			}
			i++;
		}
		System.out.println(ans);
				
	}
	
	
}


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

#include <iostream>
#include <vector>
using namespace std;
class Shop{
  public:
    int cost;
    int num;
  Shop(int a, int b){
    cost = a;
    num = b;
  }
  bool operator<(const Shop &another) const
  {
    return cost < another.cost;
  };
};
int main(){
  double N,M,m = 0;
  long long ans = 0;
  cin >> N >> M;
  vector<Shop> shopList;
  int tempA, tempB;
  for(int n=0;n<N;n++){
    cin >> tempA >> tempB;
    shopList.push_back(Shop(tempA, tempB));
  }
  std::sort(shopList.begin(),shopList.end());
  for(int n=0;n<N;n++){
    //cout << shopList[n].cost << " "<<shopList[n].num << endl;
    int buy = shopList[n].num;
    if(m + buy > M){
      buy = M - m;
      ans += buy * shopList[n].cost;
      break;
    }
    m += buy;
    ans += buy * (long long)shopList[n].cost;
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   27 |   std::sort(shopList.begin(),shopList.end());
      |        ^~~~
      |        qsort
Language: C++

#include <iostream>
#include <vector>
using namespace std;
class Shop{
  public:
    int cost;
    int num;
  Shop(int a, int b){
    cost = a;
    num = b;
  }
  bool operator<(const Shop &another) const
  {
    return cost < another.cost;
  };
};
int main(){
  double N,M,m = 0;
  long long ans = 0;
  cin >> N >> M;
  vector<Shop> shopList;
  int tempA, tempB;
  for(int n=0;n<N;n++){
    cin >> tempA >> tempB;
    shopList.push_back(Shop(tempA, tempB));
  }
  sort(shopList.begin(),shopList.end());
  for(int n=0;n<N;n++){
    //cout << shopList[n].cost << " "<<shopList[n].num << endl;
    int buy = shopList[n].num;
    if(m + buy > M){
      buy = M - m;
      ans += buy * shopList[n].cost;
      break;
    }
    m += buy;
    ans += buy * (long long)shopList[n].cost;
  }

  cout << ans << endl;
}

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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CEnergyDrinkCollector solver = new CEnergyDrinkCollector();
        solver.solve(1, in, out);
        out.close();
    }

    static class CEnergyDrinkCollector {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            List<Pair> stores = new ArrayList<>();

            for (int i = 0; i < N; i++) {
                stores.add(new Pair(in.nextLong(), in.nextLong()));
            }
            stores.sort((x, y) -> x.first - y.first);

            long ans = 0;
            long remain = M;
            out:
            for (int i = 0; i < N; i++) {
                Pair store = stores.get(i);
                for (long j = store.second; j > 0; j--) {
                    ans += store.first;
                    remain--;
                    if (remain <= 0) break out;
                }
            }
            out.println(ans);
        }

        class Pair {
            public long first;
            public long second;

            public Pair(long first, long second) {
                this.first = first;
                this.second = second;
            }

        }

    }
}



Compiler output:
Main.java:35: error: incompatible types: bad return type in lambda expression
            stores.sort((x, y) -> x.first - y.first);
                                          ^
    possible lossy conversion from long to int
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CEnergyDrinkCollector solver = new CEnergyDrinkCollector();
        solver.solve(1, in, out);
        out.close();
    }

    static class CEnergyDrinkCollector {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            List<Pair> stores = new ArrayList<>();

            for (int i = 0; i < N; i++) {
                stores.add(new Pair(in.nextLong(), in.nextLong()));
            }
            stores.sort((x, y) -> x.first - y.first == 0 ?0:(x.first - y.first>0?1:-1);

            long ans = 0;
            long remain = M;
            out:
            for (int i = 0; i < N; i++) {
                Pair store = stores.get(i);
                for (long j = store.second; j > 0; j--) {
                    ans += store.first;
                    remain--;
                    if (remain <= 0) break out;
                }
            }
            out.println(ans);
        }

        class Pair {
            public long first;
            public long second;

            public Pair(long first, long second) {
                this.first = first;
                this.second = second;
            }

        }

    }
}



Compiler output:
Main.java:35: error: ')' or ',' expected
            stores.sort((x, y) -> x.first - y.first == 0 ?0:(x.first - y.first>0?1:-1);
                                                                                      ^
1 error
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <unordered_map>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    int m = 0, n = 0;
    cin >> n >> m;
    vector<ll> val;
    unordered_map<ll, ll> num;
    
    int v0 = 0, n0 = 0;
    for(int i = 0; i < n; ++i) {
        cin >> v0 >> n0;
        if(num.count(v0) == 0) {
            val.push_back(v0);
            num[v0] = 0;
        }
        num[v0] += n0;
    }
    sort(val.begin(), val.end());
    
    ll cost = 0;
    ll cans = m;
    for(int i = 0; i < val.size() && cans > 0; ++i) {
        if(cans <= num[val[i]]) {
            cost += cans * val[i];
            cans = 0;
        } else {
            cost += num[val[i]] * val[i];
            cans = cans - num[val[i]];
        }
    }
    
    cout << cost << endl;
    return 0;
}

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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
 
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CEnergyDrinkCollector solver = new CEnergyDrinkCollector();
        solver.solve(1, in, out);
        out.close();
    }
 
    static class CEnergyDrinkCollector {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            List<Pair> stores = new ArrayList<>();
 
            for (int i = 0; i < N; i++) {
                stores.add(new Pair(in.nextLong(), in.nextLong()));
            }
            //stores.sort((x, y) -> x.first - y.first >= 0 ? 1 : -1);
 
            long ans = 0;
            long remain = M;
            out:
            for (int i = 0; i < N; i++) {
                Pair store = stores.get(i);
                for (long j = store.second; j > 0; j--) {
                    ans += store.first;
                    remain--;
                    if (remain <= 0) break out;
                }
            }
            out.println(ans);
        }
 
        class Pair {
            public long first;
            public long second;
 
            public Pair(long first, long second) {
                this.first = first;
                this.second = second;
            }
 
        }
 
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.OutputStream;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStream;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.PrintWriter;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.List;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Scanner;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import java.util.ArrayList;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:15:1: error: expected unqualified-id before 'public'
   15 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <functional>
#include <algorithm>
#include <utility>
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<long int,long int>> buy(N);
	for(int i=0;i<N;i++){
		buy[i].first = A[i];
		buy[i].second = B[i];
	}
	sort(buy.begin(), buy.end());
	long int sum = 0;
	for(int i = 0;i<N;i++){
		if(M <= 0) break;
		long int m = min(buy[i].second,M);
		sum += buy[i].first * m;
		M -= m;
	}
	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: no matching function for call to 'min(long int&, int&)'
   23 |                 long int m = min(buy[i].second,M);
      |                              ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:23:33: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   23 |                 long int m = min(buy[i].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,
                 from a.cc:3:
/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:23:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   23 |                 long int m = min(buy[i].second,M);
      |                              ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
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++)    AB[i]=make_pair(A[i], B[i]);
    
    sort(AB.begin(),AB.end());
    
    long long ans=0;
    
    for(int i=0;i<N;i++){
        int buy=min(M,AB[i].second);
        ans+=(long long)AB[i].first*buy;
        M-=buy;
    }
    
    cout<<ans<<endl;
}

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

#include<iostream>
#include<vector>
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++)    AB[i]=make_pair(A[i], B[i]);
    
    sort(AB.begin(),AB.end());
    
    long long ans=0;
    
    for(int i=0;i<N;i++){
        int buy=min(M,AB[i].second);
        ans+=(long long)AB[i].first*buy;
        M-=buy;
        if(M<=0)  break;
    }
    
    cout<<ans<<endl;
}

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

#include<iostream>
#include<vector>
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++)    AB[i]=make_pair(A[i], B[i]);
    
    sort(AB.begin(),AB.end());
    
    long long ans=0;
    
    for(int i=0;i<N;i++){
        int buy=min(M,AB[i].second);
        ans+=(long long)AB[i].first*buy;
        M-=buy;
        if(buy<=0)  break;
    }
    
    cout<<ans<<endl;
}

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

#include <iostream>
#include <vector>

using namespace std;

unsigned long N, M;
typedef pair<long long, long long> X;
vector<X> AB;

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

    for (int i = 0; i < N; i++) {
        long long a; cin >> a;
        long long b; cin >> b;

        AB.push_back(X(a, b));
    }

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

    long long ans = 0;

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

    cout << ans;

    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(AB.begin(), AB.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    pair<int, int> p[n];
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        p[i] = make_pair(a, b);
    }
    sort(p, p + n);
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int cnt = min(p[i].second, m);
        ans += p[i].first * (long long)cnt;
        m -= cnt;
        if (!m) break;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(p, p + n);
      |     ^~~~
      |     short
Language: C

#include<stdio.h>
#include<stdlib.h>
 
typedef struct {
  	int A;
  	int B;
} shop_t;
 
int cmp(const void*,const void*);
 
int
cmp(const void *a, const void *b){
	return ((shop_t *)a)->A-((shop_t *)b)->A);
 };
 
int
main()
{
  	int n,m;
  	int get;
  	int i;
  	long long ans;
  
  	scanf("%d %d",&n,&m);
  	shop_t list[n];
  	for(i=0;i<n;i++){
      	scanf("%d %d",&list[i].A,&list[i].B);
    }
  	
  	qsort(list,n,sizeof(shop_t),cmp);
  
  	ans =0;
  	for(get=0;get!=m;get++){
      	for(i=0;list[i].B==0;){ i++; }
      	ans += list[i].A;
      	list[i].B--;
    }
      
      printf("%lld",ans);
      
      return 0;
    }
  

Compiler output:
main.c: In function 'cmp':
main.c:13:49: error: expected ';' before ')' token
   13 |         return ((shop_t *)a)->A-((shop_t *)b)->A);
      |                                                 ^
      |                                                 ;
main.c:13:49: error: expected statement before ')' token
Language: C

#include<stdio.h>
#include<stdlib.h>
 
typedef struct {
  	int A;
  	int B;
} shop_t;
 
int cmp(const void*,const void*);
 
int
cmp(const void *a, const void *b){
	return ((shop_t *)a)->A-((shop_t *)b)->B);
 };
 
int
main()
{
  	int n,m;
  	int get;
  	int i;
  	long long ans;
  
  	scanf("%d %d",&n,&m);
  	shop_t list[n];
  	for(i=0;i<n;i++){
      	scanf("%d %d",&list[i].A,&list[i].B);
    }
  	
  	qsort(list,n,sizeof(shop_t),cmp);
  
  	ans =0;
  	for(get=0;get!=m;get++){
      	for(i=0;list[i].B==0;){ i++; }
      	ans += list[i].A;
      	list[i].B--;
    }
      
      prntf("%lld",ans);
      
      return 0;
    }
  

Compiler output:
main.c: In function 'cmp':
main.c:13:49: error: expected ';' before ')' token
   13 |         return ((shop_t *)a)->A-((shop_t *)b)->B);
      |                                                 ^
      |                                                 ;
main.c:13:49: error: expected statement before ')' token
main.c: In function 'main':
main.c:39:7: error: implicit declaration of function 'prntf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   39 |       prntf("%lld",ans);
      |       ^~~~~
      |       printf
Language: C

#include<stdio.h>
#include<stdlib.h>
 
typedef struct {
  	int A;
  	int B;
} shop_t;
 
int cmp(const void*,const void*);
 
int
cmp(const void *a, const void *b){
	return ((shop_t *)a->A-(shop_t *)b->B);
 };
 
int
main()
{
  	int n,m;
  	int get;
  	int i;
  	long long ans;
  
  	scanf("%d %d",&n,&m);
  	shop_t list[n];
  	for(i=0;i<n;i++){
      	scanf("%d %d",&list[i].A,&list[i].B);
    }
  	
  	qsort(list,n,sizeof(shop_t),cmp);
  
  	ans =0;
  	for(get=0;get!=m;get++){
      	for(i=0;list[i].B==0;){ i++ }
      	ans += list[i].A;
      	list[i].B--;
    }
      
      prntf("%lld",ans);
      
      return 0;
    }
  

Compiler output:
main.c: In function 'cmp':
main.c:13:28: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                            ^~
main.c:13:28: error: request for member 'A' in something not a structure or union
main.c:13:43: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                                           ^~
main.c:13:43: error: request for member 'B' in something not a structure or union
main.c: In function 'main':
main.c:34:36: error: expected ';' before '}' token
   34 |         for(i=0;list[i].B==0;){ i++ }
      |                                    ^~
      |                                    ;
main.c:39:7: error: implicit declaration of function 'prntf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   39 |       prntf("%lld",ans);
      |       ^~~~~
      |       printf
Language: C

#include<stdio.h>
#include<stdlib.h>
 
typedef struct {
  	int A;
  	int B;
} shop_t;
 
int cmp(const void*,const void*);
 
int
cmp(const void *a, const void *b){
	return ((shop_t *)a->A-(shop_t *)b->B);
 };
 
int
main()
{
  	int n,m;
  	int get;
  	int i;
  	long long ans;
  
  	scanf("%d %d",&n,&m);
  	shop_t list[n];
  	for(i=0;i<n;i++){
      	scanf("%d %d",&list[i].A,&list[i].B);
    }
  	
  	qsort(list,N,sizeof(shop_t),cmp);
  
  	ans =0;
  	for(get=0;get!=m;get++){
      	for(i=0;list[i].B==0;){ i++ }
      	ans += list[i].A;
      	list[i].B--;
      
      	printf("%d",ans);
      
      return 0;
    }
  

Compiler output:
main.c: In function 'cmp':
main.c:13:28: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                            ^~
main.c:13:28: error: request for member 'A' in something not a structure or union
main.c:13:43: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                                           ^~
main.c:13:43: error: request for member 'B' in something not a structure or union
main.c: In function 'main':
main.c:30:20: error: 'N' undeclared (first use in this function)
   30 |         qsort(list,N,sizeof(shop_t),cmp);
      |                    ^
main.c:30:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:36: error: expected ';' before '}' token
   34 |         for(i=0;list[i].B==0;){ i++ }
      |                                    ^~
      |                                    ;
main.c:41:5: error: expected declaration or statement at end of input
   41 |     }
      |     ^
Language: C

#include<stdio.h>
#include<stdlib.h>
 
typedef struct {
  	int A;
  	int B;
} shop_t;
 
int cmp(const void*,const void*);
 
int
cmp(const void *a, const void *b){
	return ((shop_t *)a->A-(shop_t *)b->B);
 };
 
int
main()
{
  	int n,m;
  	int get;
  	int i;
  	long long ans;
  
  	scanf("%d %d",&n,&m);
  	shop_t list[n];
  	for(i=0;i<n;i++){
      	scanf("%d %d",&list[i].A,&list[i].B);
    }
  	
  	qsort(list,N,sizeof(shop_t),cmp);
  
  	ans =0;
  	for(get=0;get!=m;get++){
      	for(i=0;list[i].B==0;){ i++ }
      	ans += list[i].A;
      	list[i].B--;
      
      return 0;
    }
  

Compiler output:
main.c: In function 'cmp':
main.c:13:28: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                            ^~
main.c:13:28: error: request for member 'A' in something not a structure or union
main.c:13:43: warning: dereferencing 'void *' pointer
   13 |         return ((shop_t *)a->A-(shop_t *)b->B);
      |                                           ^~
main.c:13:43: error: request for member 'B' in something not a structure or union
main.c: In function 'main':
main.c:30:20: error: 'N' undeclared (first use in this function)
   30 |         qsort(list,N,sizeof(shop_t),cmp);
      |                    ^
main.c:30:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:36: error: expected ';' before '}' token
   34 |         for(i=0;list[i].B==0;){ i++ }
      |                                    ^~
      |                                    ;
main.c:39:5: error: expected declaration or statement at end of input
   39 |     }
      |     ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
using namespace std;

int main()
{
    long long int  m, n, ans, drink = 0;
    cin >> n >> m;
    vector<long long int> a(n), b(n);
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i];
    }
    vector<pair<long long int, long long int>> shop(n);
    for(int i = 0;i < n;i++){
        shop[i] = make_pair(a[i], b[i]);
    }

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

    ans = 0;
    for(int i = 0;i < n;i++){
        drink += shop[i].second;
        if(drink < m){
            ans += shop[i].first * shop[i].second;
        }
        else{
            drink -= shop[i].second;
            ans += shop[i].first * (m - drink);

            break;
        }
    }

    cout << ans;

    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: no matching function for call to 'sort()'
   22 |     sort();
      |     ~~~~^~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 0 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 0 provided
Language: C++

#include <iostream>
#include <vector>
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

bool less_than(pair<int, int> &a, pair<int, int> &b) {
    return a.second < b.second;
}

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(n), b(n);
    rep (i, n) cin >> a[i] >> b[i];

    vector<pair<int, int>> ca(n), cb(n);
    rep (i, n) ca[i] = make_pair(a[i], a[i]);
    rep (i, n) cb[i] = make_pair(b[i], a[i]);

    sort(ca.begin(), ca.end(), less_than);
    sort(cb.begin(), cb.end(), less_than);

    int ans = 0;
    int ttl = m;

    rep (i, n) {
        // num: Number of drinks what I can buy
        //
        // ideal: m
        // real: cb[i].first
        long long num = min(ttl, cb[i].first);
        long long prc = num * ca[i].first;

        ans += prc;
        ttl -= num;
    }

    cout << ans << endl;
    return 0;
}

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

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

int main(void){
  int N,M,C;
  cin>>N;
  cin>>M;
  vector< vector<int> > A;
  int ans = 0;
  int buy = 0;
  A.resize(N);		// ()内の数字が要素数になる
  for( int i=0; i<N; i++ ){
    A[i].resize(2);
  }
  for(int i = 0; i<N; i++){
    for(int j = 0; j<2; j++){
      cin>>A[i][j];
    }
  }
  
  //shori
  sort(A.begin(),A.end());
  
  for(int i = 0; i<N; i++){
    for(; A[i][1]>0 && buy < M;){
      ans += A[i][0];
      A[i][1]--;
      buy++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc:3:14: error: multiple types in one declaration
    3 | typedef long int int;
      |              ^~~
a.cc:3:18: error: declaration does not declare anything [-fpermissive]
    3 | typedef long int int;
      |                  ^~~
Language: Java

import java.util.HashMap;
import java.util.Map;
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<Integer, Integer> mMap = new HashMap<Integer, Integer>();

		for (int i = 0; i < N; i++) {
			mMap.put(sc.nextInt(), sc.nextInt());
		}

		int ans = 0;
		for(Map.Entry<Integer, Integer> entry : mMap.entrySet()) {
			int buy = Math.min(M, entry.getValue());

			ans += buy * entry.getKey();

			M -= buy;
		}

		System.out.println(ans);

		sc.close();
	}

Compiler output:
Main.java:31: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <iostream>

using namespace std;

void swap(int* t, int i, int j);

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

	//安い順に並び変える //これ選択ソートっていうらしい
	for (i = 0; i < N-1; i++) {
		for (j = i+1; j < N; j++) {
			if (A[j] < A[i]) {
				swap(A, i, j); //配列名 == 配列の先頭要素のアドレス
				swap(B, i, j);
			}
		}
	}
	int k;
	long long price = 0;
	//安い店で買えるだけ買う
	for (i = 0; i < N; i++) {
		for (k = 1; k <= B[i]; k++) {
			if (M > 0) {
				M--;
				price += A[i];
			}
			else {
				break;
			}
		}
	}
	cout << price;
}

Compiler output:
/usr/bin/ld: /tmp/ccGpStRo.o: in function `main':
a.cc:(.text+0x16c): undefined reference to `swap(int*, int, int)'
/usr/bin/ld: a.cc:(.text+0x180): undefined reference to `swap(int*, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
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++) ab[i] = make_pair(a[i], b[i]);

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

    long long ans = 0;

    for (int i = 0; i < n; i++) {
        int buy = min(m, ab[i].second);
        ans += (long long)ab[i].first * buy;
        m -= buy;
    }
    cout << ans << endl;
}


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

import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		long A[][]=new long[N][2];
		int z=0,y=0;
		long man=0,cou=0;
		while(z<N){
			A[z][0]=stdIn.nextInt();
			A[z][1]=stdIn.nextInt();
			z++;
		}z=0;
		Arrays.sort(A, (a[2]) -> Long.compare(a[0][0], a[1][0]));
		while(z<N){
			if(cou<M)
				if(M>=A[z][1]+cou){
					cou+=A[z][1];
					man+=A[z][0]*A[z][1];
				}
				else{
					man+=A[z][0]*(M-cou);
					break;
				}
			else
				break;
			z++;
		}
		System.out.println(man);
	}

}


Compiler output:
Main.java:16: error: ')' or ',' expected
		Arrays.sort(A, (a[2]) -> Long.compare(a[0][0], a[1][0]));
		                     ^
Main.java:16: error: ';' expected
		Arrays.sort(A, (a[2]) -> Long.compare(a[0][0], a[1][0]));
		                                                       ^
2 errors
Language: C++

import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		long A[][]=new long[N][2];
		int z=0,y=0;
		long man=0,cou=0;
		while(z<N){
			A[z][0]=stdIn.nextInt();
			A[z][1]=stdIn.nextInt();
			z++;
		}z=0;
		Arrays.sort(A, (a, b) -> Long.compare(a[0], b[0]));
		while(z<N){
			if(cou<M)
				if(M>=A[z][1]+cou){
					cou+=A[z][1];
					man+=A[z][0]*A[z][1];
				}
				else{
					man+=A[z][0]*(M-cou);
					break;
				}
			else
				break;
			z++;
		}
		System.out.println(man);
	}

}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int M=stdIn.nextInt();
		long A[][]=new long[N][2];
		int z=0,y=0;
		long man=0,cou=0;
		while(z<N){
			A[z][0]=stdIn.nextInt();
			A[z][1]=stdIn.nextInt();
			z++;
		}z=0;
		Arrays.sort(A, (a[2]) -> Long.compare(a[0][0], a[1][0]));
		while(z<N){
			if(cou<M)
				if(M>=A[z][1]+cou){
					cou+=A[z][1];
					man+=A[z][0]*A[z][1];
				}
				else{
					man+=A[z][0]*(M-cou);
					break;
				}
			else
				break;
			z++;
		}
		System.out.println(man);
	}

}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
void sort2(vector<pair<ll, ll> >& pairs,ll n){
     // b順にソート
    sort(pairs.begin(),pairs.end(), compare_by_b);
for(ll i=0; i<n; i++){
    
}}


ll main()
{
//回答が整数の場合
ll ans=0;
//整数値の入力
ll n,m;
cin >> n>>m;

vector<pair<ll, ll> > pairs(n);

// 入力
for(ll i=0; i<n; i++){
    ll a, b;
    cin >> a >> b;
    pairs[i] = make_pair(b, a);
}
sort2(pairs,n);
ll buy=0;
for(ll i=0; i<n; i++){
   // cout << pairs[i].first << " "<<pairs[i].second <<" "<< buy << " "<<ans<< endl;
    if(buy+pairs[i].first>=m){ans=ans+(pairs[i].second*(m-buy));break;}
    else{ans=ans+(pairs[i].first*pairs[i].second);buy=buy+pairs[i].first;}
}

//回答
cout << ans << endl;
return 0;
}





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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){
    ios::sync_with_stdio(false);
    int N, M;
    map<int, ll> m;
    cin >> N >> M;
    for(int i=0;i<N;i++){
        int A, B;
        cin >> A >> B;
        m[A] = B;
    }
    ll ans=0;
    for(auto shop : m){
        int c = min(M, shop.second);
        ans += c*shop.first;
        M -= c;
        if(M == 0) break;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: no matching function for call to 'min(int&, long long int&)'
   21 |         int c = min(M, shop.second);
      |                 ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:21:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   21 |         int c = min(M, shop.second);
      |                 ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:21:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |         int c = min(M, shop.second);
      |                 ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){
    ios::sync_with_stdio(false);
    int N, M;
    map<int ll> m;
    cin >> N >> M;
    for(int i=0;i<N;i++){
        int A, B;
        cin >> A >> B;
        m[A] = B;
    }
    ll ans=0;
    for(auto shop : m){
        int c = min(M, shop.second);
        ans += c*shop.first;
        M -= c;
        if(M == 0) break;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: two or more data types in declaration of 'type name'
   12 |     map<int ll> m;
      |         ^~~
a.cc:12:15: error: wrong number of template arguments (1, should be at least 2)
   12 |     map<int ll> m;
      |               ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:17:10: error: invalid types 'int[int]' for array subscript
   17 |         m[A] = B;
      |          ^
a.cc:20:21: error: 'begin' was not declared in this scope
   20 |     for(auto shop : m){
      |                     ^
a.cc:20:21: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:20:21: error: 'end' was not declared in this scope
   20 |     for(auto shop : m){
      |                     ^
a.cc:20:21: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: Java

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

public class Main {

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long[] a = new long[n];
		long[] b = new long[n];
		int count = 0;
		int sum = 0;

		Map<Long, Long> map = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if (map.containsKey((a[i]))) {
				map.put((a[i]), map.get((a[i])) + b[i]);
			} else {
				map.put((a[i]), b[i]);
			}
		}

		for (Map.Entry<Long, Long> me : map.entrySet()) {
			if (me.getValue() < m - count) {
				sum += me.getKey() * me.getValue();
				count += me.getValue();
			} else {
				sum += me.getKey() * (m - count);
				System.out.println(sum);
				break;
		}






	}

}


Compiler output:
Main.java:46: error: reached end of file while parsing
}
 ^
1 error
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=1000000001;
    int b;
    int c=m-sum;
    
  	for (int i=0;i<n;i++){
      if (A[i]>1000000000+min)
        A[i] -=1000000000;
      if(a>A[i]){
        a=A[i];
        A[i]+=1000000000
      	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:25: error: expected ';' before 'b'
   30 |         A[i]+=1000000000
      |                         ^
      |                         ;
   31 |         b=B[i];
      |         ~
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int N, M;
void solve() {
    cin >> N >> M;
    long long ans = 0;
    vector<pair<int, int>> Ener;
    for (int i = 0; i < N; i++) {
        int A, B;
        cin >> A >> B;
        Ener.push_back(make_pair(A, B));
    }
    sort(Ener.begin(), Ener.end());
    long long rest = M;
    int idx = 0;
    while (rest - Ener[idx].second > 0) {
        rest = rest - Ener[idx].second;
        ans = ans + (Ener[idx].first * Ener[idx].second);
        idx++;
    } 
    if (rest == 0) {
        cout << and <<endl;
        return;
    }
    ans = ans + (Ener[idx].first * rest);
    cout << ans << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:47:21: error: expected identifier before '<<' token
   47 |         cout << and <<endl;
      |                     ^~
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];
      |         ~