for _ in range(int(input())):
n, m, k = map(int, input().split())
hs = list(map(int, input().split()))
available = m
g = hs[0]
for h in hs[1:]:
if g + available < h - k:
print("NO")
break
else:
available += g - max(0, (h - k))
g = h
else:
print("YES")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(ll test_case)
{
ll n, bag, k;
cin>> n >> bag >> k;
ll a[n];
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<n-1; i++){
if(a[i]+bag<a[i+1]-k) { cout << "NO\n"; return; }
ll x = max(0LL,a[i+1]-k);
if(a[i]>x) bag += a[i] - x;
else bag -= x - a[i];
}
cout << "YES\n";
}
int main()
{
ll t = 1, t1 = 0;
cin >> t;
while (t1 < t)
{
solve(t1 + 1);
t1++;
}
}
1143B - Nirvana | 1285A - Mezo Playing Zoma |
919B - Perfect Number | 894A - QAQ |
1551A - Polycarp and Coins | 313A - Ilya and Bank Account |
1469A - Regular Bracket Sequence | 919C - Seat Arrangements |
1634A - Reverse and Concatenate | 1619C - Wrong Addition |
1437A - Marketing Scheme | 1473B - String LCM |
1374A - Required Remainder | 1265E - Beautiful Mirrors |
1296A - Array with Odd Sum | 1385A - Three Pairwise Maximums |
911A - Nearest Minimums | 102B - Sum of Digits |
707A - Brain's Photos | 1331B - Limericks |
305B - Continued Fractions | 1165B - Polycarp Training |
1646C - Factorials and Powers of Two | 596A - Wilbur and Swimming Pool |
1462B - Last Year's Substring | 1608B - Build the Permutation |
1505A - Is it rated - 2 | 169A - Chores |
765A - Neverending competitions | 1303A - Erasing Zeroes |