Please help to sort out runtime error in the following code🔗 http://www.codechef.com/viewsolution/6882812

#include<stdio.h>
int main()
{
int t,i,j=0,w,u,a[100],m[100]={0},sum=0;
//enter no. of test cases
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<t;i++)
{
u=(a[i]/2);
m[(a[i]/2)]++;
for(j=0;j<=5000;j++)
{
if(m[j]>0)
{
w=u-1;
sum=(w*(w+1))/2.0;
printf("\n%d",sum);
break;
}
}
m[j]=0;
}
return 0;
}

Please provide a better format code, may be an ideone link. It is really very difficult to read it.

Can anyone help…