Language: C++

#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f3f3f3f3fLL
#define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
#define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
using namespace std;
const int maxn=50+5;
const int maxm=5000+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
const ll mo=1e9+7;
int n,m,k;
int a[maxn];
int ans,tmp,cnt;
ll dp[maxn][2510];
char s[maxn];
ll power(ll a,ll n)
{
    ll sum=1;
    while(n)
    {
        if(n&1) sum=sum*a%mo;
        n>>=1;
        a=a*a%mo;
    }
    return sum;
}
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int sum=0;
        rep(i,1,n)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        memset(dp,-1,sizeof(dp));
        dp[0][0]=1;
        rep(i,1,n)
        {
            dep(k,i-1,0)
            dep(j,sum,a[i])
            if(dp[k][j-a[i]]!=-1){
                dp[k+1][j]=max(dp[k+1][j],0);
                dp[k+1][j]+=dp[k][j-a[i]];
                //if(j==18)
                //cout<<k<<" * "<<i<<" "<<dp[k][j-a[i]]<<endl;
            }
        }
        //rep(i,1,n)
        //rep(j,0,sum)
        //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        ll ans=0;
        rep(i,1,n)
        if(i*m<=sum&&dp[i][i*m]>0){
            ans+=dp[i][i*m];
            //cout<<i<<" "<<i*m<<" "<<dp[i][i*m]<<endl;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 |         rep(i,1,n)
      |             ^
a.cc:4:36: note: in definition of macro 'rep'
    4 | #define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
      |                                    ^
a.cc:40:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   40 |         rep(i,1,n)
      |             ^
a.cc:4:36: note: in definition of macro 'rep'
    4 | #define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
      |                                    ^
a.cc:42:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   42 |             dep(k,i-1,0)
      |                 ^
a.cc:5:36: note: in definition of macro 'dep'
    5 | #define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
      |                                    ^
a.cc:43:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   43 |             dep(j,sum,a[i])
      |                 ^
a.cc:5:36: note: in definition of macro 'dep'
    5 | #define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
      |                                    ^
a.cc:45:31: error: no matching function for call to 'max(long long int&, int)'
   45 |                 dp[k+1][j]=max(dp[k+1][j],0);
      |                            ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:45:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   45 |                 dp[k+1][j]=max(dp[k+1][j],0);
      |                            ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:45:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   45 |                 dp[k+1][j]=max(dp[k+1][j],0);
      |                            ~~~^~~~~~~~~~~~~~
a.cc:55:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   55 |         rep(i,1,n)
      |             ^
a.cc:4:36: note: in definition of macro 'rep'
    4 | #define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
      |                                    ^