Error is coming

#include
using namespace std;

int ans(int a[],int m,int n){
int t[m+1][n+1];
for(int i=0;i<=m;i++){
for(int j=0;j<=n;j++){
if(i==0){
t[0][j]=0;
}
if(j==0){
t[i][0]=1;
}

		else{
			if(a[i-1]<=j){
				t[i][j]=t[i-1][j]+t[i][j-a[i-1]];
			}
			else{
				t[i][j]=t[i-1][j];
			}
		}
	}
}
return (t[m][n]% (1000000000 + 7);

}

int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
int m;
cin>>m;
int a[m];
for(int i=0;i<m;i++){
cin>>a[i];
}
int n;
cin>>n;
cout<<ans(a,m,n)<<endl;
}
return 0;
}

Hello @mansi25 could you please share your actual code by saving it on ide.codingblocks.com so that i can directly see the error which you are facing.

@mansi25 check now:

still error is coming

@mansi25 what error is coming?

wrong answer error is coming

@mansi25 could you please share the link where you are submitting it?

https://online.codingblocks.com/app/player/163443/content/165250/5203/code-challenge

@mansi25 i dont have access to your course.
but i think because constraints are tight it is giving error.


check this code: