Language: C++

#include<iostream>
#include<vector>
 
using namespace std;
 
void popular(vector<int>& arr,int m,int sum){
  int popular = 0;
  int unpopular = 0;
 // cout<<m;
  int checker = (4*m) ;
 // cout<<checker<<endl;
  for(int i=0;i < arr.size();i++){
    //  cout<<"k";
    if(arr[i]*sum >= checker ){
      popular++;
     // cout<<popular;
    }
    else
      unpopular++;  
  }
  if(popular > m){
    cout<<"Yes";
  }
  else
    cout<<"No";
  
}
 
int main(int args,char **argv){
  int n;
  cin>>n;
  vector<int>arr(n);
  for(int i=0;i<arr.size();i++){
    cin>>arr[i];
  }
  int m;
  cin>>m;
  int sum = 0;
  for(int i=0;i<arr.size();i++){
    sum = sum + arr[i];
  }
 // cout<<sum<<endl;
  popular(arr,m,sum);
  
}
#include<iostream>
#include<vector>
 
using namespace std;
 
void popular(vector<int>& arr,int m,int sum){
  int popular = 0;
  int unpopular = 0;
 // cout<<m;
  int checker = (4*m) ;
 // cout<<checker<<endl;
  for(int i=0;i < arr.size();i++){
    //  cout<<"k";
    if(arr[i]*sum >= checker ){
      popular++;
     // cout<<popular;
    }
    else
      unpopular++;  
  }
  if(popular > m){
    cout<<"Yes";
  }
  else
    cout<<"No";
  
}
 
int main(int args,char **argv){
  int n;
  cin>>n;
  vector<int>arr(n);
  for(int i=0;i<arr.size();i++){
    cin>>arr[i];
  }
  int m;
  cin>>m;
  int sum = 0;
  for(int i=0;i<arr.size();i++){
    sum = sum + arr[i];
  }
 // cout<<sum<<endl;
  popular(arr,m,sum);
  
}
#include<iostream>
#include<vector>
 
using namespace std;
 
void popular(vector<int>& arr,int m,int sum){
  int popular = 0;
  int unpopular = 0;
 // cout<<m;
  int checker = (4*m) ;
 // cout<<checker<<endl;
  for(int i=0;i < arr.size();i++){
    //  cout<<"k";
    if(arr[i]*sum >= checker ){
      popular++;
     // cout<<popular;
    }
    else
      unpopular++;  
  }
  if(popular >= m){
    cout<<"Yes";
  }
  else
    cout<<"No";
  
}
 
int main(int args,char **argv){
  int n;
  cin>>n;
  vector<int>arr(n);
  for(int i=0;i<arr.size();i++){
    cin>>arr[i];
  }
  int m;
  cin>>m;
  int sum = 0;
  for(int i=0;i<arr.size();i++){
    sum = sum + arr[i];
  }
 // cout<<sum<<endl;
  popular(arr,m,sum);
  
}


Compiler output:
a.cc:51:6: error: redefinition of 'void popular(std::vector<int>&, int, int)'
   51 | void popular(vector<int>& arr,int m,int sum){
      |      ^~~~~~~
a.cc:6:6: note: 'void popular(std::vector<int>&, int, int)' previously defined here
    6 | void popular(vector<int>& arr,int m,int sum){
      |      ^~~~~~~
a.cc:74:5: error: redefinition of 'int main(int, char**)'
   74 | int main(int args,char **argv){
      |     ^~~~
a.cc:29:5: note: 'int main(int, char**)' previously defined here
   29 | int main(int args,char **argv){
      |     ^~~~
a.cc:96:6: error: redefinition of 'void popular(std::vector<int>&, int, int)'
   96 | void popular(vector<int>& arr,int m,int sum){
      |      ^~~~~~~
a.cc:6:6: note: 'void popular(std::vector<int>&, int, int)' previously defined here
    6 | void popular(vector<int>& arr,int m,int sum){
      |      ^~~~~~~
a.cc:119:5: error: redefinition of 'int main(int, char**)'
  119 | int main(int args,char **argv){
      |     ^~~~
a.cc:29:5: note: 'int main(int, char**)' previously defined here
   29 | int main(int args,char **argv){
      |     ^~~~