func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void read(int &x) {     int v = 0, f = 1;     char c = getchar();     while (!isdigit(c) && c !=  - ) c = getchar();     if (c ==  - )       f = -1;     else       v = (c & 15);     while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);     x = v * f;   }   inline void read(long long &x) {     long long v = 0ll, f = 1ll;     char c = getchar();     while (!isdigit(c) && c !=  - ) c = getchar();     if (c ==  - )       f = -1;     else       v = (c & 15);     while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);     x = v * f;   }   inline void readc(char &x) {     char c;     while (((c = getchar()) ==    ) || c ==   n )       ;     x = c;   }   int n, m, i, j, t, a[30005];   long long s0, s1;   int main() {     read(t);     while (t--) {       read(n);       for (((i)) = (1); ((i)) <= ((n)); ((i))++) read(a[i]);       a[n + 1] = 0;       for (((i)) = ((n + 1)); ((i)) >= (1); ((i))--) a[i] = a[i] - a[i - 1];       s0 = a[1];       s1 = a[n + 1];       for ((i) = (2); (i) <= (n); (i)++)         if (a[i] > 0)           s1 += a[i];         else           s0 += a[i];       if (s1 <= 0 && s0 >= 0)         puts( YES );       else         puts( NO );     }     return 0;   }   