Language: C

#include<stdio.h>
#define abs(a) ((a)<0)?-(a):(a);
long d[500000],q[500000],a[500001],b[500001];

int main(int argc, char const *argv[]){
	long n,d,q,i;
	scanf("%ld %ld",&n,&d);
	a[0]=d;
	for(i=0;i<n;i++){
		scanf("%ld",&d[i]);
		if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
		else a[i+1]=a[i];
	}
	b[n]=1;
	for(i=n-1;i>=0;i--){
		if(b[i+1]<d[i]/2) b[i]=b[i+1];
		else b[i]=b[i+1]+d[i];
	}
	scanf("%ld",&q);
	for(i=0;i<q;i++){
		scanf("%ld",&q[i]);
	}
	for(i=0;i<q;i++){
		if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:31: error: subscripted value is neither array nor pointer nor vector
   10 |                 scanf("%ld",&d[i]);
      |                               ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                              ^
main.c:2:18: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                  ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                              ^
main.c:2:26: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                          ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                              ^
main.c:2:30: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                              ^
main.c:2:32: error: expected ')' before ';' token
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                                ^
main.c:11:20: note: in expansion of macro 'abs'
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                    ^~~
main.c:11:19: note: to match this '('
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                   ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                                                          ^
main.c:2:18: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                  ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                                                          ^
main.c:2:26: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                          ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
   11 |                 if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
      |                                                          ^
main.c:2:30: note: in definition of macro 'abs'
    2 | #define abs(a) ((a)<0)?-(a):(a);
      |                              ^
main.c:12:17: error: 'else' without a previous 'if'
   12 |                 else a[i+1]=a[i];
      |                 ^~~~
main.c:16:28: error: subscripted value is neither array nor pointer nor vector
   16 |                 if(b[i+1]<d[i]/2) b[i]=b[i+1];
      |                            ^
main.c:17:35: error: subscripted value is neither array nor pointer nor vector
   17 |                 else b[i]=b[i+1]+d[i];
      |                                   ^
main.c:21:31: error: subscripted value is neither array nor pointer nor vector
   21 |                 scanf("%ld",&q[i]);
      |                               ^
main.c:24:23: error: subscripted value is neither array nor pointer nor vector
   24 |                 if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
      |                       ^
main.c:24:34: error: subscripted value is neither array nor pointer nor vector
   24 |                 if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
      |                                  ^