Mixtures...2 test cases getting failed

#include
#include
using namespace std;
long long sum(int a[],int s,int e){
long long ans=0;
for(int i=s;i<=e;i++){
ans+=a[i];
ans=ans%100;
}
return ans;
}
long long mixture(int a[],int n){
if(n==0 || n==1)
return 0;

long long dp[n][n]={0};
for(int i=0;i<n;i++){
	int j=i+1;
	while(j<n){
        dp[i][j]=INT_MAX;
		for(int k=i;k<j;k++){
            dp[i][j]=min(dp[i][j] , dp[i][k] + dp[k+1][j] + sum(a,i,k)*sum(a,k+1,j));
		}
		j++;
	}
}
return dp[0][n-1];

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

@pearlgupta2000,
Please use Coding Blocks IDE to share your codes, see yourself, can you yourself read such an untidy code.
Also you are not filling the dp table in the correct order, take an example and dry run, you will know.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.