Language: C++

using namespace std;
 
int main() {
  int M, N, l, i=0, sum;
  cin >> N >> M;
  int  A[N];
  
  while(cin>>l){
    A[i] = l;
    i++;
  }
  sort(A, A+N, greater<>());
  for(i=0;i<N;i++)	cout << "A" << i << "=" << A[i] <<endl;
  
  sum = accumulate(A, A+N, 0);
    
  if(A[M-1] >= (sum/4/M))	cout << "Yes" <<endl;
  if(A[M-1] < (sum/4/M))	cout << "No" <<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N >> M;
      |   ^~~
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:12:16: error: 'greater' was not declared in this scope
   12 |   sort(A, A+N, greater<>());
      |                ^~~~~~~
a.cc:12:24: error: expected primary-expression before '>' token
   12 |   sort(A, A+N, greater<>());
      |                        ^
a.cc:12:26: error: expected primary-expression before ')' token
   12 |   sort(A, A+N, greater<>());
      |                          ^
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(A, A+N, greater<>());
      |   ^~~~
      |   short
a.cc:13:25: error: 'cout' was not declared in this scope
   13 |   for(i=0;i<N;i++)      cout << "A" << i << "=" << A[i] <<endl;
      |                         ^~~~
a.cc:13:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:59: error: 'endl' was not declared in this scope
   13 |   for(i=0;i<N;i++)      cout << "A" << i << "=" << A[i] <<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;
a.cc:15:9: error: 'accumulate' was not declared in this scope
   15 |   sum = accumulate(A, A+N, 0);
      |         ^~~~~~~~~~
a.cc:17:33: error: 'cout' was not declared in this scope
   17 |   if(A[M-1] >= (sum/4/M))       cout << "Yes" <<endl;
      |                                 ^~~~
a.cc:17:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:49: error: 'endl' was not declared in this scope
   17 |   if(A[M-1] >= (sum/4/M))       cout << "Yes" <<endl;
      |                                                 ^~~~
a.cc:17:49: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:18:33: error: 'cout' was not declared in this scope
   18 |   if(A[M-1] < (sum/4/M))        cout << "No" <<endl;
      |                                 ^~~~
a.cc:18:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:48: error: 'endl' was not declared in this scope
   18 |   if(A[M-1] < (sum/4/M))        cout << "No" <<endl;
      |                                                ^~~~
a.cc:18:48: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'