The code is giving correct answers on other compilers but the output being returned on this platform is completely different
My code
#include <stdio.h>
int main(void) {
int t,n,k,i,j,c,m;
scanf("%d",&t);
for(i=0;i<t;i++){
c=0;
scanf("%d %d",&n,&k);
int a[n];
for(j=0;j<n;j++){
scanf("%d",&a[j]);
a[j]+=c;
if(a[j]>=k){
c=a[j]-k;
m++;
}
else{
m=0;
break;}}
if(m==n)
printf("YES\n");
else
printf("NO %d\n",j+1);
}
return 0;
}
Problem Link: DIET Problem - CodeChef