Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
//template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
signed main(){
  int a,d,e=0,f=0;
  cin>>a;
  vector<int> b(a),c,d(a);
  fo(i,a)
    cin>>b[i];
  d[0]=b[0];
  Sort(b);
  for(int i=1;i<a;i++)
    d[i]=d[i-1]+b[i];
  rev(d);
  fo(i,a){
    if(d[i]>d[i-1]*3)
      f=i+1;
  }
  cout<<f<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:150:22: error: conflicting declaration 'std::vector<long long int> d'
  150 |   vector<int> b(a),c,d(a);
      |                      ^
a.cc:148:9: note: previous declaration as 'long long int d'
  148 |   int a,d,e=0,f=0;
      |         ^
a.cc:153:4: error: invalid types 'long long int[int]' for array subscript
  153 |   d[0]=b[0];
      |    ^
a.cc:156:6: error: invalid types 'long long int[long long int]' for array subscript
  156 |     d[i]=d[i-1]+b[i];
      |      ^
a.cc:156:11: error: invalid types 'long long int[long long int]' for array subscript
  156 |     d[i]=d[i-1]+b[i];
      |           ^
a.cc:6:26: error: request for member 'begin' in 'd', which is of non-class type 'long long int'
    6 | #define rev(a) reverse(a.begin(),a.end())
      |                          ^~~~~
a.cc:157:3: note: in expansion of macro 'rev'
  157 |   rev(d);
      |   ^~~
a.cc:6:36: error: request for member 'end' in 'd', which is of non-class type 'long long int'
    6 | #define rev(a) reverse(a.begin(),a.end())
      |                                    ^~~
a.cc:157:3: note: in expansion of macro 'rev'
  157 |   rev(d);
      |   ^~~
a.cc:159:9: error: invalid types 'long long int[long long int]' for array subscript
  159 |     if(d[i]>d[i-1]*3)
      |         ^
a.cc:159:14: error: invalid types 'long long int[long long int]' for array subscript
  159 |     if(d[i]>d[i-1]*3)
      |              ^