Runtime error (access violation) help pls! C
#include <stdio.h>
int main(){
int t=0,n=0,i=0,cont=0;
int a[65535];
for(i=0;i<1000;++i){
a[i]=1;
t=cont;
while(cont!=0){
a[i+cont]=0;
--cont;
}
cont=t;
i=i+cont;
++cont;
}
scanf("%d",&n);
while(n!=0){
scanf("%d",&t);
printf("%d\n",a[t-1]);
--n;
}
return(0);
}