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

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;b
};
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  sort(A.begin(), A.end(), greater<ll>());
  vector<ll> wa(N);
  wa[N - 1] = A[N - 1];
  for (int i = N - 2; i >= 0; i--) {
    wa[i] = wa[i + 1] + A[i];
  }
  int ans = 0;
  REP(i, N - 1) {
    ans = i + 1;
    if (A[i] > 2 * wa[i + 1]) break;
    if (i == N - 2) ans++;
  }

  cout << ans << endl;
}

Compiler output:
a.cc:12:11: error: 'b' does not name a type
   12 |   ll cost;b
      |           ^
Language: C++

#include <bits/stdc++.h>
#解説みた。
using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = 0;

  sort(a.begin(), a.end());
  ll t = 0;
  ll s = 0;
  rep(i, N - 1) {
    s += a[i];
    if(s * 2 < a[i + 1]) {
      t = i + 1;
      //cerr << "*" << i << " " << s << " " << t << endl;
      break;
    }
    //    cerr << i << " " << s << " " << t << endl;
  }
  ans = N - t;
  
  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Compiler output:
a.cc:2:2: error: extended character 。 is not valid in an identifier
    2 | #解説みた。
      |  ^
a.cc:2:2: error: invalid preprocessing directive #\U000089e3\U00008aac\U0000307f\U0000305f\U00003002
    2 | #解説みた。
      |  ^~~~~~~~~~
Language: C++

#include <string>
#include <memory>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>

using namespace std;

int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;

  cin >> n;
  std::vector<int> v(n);
  std::vector<int64_t> mxs;
  for (auto& el : v) {
    cin >> el;
  }

  std::sort(v.begin(), v.end());
  int64_t cur_sum = 0;
  for (const auto& el : v) {
    mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL));
    cur_sum += el;
  }
  int ans = 0;
  int last = n - 1;
  for (int i = n - 1; i >= 0; i--) {
    if (mxs[i] != 0) {
      last = i;
      break;
    }
  }
  int64_t mx = 0;
  for (int i = 0; i < last; i++) {
    mx = max(mx, mxs[i]);
  }
  if (mx <= v[last]) {
    ans = 1;
  }
  mx = max(mx, mxs[last]);

  for (int i = last + 1; i < n; i++) {
    if (mx <= v[i]) {
      ans++;
    }
  }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: no matching function for call to 'max(int64_t, long long int)'
   26 |     mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:22: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   26 |     mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   26 |     mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> ma;
    rep(i, N) { cin >> A[i]; }

    sort(all(A));

    int cnt = 1;
    ll prev = 0;
    bool judge = 0;
    rep(i, N) {
        if (i != 0) {
            if (prev * 2 >= A[i])
                cnt++;
            else
                cnt = 1;
        }

        prev += A[i];
    }

    cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:5: error: 'ios' has not been declared
    9 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:13:5: error: 'vector' was not declared in this scope
   13 |     vector<ll> A(N);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:13:12: note: in expansion of macro 'll'
   13 |     vector<ll> A(N);
      |            ^~
a.cc:14:5: error: 'map' was not declared in this scope
   14 |     map<ll, ll> ma;
      |     ^~~
a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
  +++ |+#include <map>
    1 | using namespace std;
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long
      |            ^~~~
a.cc:14:9: note: in expansion of macro 'll'
   14 |     map<ll, ll> ma;
      |         ^~
a.cc:15:24: error: 'A' was not declared in this scope
   15 |     rep(i, N) { cin >> A[i]; }
      |                        ^
a.cc:17:14: error: 'A' was not declared in this scope
   17 |     sort(all(A));
      |              ^
a.cc:3:17: note: in definition of macro 'all'
    3 | #define all(x) (x).begin(), (x).end()
      |                 ^
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(all(A));
      |     ^~~~
      |     short
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout << cnt << endl;
      |     ^~~~
a.cc:33:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:20: error: 'endl' was not declared in this scope
   33 |     cout << cnt << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

int main() {
  int64_t N;
  cin>>N;
  vector<int64_t> S(N);
  for(int i=0;i<N;i++) cin>>S.at(i);
  sort(S.begin(),S.end());
  int64_t total=S.at(0);
  for(int i=1;i<N;i++){
    if(2*total<S.at(i)) S.at(i-1)=0;
    total+=S.at(i);
  }
  int64_t ans=0;
  for(int i=0;i<N;i++){
    ans++;
    if(S.at(0)==0) ans=0;
  }
  cout<<ans;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: expected '}' at end of input
   22 |   cout<<ans;
      |             ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>

using namespace std;

vector<long long> a;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  a.resize(N);
  vector<long long> indices(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    indices[i] = i;
  }

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

  long long ret = 0;
  long long sum = 0;
  for (int i = 0; i < N; ++i) {
    if (i == 0) {
      sum += a[i];
      ret = 1;
    } else {
      if (a[i] > 2 * sum) {
        sum += a[i];
        N -= ret;
      } else {
        sum += a[i];
        ++ret;
      }
    }
  }

  cout << N << endl;

  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
  int left=-1; int right=N;
  while(1<right-left){
   int mid=left+(right-left)/2;
    int64_t sum=0;
    for(int i=0;i<=mid;i++)
      sum+=A.at(i);
    bool x=true;
    for(int i=mid+1;i<N;i++){
    if(A.at(i)<=2*sum)
      sum+=A.at(i);
      else{x=false; break;}
    }if(x)right=mid;
    else
      left=mid;
  
  }int ans=N-mid;
  cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'mid' was not declared in this scope
   25 |   }int ans=N-mid;
      |              ^~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;cin>>n;
  vector<long long>A(n);
  vector<long long>B(n+2);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  B[0] = 0;
  for(int i = 0; n > i; i++){
    B[i+1] = B[i]+A[i];
  }
  B[n+1] = 0;
  for(int i = 1; n >= i; i++){
    if(B[i]*2 >= B[i+1]){
      cout << n-i+1 << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<long long>A(n);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'long'
    6 |   vector<long long>A(n);
      |          ^~~~
a.cc:7:10: error: expected primary-expression before 'long'
    7 |   vector<long long>B(n+2);
      |          ^~~~
a.cc:9:10: error: 'A' was not declared in this scope
    9 |     cin>>A[i];
      |          ^
a.cc:11:8: error: 'A' was not declared in this scope
   11 |   sort(A.begin(),A.end());
      |        ^
a.cc:12:3: error: 'B' was not declared in this scope
   12 |   B[0] = 0;
      |   ^
Language: C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    sort(a.begin(),a.end());
    vector<ll> sum(n+1);
    sum[0]=0;
    for(int i=0; i<n; i++) sum[i+1] = sum[i] + a[i];
    int cnt=n;
    for(int i=0; i<n; i++){
        if(2*sum[i]<a[i]){
            cnt=n-i;
        }
    }
    cout<<cnt<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int (i) = 0; i < (n); i++)
#define REP(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF LLONG_MAX - 10
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



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

    itn n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    
    sort(a, a + n);
    int sum[n + 10] = {};
    rep(i, n) {
        sum[i+1] = sum[i] + a[i];
    }
    
    int ans = 1;
    rep(i, n) {
        if(sum[i] * 2 >= a[i]) ans++;
        else ans = 0;
    }
    
    cout << ans << endl;
 	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'itn' was not declared in this scope; did you mean 'int'?
   32 |     itn n;
      |     ^~~
      |     int
a.cc:33:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   33 |     cin >> n;
      |            ^
      |            yn
a.cc:35:22: error: 'a' was not declared in this scope
   35 |     rep(i, n) cin >> a[i];
      |                      ^
a.cc:37:10: error: 'a' was not declared in this scope
   37 |     sort(a, a + n);
      |          ^
a.cc:40:9: error: 'sum' was not declared in this scope
   40 |         sum[i+1] = sum[i] + a[i];
      |         ^~~
a.cc:45:12: error: 'sum' was not declared in this scope
   45 |         if(sum[i] * 2 >= a[i]) ans++;
      |            ^~~
Language: C++

n = int(input())
a = [ int(x) for x in input().split() ]

a.sort()
t = 0
s = 0
for k, v in enumerate(a):
   s += v
   if k+1 < n and s*2 < a[k+1]:
       t = k+1

print(n-t)



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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N; cin>>N;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  sort(ALL(A));
  vi sum(N);
  sum[0]=A[0];
  rep(i,1,N){
    sum[i]=sum[i-1]+A[i];
  }
  rep(i,0,N){
    int K=sum[i];
    int memo=i;
    while(1){
      if(A[N-1]<=K*2){
        ans=N-i;
        goto XYZ;
      }
      int Z=disup(A,K*2);
      if(Z==memo+1)
        break;
      memo=Z-1;
      K=sum[Z-1];
    }
  }
  XYZ:
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |         ans=N-i;
      |         ^~~
      |         abs
a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

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

using namespace std;

int main() {
    int N; 
  cin >> N ;
    long long int a[100010],b[100010];
  
    for (int i = 0; i < N; ++i) 
        cin >> a[i];
  
  
        sort(a,a+N);
  
    b[0] = a[0];
  int ans = 0 res = N;
  
  for(int i=1;i<N;i++){
    
    if(2*b[i-1] < a[i]){
      res -= ans;
      ans = 0;
    }
    
    else{
      b[i] += a[i];
      ans++;
    }
    
   cout << res << endl;
    
  }
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: expected ',' or ';' before 'res'
   19 |   int ans = 0 res = N;
      |               ^~~
a.cc:24:7: error: 'res' was not declared in this scope
   24 |       res -= ans;
      |       ^~~
a.cc:33:12: error: 'res' was not declared in this scope
   33 |    cout << res << endl;
      |            ^~~
a.cc:35:4: error: expected '}' at end of input
   35 |   }
      |    ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

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

using namespace std;

int main() {
    int N; 
  cin >> N ;
   long long int a[100010],b(N+1,0);
  
    for (int i = 0; i < N; ++i) 
        cin >> a[i];
  
  
        sort(a,a+N);
  
    b[0] = a[0];
  
  int ans = 0 res = N;
  
  for(int i=1;i<N;i++){
    
    if(2*b[i-1] < a[i]){
      res -= ans;
      ans = 0;
    }
    
    else{
      b[i] += a[i];
      ans++;
    }
    
   cout << res << endl;
    
  }
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:10:35: error: expression list treated as compound expression in initializer [-fpermissive]
   10 |    long long int a[100010],b(N+1,0);
      |                                   ^
a.cc:18:6: error: invalid types 'long long int[int]' for array subscript
   18 |     b[0] = a[0];
      |      ^
a.cc:20:15: error: expected ',' or ';' before 'res'
   20 |   int ans = 0 res = N;
      |               ^~~
a.cc:24:11: error: invalid types 'long long int[int]' for array subscript
   24 |     if(2*b[i-1] < a[i]){
      |           ^
a.cc:25:7: error: 'res' was not declared in this scope
   25 |       res -= ans;
      |       ^~~
a.cc:30:8: error: invalid types 'long long int[int]' for array subscript
   30 |       b[i] += a[i];
      |        ^
a.cc:34:12: error: 'res' was not declared in this scope
   34 |    cout << res << endl;
      |            ^~~
a.cc:36:4: error: expected '}' at end of input
   36 |   }
      |    ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] array = new long[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            max = Math.max(max, array[i]);
        }
        
        Arrays.sort(array);
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (array[i] * 2 >= max) {
                count++;
            }
        }
        
        
        int index = 99999999;
        for (int i = 0; i < n - count; i++) {
            if (array[i] * 2 < array[i + 1]) {
                
            } else {
                index = i;
            }
            array[i + 1] += array[i];
        }
        
        System.out.println(Math.max(n - index, count));
    }
}

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from long to int
            max = Math.max(max, array[i]);
                          ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}
using Int = long long;
int main() {
    Int n;
    cin >> n;
    auto v = IntsIn(n);
    sort(ALL(v));
    Int ans = 0;
    Int s = 0;
    rep(i, n) {
        auto &a = v[i];
        if (i == 0) {
            s = a;
        } else {
            if (2 * s >= a) {
                ans++;
            } else {
                ans = 0;
            }
            s += a;
        }
    }
    PUTS(ans + 1);
}


Compiler output:
a.cc:6:8: error: 'Int' was not declared in this scope; did you mean 'int'?
    6 | vector<Int> IntsIn(int n) {
      |        ^~~
      |        int
a.cc:6:11: error: template argument 1 is invalid
    6 | vector<Int> IntsIn(int n) {
      |           ^
a.cc:6:11: error: template argument 2 is invalid
a.cc: In function 'int IntsIn(int)':
a.cc:7:21: error: 'Int' was not declared in this scope; did you mean 'int'?
    7 |     auto v = vector<Int>(0);
      |                     ^~~
      |                     int
a.cc:7:24: error: template argument 1 is invalid
    7 |     auto v = vector<Int>(0);
      |                        ^
a.cc:7:24: error: template argument 2 is invalid
a.cc:9:12: error: expected ';' before 'a'
    9 |         Int a;
      |            ^~
      |            ;
a.cc:10:16: error: 'a' was not declared in this scope
   10 |         cin >> a;
      |                ^
a.cc: In function 'int main()':
a.cc:4:20: error: request for member 'begin' in 'v', which is of non-class type 'int'
    4 | #define ALL(v) (v).begin(), (v).end()
      |                    ^~~~~
a.cc:20:10: note: in expansion of macro 'ALL'
   20 |     sort(ALL(v));
      |          ^~~
a.cc:4:33: error: request for member 'end' in 'v', which is of non-class type 'int'
    4 | #define ALL(v) (v).begin(), (v).end()
      |                                 ^~~
a.cc:20:10: note: in expansion of macro 'ALL'
   20 |     sort(ALL(v));
      |          ^~~
a.cc:24:20: error: invalid types 'int[int]' for array subscript
   24 |         auto &a = v[i];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
using Int = long long;
int main() {
    Int n;
    cin >> n;
    auto v = IntsIn(n);
    sort(ALL(v));
    Int ans = 0;
    Int s = 0;
    rep(i, n) {
        auto &a = v[i];
        if (i == 0) {
            s = a;
        } else {
            if (2 * s >= a) {
                ans++;
            } else {
                ans = 0;
            }
            s += a;
        }
    }
    PUTS(ans + 1);
}


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    int ans=0;
    ll s=a[0];
    for (int i=1;i<n;i++) {
        if (a[i]>2*s) ans=i;
        s+=a[i];
    }
    cout << n-ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll s=a[0];
      |     ^~
a.cc:13:20: error: 's' was not declared in this scope
   13 |         if (a[i]>2*s) ans=i;
      |                    ^
a.cc:14:9: error: 's' was not declared in this scope
   14 |         s+=a[i];
      |         ^
Language: C++

using ll=long long;
using namespace std;


int main() {
	ll N;
	ll g;
	vector<ll>A;
	vector<ll>B;
	cin >> N;
	for (ll i = 0; i < N; i++) {
		cin >> g;
		A.push_back(g);
		B.push_back(0);
	}
	sort(A.begin(),A.end());
	ll count=0;
	for (ll j = 0; j <=N; j++) {
		B[N-1] += A[j];
	}
	for (ll i=N-2; 0<=i; i--) {

			B[i] -= A[i+1];
		
		if (B[i]*2 >= A[i+1] ) {
			count++;
		}
		else {
			break; }
	}
	cout << count;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector<ll>A;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using ll=long long;
a.cc:8:18: error: expected primary-expression before '>' token
    8 |         vector<ll>A;
      |                  ^
a.cc:8:19: error: 'A' was not declared in this scope
    8 |         vector<ll>A;
      |                   ^
a.cc:9:18: error: expected primary-expression before '>' token
    9 |         vector<ll>B;
      |                  ^
a.cc:9:19: error: 'B' was not declared in this scope
    9 |         vector<ll>B;
      |                   ^
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin >> N;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using ll=long long;
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |         sort(A.begin(),A.end());
      |         ^~~~
      |         short
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << count;
      |         ^~~~
a.cc:31:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

    #include <bits/stdc++.h>
     
    #define sz(x) ((int)x.size())
    #define int long long
    
    using namespace std;
     
     
    const int MAXN = 100 * 1000 + 23;
     
     
     
     
     
     
     
     
    int n, a[MAXN], ps[MAXN], ans;
     
     
    int main() {
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a[i];
        sort(a, a + n);
        partial_sum(a, a + n, ps + 1);
        for (int i = n - 1; i; i--)
            if (ps[i] * 2 < a[i])
                ans = i;
        cout << n - ans;
        return 0;
    }

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

#include <iostream>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

int main()
{
    int n;
    cin >> n;
    ll a[100002];
    P p[100002];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        p[i] = P(a[i], i);
    }
    sort(p, p + n);
    int les = 0;
    for(int i = 0; i < n - 1; i++){
        if(p[i].first * 2 < p[i + 1].first) les = i + 1;
        p[i + 1].first += p[i].first;
    }
    cout << n - les << endl;
}

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

#include <iostream>
#include <vector>

int main()
{
    int N;
    scanf("%d", &N);
    std::vector<long long> A(N);
    for(int i=0; i<N; i++) scanf(" %lld", &A[i]);

    std::sort(A.begin(), A.end());
    std::vector<long long> sum(1, A[0]);
    for(int i=1; i<N; i++) sum.push_back(sum.back() + A[i]);
    
    for(int i=N-1; i>0; i--){
        if(sum[i-1] * 2 < A[i]){
            std::cout << N-i << std::endl; return 0;
        }
    }
    std::cout << N << std::endl;
}

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

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

using namespace std;
typedef long long ll;

int Judge(int tag, vector<ll> &d) {
	ll i, x = 0;
	for (i = 0; i <= tag; i++)
		x += d[i];
	for (; i < d.size(); i++) {
		if ((x << 1) < d[i])
			return false;
		x += d[i];
	}
	return true;
}

int Search(vector<ll> &d, int l, int r) {
	if (l == r)
		return l;
	int tag = (l + r) >> 1;
	if (Judge(tag, d))
		return Search(d, l, tag);
	else
		return Search(d, tag + 1, r);
}

int main(void) {
	int num, i;
	cin >> num;
	vector<ll> d(num);
	for (i = 0; i < num; i++)
		scanf_s("%lld", &d[i]);
	sort(d.begin(), d.end());
	i = Search(d, 0, num - 1);
	cout << num - i << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   35 |                 scanf_s("%lld", &d[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

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

#define MAX 300001
 
lll A[MAX], B[MAX], C[1001][1001];
vll vA, vB;
lll T,n,i,j,k,a,b,c,m,u,v,x,y,l,r,s,e,ans;
string sA, sB, sC[MAX];
 
int main(){
 
    
    cin >> n;
    for (i=0;i<n;i++){cin >> A[i];}
    sort(A, A + n);
    B[0] = A[0]; A[n] = 0;
   for (i=1;i<=n-1;i++) B[i] = A[i] + B[i - 1];
    ans = 0;
    for (i=n;i>=1;i--){
        if(A[i] / 2.0 <= B[i - 1]) ans++;
        else break;
    }

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

Compiler output:
a.cc:8:1: error: 'lll' does not name a type
    8 | lll A[MAX], B[MAX], C[1001][1001];
      | ^~~
a.cc:9:1: error: 'vll' does not name a type
    9 | vll vA, vB;
      | ^~~
a.cc:10:1: error: 'lll' does not name a type
   10 | lll T,n,i,j,k,a,b,c,m,u,v,x,y,l,r,s,e,ans;
      | ^~~
a.cc: In function 'int main()':
a.cc:16:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 |     cin >> n;
      |            ^
      |            yn
a.cc:17:10: error: 'i' was not declared in this scope
   17 |     for (i=0;i<n;i++){cin >> A[i];}
      |          ^
a.cc:17:30: error: 'A' was not declared in this scope; did you mean 'sA'?
   17 |     for (i=0;i<n;i++){cin >> A[i];}
      |                              ^
      |                              sA
a.cc:18:10: error: 'A' was not declared in this scope; did you mean 'sA'?
   18 |     sort(A, A + n);
      |          ^
      |          sA
a.cc:19:5: error: 'B' was not declared in this scope; did you mean 'sB'?
   19 |     B[0] = A[0]; A[n] = 0;
      |     ^
      |     sB
a.cc:20:9: error: 'i' was not declared in this scope
   20 |    for (i=1;i<=n-1;i++) B[i] = A[i] + B[i - 1];
      |         ^
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans = 0;
      |     ^~~
      |     abs
a.cc:22:10: error: 'i' was not declared in this scope
   22 |     for (i=n;i>=1;i--){
      |          ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

bool func(int i,vector<long long> a){//i番目のモンスターが生き残れるかどうか。
  int n=a.size();
  vector<pair<long long,int>> b;
  REP()
  
int main(){
  int n;
  cin>>n;
  vector<long long> a(n);
  long long s[n];
  REP(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  REP(i,n){
    if(i==0){
      s[i]=a[i];
    }else{
      s[i]=s[i-1]+a[i];
    }
  }
  
  int l=0,r=n;//二分探索でいける??
  int lm,rm,mm;
  long long temp;
  while(r-l>1){
    int m=(l+r)/2;
    lm = m+1;
    rm = n;
    temp = s[m];
    mm = m;
    //m番目のモンスターが吸収できる最大のモンスターのインデックスを取得
    while(true){
      for(int i=m+1;i<n;i++){
        if(a[i]<2*temp){
          mm = i;
        }
      }
      temp = s[mm];
      if(mm==m && m){
        break;
      }else{
        
    
  return 0;
}


Compiler output:
a.cc:92:7: error: macro "REP" requires 2 arguments, but only 1 given
   92 |   REP()
      |       ^
a.cc:2:9: note: macro "REP" defined here
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |         ^~~
a.cc: In function 'bool func(int, std::vector<long long int>)':
a.cc:92:3: error: 'REP' was not declared in this scope
   92 |   REP()
      |   ^~~
a.cc:134:2: error: expected '}' at end of input
  134 | }
      |  ^
a.cc:89:37: note: to match this '{'
   89 | bool func(int i,vector<long long> a){//i番目のモンスターが生き残れるかどうか。
      |                                     ^
a.cc:134:2: warning: no return statement in function returning non-void [-Wreturn-type]
  134 | }
      |  ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

bool func(int i,vector<long long> a){//i番目のモンスターが生き残れるかどうか。
  int n=a.size();
  vector<pair<long long,int>> b;
  REP()
  
int main(){
  int n;
  cin>>n;
  vector<long long> a(n);
  long long s[n];
  REP(i,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  REP(i,n){
    if(i==0){
      s[i]=a[i];
    }else{
      s[i]=s[i-1]+a[i];
    }
  }
  
  int l=0,r=n;//二分探索でいける??
  int lm,rm,mm;
  long long temp;
  while(r-l>1){
    int m=(l+r)/2;
    lm = m+1;
    rm = n;
    temp = s[m];
    //m番目のモンスターが吸収できる最大のモンスターのインデックスを取得
    while(rm-lm>1){
      mm = (lm+rm)/2;
      if(a[mm]<=2*temp){
        lm = mm;
      }else{
        rm = mm;
      }
    }
    temp = s[mm];
    
  return 0;
}


Compiler output:
a.cc:92:7: error: macro "REP" requires 2 arguments, but only 1 given
   92 |   REP()
      |       ^
a.cc:2:9: note: macro "REP" defined here
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |         ^~~
a.cc: In function 'bool func(int, std::vector<long long int>)':
a.cc:92:3: error: 'REP' was not declared in this scope
   92 |   REP()
      |   ^~~
a.cc:131:2: error: expected '}' at end of input
  131 | }
      |  ^
a.cc:89:37: note: to match this '{'
   89 | bool func(int i,vector<long long> a){//i番目のモンスターが生き残れるかどうか。
      |                                     ^
a.cc:131:2: warning: no return statement in function returning non-void [-Wreturn-type]
  131 | }
      |  ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<int, pii> pipii;

ll l[100005];
void solve() {
  int n;
  cin >> n;
  ll all = 0;
  for(int i = 0; i < n; i++) {
    cin >> l[i];
    all += l[i];
  }
  sort(l, l+n);
  int ret = 0;
  for(int i = n-1; i >= 0) {
    if(2*all >= l[i]) ret++;
    all -= l[i];
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:31:26: error: expected ';' before ')' token
   31 |   for(int i = n-1; i >= 0) {
      |                          ^
      |                          ;
Language: C++

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

int main(){
	int n;cin >>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	sort(begin(a),end(a));
	vector<int>s(n+1,0);
	for(int i=0;i<n;i++){
	s[i+1]=s[i]+a[i];}
	int num=n-1;	
	bool flg=false;
	for(int i=n-2;i>=0;i--){
	if(a[i+1]>2*s[i+1]){
		num=i;
		flg=true;
		break;
	}
	}
	if(!flg)cout<<n<<endl;
	else if(num<=n-2) cout<<n-1-num<<endl;
}	else cout<<1<<endl;

Compiler output:
a.cc:23:9: error: expected unqualified-id before 'else'
   23 | }       else cout<<1<<endl;
      |         ^~~~
Language: C++

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

int main(){
	int n;cin >>n;
	vector<int>a(n);
	for(auto&& w:a)cin>>w;
	sort(begin(a),end(a));
	vector<int>s(n+1,0);
	for(int i=0;i<n;i++){
	s[i+1]=s[i]+a[i];}
	int num=n-1;	
	bool flg=false;
	for(int i=n-2;i>=0;i--){
	if(a[i+1]>2*s[i+1]){
		num=i;
		flg=true;
		break;
	}	
	if(!flg)cout<<n<<endl;
	else cout<<n-num<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

typedef long long ll;

int main(){
  ll n;
  cin >> n;
  ll a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a,a+n);
  ll sum[n];
  sum[0]=a[0];
  for(int i=1;i<n;i++){
    sum[i]=sum[i-1]+a[i];
  }
  int x=0;
  for(int i=0;i<n-1;i++){
    if(2*sum[i]<a[i+1]){
      x=i;
    }
  }
  cout << n-x-1 << endl
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: expected ';' before '}' token
   24 |   cout << n-x-1 << endl
      |                        ^
      |                        ;
   25 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,n) for(ll i=0;i<n;++i)
#define pie 3.141592653589793238462643383279
#define mod 1e9+7
int x[100000],y[100000];
signed main(){
	int n;
	cin>>n;
	f(i,n){
		cin>>x[i];
	}
	sort(x,x+n);
	f(i,n){
		y[i]=x[i];
		if(i) y[i]+=y[i-1];
	}
	for(int i=n-2;i>=0;i--){
		if(y[i]*2<x[i+1]){
			cout<<n-i-1<<endl;
			return 0;
		}
	}
	cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: 'll' was not declared in this scope
    4 | #define f(i,n) for(ll i=0;i<n;++i)
      |                    ^~
a.cc:11:9: note: in expansion of macro 'f'
   11 |         f(i,n){
      |         ^
a.cc:11:11: error: 'i' was not declared in this scope
   11 |         f(i,n){
      |           ^
a.cc:4:27: note: in definition of macro 'f'
    4 | #define f(i,n) for(ll i=0;i<n;++i)
      |                           ^
a.cc:4:20: error: 'll' was not declared in this scope
    4 | #define f(i,n) for(ll i=0;i<n;++i)
      |                    ^~
a.cc:15:9: note: in expansion of macro 'f'
   15 |         f(i,n){
      |         ^
a.cc:15:11: error: 'i' was not declared in this scope
   15 |         f(i,n){
      |           ^
a.cc:4:27: note: in definition of macro 'f'
    4 | #define f(i,n) for(ll i=0;i<n;++i)
      |                           ^
Language: Java

vimport java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);

        long total = a[0];
        int bottom = 0;
        for (int i = 1; i < n; i++) {
            if (total * 2 < a[i]) {
                bottom = i;
            }
            total += a[i];
        }

        out.println(n - bottom);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

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

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
vimport java.io.IOException;
^
Main.java:2: error: class, interface, enum, or record expected
import java.io.InputStream;
^
Main.java:3: error: class, interface, enum, or record expected
import java.io.PrintWriter;
^
Main.java:4: error: class, interface, enum, or record expected
import java.util.*;
^
4 errors
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
#include <stdlib.h>
#include <stack>
#include <string.h>
#include <set>
#include <iomanip>
#include <ctime>
#include <map>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <cstring>
#define eps 1e-15
#define ull unsigned long long
//priority_queue<int,vector<int>,greater<int> > q;
//priority_queue<int,vector<int>,less<int> > q;
//#define ls l, mid, rt << 1
//#define rs mid + 1, r, rt << 1 | 1
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const long long mod1 = 1e16;
//int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
//int Find(int x){return x == p[x] ? x : p[x] = Find(p[x]);}
//#define lson 1<<rt
//#define rson 1<<rt|1
const int maxn=1e5+7;
#define pi 3.1415926535898
#define PI atan(1.0)*4
int dx[4]= {0,1,0,-1},dy[4]= {1,0,-1,0};
int dir[4][2]= {{1,0},{-1,0},{0,1},{0,-1}};
int dir1[8][2]= {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
//int d[]= {1,-1,4,-4}; //八数码问题
//----------------------------------------

bool check(int mid)
{
    ll s=a[mid];
    for(int j=0;j<n;j++)
    {
        if(j!=mid)
        {
            if(a[j]>s*2)
                a[j]+=s;
            else
                return 0;
        }
    }
    return 1;
}

int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    int l=0,r=100000,mid;
    while(l<=r)
    {
        mid=(l+r)/2;
        if(check(mid))
        {
            r=mid-1;
        }
            else
            l=mid+1;
    }
    cout<<l-1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:42:10: error: 'a' was not declared in this scope
   42 |     ll s=a[mid];
      |          ^
a.cc:43:19: error: 'n' was not declared in this scope
   43 |     for(int j=0;j<n;j++)
      |                   ^
a.cc: In function 'int main()':
a.cc:58:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   58 |     cin>>n;
      |          ^
      |          yn
a.cc:60:14: error: 'a' was not declared in this scope
   60 |         cin>>a[i];
      |              ^
a.cc:61:10: error: 'a' was not declared in this scope
   61 |     sort(a,a+n);
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,j=0;
  cin>>n
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a.begin(),a.end());
  for(int i=1;i<n;i++){
    if(a[i-1]*2<a[i]){
      j=i;
    }
    a[i]+=a[i-1];
  }
  cout<<n-j;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: expected ';' before 'vector'
    6 |   cin>>n
      |         ^
      |         ;
    7 |   vector<ll> a(n);
      |   ~~~~~~ 
a.cc:8:29: error: 'a' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin>>a[i];
      |                             ^
a.cc:9:8: error: 'a' was not declared in this scope
    9 |   sort(a.begin(),a.end());
      |        ^
Language: C++

N = int(input())
a = input().split()
for i in range(0,N):
	a[i] = int(a[i])
a.sort()
t = 0
flag = 1
i = 0
while flag:
	if a[i]*2 > a[i+1]:
		t = i
		flag = 0	
	else:
		i += 1
print(N-t)
		

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

#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    long long a[100000];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    long long sum = 0;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        sum += a[i];
        if(i==n-1){
            cnt++;
            continue;
        }
        if(sum*2 >= a[i+1]){
            cnt++;
        }else{
            cnt = 0;
        }
    }
    cout << cnt << endl;
}

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

#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int i,n,a[100005],temp=1;
	long long sum;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	 scanf("%d",&a[i]);
	sort(a,a+n);
	sum=(long long)a[0];
	for(i=1;i<n;i++)
	{
		if(sum*2<=(long long)a[i])
		{
		   temp=1;
		   sum+=(long long)a[i];
		}
		else
		{
			temp++;
			sum+=(long long)a[i];
		}	
	}
   printf("%d\n",temp);
}

Compiler output:
main.c:2:9: fatal error: algorithm: No such file or directory
    2 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.