func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 30000;   long long t, n, a[N], l, r;   bool possible() {     if (l > r) return 1;     long long o = a[l - 1];     a[l - 1] = 0;     for (long long i = l; i <= r; i++) {       long long v = max(a[i - 1], a[i] - o);       if (v > a[r + 1]) return 0;       o = a[i] - v;       a[i] = v;     }     return 1;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> t;     while (t--) {       cin >> n;       for (long long i = 0; i < n; i++) cin >> a[i];       l = 1;       r = n - 2;       for (; l < n && a[l - 1] >= a[l]; l++)         ;       for (; r >= 0 && a[r] <= a[r + 1]; r--)         ;       cout << (possible() ?  YES n  :  NO n );     }   }   