Language: C++

using namespace std;
 
int counts = 0;
 
int sum(vector<int> li, int size) {
    int sum = 0;
    for (int i = 0; i< size; i++) {
        sum +=li[i];
    }
    return sum;
}
 
void agg(vector<int> car, int avg,int size ){
    if(size>=2) {
        if ( sum(car, size)/size== avg){
            counts+=1;
        }
        vector<int> temp1(size-1); 
        for(int i = 0; i<size-1;i++) {
            temp1.push_back(car[i]);
        }
        agg(temp1, avg, size-1);
        
    }else {
        if (car[0] == avg){
            counts += 1;
        }
    }
}
 
int main(){
    int A, N;
    vector<int> card(A);
 
    cin >> A >> N;
    for(int i=0; i<A;i++) {
        cin >> card[i];
    }
    for (int test = 0; test< A; test++) {
        vector<int> temp(A-test);
        for(int i=0; i<A; i++) {
            temp.push_back(card[i]); 
        }
        agg(temp, N, temp.size());
    }
 
    cout << counts << endl;
 
 
}

Compiler output:
a.cc:5:9: error: 'vector' was not declared in this scope
    5 | int sum(vector<int> li, int size) {
      |         ^~~~~~
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:5:16: error: expected primary-expression before 'int'
    5 | int sum(vector<int> li, int size) {
      |                ^~~
a.cc:5:25: error: expected primary-expression before 'int'
    5 | int sum(vector<int> li, int size) {
      |                         ^~~
a.cc:5:33: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int sum(vector<int> li, int size) {
      |                                 ^
a.cc:13:6: error: variable or field 'agg' declared void
   13 | void agg(vector<int> car, int avg,int size ){
      |      ^~~
a.cc:13:10: error: 'vector' was not declared in this scope
   13 | void agg(vector<int> car, int avg,int size ){
      |          ^~~~~~
a.cc:13:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:13:17: error: expected primary-expression before 'int'
   13 | void agg(vector<int> car, int avg,int size ){
      |                 ^~~
a.cc:13:27: error: expected primary-expression before 'int'
   13 | void agg(vector<int> car, int avg,int size ){
      |                           ^~~
a.cc:13:35: error: expected primary-expression before 'int'
   13 | void agg(vector<int> car, int avg,int size ){
      |                                   ^~~
a.cc: In function 'int main()':
a.cc:33:5: error: 'vector' was not declared in this scope
   33 |     vector<int> card(A);
      |     ^~~~~~
a.cc:33:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:33:12: error: expected primary-expression before 'int'
   33 |     vector<int> card(A);
      |            ^~~
a.cc:35:5: error: 'cin' was not declared in this scope
   35 |     cin >> A >> 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 namespace std;
a.cc:37:16: error: 'card' was not declared in this scope
   37 |         cin >> card[i];
      |                ^~~~
a.cc:40:16: error: expected primary-expression before 'int'
   40 |         vector<int> temp(A-test);
      |                ^~~
a.cc:42:13: error: 'temp' was not declared in this scope
   42 |             temp.push_back(card[i]);
      |             ^~~~
a.cc:42:28: error: 'card' was not declared in this scope
   42 |             temp.push_back(card[i]);
      |                            ^~~~
a.cc:44:13: error: 'temp' was not declared in this scope
   44 |         agg(temp, N, temp.size());
      |             ^~~~
a.cc:44:9: error: 'agg' was not declared in this scope
   44 |         agg(temp, N, temp.size());
      |         ^~~
a.cc:47:5: error: 'cout' was not declared in this scope
   47 |     cout << counts << endl;
      |     ^~~~
a.cc:47:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:47:23: error: 'endl' was not declared in this scope
   47 |     cout << counts << 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;