#include<stdlib.h>
#include<stdio.h>
#include<math.h>
int main()
{
int a,query,in,n,b[n],sum[a];
sum[1]=0;
scanf("%d",&query);
for(a=1;a<=query;a++)
{
scanf("%d",&in);
for(n=1;n<=in;n++)
{
b[n]=1+7*(n-1)+6*(n-1)*(n-2)+(n-1)*(n-2)*(n-3);
sum[a]=sum[a]+b[n];
}
}
for(a=1;a<=query;a++)
{
printf("%d\n",sum[a]);
}
return 0;
}
I have made this code which is running in terminal .
But in hacker rank it is showing
Input (stdin)
2
2
5
Your Output (stdout)
~ no response on stdout ~
Expected Output
9
225
Compiler Message
Segmentation Fault
Now what should I do to solve the problem .