Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
using namespace std;

typedef long long ll;
typedef short int sh;

const ll inf=0x3f3f3f3f;
const int MAX=1<<6;
const int mod=1e9+7;

ll dp[MAX][MAX];
int num[MAX],n,a;

ll Dp(int st,int cnt,int sum)
{
    if(dp[st][sum]!=-1)
        return dp[st][sum];
    dp[st][sum]=0;
    if(cnt&&(double)sum/cnt==a)
    {
        dp[st][sum]++;
    }
    for(int i=st;i<n&&(double)(sum+num[i])/(cnt+1)<=a;i++)
    {
        dp[st][sum]+=Dp(i+1,cnt+1,sum+num[i]);
    }
    return dp[st][sum];
}

int main()
{
    while(scanf("%d%d",&n,&a)!=EOF)
    {
        for(int i=0;i<n;i++)
        {
            scanf("%d",&num[i]);
        }
        sort(num,num+n);
        memset(dp,-1,sizeof(dp));
        printf("%lld\n",Dp(0,0,0));
    }
    return 0;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>
using namespace std;

typedef long long ll;
typedef short int sh;

const ll inf=0x3f3f3f3f;
const int MAX=1<<6;
const int mod=1e9+7;

ll dp[MAX][MAX];
int num[MAX],n,a;

ll Dp(int st,int cnt,int sum)
{
    if(dp[st][sum]!=-1)
        return dp[st][sum];
    dp[st][sum]=0;
    if(cnt&&(double)sum/cnt==a)
    {
        dp[st][sum]++;
    }
    for(int i=st;i<n&&(double)(sum+num[i])/(cnt+1)<=a;i++)
    {
        dp[st][sum]+=Dp(i+1,cnt+1,sum+num[i]);
    }
    return dp[st][sum];
}

int main()
{
    while(scanf("%d%d",&n,&a)!=EOF)
    {
        for(int i=0;i<n;i++)
        {
            scanf("%d",&num[i]);
        }
        sort(num,num+n);
        memset(dp,-1,sizeof(dp));
        printf("%lld\n",Dp(0,0,0));
    }
    return 0;
}


Compiler output:
a.cc:66:10: error: redefinition of 'const ll inf'
   66 | const ll inf=0x3f3f3f3f;
      |          ^~~
a.cc:15:10: note: 'const ll inf' previously defined here
   15 | const ll inf=0x3f3f3f3f;
      |          ^~~
a.cc:67:11: error: redefinition of 'const int MAX'
   67 | const int MAX=1<<6;
      |           ^~~
a.cc:16:11: note: 'const int MAX' previously defined here
   16 | const int MAX=1<<6;
      |           ^~~
a.cc:68:11: error: redefinition of 'const int mod'
   68 | const int mod=1e9+7;
      |           ^~~
a.cc:17:11: note: 'const int mod' previously defined here
   17 | const int mod=1e9+7;
      |           ^~~
a.cc:70:4: error: redefinition of 'll dp [64][64]'
   70 | ll dp[MAX][MAX];
      |    ^~
a.cc:19:4: note: 'll dp [64][64]' previously declared here
   19 | ll dp[MAX][MAX];
      |    ^~
a.cc:71:5: error: redefinition of 'int num [64]'
   71 | int num[MAX],n,a;
      |     ^~~
a.cc:20:5: note: 'int num [64]' previously declared here
   20 | int num[MAX],n,a;
      |     ^~~
a.cc:71:14: error: redefinition of 'int n'
   71 | int num[MAX],n,a;
      |              ^
a.cc:20:14: note: 'int n' previously declared here
   20 | int num[MAX],n,a;
      |              ^
a.cc:71:16: error: redefinition of 'int a'
   71 | int num[MAX],n,a;
      |                ^
a.cc:20:16: note: 'int a' previously declared here
   20 | int num[MAX],n,a;
      |                ^
a.cc:73:4: error: redefinition of 'll Dp(int, int, int)'
   73 | ll Dp(int st,int cnt,int sum)
      |    ^~
a.cc:22:4: note: 'll Dp(int, int, int)' previously defined here
   22 | ll Dp(int st,int cnt,int sum)
      |    ^~
a.cc:89:5: error: redefinition of 'int main()'
   89 | int main()
      |     ^~~~
a.cc:38:5: note: 'int main()' previously defined here
   38 | int main()
      |     ^~~~