Error with problem ATM2

I am unable to understand why CodeChef compiler is giving me wrong output while solving https://www.codechef.com/problems/ATM2. When I tried every other online compiler as well as GNU compiler I was getting required output.

My code:

#include <stdio.h>
int main(void)
{
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++)
	{
	    int n,k;
	    scanf("%d %d",&n,&k);
	    int a[n];
	    char o[n];
	    for(int j=0;j<n;j++)
	    {
	        scanf("%d",&a[j]);
	        if(a[j]>k || k==0)
	        {
	            o[j]='0';
	        }
	        else
	        {
	            k=k-a[j];
	            o[j]='1';
	        }
	    }
	    printf("%s\n",o);
	}
	return 0;
}

@yash_7200
there is something prb with the size of char o its taking the maximum always don’t know why its happening bacozz i don’t have good hands on c language but u can print 0 or 1 directly if u want to make it accepted don’t need to store in array of char

but it is only happening when I am compiling in CodeChef any other compiler is not making the same error.

@yash_7200
No prb just clear the array for each test case

but I am reinitializing array on each iteration