Language: C++

#include <bits/stdc++.h>
using namespace std;

int n,a=0,b=0;
long long low,high,ans=1000000000,count=0;
long long num[n],sum[n+1][n+1];

void calc(){
  if(a+b==n){
    if(low<=b && b<=high){
      bool x=(bool)sum[a][b]/(bool)b;
      if(x==ans) count++;
      else {
      ans=min(ans,x); count=0;
      }
    }return;
  }a++;sum[a][b]=sum[a-1][b];
  calc();a--;
  b++;sum[a][b]+=sum[a][b-1]+num[b-1];
  calc();
  return;
}
    
  

int main(){
  cin>>n>>low>>high;
  for(int i=0;i<n;i++){
    cin>>num[i];
  }calc();
  cout<<ans<<endl;
  cout<<count<<endl;
}

Compiler output:
a.cc:6:15: error: size of array 'num' is not an integral constant-expression
    6 | long long num[n],sum[n+1][n+1];
      |               ^
a.cc:6:28: error: size of array 'sum' is not an integral constant-expression
    6 | long long num[n],sum[n+1][n+1];
      |                           ~^~
a.cc:6:23: error: size of array 'sum' is not an integral constant-expression
    6 | long long num[n],sum[n+1][n+1];
      |                      ~^~
a.cc: In function 'void calc()':
a.cc:12:18: error: reference to 'count' is ambiguous
   12 |       if(x==ans) count++;
      |                  ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:5:35: note:                 'long long int count'
    5 | long long low,high,ans=1000000000,count=0;
      |                                   ^~~~~
a.cc:14:14: error: no matching function for call to 'min(long long int&, bool&)'
   14 |       ans=min(ans,x); count=0;
      |           ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'bool')
   14 |       ans=min(ans,x); count=0;
      |           ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |       ans=min(ans,x); count=0;
      |           ~~~^~~~~~~
a.cc:14:23: error: reference to 'count' is ambiguous
   14 |       ans=min(ans,x); count=0;
      |                       ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:5:35: note:                 'long long int count'
    5 | long long low,high,ans=1000000000,count=0;
      |                                   ^~~~~
a.cc: In function 'int main()':
a.cc:32:9: error: reference to 'count' is ambiguous
   32 |   cout<<count<<endl;
      |         ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:5:35: note:                 'long long int count'
    5 | long long low,high,ans=1000000000,count=0;
      |                                   ^~~~~