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

#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

static const int MAX = 1e5;
static const int MAX_C = 1e9;
int n, m, B[MAX], c;
long A[MAX], max_a, C[MAX_C], ans;

int main() {
    scanf("%d %d", &n, &m);
    max_a = 0;

    for ( int i = 0; i < n; i++ ) {
        scanf("%ld %d", &A[i], &B[i]);
        max_a = max(max_a, A[i]);
    }

    for ( int i = 0; i <= max_a; i++ ) {
        C[i] = 0;
    }

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

    c = 0;
    ans = 0;

    while ( m > 0 ) {
        m -= C[c];

        ans += c * C[c];
        c++;
    }

    ans += (c - 1) * m;
    printf("%ld\n", ans);
    return 0;
}


Compiler output:
/tmp/ccXhMPC9.o: in function `main':
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
a.cc:(.text+0x20a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
a.cc:(.text+0x257): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
a.cc:(.text+0x25e): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccXhMPC9.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*/



/*ここからmain関数*/

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 int mon = 0, num = 0;
	for (int i = 0; i < N ; i++)
	{
		if (num >= M) break;

		int buy = 0;
		buy = min(AB[i].second, M - num);

		mon += buy * AB[i].first;
		num += buy;
	}

	cout << mon;

	return 0;
}

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

#include <iostream>
#include<algorithm>
using namespace std;
#define int long long 
signed main (){
int n,m;
cin >> n>> m;
int a[114514] ,b[114514] ;
for(int i =0;i<n;i++){
cin >>a[i]>>b[i];
}
int memory,count=0;
int k=n;
while(1){
int mi=1e10;
for(int i =0;i<k;i++){
if(min>=a[i]){
memory=i;
}


} 

count+=b[memory]*a[memory];
m-=b[memory] ;
if(m<=0){
count-=a[memory] *abs(m);
break;
}
k--;
}
cout << count<< endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator>='
   17 | if(min>=a[i]){
      |    ~~~^~~~~~
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
#define int long long 
signed main (){
int n,m;
cin >> n>> m;
int a[114514] ,b[114514] ;
for(int i =0;i<n;i++){
cin >>a[i]>>b[i];
}
int memory,count=0;
int k=n;
while(1){
int mi=1e10;
for(int i =0;i<k;i++){
if(min>=a[i]){
memory=i;
}


} 

count+=b[memory]*a[memory];
m-=b[memory] ;
if(m<=0){
count-=a[memory] *abs(m);
break;
}
k—;
}
cout << count<< endl;
return 0;
}



Compiler output:
a.cc:30:1: error: extended character — is not valid in an identifier
   30 | k—;
      | ^
a.cc: In function 'int main()':
a.cc:17:7: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator>='
   17 | if(min>=a[i]){
      |    ~~~^~~~~~
a.cc:30:1: error: 'k\U00002014' was not declared in this scope
   30 | k—;
      | ^~
Language: C

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

struct stor{
  int a;
  int b;
};

int asc(const void *p, const void *q){
  return *(stor*)p.a - *(stor*)q.b;
}

int main(void){
  int n, m;
  scanf("%d %d", &n, &m);
  
  struct stor num[n];
  int i;
  
  for(i = 0; i < n; i++){
    scanf("%d %d", &num[i].a, &num[i].b);
  }
  
  qsort(num, n, stor, asc);
  
  long int sum = 0, kazu = 0;
  kazu = m;
  for(i = 0; i < n; i++){
    kazu -= num[i].b;
    if(kazu >= 0){
      sum += num[i].a * num[i].b;
    }
    else{
      sum += num[i].a * (num[i].b + kazu);
    }
  }
  printf("%ld\n", sum);
  return 0;
}

    

Compiler output:
main.c: In function 'asc':
main.c:10:12: error: 'stor' undeclared (first use in this function)
   10 |   return *(stor*)p.a - *(stor*)q.b;
      |            ^~~~
main.c:10:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:17: error: expected expression before ')' token
   10 |   return *(stor*)p.a - *(stor*)q.b;
      |                 ^
main.c: In function 'main':
main.c:24:17: error: 'stor' undeclared (first use in this function)
   24 |   qsort(num, n, stor, asc);
      |                 ^~~~
Language: C

#include<stdio.h>
int main(void){
  int n, m;
  scanf("%d %d", &n, &m);
  
  int a[n][2];
  int work[1][2];
  int i, j, k;
  for(i = 0; i < n; i++){
    scanf("%d %d", &a[i][0], &a[i][1]);
    if(i != 0 && a[i - 1][0] > a[i][0]){
      if(a[i / 2][0] > a[i][0]){
        for(j = 0; j < i / 2; j++){
          if(a[j][0] > a[i][0]){
          	work[0] = a[i];
          	for(k = i - 1; k >= j; k--){
            	a[k + 1] = a[k];
          	}
          	a[j] = work[0];
            break;
          }
        }
      }
      else{
        for(j = (i / 2) + 1; j < i; j++){
          if(a[j][0] > a[i][0]){
            work[0] = a[i];
            for(k = i - 1; k >= j; k--){
              a[k + 1] = a[k];
            }
            a[j] = work[0];
            break;
          }
        }
      }
    }
  }
  
  int num = 0;
  long int sum = 0;
  for(i = 0; i < n; i++){
    num = m - a[i][1];
    if(num >= 0){
      sum += a[i][0] * a[i][1];
    }
    else{
      sum += a[i][0] * num;
      printf("%ld\n", sum);
      break;
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:25: error: assignment to expression with array type
   15 |                 work[0] = a[i];
      |                         ^
main.c:17:26: error: assignment to expression with array type
   17 |                 a[k + 1] = a[k];
      |                          ^
main.c:19:22: error: assignment to expression with array type
   19 |                 a[j] = work[0];
      |                      ^
main.c:27:21: error: assignment to expression with array type
   27 |             work[0] = a[i];
      |                     ^
main.c:29:24: error: assignment to expression with array type
   29 |               a[k + 1] = a[k];
      |                        ^
main.c:31:18: error: assignment to expression with array type
   31 |             a[j] = work[0];
      |                  ^
Language: C

#include<stdio.h>
int main(void){
  int n, m;
  scanf("%d %d", &n, &m);
  
  int a[n][2];
  int work[1][1];
  int i, j, k;
  for(i = 0; i < n; i++){
    scanf("%d %d", &a[i][0], &a[i][1]);
    if(i != 0 && a[i - 1][0] > a[i][0]){
      if(a[i / 2][0] > a[i][0]){
        for(j = 0; j < i / 2; j++){
          if(a[j][0] > a[i][0]){
          	work[0] = a[i];
          	for(k = i - 1; k >= j; k--){
            	a[k + 1] = a[k];
          	}
          	a[j] = work[0];
            break;
          }
        }
      }
      else{
        for(j = (i / 2) + 1; j < i; j++){
          if(a[j][0] > a[i][0]){
            work[0] = a[i];
            for(k = i - 1; k >= j; k--){
              a[k + 1] = a[k];
            }
            a[j] = work[0];
            break;
          }
        }
      }
    }
  }
  
  int num = 0;
  long int sum = 0;
  for(i = 0; i < n; i++){
    num = m - a[i][1];
    if(num >= 0){
      sum += a[i][0] * a[i][1];
    }
    else{
      sum += a[i][0] * num;
      printf("%ld\n", sum);
      break;
    }
  }
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:15:25: error: assignment to expression with array type
   15 |                 work[0] = a[i];
      |                         ^
main.c:17:26: error: assignment to expression with array type
   17 |                 a[k + 1] = a[k];
      |                          ^
main.c:19:22: error: assignment to expression with array type
   19 |                 a[j] = work[0];
      |                      ^
main.c:27:21: error: assignment to expression with array type
   27 |             work[0] = a[i];
      |                     ^
main.c:29:24: error: assignment to expression with array type
   29 |               a[k + 1] = a[k];
      |                        ^
main.c:31:18: error: assignment to expression with array type
   31 |             a[j] = work[0];
      |                  ^
Language: C++

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

int main(){
    long long n,m;
    long long sum=0;
    cin>> n >> m;
    vector<long long> a(n),b(n);
    vector<pair<long long,long long>> c(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i) >> b.at(i);
        c.at(i)=make_pair(a.at(i),b.at(i));
    }
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        long long k,l;
        k=min(c.at(i).second,m);
        l=c.at(i).first*k;
        sum+=l;
        m-=k;
        if(m<=0){
            break;
        }
    }
    coout << sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'coout' was not declared in this scope
   29 |     coout << sum << endl;
      |     ^~~~~
Language: C++

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

int main(){
    int n,m;
    long long sum=0;
    cin>> n >> m;
    vector<long long> a(n),b(n);
    vector<pair<long long,long long>> c(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i) >> b.at(i);
        c.at(i)=make_pair(a.at(i),b.at(i));
    }
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        long long k,l;
        k=min(c.at(i).second,m);
        l=c.at(i).first*k;
        sum+=l;
        m-=k;
        if(m<=0){
            break;
        }
    }
    coout << sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: no matching function for call to 'min(long long int&, int&)'
   21 |         k=min(c.at(i).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:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   21 |         k=min(c.at(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:
/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:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         k=min(c.at(i).second,m);
      |           ~~~^~~~~~~~~~~~~~~~~~
a.cc:29:5: error: 'coout' was not declared in this scope
   29 |     coout << sum << endl;
      |     ^~~~~
Language: C++

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

int main(){
    int n,m;
    long long sum=0;
    cin>> n >> m;
    vector<long long> a(n),b(n);
    vector<pair<long long>> c(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i) >> b.at(i);
        c.at(i)=make_pair(a.at(i),b.at(i));
    }
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        long long k,l;
        k=min(c.at(i).second,m);
        l=c.at(i).first*k;
        sum+=l;
        m-=k;
        if(m<=0){
            break;
        }
    }
    coout << sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: wrong number of template arguments (1, should be 2)
   13 |     vector<pair<long long>> c(n);
      |                      ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:13:26: error: template argument 1 is invalid
   13 |     vector<pair<long long>> c(n);
      |                          ^~
a.cc:13:26: error: template argument 2 is invalid
a.cc:16:11: error: request for member 'at' in 'c', which is of non-class type 'int'
   16 |         c.at(i)=make_pair(a.at(i),b.at(i));
      |           ^~
a.cc:18:12: error: request for member 'begin' in 'c', which is of non-class type 'int'
   18 |     sort(c.begin(),c.end());
      |            ^~~~~
a.cc:18:22: error: request for member 'end' in 'c', which is of non-class type 'int'
   18 |     sort(c.begin(),c.end());
      |                      ^~~
a.cc:21:17: error: request for member 'at' in 'c', which is of non-class type 'int'
   21 |         k=min(c.at(i).second,m);
      |                 ^~
a.cc:22:13: error: request for member 'at' in 'c', which is of non-class type 'int'
   22 |         l=c.at(i).first*k;
      |             ^~
a.cc:29:5: error: 'coout' was not declared in this scope
   29 |     coout << sum << endl;
      |     ^~~~~
Language: C++

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

int main(){
    int n,m,;
    long long sum=0;
    cin>> n >> m;
    vector<int> a(n),b(n);
    vector<pair<long long>> c(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i) >> b.at(i);
        c.at(i)=make_pair(a.at(i),b.at(i));
    }
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        long long k,l;
        k=min(c.at(i).second,m);
        l=c.at(i).first*k;
        sum+=l;
        m-=k;
        if(m<=0){
            break;
        }
    }
    coout << sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: expected unqualified-id before ';' token
    9 |     int n,m,;
      |             ^
a.cc:13:22: error: wrong number of template arguments (1, should be 2)
   13 |     vector<pair<long long>> c(n);
      |                      ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:13:26: error: template argument 1 is invalid
   13 |     vector<pair<long long>> c(n);
      |                          ^~
a.cc:13:26: error: template argument 2 is invalid
a.cc:16:11: error: request for member 'at' in 'c', which is of non-class type 'int'
   16 |         c.at(i)=make_pair(a.at(i),b.at(i));
      |           ^~
a.cc:18:12: error: request for member 'begin' in 'c', which is of non-class type 'int'
   18 |     sort(c.begin(),c.end());
      |            ^~~~~
a.cc:18:22: error: request for member 'end' in 'c', which is of non-class type 'int'
   18 |     sort(c.begin(),c.end());
      |                      ^~~
a.cc:21:17: error: request for member 'at' in 'c', which is of non-class type 'int'
   21 |         k=min(c.at(i).second,m);
      |                 ^~
a.cc:22:13: error: request for member 'at' in 'c', which is of non-class type 'int'
   22 |         l=c.at(i).first*k;
      |             ^~
a.cc:29:5: error: 'coout' was not declared in this scope
   29 |     coout << sum << endl;
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int N,M;
	cin>>N>>M;
	vector<int> A(N);
	vector<int> B(N);
	FDS(i,N){
		cin>>A[i]>>B[i];
	}
	
	vector<pair<int,int>> AB(N);
	FDS(i,N){
		AB[i]= make_pair(A[i],B[i]);
	}
	VSORT(AB);//pair型は前からsortされる
	ll ans=0;
	FDS(i,N){
		int buy =min(M,AB[i].second);//買う数
		
		ans+=buy*AB[i].first;
		M-=AB.second;
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   39 |                 M-=AB.second;
      |                       ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int N,M;
	cin>>N>>M;
	vector<int> A(N);
	vector<int> B(N);
	FDS(i,N){
		cin>>A[i]>>B[i];
	}
	
	vector<pair<int,int>> AB(N);
	FDS(i,N){
		AB[i]= make_pair(A[i].B[i]);
	}
	VSORT(AB);//pair型は前からsortされる
	ll ans=0;
	FDS(i,N){
		int buy =min(M,AB[i].second);//買う数
		
		ans+=buy*AB[i].first;
		M-=AB.second;
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:39: error: request for member 'B' in 'A.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   31 |                 AB[i]= make_pair(A[i].B[i]);
      |                                       ^
a.cc:39:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   39 |                 M-=AB.second;
      |                       ^~~~~~
Language: C++

#include <iostream>
#include <vector>
struct E {
    long long a, b;
};
int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<E> v(n);
    for (int i = 0; i < n; i++) std::cin >> v[i].a >> v[i].b;
    std::sort(v.begin(), v.end(), [](E &x, E &y){ return x.a < y.a; });
    long long count = 0, yen = 0;
    for (auto &e: v) {
        if (count + e.b >= m) {
            yen += (m - count) * e.a;
            break;
        }
        count += e.b;
        yen += e.a * e.b;
    }
    std::cout << yen;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   11 |     std::sort(v.begin(), v.end(), [](E &x, E &y){ return x.a < y.a; });
      |          ^~~~
      |          qsort
Language: C++

#include <bits/stdc++.h>
#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.at(i) >> B.at(i);}
 
 vector<pair<int,int>> AB(N);
 for(int j = 0; j < N; j++)
 {AB.at(i) = make_pair(A.at(i),B,at(i));}
 
 sort(AB.begin(),AB.end());
 //ペアABを、Aが小さい順にソートした。
 int sum = 0;
 int buy;
 
 for(int i = 0; i < N; i++)
 { buy = min(M,AB(i).second);
   sum += buy*AB(i).first;
  M -=buy;}
 
 cout << sum <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'i' was not declared in this scope
   15 |  {AB.at(i) = make_pair(A.at(i),B,at(i));}
      |         ^
a.cc:15:34: error: 'at' was not declared in this scope
   15 |  {AB.at(i) = make_pair(A.at(i),B,at(i));}
      |                                  ^~
a.cc:23:18: error: no match for call to '(std::vector<std::pair<int, int> >) (int&)'
   23 |  { buy = min(M,AB(i).second);
      |                ~~^~~
a.cc:24:17: error: no match for call to '(std::vector<std::pair<int, int> >) (int&)'
   24 |    sum += buy*AB(i).first;
      |               ~~^~~
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] array = new int[n][2];
    int sum = 0;
    for(int i=0;i<n;++i){
      for(int j=0;j<2;++j){
        array[i][j]=sc.nextInt();
      }
    }
    int a,b=0;
    for(int i=0;i<n-1;++i){
      for(int j=i+1;j<n;++j){
        if(array[j][0]<array[i][0]){
          a=array[j][0];
          array[j][0]=array[i][0];
          array[i][0]=b;
          b=array[j][1];
          array[j][1]=array[i][1];
          array[i][1]=b;
        }
      }
    }
    for(int i=0;i<n;++i){
      if(array[i][1]<m){
        sum+=array[i][0]*array[i][1];
        m-=array[i][1];
      }else{
        sum+=array[i][0]*m;
        return 0;
      }
    }
    System.out.print(sum);
  }
}

Compiler output:
Main.java:34: error: incompatible types: unexpected return value
        return 0;
               ^
1 error
Language: C++

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

using namespace std;

int main(){
    long long n,m;
    long long ans;
    cin >> n >> m;
    
    vector<pair<long long, long long>> p_vec;
    for(int i = 0; i < n; i++){
        pair<long long, long long> p;
        cin >> p.first >> p.second;
        p_vec.push_back(p);
    }
    sort(p_vec.begin(), p_vec.end());

    for(int i = 0; i < n; i++){
        long long honsu;
        if(m < p_vec[i].second)honsu = m;
        else honsu = p_vec[i].second;
        ans += p_vec[i].first * honsu;
        m -= honsu;
    }
    cout << ans << endl;
    return 0;
}

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

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<pair<long long int, int>> AB(N);
  
  for(int i = 0; i < N; i++){
    long long int A;
    int B;
    cin >> A >> B;
    AB[i] = make_pair(A,B);
  }
  sort(AB.begin(), AB.end());
  long long int budget = 0LL;
  int ind = 0;
  while(M > 0){
    if(M > AB[ind].second){
      budget += AB[ind].first * AB[ind].second;
    }
    M -= AB[ind].second;
    ind++;
  }
  budget += M * AB.first;
  cout << budget;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: 'class std::vector<std::pair<long long int, int> >' has no member named 'first'
   30 |   budget += M * AB.first;
      |                    ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<pair<long long int, int>> AB(N);
  
  for(int i = 0; i < N; i++){
    long long int A;
    int B;
    cin >> A >> B;
    AB[i] = make_pair(A,B);
  }
  sort(AB.begin(), AB.end());
  long long int budget = 0LL;
  int ind = 0;
  while(M > 0){
    if(M > AB[i].second){
      budget += AB[i].first * AB[i].second;
    }
    M -= AB[i].second;
    ind++;
  }
  budget += M * AB.first;
  cout << budget;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: 'i' was not declared in this scope
   24 |     if(M > AB[i].second){
      |               ^
a.cc:27:13: error: 'i' was not declared in this scope
   27 |     M -= AB[i].second;
      |             ^
a.cc:30:20: error: 'class std::vector<std::pair<long long int, int> >' has no member named 'first'
   30 |   budget += M * AB.first;
      |                    ^~~~~
Language: C++

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

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

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

#include<stdio.h>

typedef struct {
    long int price;             //値段    
    int zaiko;          //数量
} shop;

// --------------- 比較用の関数 cmp -------------------
int cmp( const void *p, const void *q ) {
    return ((shop*)p)->price - ((shop*)q)->price;
}

int main(){
  int N,M;
  long int k=0;
  
  scanf("%d %d",&N,&M);
  shop list[N];
  for(i=0;i<N;i++)
    scanf("%ld %d",&list.price[i],&list.zaiko[i]);
  
  qsort( list, N, sizeof(list), cmp );
  
  for(i=0;i<N;i++){
    if(list.zaiko[i] >= M){
      k+=M*list.price[i];
      break;
    }
    else{
      k+=list.price[i]*list.zaiko[i];
      M-= list.zaiko[i];
    }
    
  }
  printf("%ld\n",k);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:7: error: 'i' undeclared (first use in this function)
   19 |   for(i=0;i<N;i++)
      |       ^
main.c:19:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:25: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   20 |     scanf("%ld %d",&list.price[i],&list.zaiko[i]);
      |                         ^
      |                         ->
main.c:20:40: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   20 |     scanf("%ld %d",&list.price[i],&list.zaiko[i]);
      |                                        ^
      |                                        ->
main.c:22:3: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
   22 |   qsort( list, N, sizeof(list), cmp );
      |   ^~~~~
main.c:25:12: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   25 |     if(list.zaiko[i] >= M){
      |            ^
      |            ->
main.c:26:16: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   26 |       k+=M*list.price[i];
      |                ^
      |                ->
main.c:30:14: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   30 |       k+=list.price[i]*list.zaiko[i];
      |              ^
      |              ->
main.c:30:28: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   30 |       k+=list.price[i]*list.zaiko[i];
      |                            ^
      |                            ->
main.c:31:15: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   31 |       M-= list.zaiko[i];
      |               ^
      |               ->
Language: C

#include<stdio.h>

typedef struct {
    long int price;             //値段    
    int zaiko;          //数量
} shop;

// --------------- 比較用の関数 cmp -------------------
int cmp( const void *p, const void *q ) {
    return ((choco_t*)p)->price - ((choco_t*)q)->price;
}

int main(){
  int N,M;
  long int k=0;
  
  scanf("%d %d",&N,&M);
  shop list[N];
  for(i=0;i<N;i++)
    scanf("%ld %d",&list.price[i],&list.zaiko[i]);
  
  qsort( list, N, sizeof(list), cmp );
  
  for(i=0;i<N;i++){
    if(list.zaiko[i] >= M){
      k+=M*list.price[i];
      break;
    }
    else{
      k+=list.price[i]*list.zaiko[i];
      M-= list.zaiko[i];
    }
    
  }
  printf("%ld\n",k);
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:10:14: error: 'choco_t' undeclared (first use in this function)
   10 |     return ((choco_t*)p)->price - ((choco_t*)q)->price;
      |              ^~~~~~~
main.c:10:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:22: error: expected expression before ')' token
   10 |     return ((choco_t*)p)->price - ((choco_t*)q)->price;
      |                      ^
main.c:10:45: error: expected expression before ')' token
   10 |     return ((choco_t*)p)->price - ((choco_t*)q)->price;
      |                                             ^
main.c: In function 'main':
main.c:19:7: error: 'i' undeclared (first use in this function)
   19 |   for(i=0;i<N;i++)
      |       ^
main.c:20:25: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   20 |     scanf("%ld %d",&list.price[i],&list.zaiko[i]);
      |                         ^
      |                         ->
main.c:20:40: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   20 |     scanf("%ld %d",&list.price[i],&list.zaiko[i]);
      |                                        ^
      |                                        ->
main.c:22:3: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
   22 |   qsort( list, N, sizeof(list), cmp );
      |   ^~~~~
main.c:25:12: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   25 |     if(list.zaiko[i] >= M){
      |            ^
      |            ->
main.c:26:16: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   26 |       k+=M*list.price[i];
      |                ^
      |                ->
main.c:30:14: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   30 |       k+=list.price[i]*list.zaiko[i];
      |              ^
      |              ->
main.c:30:28: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   30 |       k+=list.price[i]*list.zaiko[i];
      |                            ^
      |                            ->
main.c:31:15: error: '(shop *)&list' is a pointer; did you mean to use '->'?
   31 |       M-= list.zaiko[i];
      |               ^
      |               ->
Language: C++

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


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

  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.second);
    ans += AB[i].first * buy;
    M -= AB.second;
  }
  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   21 |     int buy = min(M,AB.second);
      |                        ^~~~~~
a.cc:23:13: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   23 |     M -= AB.second;
      |             ^~~~~~
Language: Java

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();
    }
    Main abc122C = new Main();
    System.out.println(abc122C.solve(N, M, A, B));
  }
 
  public long solve(int N, int M, int[] A, int[] B) {
    long ans = 0;
    Store[] Stores = new Store[N];
    for (int i = 0; i < N; i++) {
      Stores[i] = new Store(A[i], B[i]);
    }
    Arrays.sort(Stores);
    for (int i = 0; i < N; i++) {
      int num = M > Stores[i].num ? Stores[i].num : M;
      ans += (long) num * Stores[i].price;
      M -= num;
      if(M == 0) break;
    }
    return ans;
  }
 
  class Store implements Comparable<Store> {
    int price;
    int num;
    public Store(int price, int num){
      this.price = price;
      this.num = num;
    }
    @Override
    public int compareTo(Store other) {
      return this.price - other.price;
    }
  }
}

Compiler output:
Main.java:3: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
Main.java:22: error: cannot find symbol
    Arrays.sort(Stores);
    ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: Java

import java.util.*;

public class Main {
  
  public class Drink implements Comparable<Drink> {
    public int A;
    public int B;
    public Drink(int a, int b) {
      this.A = a;
      this.B = b;
    }
    
    @Override
    public int compareTo(Drink other) {
      return this.A - other.A;
    }
  }
  
  public long solve(Scanner sc, int N, int M) {
    
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list);
    
    long totalYen = 0L;
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      int n = M > d.B ? d.B : M;
      totalYen += (long)(n*d.A);
      M -= n;
      if (M == 0)
        break;
    }
    return totalYen;
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    Main C = new Main();
    System.out.println(C.solve(list, N, M));
    return;
  }
}


Compiler output:
Main.java:46: error: cannot find symbol
    System.out.println(C.solve(list, N, M));
                               ^
  symbol:   variable list
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {
  
  public class Drink implements Comparable<Drink> {
    public int A;
    public int B;
    public Drink(int a, int b) {
      this.A = a;
      this.B = b;
    }
    
    @Override
    public int compareTo(Drink other) {
      return this.A - other.A;
    }
  }
  
  public long solve(List<Drink> list, int M) {
    long totalYen = 0L;
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      int n = M > d.B ? d.B : M;
      totalYen += (long)(n*d.A);
      M -= n;
      if (M == 0)
        break;
    }
    return totalYen;
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list);
    
    Main C = new Main();
    System.out.println(C.solve(list, M));
    return;
  }
}


Compiler output:
Main.java:40: error: non-static variable this cannot be referenced from a static context
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
               ^
1 error
Language: Java

import java.util.*;

public class Main {
  
  public static class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      A = a;
      B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>() {
      @Override
      public int compare(Drink d1, Drink d2) {
        return d1.A-d2.A;
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B; j++) {
          if (M-- >= 0) {
          	totalYen += d.A;
          }
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    System.out.println(totalYen);
    return;
  }
}


Compiler output:
Main.java:20: error: not a statement
    long long totalYen = 0L;
    ^
Main.java:20: error: ';' expected
    long long totalYen = 0L;
        ^
2 errors
Language: Java

import java.util.*;

public class Main {
  
  public static class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      A = a;
      B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>() {
      @Override
      public int compareTo(Drink d1, Drink d2) {
        return d1.A.compareTo(d2.A);
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B && M>=0; j++, M--) {
          totalYen += d.A;
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    return;
  }
}


Compiler output:
Main.java:25: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Drink,Drink) in Comparator
    Collections.sort(list, new Comparator<Drink>() {
                                                   ^
Main.java:26: error: method does not override or implement a method from a supertype
      @Override
      ^
Main.java:28: error: int cannot be dereferenced
        return d1.A.compareTo(d2.A);
                   ^
3 errors
Language: Java

import java.util.*;

public class Main {
  
  public static class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      A = a;
      B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>() {
      @Override
      public int compareTo(Drink d1, Drink d2) {
        return d1.A - d2.A;
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B && M>=0; j++, M--) {
          totalYen += d.A;
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    return;
  }
}


Compiler output:
Main.java:25: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Drink,Drink) in Comparator
    Collections.sort(list, new Comparator<Drink>() {
                                                   ^
Main.java:26: error: method does not override or implement a method from a supertype
      @Override
      ^
2 errors
Language: Java

import java.util.*;

public class Main {
  
  public class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      A = a;
      B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>() {
      @Override
      public int compareTo(Drink d1, Drink d2) {
        return d1.A - d2.A;
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B && M>=0; j++, M--) {
          totalYen += d.A;
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    return;
  }
}


Compiler output:
Main.java:23: error: non-static variable this cannot be referenced from a static context
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
               ^
Main.java:25: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Main.Drink,Main.Drink) in Comparator
    Collections.sort(list, new Comparator<Drink>() {
                                                   ^
Main.java:26: error: method does not override or implement a method from a supertype
      @Override
      ^
3 errors
Language: Java

import java.util.*;

public class Main {
  
  public class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      this.A = a;
      this.B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>() {
      @Override
      public int compareTo(Drink d1, Drink d2) {
        return d1.A - d2.A;
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B && M>=0; j++, M--) {
          totalYen += d.A;
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    return;
  }
}


Compiler output:
Main.java:23: error: non-static variable this cannot be referenced from a static context
      list.add(new Drink(sc.nextInt(), sc.nextInt()));
               ^
Main.java:25: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Main.Drink,Main.Drink) in Comparator
    Collections.sort(list, new Comparator<Drink>() {
                                                   ^
Main.java:26: error: method does not override or implement a method from a supertype
      @Override
      ^
3 errors
Language: Java

import java.util.*;

public class Main {
  
  public class Drink {
    public int A;
    public int B;
    public Drink(int a, int b) {
      this.A = a;
      this.B = b;
    }
  }
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, M;
    N = sc.nextInt();
    M = sc.nextInt();
    
    long totalYen = 0L;
    List<Drink> list = new ArrayList<>();
    for (int i=0; i<N; i++) {
      list.add(new Drink(sc.nextInt(), nextInt()));
    }
    Collections.sort(list, new Comparator<Drink>(){
      @Override
      public int compareTo(Drink d1, Drink d2) {
        return d1.A - d2.A;
      }
    });
    
    for (int i=0; i<list.size(); i++) {
      Drink d = list.get(i);
      long yen = d.A*d.B;
      if (M - d.B > 0) {
        totalYen += yen;
        M -= d.B;
      } else if (M - d.B <= 0) {
        for (int j=1; j<=d.B && M>=0; j++, M--) {
          totalYen += d.A;
        }
      }
      if (M == 0) {
        System.out.println(totalYen);
        return;
      } 
    }
    return;
  }
}


Compiler output:
Main.java:23: error: non-static variable this cannot be referenced from a static context
      list.add(new Drink(sc.nextInt(), nextInt()));
               ^
Main.java:23: error: cannot find symbol
      list.add(new Drink(sc.nextInt(), nextInt()));
                                       ^
  symbol:   method nextInt()
  location: class Main
Main.java:25: error: <anonymous Main$1> is not abstract and does not override abstract method compare(Main.Drink,Main.Drink) in Comparator
    Collections.sort(list, new Comparator<Drink>(){
                                                  ^
Main.java:26: error: method does not override or implement a method from a supertype
      @Override
      ^
4 errors