Language: C++

include <cstdio>
include <cmath>

int DP[12][1030][331];
int slove(int k,int u,int s){
	if(n>=11) return 0;
	if(s>=331) return 0;
	int res=0;
	if(s<0)return 0;
	if(DP[k][u][s]>=0) return DP[k][u][s];
	if(k==n) {
		if((s%k)==0&&((int)pow(2,(s/k))&u)==0&&s/k<10){
			res=1;
			//printf("%d %d %d hit\n",k,u,s);
		}
	} else {
		for(int i=0;i<10;i++){
			if(((int)pow(2,i)&u)==0){
				res+=slove(k+1,u+pow(2,i),s-i*k);
			}
		}
	}
	DP[k][u][s]=res;
	return res;
}
int main() {
	int m;
	int bn=-1;
	while(scanf("%d %d",&n,&m)!=EOF){
		if(bn!=n){
			for(int x=0;x<12;x++){
				for(int y=0;y<1030;y++)
					for(int z=0;z<331;z++){
						DP[x][y][z]=-1;
					}
			}
		}
		printf("%d\n",slove(1,0,m));
		fflush(stdout);
		bn=n;
	}
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <cstdio>
      | ^~~~~~~
a.cc: In function 'int slove(int, int, int)':
a.cc:6:12: error: 'n' was not declared in this scope
    6 |         if(n>=11) return 0;
      |            ^
a.cc:10:12: error: 'DP' was not declared in this scope
   10 |         if(DP[k][u][s]>=0) return DP[k][u][s];
      |            ^~
a.cc:11:15: error: 'n' was not declared in this scope
   11 |         if(k==n) {
      |               ^
a.cc:12:36: error: 'pow' was not declared in this scope
   12 |                 if((s%k)==0&&((int)pow(2,(s/k))&u)==0&&s/k<10){
      |                                    ^~~
a.cc:18:34: error: 'pow' was not declared in this scope
   18 |                         if(((int)pow(2,i)&u)==0){
      |                                  ^~~
a.cc:23:9: error: 'DP' was not declared in this scope
   23 |         DP[k][u][s]=res;
      |         ^~
a.cc: In function 'int main()':
a.cc:29:30: error: 'n' was not declared in this scope; did you mean 'bn'?
   29 |         while(scanf("%d %d",&n,&m)!=EOF){
      |                              ^
      |                              bn
a.cc:29:15: error: 'scanf' was not declared in this scope
   29 |         while(scanf("%d %d",&n,&m)!=EOF){
      |               ^~~~~
a.cc:29:37: error: 'EOF' was not declared in this scope
   29 |         while(scanf("%d %d",&n,&m)!=EOF){
      |                                     ^~~
a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include <cstdio>
a.cc:34:49: error: 'DP' was not declared in this scope
   34 |                                                 DP[x][y][z]=-1;
      |                                                 ^~
a.cc:38:17: error: 'printf' was not declared in this scope
   38 |                 printf("%d\n",slove(1,0,m));
      |                 ^~~~~~
a.cc:38:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:39:24: error: 'stdout' was not declared in this scope
   39 |                 fflush(stdout);
      |                        ^~~~~~
a.cc:39:24: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:39:17: error: 'fflush' was not declared in this scope
   39 |                 fflush(stdout);
      |                 ^~~~~~