Language: C++

#include <vector>
#include <sstream>
#include <deque>

std::vector<std::vector<long int> > table;

void outtable(std::vector<std::vector<int> > t){
    for(int i = 0; i < t.size(); ++i){
        for(int j = 0; j < t[i].size(); ++j){
            std::cout << t[i][j] << " ";
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;
}

int calc(std::deque<int> num, int input_data_num){
    for(int i = 0; i < input_data_num - 1; ++i){
        for(int j = 0; j < 21; ++j){
            if(table[i][j] != 0){
                //std::cout << i << " " << j << std::endl;
                if(j + num.front() <= 20){
                    table[i+1][j + num.front()] += table[i][j];
                }
                if(j - num.front() >= 0){
                    table[i+1][j - num.front()] += table[i][j];
                }
                //outtable(table);
            }
        }
        num.pop_front();
    }
}

int main(){

    std::deque<int> num;
    int input_data;
    int input_data_num;
    std::string str;

    std::cin >> input_data_num;
    std::cin.ignore();

    std::getline(std::cin, str);
    std::istringstream iss(str);
    while(!iss.eof()){
        iss >> input_data;
        num.push_back(input_data);
    }

    table = std::vector<std::vector<int> >(input_data_num, std::vector<int>(21, 0));
    ++table[0][num.front()];

    //outtable(table);
    
    num.pop_front();

    calc(num, input_data_num);

    //outtable(table);

    std::cout << table[input_data_num-1][0] << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'void outtable(std::vector<std::vector<int> >)':
a.cc:10:18: error: 'cout' is not a member of 'std'
   10 |             std::cout << t[i][j] << " ";
      |                  ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <deque>
  +++ |+#include <iostream>
    4 | 
a.cc:12:14: error: 'cout' is not a member of 'std'
   12 |         std::cout << std::endl;
      |              ^~~~
a.cc:12:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:10: error: 'cout' is not a member of 'std'
   14 |     std::cout << std::endl;
      |          ^~~~
a.cc:14:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'int calc(std::deque<int>, int)':
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
a.cc: In function 'int main()':
a.cc:42:10: error: 'cin' is not a member of 'std'
   42 |     std::cin >> input_data_num;
      |          ^~~
a.cc:42:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:10: error: 'cin' is not a member of 'std'
   43 |     std::cin.ignore();
      |          ^~~
a.cc:43:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:23: error: 'cin' is not a member of 'std'
   45 |     std::getline(std::cin, str);
      |                       ^~~
a.cc:45:23: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:52:83: error: no match for 'operator=' (operand types are 'std::vector<std::vector<long int> >' and 'std::vector<std::vector<int> >')
   52 |     table = std::vector<std::vector<int> >(input_data_num, std::vector<int>(21, 0));
      |                                                                                   ^
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<long int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<long int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::initializer_list<std::vector<long int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:63:10: error: 'cout' is not a member of 'std'
   63 |     std::cout << table[input_data_num-1][0] << std::endl;
      |          ^~~~
a.cc:63:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'