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

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  vector<ll> plus;
  ll sum = 0;
  int num = 0;
  rep(i, n) {
    ll dif = a[i] - b[i];
    //マイナスの和と個数を求める
    if (dif < 0) {
      sum -= dif;
      num++;
    } else
      plus.push_back(dif);
  }

  //マイナスがなかったら0
  if (num == 0)
    cout << 0 << endl;
  else {
    int res = num;
    SORT(plus);
    RSORT(plus);
    //降順にする
    ll p = 0;
    res(i, plus.size()) {
      p += plus[i];
      ++res;
      if (p >= sum) break;
    }

    if (p >= sum)
      cout << res << endl;
    else
      cout << -1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'i' was not declared in this scope
   38 |     res(i, plus.size()) {
      |         ^
a.cc:38:8: error: 'res' cannot be used as a function
   38 |     res(i, plus.size()) {
      |     ~~~^~~~~~~~~~~~~~~~
Language: C++

/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/
ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

ll lcm(ll number1,ll number2){
	return number1 * number2 / gcd(number1,number2);	
}

int main() {
	
	int n;
	scanf("%d", &n);
	vector<int> a(n), b(n), plus;
	rep(i, n)scanf("%d", &a[i]);
	rep(i, n)scanf("%d", &b[i]);
	ll minus = 0, ans = 0;
	rep(i, n){
	  if(a[i] >= b[i]){
	    plus.pb(a[i] - b[i]);
		}else{
		minus += a[i] - b[i];
		++ans;
		}
	}
	if(ans == n){
	  printf("-1\n");
	  retrun 0;
	}
	sort(all(plus), greater<int>());
	for(auto aa : plus){
	  if(minus >= 0)break;
	  ++ans;
	  minus += aa;
	}
	if(minis < 0)ans = -1;
	printf("%lld\n", ans);
	
	Please AC;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:111:11: error: 'retrun' was not declared in this scope
  111 |           retrun 0;
      |           ^~~~~~
a.cc:119:12: error: 'minis' was not declared in this scope; did you mean 'minus'?
  119 |         if(minis < 0)ans = -1;
      |            ^~~~~
      |            minus
Language: C++

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define PB push_back
#define SZ(x) ((int)(x).size())
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
int main() {
    Int n;
    cin >> n;
    auto a = IntsIn(n);
    auto shortage = 0LL;
    auto shortageCount = 0LL;
    auto surpluses = vector<Int>();
    rep(i, n) {
        Int x;
        cin >> x;
        if (a[i] > x) {
            surpluses.PB(a[i] - x);
        } else if (x > a[i]) {
            shortageCount++;
            shortage += x - a[i];
        }
    }
    sort(ALL(surpluses), greater<Int>());
    if (shortage == 0) {
        puts("0");
        return 0;
    }
    Int current = 0;
    while (shortage > 0 && current < SZ(surpluses)) {
        if (surpluses[current] >= shortage) {
            PUTS(shortageCount + current + 1);
            return 0;
        } else {
            shortage -= surpluses[current];
            current++;
        }
    }
    puts("-1");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'IntsIn' was not declared in this scope
   12 |     auto a = IntsIn(n);
      |              ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	VLL A(n), B(n);
	INPUT(A); INPUT(B);
	VLL mar(n);
	REP(i, n) mar[i] = A[i] - B[i];
	SORT(mar);
	VLL prev = mar;
	int r = n-1;
	REP(l, n-1)
	{
		if (mar[l] >= 0) break;
		while(mar[l] < 0)
		{
			if (r <= l) break;
			if (-mar[l] <= mar[r])
			{
				mar[r] += mar[l];
				mar[l] = 0;
			}
			else
			{
				mar[l] += mar[r];
				mar[r] = 0;
			}
			if (mar[r] == 0) r--;
		}
	}
	int ans = 0;
	REP(i, n)
	{
		if (mar[i] < 0)
		{
			cout << -1 << endl;
			return 0;
		}
		if (prev[i] != mar[i]) ans++;
	}
	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   10 | #define SORT(a) sort(ALL(a))
      |                 ^~~~
a.cc:55:9: note: in expansion of macro 'SORT'
   55 |         SORT(mar);
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(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;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

void Solve();

/*
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}
*/

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 

signed main(){
  ll n;
    cin>>n;
  ll s=0;
  ll t=0;
  vll C(n);
  ll c=0;
  ll ans=0;

  FOR(i,0,n){
    ll a
    cin>>a;
    s+=a;
    C[i]+=a;
  }

  FOR(i,0,n){
    ll b;
    cin>>b;
    t+=b;
    C[i]-=b;
    if(C[i]<0){
      ans++;
      c+=C[i];
    }
  }

  if(s<t){
    cout<<-1<<endl;
    return 0;
  }

  SORT(C);
  ll I=n-1;
  while(c<0){
      c+=C[I];
      ans++;
      I--;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:154:5: error: expected initializer before 'cin'
  154 |     cin>>a;
      |     ^~~
a.cc:155:8: error: 'a' was not declared in this scope
  155 |     s+=a;
      |        ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

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

  int n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  vector<long> b(n);
  fillLong(b, n);

  vector<long> amari;
  long tarinai = 0;
  int chCnt = 0;

  rep(i, n) {
    if(a[i] > b[i]) {
      amari.push_back(a[i] - b[i]);
    }
    if(b[i] > a[i]) {
      chcnt++;
      tarinai += b[i]-a[i];
    }
  }

  sortvinv(amari);

  rep(i, amari.size()) {
    if(tarinai <= 0) break;
    chCnt++;
    tarinai -= amari[i];
  }

  if(tarinai <= 0) {
    cout << chCnt << endl;
  } else {
    cout << -1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:7: error: 'chcnt' was not declared in this scope; did you mean 'chCnt'?
   73 |       chcnt++;
      |       ^~~~~
      |       chCnt
Language: C++

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

const int N = 1e5 + 10;
pair<int, int> a[N];

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

int main() {
  	int n;
  	cin >> n;
  	for (int i = 0; i < n; i++) 
    	cin >> a[i].first;
  	for (int i = 0; i < n; i++)
      	cin >> a[i].second;
 	long long cnt1 = 0, cnt2 = 0;
  	for (int i = 0; i < n; i++) {
      	cnt1 += a[i].first;
      	cnt2 += a[i].second;
	}
	if (cnt1 < cnt2) 
      	cout << -1 << endl;
  	else {
    	sort(a, a + n, cmp);
		int st = 0, en = n - 1, ans = 0;
      	bool flag = true, flag2 = true;
      	while (st < en) {
        	if (a[en].first < a[en].second) {
        		if (flag2) {
                  	ans++;
                  	flag2 = false;
                }
              	if (flag) {
                  	ans++;
                	flag = false;
                }
              	if (a[en].second - a[en].first < a[st].first - a[st].second) {
                	a[st] -= a[en].second - a[en].first;
                 	a[en].first = a[en].second;
                }
              	else {
                	a[en].first += a[st].first - a[st].second;
                  	a[st].first = a[st].second;
                }
              	if (a[st].first == a[st].second) {
                	st++;
                	flag = true;
                }
              	if (a[en].first == a[en].second) {
                  	en--;
                	flag2 = true;
                }
         	}
          	else
              	break;
        }
		cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:31: error: no match for 'operator-=' (operand types are 'std::pair<int, int>' and 'int')
   40 |                         a[st] -= a[en].second - a[en].first;
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

const int N = 1e5 + 10;
pair<int, int> a[N];

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

int main() {
  	int n;
  	cin >> n;
  	for (int i = 0; i < n; i++) 
    	cin >> a[i].first;
  	for (int i = 0; i < n; i++)
      	cin >> a[i].second;
 	long long cnt1 = 0, cnt2 = 0;
  	for (int i = 0; i < n; i++) {
      	cnt1 += a[i].first;
      	cnt2 += a[i].second;
	}
	if (cnt1 < cnt2) 
      	cout << -1 << endl;
  	else {
    	sort(a, a + n, cmp);
		int st = 0, en = n - 1, ans = 0;
      	bool flag = true, flag2 = true;
      	while (st < en) {
        	if (a[en].first < a[en].second) {
        		if (flag2) {
                  	ans++;
                  	flag2 = false;
                }
              	if (flag) {
                  	ans++;
                	flag = false;
                }
              	if (a[en].second - a[en].first < a[st].first - a[st].second) {
                	a[first] -= a[en].second - a[en].first;
                 	a[en].first = a[en].second;
                }
              	else {
                	a[en].first += a[st].first - a[st].second;
                  	a[st].first = a[st].second;
                }
              	if (a[st].first == a[st].second) {
                	st++;
                	flag = true;
                }
              	if (a[en].first == a[en].second) {
                  	en--;
                	flag2 = true;
                }
         	}
          	else
              	break;
        }
		cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:27: error: 'first' was not declared in this scope
   40 |                         a[first] -= a[en].second - a[en].first;
      |                           ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    ll n;cin>>n;
    vector<ll> a(n),b(n);
    ll sa=0,sb=0;
    rep(i,n){
        cin>>a[i];
        sa+=a[i];
    }
    rep(i,n){
        cin>>b[i];
        sb+=b[i];
    }
    if(sa<sb){
        cout<<-1<<endl;
        return 0;
    }
    ll shortage=0;
    ll ans=0;
    vector<ll> v;
    sort(ALL(v),greater<ll>);
    rep(i,n){
        if(a[i]<b[i]){
            shortage+=b[i]-a[i];
            ans++;
        }
        if(a[i]>b[i]){
            v.push_back(a[i]-b[i]);
        }
    }
    for(auto x:v)if(shortage>0){
        shortage-=x;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:28: error: expected primary-expression before ')' token
   38 |     sort(ALL(v),greater<ll>);
      |                            ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

void solve()
{
    int a;
    cin>>a;
    vector<int> b(a),c(a);
    rep(i,a)cin>>b[i];
    rep(i,a)cin>>c[i];
    int s=accumulate(begin(b),end(b),int(0))-accumulate(begin(c),end(c),int(0));
    if(s<0){puts(-1);return;}
    vector<int> waf;
    rep(i,a)
    {
        if(b[i]>=c[i])was.emplace_back(a[i]-b[i]);
    }
    sort(begin(waf),end(waf));
    int ans=0;
    for(auto w:waf)
    {
        if(s>=w)
        {
            ans++;
            s-=w;
        }
    }
    print(a-ans);
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:19:18: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   19 |     if(s<0){puts(-1);return;}
      |                  ^~
      |                  |
      |                  int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
a.cc:23:23: error: 'was' was not declared in this scope; did you mean 'waf'?
   23 |         if(b[i]>=c[i])was.emplace_back(a[i]-b[i]);
      |                       ^~~
      |                       waf
a.cc:23:41: error: invalid types 'int[int]' for array subscript
   23 |         if(b[i]>=c[i])was.emplace_back(a[i]-b[i]);
      |                                         ^
a.cc:35:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   35 |     print(a-ans);
      |     ^~~~~
      |     printf
a.cc: At global scope:
a.cc:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main()
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define long long LL
int main () {
  int N;
  cin >> N;
  vector<LL>A(N);
  vector<LL>B(N);
  vector<LL>dis(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  for (int i = 0; i < N; i ++) cin >> B[i];
  for (int i = 0; i < N; i ++) dis[i] = A[i] - B[i];
  sort(dis.begin(), dis.end());
  LL k = 0;
  int i = 0;
  while(dis[i] < 0) {
    k += dis[i];
    i ++;
  }
  int ans = i;
  for (int j = N - 1; j >= i; j --) {
    if (k >= 0) {
      cout << ans << endl;
      return 0;
    }
    k += dis[j];
    ans ++;
  }
  if (k >= 0) cout << ans << endl;
  else cout << -1 << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'LL' was not declared in this scope
    7 |   vector<LL>A(N);
      |          ^~
a.cc:7:12: error: template argument 1 is invalid
    7 |   vector<LL>A(N);
      |            ^
a.cc:7:12: error: template argument 2 is invalid
a.cc:8:12: error: template argument 2 is invalid
    8 |   vector<LL>B(N);
      |            ^
a.cc:9:12: error: template argument 2 is invalid
    9 |   vector<LL>dis(N);
      |            ^
a.cc:10:40: error: invalid types 'int[int]' for array subscript
   10 |   for (int i = 0; i < N; i ++) cin >> A[i];
      |                                        ^
a.cc:11:40: error: invalid types 'int[int]' for array subscript
   11 |   for (int i = 0; i < N; i ++) cin >> B[i];
      |                                        ^
a.cc:12:35: error: invalid types 'int[int]' for array subscript
   12 |   for (int i = 0; i < N; i ++) dis[i] = A[i] - B[i];
      |                                   ^
a.cc:12:42: error: invalid types 'int[int]' for array subscript
   12 |   for (int i = 0; i < N; i ++) dis[i] = A[i] - B[i];
      |                                          ^
a.cc:12:49: error: invalid types 'int[int]' for array subscript
   12 |   for (int i = 0; i < N; i ++) dis[i] = A[i] - B[i];
      |                                                 ^
a.cc:13:12: error: request for member 'begin' in 'dis', which is of non-class type 'int'
   13 |   sort(dis.begin(), dis.end());
      |            ^~~~~
a.cc:13:25: error: request for member 'end' in 'dis', which is of non-class type 'int'
   13 |   sort(dis.begin(), dis.end());
      |                         ^~~
a.cc:14:5: error: expected ';' before 'k'
   14 |   LL k = 0;
      |     ^~
      |     ;
a.cc:16:12: error: invalid types 'int[int]' for array subscript
   16 |   while(dis[i] < 0) {
      |            ^
a.cc:17:5: error: 'k' was not declared in this scope
   17 |     k += dis[i];
      |     ^
a.cc:17:13: error: invalid types 'int[int]' for array subscript
   17 |     k += dis[i];
      |             ^
a.cc:22:9: error: 'k' was not declared in this scope
   22 |     if (k >= 0) {
      |         ^
a.cc:26:5: error: 'k' was not declared in this scope
   26 |     k += dis[j];
      |     ^
a.cc:26:13: error: invalid types 'int[int]' for array subscript
   26 |     k += dis[j];
      |             ^
a.cc:29:7: error: 'k' was not declared in this scope
   29 |   if (k >= 0) cout << ans << endl;
      |       ^
Language: Java

import java.util.*;

public class Main {
    long MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        long[] c = new long[n];
        for (int i = 0; i < n; i++) {
            c[i] = a[i] - b[i];
        }
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += c[i];
        }
        if (sum < 0) {
            System.out.println("-1");
            return;
        }
        Arrays.sort(c);
        int r = n - 1;
        boolean ru = false;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (c[i] >= 0)
                break;
            ans++;
            while (r >= 0) {
                if (!ru) {
                    ru = true;
                    ans++;
                }
                if (c[i] + c[r] >= 0) {
                    int tmp = c[i] + c[r];
                    c[i] = 0;
                    c[r] = tmp;
                    break;
                } else {
                    c[i] = c[i] + c[r];
                    ru = false;
                    r--;
                }
            }
        }
        System.out.println(ans);

    }
}

Compiler output:
Main.java:44: error: incompatible types: possible lossy conversion from long to int
                    int tmp = c[i] + c[r];
                                   ^
1 error
Language: C++

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

signed main(){
	int n;cin>>n;
	vector<int> a(n),b(n),d(n);
	for(auto&& w:a)cin>>w;
	for(auto&& w:b)cin>>w;
	for(int i=0;i<n;i++)d[i]=a[i]-b[i];
	int ans;
	int sum=0,nsum=0;
for(auto&& w:d){
	sum+=w;
	if (w<0)nsum-=w;
	}	
if (sum<0)ans=-1;
if (nsum==0)ans=0;
	sort(begin(d),end(d),greater<int>());
int tmp=0;	
for(int i=0;i<n;i++){tmp+=d[i];if(tmp>=nsum)ans=i+1;break}
cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:58: error: expected ';' before '}' token
   21 | for(int i=0;i<n;i++){tmp+=d[i];if(tmp>=nsum)ans=i+1;break}
      |                                                          ^
      |                                                          ;
Language: C++

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

const int MAXN = 1e5 + 10
long long sum, t;
int n, a[MAXN], b[MAXN];
vector<int> r;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		cin >> b[i];
	for (int i = 0; i < n; i++)
		if (a[i] - b[i] < 0)
			sum += b[i] - a[i];
		else
			r.push_back(a[i] - b[i]);
	sort(r.being(), r.end());
	reverse(r.begin(), r.end());
	for (int i = 0; i < r.size(); i++) {
		t += r[i];
		if (t >= sum)
			return cout << i + 1, 0;
	}
	cout << -1;
}

Compiler output:
a.cc:7:1: error: expected ',' or ';' before 'long'
    7 | long long sum, t;
      | ^~~~
a.cc: In function 'int main()':
a.cc:19:25: error: 'sum' was not declared in this scope
   19 |                         sum += b[i] - a[i];
      |                         ^~~
a.cc:22:16: error: 'class std::vector<int>' has no member named 'being'
   22 |         sort(r.being(), r.end());
      |                ^~~~~
a.cc:25:17: error: 't' was not declared in this scope
   25 |                 t += r[i];
      |                 ^
a.cc:26:26: error: 'sum' was not declared in this scope
   26 |                 if (t >= sum)
      |                          ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1e5 + 10;

long long ar[MAXn], ar2[MAXn], n, ans, sum1, sum2;
long long hp;
vector<long long> vec;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ar[i];
		sum1 += ar[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> ar2[i];
		sum2 += ar2[i];
	}
	if (sum2 > sum1)
		return cout << -1,0;
	
	for (int i = 0; i < n; i++) {
		if (ar[i] >= ar2[i]) {
			vec.push_back(ar[i]-ar2[i]);
		}
		else  {
			ans++;
			hp += ar2[i] - ar[i];
		}
	}
	if (hp2 == hp)
		return cout << 0,0;
	sort(vec.begin(), vec.end());
	long long hp2 = 0;
	for (int i = (int)vec.size() -1; i >= 0; i--) {
		hp2 += vec[i];
		ans++;
		if (hp2 >= hp)
			return cout << ans,0;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'hp2' was not declared in this scope; did you mean 'hp'?
   30 |         if (hp2 == hp)
      |             ^~~
      |             hp
Language: Java

/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        long[] a=new long[n];
        long[] b=new long[n];
        long sum_a=0,sum_b=0;
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                if (i==0){
                    a[j]=sc.nextLong();
                    sum_a+=a[j];
                }
                else {
                    b[j]=sc.nextLong();
                    sum_b+=b[j];
                }
            }
        }
        if(sum_a<sum_b){
            out.println(-1);
        }else {
          a
            exit(0);
        }
    }
}


Compiler output:
Main.java:35: error: ';' expected
            exit(0);
                ^
1 error
Language: Java

// 作者：杨成瑞先生
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        long[] a = new long[n], b = new long[n];

        for(int i=0;i<n;i++) {
            a[i] = sc.nextLong();
        }
        for(int i=0;i<n;i++) {
            b[i] = sc.nextLong();
        }
        
        long[] diff = new long[n];
        ArrayList<Long> plus = new ArrayList<>();
        long sum = 0;
        int num = 0;

        for(int i=0;i<n;i++) {
            long diff = a[i] - b[i];
            if(diff < 0) {
                sum -= diff;
                num++;
            }
            else {
                plus.add(diff);
            }
        }

        if(num == 0) {
            pw.println(0);
            pw.close();
            return;
        }

        int ans = num;
        Collections.sort(plus, Collections.reverseOrder());

        long p = 0;
        for(int i=0;i<n;i++) {
            p += plus.get(i);
            ans++;
            if(p >= sum) {
                break;
            }
        }

        if(p >= sum) {
            pw.println(ans);
        }
        else {
            pw.println(-1);
        }

        pw.close();
	}

}


Compiler output:
Main.java:60: error: variable diff is already defined in method main(String[])
            long diff = a[i] - b[i];
                 ^
1 error
Language: Java

import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
 
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			long a[] = new long[n];
			long b[] = new long[n];
			
			long suma = 0;
			long sumb = 0;
			
			for (int i=0; i<n; i++) {
				a[i] = sc.nextInt();
				suma += a[i];
			}
			for (int i=0; i<n; i++) {
				b[i] = sc.nextInt();
				sumb += b[i];
			}
			
			if (suma < sumb) {
				System.out.println(-1);
				return;
			}
			
			int count = 0;
			long husoku = 0;
			int kajo_count = 0;
			List<Integer> kajo_list = new ArrayList<Integer>();

			for (int i=0; i<n; i++) {
				if (a[i] < b[i]) {
					count++;
					husoku += b[i] - a[i];
				} else if (a[i] > b[i]) {
					kajo_count++;
					kajo_list.add(a[i] - b[i]);
					
				}
			}
			
			if (count == 0) {
				System.out.println(count);
				return;
			}
			
			Collections.sort(kajo_list, Collections.reverseOrder());
			long kajo_sum = 0;
			for(int i=0;i<kajo_list.size();i++){
				kajo_sum += kajo_list.get(i);
				count++;
				if (husoku <= kajo_sum) {
					break;
				}
				
			}
			
			System.out.println(count);

		}
	}
}

Compiler output:
Main.java:41: error: incompatible types: long cannot be converted to Integer
					kajo_list.add(a[i] - b[i]);
					                   ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.util.*;
public class C{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		long[] Ai = new long[length];
		long[] Bi = new long[length];
		for(int counter = 0; counter < length; counter++) {
			Ai[counter] = sc.nextLong();
		}
		for(int counter = 0; counter < length; counter++) {
			Bi[counter] = sc.nextLong();
		}
		
		long aSum = 0;
		long bSum = 0;
		long indices = 0;
		
		for(int counter = 0; counter < length; counter++) {
			aSum += Ai[counter];
			bSum += Bi[counter];
			if(Bi[counter] > Ai[counter]) {
				indices++;
			}
		}
		
		if(aSum >= bSum) {
			System.out.println(indices);
		} else {
			System.out.println(-1);
		}
	}
}

Compiler output:
Main.java:2: error: class C is public, should be declared in a file named C.java
public class C{
       ^
1 error
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cnt = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(-1);
          	break;
        }else{
          	ArrayList<Integer> bigger = new ArrayList<Integer>();
        	for(int j=0;j<N;j++){
            	if(A[j]-B[j] <0){
                	difsum += A[j]-B[j];
                    cnt++;
                }else if(A[j]-B[j] > 0){
                 	bigger.add(A[j]-B[j]);
                }
            }
          	int big[] = bigger.stream().mapToInt(i->i).toArray();
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum < 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  

Compiler output:
Main.java:24: error: break outside switch or loop
          	break;
          	^
1 error
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cnt = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList<Integer> bigger = new ArrayList<Integer>();
        	for(int j=0;j<N;j++){
            	if(A[j]-B[j] <0){
                	difsum += A[j]-B[j];
                    cnt++;
                }else if(A[j]-B[j] > 0){
                 	bigger.add(A[j]-B[j]);
                }
            }
          	int big[] = bigger.toArray(new Integer[bigger.size()]);
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:34: error: incompatible types: inference variable T has incompatible bounds
          	int big[] = bigger.toArray(new Integer[bigger.size()]);
          	                          ^
    upper bounds: int,Object
    lower bounds: Integer
  where T is a type-variable:
    T extends Object declared in method <T>toArray(T[])
1 error
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cnt = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList<Integer> bigger = new ArrayList<Integer>();
        	for(int j=0;j<N;j++){
            	if(A[j]-B[j] <0){
                	difsum += A[j]-B[j];
                    cnt++;
                }else if(A[j]-B[j] > 0){
                 	bigger.add(A[j]-B[j]);
                }
            }
          	int big[] = (int [])bigger.toArray(new Integer[bigger.size()]);
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:34: error: incompatible types: Integer[] cannot be converted to int[]
          	int big[] = (int [])bigger.toArray(new Integer[bigger.size()]);
          	                                  ^
1 error
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cnt = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList<Integer> bigger = new ArrayList<Integer>();
        	for(int j=0;j<N;j++){
            	if(A[j]-B[j] <0){
                	difsum += A[j]-B[j];
                    cnt++;
                }else if(A[j]-B[j] > 0){
                 	bigger.add(A[j]-B[j]);
                }
            }
          	int big[] = bigger.toArray(new int[bigger.size()]);
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:34: error: no suitable method found for toArray(int[])
          	int big[] = bigger.toArray(new int[bigger.size()]);
          	                  ^
    method Collection.<T#1>toArray(IntFunction<T#1[]>) is not applicable
      (cannot infer type-variable(s) T#1
        (argument mismatch; int[] cannot be converted to IntFunction<T#1[]>))
    method ArrayList.<T#2>toArray(T#2[]) is not applicable
      (inference variable T#2 has incompatible bounds
        equality constraints: int
        upper bounds: Object)
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>toArray(IntFunction<T#1[]>)
    T#2 extends Object declared in method <T#2>toArray(T#2[])
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cntdif = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList<int> bigger = new ArrayList<int>();
        	for(int j=0;j<N;j++){
            	if(A[j]-B[j] <0){
                	difsum += A[j]-B[j];
                    cnt++;
                }else if(A[j]-B[j] > 0){
                 	bigger.add(A[j]-B[j]);
                }
            }
          	int big[] = bigger.toArray(new int[bigger.size()]);
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:25: error: unexpected type
          	ArrayList<int> bigger = new ArrayList<int>();
          	          ^
  required: reference
  found:    int
Main.java:25: error: unexpected type
          	ArrayList<int> bigger = new ArrayList<int>();
          	                                      ^
  required: reference
  found:    int
Main.java:29: error: cannot find symbol
                    cnt++;
                    ^
  symbol:   variable cnt
  location: class Main
Main.java:49: error: cannot find symbol
                cnt++;
                ^
  symbol:   variable cnt
  location: class Main
Main.java:52: error: cannot find symbol
     System.out.println(cnt);    	
                        ^
  symbol:   variable cnt
  location: class Main
5 errors
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cntdif = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList<int> bigger = new ArrayList<int>();
        	for(int j=0;j<N;j++){
            	if(int dif = A[j]-B[j] <0){
                	difsum += dif;
                    cnt++;
                }else if(dif > 0){
                 	bigger.add(dif);
                }
            }
          	int big[] = bigger.toArray(new int[bigger.size()]);
          	int temp;
        	for(int k = 0; k < big.length; k++){
            	for(int l = 0; l< big.length -k-1; l++){
                	if(big[l] > big[l + 1]){
                    	temp = big[l];
                    	big[l] = big[l + 1];
                    	big[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += big[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:27: error: '.class' expected
            	if(int dif = A[j]-B[j] <0){
            	       ^
Main.java:27: error: ';' expected
            	if(int dif = A[j]-B[j] <0){
            	                         ^
Main.java:30: error: 'else' without 'if'
                }else if(dif > 0){
                 ^
3 errors
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[] A = new int[N];
      	int[] B = new int[N];
        int Asum = 0;
        int Bsum = 0;
        int difsum = 0;
        int cntdif = 0;
        for(int i=0;i<N;i++){
        	A[i] = sc.nextInt();
            Asum += A[i];
        }
      	for(int i=0;i<N;i++){
        	B[i] = sc.nextInt();
          	Bsum += B[i];
        }
      
      	if(Asum < Bsum){
        	System.out.println(0);
        }else{
          	ArrayList bigger<int> = new ArrayList<int>();
        	for(int j=0;j<N;j++){
            	if(int dif = A[j]-B[j] <0){
                	difsum += dif;
                    cnt++;
                }else if(dif > 0){
                 	bigger.add(dif);
                }
            }
          	int big[] = bigger.toArray(new int[bigger.size()]);
          	int temp;
        	for(int k = 0; k < bigger.length; k++){
            	for(int l = 0; l< bigger.length -k-1; l++){
                	if(bigger[l] > bigger[l + 1]){
                    	temp = bigger[l];
                    	bigger[l] = bigger[l + 1];
                    	bigger[l + 1] = temp;
                	}
            	}
        	}
            int m =0;
          	while(difsum <= 0){
            	difsum += bigger[m];
              	m++;
                cnt++;
            }
        }
     System.out.println(cnt);    	
     } 
}  


Compiler output:
Main.java:25: error: ';' expected
          	ArrayList bigger<int> = new ArrayList<int>();
          	                ^
Main.java:25: error: illegal start of expression
          	ArrayList bigger<int> = new ArrayList<int>();
          	                      ^
Main.java:27: error: '.class' expected
            	if(int dif = A[j]-B[j] <0){
            	       ^
Main.java:27: error: ';' expected
            	if(int dif = A[j]-B[j] <0){
            	                         ^
Main.java:30: error: 'else' without 'if'
                }else if(dif > 0){
                 ^
5 errors
Language: C++

#include<iostream>
#include<vector>
using namespace std;
bool cmp(int a,int b){
  return a>b;
}
int mini_change(vector<int> v){
  long long sum=0;
  int ans=0;
  long long neg=0;
  vector<int> p;
  for(auto o: v){
    sum+=o;
    if(o>0)
      p.push_back(o);
    if(o<0){
      ans++;
      neg-=o;
    }
  }
  if(sum<0) return -1;
  sort(p.begin(),p.end(),cmp);
  i=0;
  while(neg>0){
    neg+=p[i];
    i++;
    ans++;
  }
  return ans;
}
int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)
    cin>>v[i];
  int temp;
  for(int i=0;i<n;i++){
    cin>>temp;
    v[i]-=temp;
  }
  cout<<mini_change(v)<<endl;
  return 0;
}
    

Compiler output:
a.cc: In function 'int mini_change(std::vector<int>)':
a.cc:22:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |   sort(p.begin(),p.end(),cmp);
      |   ^~~~
      |   short
a.cc:23:3: error: 'i' was not declared in this scope
   23 |   i=0;
      |   ^