func_code_string: #include <bits/stdc++.h>   using namespace std;   int arr[30001];   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       for (int i = 1; i <= n; i++) {         cin >> arr[i];       }       int dp1 = arr[1];       int dp2 = 0;       bool fail = 0;       for (int i = 2; i < n; i++) {         arr[i] = arr[i] - dp2;         if (arr[i] < 0) {           fail = 1;           break;         }         if (arr[i] > dp1) {           arr[i] = arr[i] - dp1;           dp2 = dp2 + arr[i];         } else {           dp1 = arr[i];         }       }       if (dp2 > arr[n]) {         fail = 1;       }       if (fail) {         cout <<  NO               <<   n ;       } else {         cout <<  YES               <<   n ;       }     }   }   