func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[114514];   int l[114514], r[114514];   bool solve(int n) {     int curr = a[1];     l[1] = a[1];     for (int i = 2; i <= n; i++) {       if (a[i] < a[i - 1]) curr -= a[i - 1] - a[i];       if (curr < 0) return false;       l[i] = curr;     }     return true;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       for (int i = 1; i <= n; i++) cin >> a[i];       if (solve(n))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }   