Gildong is playing a video game called Block Adventure. In Block Adventure, there are $n$ columns of blocks in a row, and the columns are numbered from $1$ to $n$. All blocks have equal heights. The height of the $i$-th column is represented as $h_i$, which is the number of blocks stacked in the $i$-th column.

Gildong plays the game as a character that can stand only on the top of the columns. At the beginning, the character is standing on the top of the $1$-st column. The goal of the game is to move the character to the top of the $n$-th column.

The character also has a bag that can hold infinitely many blocks. When the character is on the top of the $i$-th column, Gildong can take one of the following three actions as many times as he wants:   if there is at least one block on the column, remove one block from the top of the $i$-th column and put it in the bag;  if there is at least one block in the bag, take one block out of the bag and place it on the top of the $i$-th column;  if $i < n$ and $|h_i - h_{i+1}| \le k$, move the character to the top of the $i+1$-st column. $k$ is a non-negative integer given at the beginning of the game. Note that it is only possible to move to the next column. 

In actions of the first two types the character remains in the $i$-th column, and the value $h_i$ changes.

The character initially has $m$ blocks in the bag. Gildong wants to know if it is possible to win the game. Help Gildong find the answer to his question.


-----Input-----

Each test contains one or more test cases. The first line contains the number of test cases $t$ ($1 \le t \le 1000$). Description of the test cases follows.

The first line of each test case contains three integers $n$, $m$, and $k$ ($1 \le n \le 100$, $0 \le m \le 10^6$, $0 \le k \le 10^6$) — the number of columns in the game, the number of blocks in the character's bag at the beginning, and the non-negative integer $k$ described in the statement.

The second line of each test case contains $n$ integers. The $i$-th integer is $h_i$ ($0 \le h_i \le 10^6$), the initial height of the $i$-th column.


-----Output-----

For each test case, print "YES" if it is possible to win the game. Otherwise, print "NO".

You can print each letter in any case (upper or lower).


-----Example-----
Input
5
3 0 1
4 3 5
3 1 2
1 4 7
4 10 0
10 20 10 20
2 5 5
0 11
1 9 9
99

Output
YES
NO
YES
NO
YES



-----Note-----

In the first case, Gildong can take one block from the $1$-st column, move to the $2$-nd column, put the block on the $2$-nd column, then move to the $3$-rd column.

In the second case, Gildong has to put the block in his bag on the $1$-st column to get to the $2$-nd column. But it is impossible to get to the $3$-rd column because $|h_2 - h_3| = 3 > k$ and there is no way to decrease the gap.

In the fifth case, the character is already on the $n$-th column from the start so the game is won instantly.

Difficulty: EASY
Tags: Dynamic programming

Greedy algorithms
Skill types: Dynamic programming

Greedy algorithms

Starter code:

Solutions:
test_count = int(input())
n_list = []
m_list = []
k_list = []
tables = []
for i in range(test_count):
	n_m_k = list(map(int, input().split()))
	n_list.append(n_m_k[0])
	m_list.append(n_m_k[1])
	k_list.append(n_m_k[2])
	tables.append(list(map(int, input().split())))
for i in range(test_count):
	n = n_list[i]
	m = m_list[i]
	k = k_list[i]
	table = tables[i]
	can_do = True
	curr_pos = 0
	while curr_pos < n - 1:
		diff = table[curr_pos + 1] - table[curr_pos]
		if diff < k:
			if table[curr_pos] + diff - k < 0:
				m += table[curr_pos]
			else:
				m += -diff + k
			curr_pos += 1
		elif diff - m <= k:
			m -= diff - k
			curr_pos += 1
		else:
			can_do = False
			print('NO')
			break
	if can_do:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	no_of_blocks = m
	a = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) <= k:
			if a[i] >= a[i + 1]:
				no_of_blocks += abs(a[i] - a[i + 1])
				if a[i + 1] >= k:
					no_of_blocks += k
				else:
					no_of_blocks += a[i + 1]
			elif a[i + 1] - k >= 0:
				no_of_blocks += abs(k - abs(a[i] - a[i + 1]))
			else:
				no_of_blocks += a[i]
		elif a[i] >= a[i + 1]:
			no_of_blocks += abs(a[i] - a[i + 1])
			if a[i + 1] - k >= 0:
				no_of_blocks += k
			else:
				no_of_blocks += a[i + 1]
		else:
			no_of_blocks -= abs(abs(a[i + 1] - k) - a[i])
		if no_of_blocks < 0:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	s = list(map(int, input().split()))
	flag = True
	for j in range(n - 1):
		if s[j] - s[j + 1] >= -k:
			mx_pick = max(0, s[j + 1] - k)
			m += s[j] - mx_pick
		else:
			mn_lose = s[j + 1] - k
			m -= mn_lose - s[j]
			if m < 0:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	(n, m, k) = inpl()
	h = inpl()
	for i in range(n - 1):
		if h[i] + k >= h[i + 1]:
			tmp = max(0, h[i + 1] - k)
			m += h[i] - tmp
		else:
			need = h[i + 1] - k - h[i]
			if m < need:
				print('NO')
				break
			m -= need
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		if h[i] >= h[i + 1] - k:
			m += min(h[i] - (h[i + 1] - k), h[i])
		elif m >= h[i + 1] - k - h[i]:
			m -= h[i + 1] - k - h[i]
		else:
			print('NO')
			break
	else:
		print('YES')


R = lambda : list(map(int, input().split()))
t = int(input())

def dp_game(h, m, k):
	if len(h) == 1:
		print('YES')
		return
	elif abs(h[1] - h[0]) <= k:
		if h[1] <= k:
			m += h[0]
		else:
			m += h[0] + k - h[1]
		dp_game(h[1:], m, k)
	elif h[1] - h[0] > k:
		if h[1] - (h[0] + k) <= m:
			m -= h[1] - h[0] - k
			dp_game(h[1:], m, k)
		else:
			print('NO')
			return
	elif h[0] - h[1] > k:
		if h[1] <= k:
			m += h[0]
		else:
			m += h[0] + k - h[1]
		dp_game(h[1:], m, k)
	else:
		print('NO')
		return
for i in range(t):
	(n, m, k) = R()
	h = R()
	dp_game(h, m, k)


T = int(input())
for tc in range(T):
	(N, M, K) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	bag = M
	for i in range(N - 1):
		if arr[i] - arr[i + 1] >= -K:
			min_value = max(0, arr[i + 1] - K)
			pick = arr[i] - min_value
			bag += pick
		else:
			min_value = max(0, arr[i + 1] - K)
			place = min_value - arr[i]
			bag -= place
			if bag < 0:
				print('NO')
				break
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		m += a[i] - max(0, a[i + 1] - k)
		if m < 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for w in range(int(input())):
	(n, m, k) = tuple(map(int, input().split()))
	h = list(map(int, input().split()))
	count = 0
	c = 0
	for i in range(n - 1):
		if m < 0:
			c = 1
			break
		if abs(h[i] - h[i + 1]) > k:
			if h[i] <= h[i + 1]:
				m -= abs(h[i] - h[i + 1]) - k
			else:
				m += abs(h[i] - h[i + 1]) + min(k, h[i + 1])
		elif h[i] <= h[i + 1]:
			m += min(k - abs(h[i] - h[i + 1]), h[i + 1] - abs(h[i] - h[i + 1]))
		else:
			m += min(k, h[i + 1]) + abs(h[i] - h[i + 1])
		if m < 0:
			c = 1
			break
	if c == 1 or m < 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	pos = True
	for i in range(n - 1):
		m += min(h[i] + k - h[i + 1], h[i])
		pos = pos and m >= 0
	print('YES' if pos else 'NO')


t = int(input())
for w in range(t):
	(n, m, k) = map(int, input().split())
	f = 0
	l = []
	a = [int(i) for i in input().split()]
	for i in range(n - 1):
		m += a[i] - max(0, a[i + 1] - k)
		if m < 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	arr = [int(num) for num in input().split(' ', n - 1)]
	for i in range(0, n - 1):
		m += arr[i]
		m -= max(0, arr[i + 1] - k)
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout
input = stdin.readline
p = int(input())
for i in range(0, p):
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	f = 0
	for i in range(0, n - 1):
		m = m + (a[i] - max(0, a[i + 1] - k))
		if m < 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


def solve():
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if a[i] >= a[i + 1] - k:
			m += min(a[i], a[i] - max(a[i + 1] - k, 0))
			continue
		elif a[i] + m < a[i + 1] - k:
			print('NO')
			return
		else:
			m -= max(0, a[i + 1] - k - a[i])
	print('YES')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	ns = list(map(int, input().split()))
	c = False
	for i in range(n - 1):
		m += ns[i] - max(ns[i + 1] - k, 0)
		if m < 0:
			c = True
			break
	print('YNEOS'[c::2])


g = int(input())
for i in range(g):
	(n, m, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	i = 0
	count = 0
	c = 0
	while i < n - 1:
		temp = a[i]
		temp1 = max(0, a[i + 1] - k)
		if a[i] > temp1:
			m += temp - temp1
		else:
			m -= abs(temp1 - temp)
		i += 1
		if m < 0:
			c = 1
			break
	print(('YES', 'NO')[c == 1])


t = int(input())
for i in range(t):
	txt = input().split()
	n = int(txt[0])
	m = int(txt[1])
	k = int(txt[2])
	col = input().split()
	pre = int(col[0])
	win = True
	for j in range(1, n):
		cur = int(col[j])
		num = max(cur - k, 0) - pre
		pre = cur
		m -= num
		if m < 0:
			win = False
	if win:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	result = True
	for i in range(n - 1):
		if h[i + 1] - h[i] > k + m:
			result = False
			break
		elif h[i] + k > h[i + 1]:
			m += h[i] - h[i + 1] + min(k, h[i + 1])
		elif h[i + 1] > h[i] + k:
			m -= h[i + 1] - h[i] - k
			if m < 0:
				result = False
				break
		else:
			pass
	if result:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(N, M, K) = map(int, input().split())
	H = list(map(int, input().split()))
	if N == 1:
		print('YES')
		continue
	for (a, b) in zip(H, H[1:]):
		if a + M < b - K:
			print('NO')
			break
		elif a < b - K:
			M -= b - K - a
		else:
			M += min(a, a - (b - K))
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		m += h[i] - max(0, h[i + 1] - k)
		if m < 0:
			print('NO')
			break
	if m >= 0:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = [int(x) for x in input().split()]
	heights = [int(x) for x in input().split()]
	ans = 'YES'
	for i in range(n - 1):
		m = heights[i] + m - max(0, heights[i + 1] - k)
		if m < 0:
			ans = 'NO'
			break
	print(ans)


t = int(input())
l2 = []
for i in range(t):
	(n, m, k) = map(int, input().split())
	c1 = m
	flag = 0
	l1 = [int(a) for a in input().split()]
	for j in range(n - 1):
		if l1[j] >= l1[j + 1] - k:
			if l1[j + 1] - k <= 0:
				c1 += l1[j]
			else:
				c1 += l1[j] - l1[j + 1] + k
		else:
			a1 = l1[j + 1] - l1[j] - k
			if c1 >= a1:
				c1 -= a1
			else:
				flag = 1
				break
	if flag == 1:
		l2.append('NO')
	else:
		l2.append('YES')
for k in range(t):
	print(l2[k])


t = int(input())
for _ in range(t):
	flag = 1
	(n, m, k) = map(int, input().split())
	hts = list(map(int, input().split()))
	for i in range(n - 1):
		a = hts[i + 1] + k
		b = hts[i + 1] - k
		if b < 0:
			b = 0
		if b > hts[i]:
			m -= b - hts[i]
		else:
			m += hts[i] - b
		if m < 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	possible = True
	(n, m, k) = list(map(int, input().split()))
	arr = input().split()
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	maxBlocks = m
	for j in range(1, n):
		if arr[j] - arr[j - 1] > maxBlocks + k:
			possible = False
		elif arr[j - 1] >= arr[j] - k:
			maxBlocks += min(arr[j - 1] - max(arr[j] - k, 0), arr[j - 1])
		elif arr[j - 1] < arr[j] - k:
			maxBlocks -= abs(arr[j] - arr[j - 1]) - k
	if possible:
		print('YES')
	else:
		print('NO')


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m, k) = [int(x) for x in inp().split()]
	h = [int(x) for x in inp().split()]
	for i in range(n - 1):
		m += min(h[i], h[i] - (h[i + 1] - k))
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	Height = [int(x) for x in input().split()]
	flag = 0
	for i in range(len(Height) - 1):
		if Height[i + 1] - Height[i] > 0:
			if Height[i + 1] - Height[i] <= k:
				m += min(Height[i], Height[i] - (Height[i + 1] - k))
			else:
				Needed = Height[i + 1] - k - Height[i]
				if m >= Needed:
					m -= Needed
				else:
					print('NO')
					flag = 1
					break
		elif Height[i + 1] == Height[i]:
			m += min(k, Height[i])
		else:
			m += min(Height[i], Height[i] - (Height[i + 1] - k))
	if flag == 0:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			m += a[i] - (max(k, a[i + 1]) - k)
		elif abs(a[i] - a[i + 1]) <= k:
			m += a[i] - (max(a[i + 1], k) - k)
			continue
		else:
			need = abs(a[i + 1] - a[i]) - k
			if need > m:
				flag = 1
				break
			else:
				m -= need
	ans = 'YES' if not flag else 'NO'
	print(ans)


import sys
t = int(input())
for i in range(0, t):
	l = [int(j) for j in sys.stdin.readline().rstrip().split(' ')]
	n = l[0]
	m = l[1]
	k = l[2]
	ln = [int(j) for j in sys.stdin.readline().rstrip().split(' ')]
	f = True
	for j in range(1, len(ln)):
		oln = ln[j]
		if ln[j - 1] > ln[j]:
			m += ln[j - 1] - max(0, ln[j] - k)
		elif ln[j] >= ln[j - 1] - k:
			m += ln[j - 1] - max(0, ln[j] - k)
		else:
			m -= ln[j] - ln[j - 1] - k
		if m < 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


test = int(input())
for t in range(test):
	(n, m, k) = map(int, input().split())
	arr = input().split()
	flag = 0
	for i in range(n - 1):
		if int(arr[i]) >= int(arr[i + 1]):
			m += int(arr[i]) - int(arr[i + 1]) + min(k, int(arr[i + 1]))
		else:
			x = int(arr[i + 1]) - int(arr[i])
			if x > k:
				m -= x - k
			else:
				m += min(k - x, int(arr[i]))
			if m < 0:
				flag = 1
				break
	if flag == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	f = True
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(1, n):
		m += h[i - 1] - max(h[i] - k, 0)
		if m < 0:
			print('NO')
			f = False
			break
	if f:
		print('YES')


t = int(input())
while t > 0:
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	for i in range(n - 1):
		if l[i] > max(l[i + 1] - k, 0):
			m += l[i] - max(l[i + 1] - k, 0)
		elif max(l[i + 1] - k, 0) - l[i] <= m:
			m -= max(l[i + 1] - k, 0) - l[i]
		else:
			c = 1
	if c == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


for _ in range(int(input())):
	(n, m, k) = [int(i) for i in input().split()]
	h = [int(i) for i in input().split()]
	ans = 'YES'
	for i in range(n - 1):
		if h[i] < h[i + 1] and h[i + 1] - (h[i] + m) > k:
			ans = 'NO'
			break
		m += h[i] - max(h[i + 1] - k, 0)
	print(ans)


for _ in range(int(input())):
	(col, block, diff) = map(int, input().split())
	heights = list(map(int, input().split()))
	for i in range(1, col):
		z = max(heights[i] - diff, 0) - heights[i - 1]
		if z > block:
			print('NO')
			break
		block -= z
	else:
		print('YES')


for i in range(int(input())):
	ans = 0
	(n, m, k) = map(int, input().split())
	col = list(map(int, input().split()))
	for j in range(n - 1):
		m += col[j]
		if col[j + 1] > k:
			m -= col[j + 1] - k
		if m < 0:
			ans = 1
			break
	print('YNEOS'[ans::2])


def main():
	t = int(input())
	for __ in range(t):
		(n, m, k) = map(int, input().split())
		h = list(map(int, input().split()))
		i = 0
		flag = True
		while i + 1 < n:
			m += h[i] - max(0, h[i + 1] - k)
			if m < 0:
				flag = False
				break
			i += 1
		if flag:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for tt in range(t):
	(n, m, k) = map(int, input().split())
	l = [*map(int, input().split())]
	for i in range(n - 1):
		m += l[i] - max(0, l[i + 1] - k)
		if m < 0:
			print('NO')
			break
	if m >= 0:
		print('YES')


from sys import stdin
input = stdin.readline

def solve(n, bag, k, h):
	for i in range(n - 1):
		if h[i] >= h[i + 1] - k:
			bag += min(h[i], h[i] - (h[i + 1] - k))
		else:
			bag -= h[i + 1] - k - h[i]
			if bag < 0:
				return 'NO'
	return 'YES'
t = int(input())
while t:
	t -= 1
	(n, bag, k) = map(int, input().split())
	h = list(map(int, input().split()))
	print(solve(n, bag, k, h))


t = int(input())
f = []
for i in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ans = 'YES'
	for j in range(n - 1):
		m += min(k + h[j] - h[j + 1], h[j])
		if m < 0:
			ans = 'NO'
			break
	f += [ans]
for i in f:
	print(i)


t = int(input())
for tt in range(t):
	(n, m, k) = list(map(int, input().split()))
	hl = list(map(int, input().split()))
	yes = True
	for p in range(n - 1):
		d = hl[p] - max([hl[p + 1] - k, 0])
		m += d
		if m < 0:
			yes = False
			break
	print('YES' if yes else 'NO')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, m, k) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	ans = True
	for i in range(n - 1):
		low = max(0, l[i + 1] - k)
		val = max(0, l[i] - low)
		m += val
		l[i] -= val
		val = max(0, low - l[i])
		l[i] += val
		m -= val
		if m < 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	ok = True
	h = list(map(int, input().split()))
	for i in range(n - 1):
		hi = max(h[i + 1] - k, 0)
		if h[i] > hi:
			m += h[i] - hi
		elif m >= hi - h[i]:
			m -= hi - h[i]
		else:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for (h1, h2) in zip(h, h[1:]):
		m += min(h1, h1 - h2 + k)
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	r = list(map(int, input().split()))
	c = m
	f = False
	for i in range(n - 1):
		t = max(r[i + 1] - k, 0)
		if r[i] > t:
			c += r[i] - t
			r[i] = t
		else:
			c -= t - r[i]
			r[i] = t
		if c < 0:
			f = True
			break
	if f:
		print('NO')
	else:
		print('YES')


a = int(input())
for i in range(a):
	flag = 1
	info = [int(i) for i in input().split()]
	hight = [int(i) for i in input().split()]
	for l in range(info[0] - 1):
		if hight[l] + info[2] >= hight[l + 1]:
			boop = hight[l] + info[2] - hight[l + 1]
			if boop <= hight[l]:
				info[1] += boop
			else:
				info[1] += hight[l]
		else:
			boop = hight[l + 1] - (hight[l] + info[2])
			if boop <= info[1]:
				info[1] -= boop
			else:
				flag = 0
				print('NO')
				break
	if flag:
		print('YES')


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	p = 1
	for i in range(n - 1):
		if a[i] > a[i + 1]:
			m += a[i] - a[i + 1]
			a[i] = a[i + 1]
		dif = abs(a[i] - a[i + 1])
		need = dif - k
		if dif > k:
			if m < need:
				print('NO')
				p = 0
				break
			else:
				m -= need
				a[i] += need
		dif = abs(a[i] - a[i + 1])
		take = k - dif
		m += min(take, a[i])
	if p:
		print('YES')


cases = int(input())
for i in range(cases):
	(n, bag, k) = list(map(int, input().split()))
	col = list(map(int, input().split()))
	ans = True
	for i in range(0, n - 1):
		diff = col[i] - col[i + 1]
		if diff < -k:
			bag -= abs(k - abs(diff))
		elif diff >= 0:
			bag += min(diff + k, col[i])
		elif diff < 0:
			bag += min(k - abs(diff), col[i])
		if bag < 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		lim = max(0, h[i + 1] - k)
		if h[i] >= lim:
			m += h[i] - lim
		else:
			m -= lim - h[i]
			if m < 0:
				flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = [int(s) for s in input().split()]
	for i in range(n - 1):
		if h[i] >= h[i + 1] - k:
			if h[i + 1] - k >= 0:
				m += h[i] - h[i + 1] + k
			else:
				m += h[i]
		elif h[i + 1] - k - h[i] <= m:
			m -= h[i + 1] - k - h[i]
		else:
			print('NO')
			break
	else:
		print('YES')


for T in range(int(input())):
	(n, m, k) = [int(x) for x in input().split()]
	h = [int(x) for x in input().split()]
	flag = 0
	for i in range(1, n):
		req = max(0, h[i] - k)
		if h[i - 1] >= req:
			m += h[i - 1] - req
		elif m + h[i - 1] >= req:
			m -= req - h[i - 1]
			m = max(0, m)
		else:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, m, k) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	f = 1
	for i in range(n - 1):
		h1 = a[i]
		h2 = a[i + 1]
		if h1 >= h2:
			target = max(0, h2 - k)
			m += h1 - target
		else:
			target = max(0, h2 - k)
			if m < target - h1:
				f = 0
				break
			m -= target - h1
	print('YES' if f else 'NO')


def main():
	import sys
	input = sys.stdin.readline

	def solve():
		(n, m, k) = map(int, input().split())
		arr = list(map(int, input().split()))
		curr = m
		for i in range(n - 1):
			diff = arr[i] - max(0, arr[i + 1] - k)
			curr += diff
			if curr < 0:
				print('NO')
				return
		print('YES')
		return
	for _ in range(int(input())):
		solve()
	return 0
main()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		(n, m, k) = mi()
		h = li()
		flag = 1
		for i in range(n - 1):
			C = max(0, h[i + 1] - k)
			if h[i] > C:
				m += h[i] - C
			else:
				m -= C - h[i]
			if m < 0:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def sol(n, m, k, arr):
	for i in range(n - 1):
		if m < 0:
			print('NO')
			return
		m += arr[i] - max(0, arr[i + 1] - k)
	if m < 0:
		print('NO')
	else:
		print('YES')
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	sol(n, m, k, arr)


t = int(input())

def solve(n, m, k, l):
	dp = [-1 for x in range(n + 1)]
	dp[0] = m
	for i in range(1, n + 1):
		x = max(l[i] - k, 0)
		x = l[i - 1] - x
		dp[i] = dp[i - 1] + x
		if dp[i] < 0:
			return 'NO'
	return 'YES'
for _ in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.append(-1)
	print(solve(n, m, k, l))


def is_winable(m, h, k):
	for i in range(1, n):
		m -= max(-h[i - 1], h[i] - h[i - 1] - k)
		if m < 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	print(is_winable(m, h, k))


def main():
	t = int(input())
	for _ in range(t):
		(n, m, k) = map(int, input().split())
		hlist = list(map(int, input().split()))
		for (prevh, h) in zip(hlist, hlist[1:]):
			if h - k > prevh:
				if m < h - k - prevh:
					print('NO')
					break
				else:
					m -= h - k - prevh
			elif h - k < 0:
				m += prevh
			elif prevh >= h:
				m += prevh - h + k
			else:
				m += k - (h - prevh)
		else:
			print('YES')
main()


def win_game(n, m, k, l):
	for i in range(1, n):
		if l[i - 1] < l[i] - k:
			if m < l[i] - k - l[i - 1]:
				return 'NO'
			else:
				m = m - (l[i] - k - l[i - 1])
		else:
			m += min(l[i - 1], l[i - 1] - l[i] + k)
	return 'YES'
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	print(win_game(n, m, k, l))


import os
import sys
from io import BytesIO, IOBase
import math
from itertools import permutations
from decimal import Decimal, getcontext
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, m, k) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	ans = 'YES'
	for i in range(n - 1):
		if l[i] >= max(l[i + 1] - k, 0):
			ad = max(l[i + 1] - k, 0)
			m += l[i] - ad
		elif l[i] < l[i + 1] - k:
			if m < l[i + 1] - k - l[i]:
				ans = 'NO'
				break
			m -= l[i + 1] - k - l[i]
	print(ans)


for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	f = 0
	for i in range(n - 1):
		if h[i] >= h[i + 1]:
			m += h[i] - h[i + 1]
			h[i] = h[i + 1]
			m += min(k, h[i])
		else:
			gap = h[i + 1] - h[i]
			if k >= gap:
				m += min(h[i], k - gap)
			else:
				gap = abs(k - gap)
				m -= gap
				if m < 0:
					f = 1
					break
	if f == 0:
		print('YES')
	else:
		print('NO')


def answer():
	(n, m, k) = list(map(int, input().split(' ')))
	h_list = list(map(int, input().split(' ')))
	for i in range(n - 1):
		h0 = h_list[i]
		h1 = h_list[i + 1]
		if h1 - (m + h0) > k:
			return 'NO'
		changed_h0 = max(h1 - k, 0)
		add_m = h0 - changed_h0
		m += add_m
	return 'YES'
n = int(input())
for _ in range(n):
	out = answer()
	print(out)


import sys

def solve(H, m, k):
	for i in range(len(H) - 1):
		m += min(H[i] - H[i + 1] + k, H[i])
		if m < 0:
			return False
	return True
in_file = sys.stdin
t = int(in_file.readline().strip())
for _ in range(t):
	(n, m, k) = map(int, in_file.readline().strip().split())
	H = list(map(int, in_file.readline().strip().split()))
	if solve(H, m, k):
		sys.stdout.write('YES\n')
	else:
		sys.stdout.write('NO\n')
sys.stdout.flush()


def check(n, m, k, l):
	count = m
	for i in range(n - 1):
		if count < 0:
			return False
		count += l[i] - max(l[i + 1] - k, 0)
	if count < 0:
		return False
	return True
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if check(n, m, k, l):
		print('YES')
	else:
		print('NO')


query = int(input())
for q in range(query):
	(n, m, k) = map(int, input().split())
	ns = list(map(int, input().split()))
	for i in range(n - 1):
		m += ns[i] - max(ns[i + 1] - k, 0)
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = [int(i) for i in input().split()]
	for i in range(n):
		if i == n - 1:
			break
		dist = abs(h[i] - h[i + 1])
		if h[i] >= h[i + 1] and dist >= 0:
			h[i] -= dist
			m += dist
			dist = 0
		elif h[i] < h[i + 1] and dist > k:
			mn = min(dist, m)
			h[i] += mn
			m -= mn
			dist = abs(h[i] - h[i + 1])
			if dist > k:
				print('NO')
				break
		if dist < k:
			mn = min(h[i], k - dist)
			h[i] -= mn
			m += mn
	if i == n - 1:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split(' '))
	h = list(map(int, input().split(' ')))
	flag = 0
	for j in range(n - 1):
		m += min(k + h[j] - h[j + 1], h[j])
		if m < 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for j in range(t):
	data = input().split(' ')
	n = int(data[0])
	m = int(data[1])
	k = int(data[2])
	posible = True
	ns = [int(x) for x in input().split(' ')]
	sum = m
	for i in range(n - 1):
		delta = ns[i] - ns[i + 1] + k
		if delta > ns[i]:
			sum += ns[i]
		else:
			sum += delta
		if sum < 0:
			posible = False
			break
	if posible:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	hi = None
	for hi1 in map(int, input().split()):
		if hi is not None:
			m += hi
			if m + k < hi1:
				print('NO')
				break
			if hi1 > k:
				m -= hi1 - k
		hi = hi1
	else:
		print('YES')


res = []
T = int(input())
for t in range(T):
	false_case = 0
	(n, m, k) = map(int, input().split())
	h = [int(k) for k in input().split()]
	for i in range(1, n):
		if abs(h[i] - h[i - 1]) <= k:
			if h[i] - k > 0:
				m += h[i - 1] - (h[i] - k)
			else:
				m += h[i - 1]
		elif h[i - 1] > h[i]:
			if h[i] - k > 0:
				m += h[i - 1] - (h[i] - k)
			else:
				m += h[i - 1]
		elif h[i - 1] < h[i]:
			if h[i] - k - h[i - 1] <= m:
				m -= h[i] - k - h[i - 1]
			else:
				false_case += 1
				res.append('NO')
				break
	if false_case == 0:
		res.append('YES')
for i in res:
	print(i)


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = ''
	for i in range(n - 1):
		req = max(a[i + 1] - k, 0)
		if a[i] >= req:
			m += a[i] - req
		elif a[i] + m < req:
			print('NO')
			break
		else:
			m -= req - a[i]
	else:
		print('YES')


for zapr in range(int(input())):
	(_, bag, jump) = map(int, input().split())
	a = list(map(int, input().split()))
	can = 'YES'
	for i in range(len(a) - 1):
		if a[i] + jump >= a[i + 1]:
			bag += a[i] - max(a[i + 1] - jump, 0)
		elif a[i] + jump + bag >= a[i + 1]:
			bag -= a[i + 1] - a[i] - jump
		else:
			can = 'NO'
			break
	print(can)


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getArr():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
T = getInt()
for _ in range(T):
	(N, M, K) = getVars()
	H = getArr()
	res = 'YES'
	for i in range(N - 1):
		if H[i + 1] > H[i] + M + K:
			res = 'NO'
			break
		if H[i + 1] > H[i] + K:
			M -= H[i + 1] - (H[i] + K)
		else:
			M += min(H[i] + K - H[i + 1], H[i])
	print(res)


import sys

def triumph(col, bag, k):
	col_ht = list(map(int, sys.stdin.readline().strip().split()))
	col -= 1
	for i in range(col):
		if col_ht[i] < col_ht[i + 1] - k:
			bag -= col_ht[i + 1] - k - col_ht[i]
			if bag < 0:
				return 'No'
		else:
			bag += min(col_ht[i] - (col_ht[i + 1] - k), col_ht[i])
	return 'Yes'
test = int(input())
for i in range(test):
	(col, bag, k) = map(int, sys.stdin.readline().split())
	print(triumph(col, bag, k))


def blockadventure(n, m, k, h):
	for i in range(n - 1):
		r = max(0, h[i + 1] - k)
		m += h[i] - r
		if m < 0:
			return 'NO'
	return 'YES'
t = int(input())
for tt in range(t):
	arr = list(map(int, input().rstrip().split()))
	n = arr[0]
	m = arr[1]
	k = arr[2]
	a = list(map(int, input().rstrip().split()))
	ans = blockadventure(n, m, k, a)
	print(ans)


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	pre = h[0]
	for j in range(1, n):
		if h[j] >= pre:
			if h[j] - pre - m > k:
				print('NO')
				break
			elif abs(h[j] - pre) <= k:
				m += pre - max(0, h[j] - k)
				pre = h[j]
			else:
				m -= h[j] - k - pre
				pre = h[j]
		else:
			m += pre - max(0, h[j] - k)
			pre = h[j]
	else:
		print('YES')


x = int(input())
z = 0
l = []
d = []
while z < x:
	(c, bag, can) = map(int, input().split())
	p = c
	for p in map(int, input().split()):
		l.append(p)
	if c == 1:
		d.append('YES')
	f = 0
	while f < len(l) - 1:
		if l[f] >= l[f + 1]:
			if l[f + 1] < can:
				bag += l[f]
			else:
				bag += l[f] - l[f + 1] + can
			f += 1
		elif l[f] < l[f + 1]:
			if l[f + 1] <= can:
				bag += l[f]
				f += 1
			else:
				l[f] += can
				if l[f + 1] - l[f] <= bag:
					bag -= l[f + 1] - l[f]
					f += 1
				else:
					d.append('NO')
					break
		if f == len(l) - 1:
			d.append('YES')
	z += 1
	l = []
h = 0
while h < len(d):
	print(d[h])
	h += 1


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	bag = m
	possible = True
	i = 0
	while i < n - 1:
		if a[i] >= a[i + 1]:
			bag += a[i] - a[i + 1]
			if a[i + 1] >= k:
				bag += k
			else:
				bag += a[i + 1]
			i += 1
		elif a[i + 1] - a[i] <= k:
			if a[i + 1] > k:
				bag += k - a[i + 1] + a[i]
			else:
				bag += a[i]
			i += 1
		elif a[i + 1] - a[i] - k > bag:
			possible = False
			break
		else:
			bag -= a[i + 1] - a[i] - k
			i += 1
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ch = 1
	for i in range(n - 1):
		diff = abs(h[i] - h[i + 1])
		if 0 <= diff <= k:
			if h[i] >= h[i + 1]:
				m += diff
				h[i] -= diff
				if h[i] - k < 0:
					m += h[i]
				else:
					m += k
			else:
				netdif = k - diff
				if h[i] - netdif < 0:
					m += h[i]
				else:
					m += netdif
		elif h[i] > h[i + 1]:
			m += diff
			h[i] -= diff
			if h[i] - k < 0:
				m += h[i]
			else:
				m += k
		else:
			req = diff - k
			if req > m:
				ch = 0
				break
			else:
				m -= req
	if ch:
		print('YES')
	else:
		print('NO')


def mapit():
	temp = list(map(int, input().split()))
	return temp

def solution():
	(n, m, k) = mapit()
	arr = mapit()
	curr = m
	for i in range(n - 1):
		curr += arr[i] - max(0, arr[i + 1] - k)
		if curr < 0:
			print('NO')
			return
	print('YES')
	return
t = int(input())
while t:
	t -= 1
	solution()


for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	now = m
	fl = True
	for i in range(n - 1):
		l = max(0, arr[i + 1] - k)
		now += arr[i] - l
		if now < 0:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


for test in range(int(input())):
	(n, m, k) = [int(x) for x in input().split()]
	h = [int(x) for x in input().split()]
	index = 0
	while index != n - 1:
		m += h[index] - max(0, h[index + 1] - k)
		index += 1
		if m < 0:
			print('NO')
			index = -1
			break
	if index == n - 1:
		print('YES')


def main():
	(n, m, k) = map(int, input().split())
	bollars = list(map(int, input().split()))
	for i in range(n - 1):
		if bollars[i] - bollars[i + 1] > k:
			if bollars[i + 1] - k < 0:
				m += bollars[i]
			else:
				m += bollars[i] - bollars[i + 1] + k
		elif bollars[i + 1] - bollars[i] > k:
			m -= bollars[i + 1] - bollars[i] - k
			if m < 0:
				print('NO')
				return
		elif bollars[i] == bollars[i + 1]:
			if k <= bollars[i]:
				m += k
			else:
				m += bollars[i]
		elif 0 < bollars[i] - bollars[i + 1] == k:
			if bollars[i] >= 2 * k:
				m += 2 * k
			else:
				m += bollars[i]
		elif 0 < bollars[i + 1] - bollars[i] == k:
			pass
		elif 0 < bollars[i + 1] - bollars[i] < k:
			if bollars[i + 1] > k:
				m += k - (bollars[i + 1] - bollars[i])
			else:
				m += bollars[i]
		elif 0 < bollars[i] - bollars[i + 1] < k:
			if bollars[i + 1] > k:
				m += bollars[i] - bollars[i + 1] + k
			else:
				m += bollars[i]
	print('YES')
t = int(input())
for i in range(t):
	main()


t = int(input())
while t:
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	prefxr = list()
	ch = 1
	prefxr.append(m)
	for i in range(n - 1):
		if h[i + 1] >= h[i]:
			if h[i + 1] - h[i] - k <= 0:
				p = (h[i + 1] - h[i] - k) * -1
				if p > h[i]:
					p = h[i]
				prefxr.append(prefxr[i] + p)
			else:
				p = h[i + 1] - h[i] - k
				prefxr.append(prefxr[i] - p)
		else:
			p = h[i] - h[i + 1] + k
			if p > h[i]:
				p = h[i]
			prefxr.append(prefxr[i] + p)
		if prefxr[i + 1] < 0:
			ch = 0
			break
	if ch == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	nmk = [int(c) for c in input().split()]
	hi = [int(c) for c in input().split()]
	if nmk[0] == 1:
		print('YES')
		continue
	else:
		h = 'YES'
		for j in range(nmk[0] - 1):
			if hi[1 + j] <= nmk[2]:
				nmk[1] += hi[j]
			else:
				nmk[1] += hi[j] - (hi[1 + j] - nmk[2])
			if nmk[1] < 0:
				h = 'NO'
		print(h)


def main():
	q = int(input())
	for x in range(q):
		(n, m, k) = map(int, input().split())
		tab = list(map(int, input().split()))
		yess = True
		for x in range(n - 1):
			if tab[x] >= tab[x + 1]:
				m += abs(tab[x] - tab[x + 1])
				tab[x] -= abs(tab[x] - tab[x + 1])
				m += min(k, tab[x])
			elif tab[x] < tab[x + 1]:
				if abs(tab[x] - tab[x + 1]) > k:
					if abs(tab[x] - tab[x + 1]) - k > m or m < 0:
						yess = False
						break
					else:
						m -= abs(tab[x] - tab[x + 1]) - k
				else:
					m += min(tab[x], k - abs(tab[x] - tab[x + 1]))
		if yess:
			print('YES')
		else:
			print('NO')
main()


for t in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	total = m
	printed = False
	for i in range(n - 1):
		total = total + (h[i] - max(0, h[i + 1] - k))
		if total < 0:
			print('NO')
			printed = True
			break
	if not printed:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	tag = True
	for i in range(1, n):
		if a[i - 1] - a[i] >= -k:
			m += min(a[i - 1], a[i - 1] - (a[i] - k))
		else:
			x = a[i] - k - a[i - 1]
			if m >= x:
				m = m - x
			else:
				print('NO')
				tag = False
				break
	if tag:
		print('YES')


from sys import stdin
t = int(stdin.readline().strip())
for case in range(t):
	(n, m, k) = map(int, stdin.readline().strip().split())
	s = list(map(int, stdin.readline().strip().split()))
	t = True
	for j in range(n):
		if j != n - 1:
			x = max(s[j] - max(s[j + 1] - k, 0), 0)
			m += max(s[j] - max(s[j + 1] - k, 0), 0)
			s[j] -= x
			y = max(max(s[j + 1] - k, 0) - s[j], 0)
			m -= y
			if m < 0:
				t = False
			s[j] += y
			if abs(s[j + 1] - s[j]) > k:
				t = False
	if t:
		print('YES')
	else:
		print('NO')


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys, math
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))
	out = sys.stdout.write
	INF = float('INF')
	mod = int(1000000000.0) + 7
	for t in range(int(data())):
		(n, m, k) = mdata()
		h = mdata()
		flag = True
		for i in range(1, n):
			if h[i] - h[i - 1] > 0:
				m += min(k - (h[i] - h[i - 1]), h[i - 1])
			else:
				m += min(k, h[i]) + h[i - 1] - h[i]
			if m < 0:
				flag = False
				break
		if flag == True:
			print('YES')
		else:
			print('NO')
main()


from collections import defaultdict as DD
from bisect import bisect_left as BL
from bisect import bisect_right as BR
from itertools import combinations as IC
from itertools import permutations as IP
from random import randint as RI
import sys
MOD = pow(10, 9) + 7

def IN(f=0):
	if f == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
tc = IN(1)
for _ in range(tc):
	(n, m, k) = IN()
	h = IN()
	f = 1
	for i in range(n - 1):
		if abs(h[i] - h[i + 1]) <= k:
			m += max(h[i] - max(h[i + 1] - k, 0), 0)
			continue
		elif h[i] >= h[i + 1]:
			m += max(h[i] - max(h[i + 1] - k, 0), 0)
			continue
		elif m >= h[i + 1] - k - h[i]:
			m -= max(max(h[i + 1] - k - h[i], 0), 0)
			continue
		else:
			f = 0
			break
	if n == 1:
		print('YES')
	elif i == n - 2 and f == 1:
		print('YES')
	else:
		print('NO')


import sys
inp = sys.stdin

def process_test():
	(n, m, k) = map(int, inp.readline().split())
	h = list(map(int, inp.readline().split()))
	solve(n, m, k, h)

def solve(n, m, k, h):
	for i in range(n - 1):
		diff = h[i] + m - max(0, h[i + 1] - k)
		m = diff
		if diff < 0:
			print('NO')
			return None
	print('YES')
num_tests = int(inp.readline().rstrip())
for t in range(num_tests):
	process_test()


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	flag = 0
	l = list(map(int, input().split()))
	for i in range(n - 1):
		z = abs(l[i] - l[i + 1])
		if z <= k:
			m += min(k - (l[i + 1] - l[i]), l[i])
		elif l[i] >= l[i + 1]:
			m += min(k - (l[i + 1] - l[i]), l[i])
		elif m >= abs(z - k):
			m -= abs(z - k)
		else:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	H = list(map(int, input().split()))
	ans = 'YES'
	for i in range(n - 1):
		h1 = H[i]
		h2 = H[i + 1]
		if h1 >= h2:
			if h2 >= k:
				m += h1 - h2 + k
			else:
				m += h1
		elif h2 > h1 + m + k:
			ans = 'NO'
			break
		elif h2 <= k:
			m += h1
		elif h2 - h1 <= k:
			m += k - (h2 - h1)
		else:
			m -= h2 - h1 - k
	print(ans)


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	c = list(map(int, input().split()))
	f = 0
	for i in range(0, n - 1):
		if c[i] + k + m < c[i + 1]:
			f = 1
		if c[i] + k > c[i + 1]:
			m += min(c[i], c[i] - c[i + 1] + k)
		else:
			m -= c[i + 1] - k - c[i]
	if f == 1:
		print('NO')
	else:
		print('YES')


import math
import functools

def s():
	(n, m, k) = list(map(int, input().split(' ')))
	h = list(map(int, input().split(' ')))
	if n == 1:
		print('YES')
	else:
		for i in range(0, n - 1):
			if abs(h[i] - h[i + 1]) <= k:
				if h[i + 1] < k:
					m += h[i]
				else:
					m += h[i] - h[i + 1] + k
			elif h[i] >= h[i + 1]:
				if h[i + 1] < k:
					m += h[i]
				else:
					m += h[i] - h[i + 1] + k
			else:
				m -= h[i + 1] - (k + h[i])
				if m < 0:
					print('NO')
					break
			if i == n - 2:
				print('YES')
t = int(input())
for i in range(t):
	s()


t = int(input())
for q in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	flag = 1
	for i in range(n - 1):
		d = h[i + 1] - h[i]
		if d > 0:
			if d < k:
				c = k - d
				h[i] -= c
				m += c
				if h[i] < 0:
					m -= abs(h[i])
					h[i] = 0
			else:
				d1 = d - k
				if m >= d1:
					m -= d1
				else:
					flag = 0
					break
		else:
			m += abs(d)
			h[i] = h[i + 1]
			m += min(h[i], k)
	if flag == 1:
		print('YES')
	else:
		print('NO')


def func(temp, h):
	(n, m, k) = temp
	step = 0
	while step < n - 1:
		error = h[step] - max(0, h[step + 1] - k)
		if error < 0 and -error <= m:
			m += error
		elif error >= 0:
			m += error
		else:
			return 'NO'
		step += 1
	return 'YES'

def main():
	t = int(input())
	for i in range(t):
		temp = [int(x) for x in input().split()]
		c = [int(x) for x in input().split()]
		print(func(temp, c))
main()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	s = list(map(int, input().split()))
	p = 1
	for i in range(n - 1):
		m += s[i] - max(0, s[i + 1] - k)
		if m < 0:
			p = 0
			break
	if p:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		m += a[i] - max(0, a[i + 1] - k)
		if m < 0:
			flag = 1
			break
	print('NO' if flag else 'YES')


R = lambda : map(int, input().split())
for _ in [0] * int(input()):
	(n, m, k) = R()
	h = (*R(),)
	l = 0
	for (x, y) in zip(h, h[1:]):
		m += x - max(0, y - k)
		l |= m
	print('YNEOS'[l < 0::2])


t = int(input())
for i in range(t):
	(n, m, k) = [int(j) for j in input().split()]
	lst = [int(j) for j in input().split()]
	if n == 1:
		print('YES')
	else:
		for x in range(n - 1):
			mid = lst[x + 1] - (lst[x] + k)
			if lst[x] + k >= lst[x + 1]:
				m += min(lst[x] + k - lst[x + 1], lst[x])
			elif lst[x] + k + m >= lst[x + 1]:
				m -= lst[x + 1] - lst[x] - k
			else:
				print('NO')
				break
		else:
			print('YES')


t = int(input())
while t:
	(n, m, k) = [int(a) for a in input().split()]
	ans = 'YES'
	lst = [int(a) for a in input().split()]
	for (i, j) in enumerate(lst):
		if i == len(lst) - 1:
			break
		else:
			b = j - max(0, lst[i + 1] - k)
		m = m + b
		if m < 0:
			ans = 'NO'
			break
	print(ans)
	t -= 1


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, m, k) = map(int, sys.stdin.readline().split())
	pillors = list(map(int, sys.stdin.readline().split()))
	if n <= 1:
		print('YES')
	else:
		flag = 1
		for i in range(1, n):
			req = max(pillors[i] - k, 0) - pillors[i - 1]
			m -= req
			if m < 0:
				flag = 0
				break
		print('YES' if flag else 'NO')


t = int(input())
for test in range(0, t):
	num_input = input()
	num_input = num_input.split(' ')
	n = int(num_input[0])
	m = int(num_input[1])
	k = int(num_input[2])
	height = input()
	height = height.split(' ')
	for i in range(0, len(height)):
		height[i] = int(height[i])
	cur = 0
	win = True
	for i in range(0, n - 1):
		if height[i] > height[i + 1]:
			m = m + height[i] - height[i + 1]
			if k >= height[i + 1]:
				m = m + height[i + 1]
			else:
				m = m + k
		elif height[i] == height[i + 1]:
			if k >= height[i + 1]:
				m = m + height[i + 1]
			else:
				m = m + k
		else:
			if height[i] + m + k < height[i + 1]:
				win = False
				break
			if height[i] + k < height[i + 1]:
				m = m - (height[i + 1] - (height[i] + k))
			elif k >= height[i + 1]:
				m = m + height[i]
			else:
				m = m + (height[i] + k - height[i + 1])
	if win == False:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	[n, m, k] = [int(x) for x in input().split()]
	h = [int(x) for x in input().split()]
	flag = True
	for j in range(0, n - 1):
		if h[j] > h[j + 1]:
			if h[j + 1] >= k:
				m += k + h[j] - h[j + 1]
			else:
				m += h[j]
		elif h[j] <= h[j + 1]:
			if h[j + 1] - h[j] <= k:
				m += k - (h[j + 1] - h[j]) if h[j + 1] >= k else h[j]
			elif m >= h[j + 1] - h[j] - k:
				m -= h[j + 1] - h[j] - k
			else:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	c = [*map(int, input().split())]
	ans = 'YES'
	for i in range(n - 1):
		t = max(0, c[i + 1] - k)
		z = c[i] - t
		if z >= 0:
			m += z
			c[i] = t
		else:
			z = abs(z)
			if z > m:
				ans = 'NO'
				break
			else:
				m -= z
				c[i] += z
	print(ans)


def can(n, m, k, h):
	for i in range(n - 1):
		if m + h[i] + k < h[i + 1]:
			return False
		if h[i] + k < h[i + 1]:
			m -= h[i + 1] - h[i] - k
		else:
			m += h[i] - max(0, h[i + 1] - k)
	return True
t = int(input())
for tc in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	print('YES' if can(n, m, k, h) else 'NO')


for nt in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 'YES'
	for i in range(1, n):
		if a[i] <= a[i - 1]:
			m += min(a[i - 1], a[i - 1] - a[i] + k)
		elif a[i - 1] >= a[i] - k:
			m += min(a[i - 1], a[i - 1] - (a[i] - k))
		else:
			m -= a[i] - k - a[i - 1]
		if m < 0:
			ans = 'NO'
			break
	print(ans)


import sys
input = sys.stdin.readline
testcases = int(input())
for test in range(testcases):
	(n, m, k) = list(map(int, input().split()))
	H = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	for i in range(n - 1):
		if H[i] > H[i + 1] - k:
			m += min(H[i], H[i] - (H[i + 1] - k))
		elif H[i] < H[i + 1] - k:
			m -= H[i + 1] - k - H[i]
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


import re
from collections import deque
from functools import reduce
from heapq import *
from itertools import permutations
from math import pi
from operator import itemgetter
from operator import mul
from operator import xor
from os import linesep

def fmatr(matrix, lnsep: str=linesep, fieldsep: str=' ') -> str:
	return lnsep.join(map(lambda row: fieldsep.join(map(str, row)), matrix))

def fbool(boolval: int) -> str:
	return ['No', 'Yes'][boolval]

def solve() -> None:
	(t, *tmp) = map(int, open(0).read().split())
	ans = [None] * t
	ti = 0
	for i in range(t):
		(n, m, k) = (tmp[ti], tmp[ti + 1], tmp[ti + 2])
		h = tmp[ti + 3:ti + 3 + n]
		ti = ti + 3 + n
		subans = True
		for j in range(1, n):
			shouldBeH = max([0, h[j] - k])
			dh = h[j - 1] - shouldBeH
			if dh < -m:
				subans = False
				break
			m += dh
		ans[i] = subans
	print(linesep.join(list(map(lambda bl: fbool(bl).upper(), ans))))
solve()


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().strip().split())
	h = [int(x) for x in input().strip().split()]
	flag = True
	for i in range(n - 1):
		m = m + (h[i] - max(0, h[i + 1] - k))
		if m < 0:
			print('NO')
			flag = False
			break
	if flag is True:
		print('YES')


a = int(input())
for i in range(a):
	(n, m, k) = map(int, input().split())
	z = list(map(int, input().split()))
	glag = 0
	for i in range(1, len(z)):
		if z[i] > z[i - 1]:
			if z[i] - z[i - 1] <= k:
				wood = max(z[i] - k, 0)
				m += z[i - 1] - wood
				continue
			else:
				temp = z[i] - z[i - 1]
				if temp - k <= m:
					m -= temp - k
				else:
					glag = 1
					break
		else:
			wood = max(z[i] - k, 0)
			m += z[i - 1] - wood
	if glag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m, k) = [int(x) for x in inp().split()]
	a = [int(x) for x in inp().split()]
	for i in range(n - 1):
		hDiff = a[i] - a[i + 1]
		if abs(hDiff) <= k:
			lowest = max(0 - k, -a[i + 1])
			m += abs(lowest - hDiff)
		elif a[i] < a[i + 1]:
			if m < abs(k - abs(hDiff)):
				print('NO')
				break
			m -= abs(k - abs(hDiff))
		else:
			lowest = max(0 - k, -a[i + 1])
			m += abs(lowest - hDiff)
	else:
		print('YES')


q = int(input())
for query in range(q):
	arr = [int(x) for x in input().split()]
	arr2 = [int(x) for x in input().split()]
	n = arr[0]
	m = arr[1]
	k = arr[2]
	pos = True
	for i in range(n - 1):
		l = arr2[i + 1] - arr2[i]
		g = l - k
		t = max(g, -arr2[i])
		m -= t
		if m < 0:
			pos = False
			break
	if pos == False:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	(n, m, k) = map(int, input().split())
	h = []
	h = list(map(int, input().split()))
	f = 1
	for i in range(n - 1):
		m = m + h[i] - max(0, h[i + 1] - k)
		if m < 0:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')
	t = t - 1


R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, m, k) = R()
	arr = list(R())
	success = 1
	for i in range(n - 1):
		if arr[i] >= max(0, arr[i + 1] - k):
			m += arr[i] - max(0, arr[i + 1] - k)
		else:
			m -= arr[i + 1] - k - arr[i]
		if m < 0:
			success = 0
			break
	print('YES' if success else 'NO')


t = int(input())
for _ in range(t):
	(n, m, k) = [int(x) for x in input().split(' ')]
	z = [int(x) for x in input().split(' ')]
	f = 0
	for i in range(1, n):
		if z[i] not in range(z[i - 1] + m + k + 1):
			f = 1
			break
		if z[i] >= k:
			a = z[i] - k
		else:
			a = 0
		m = m + z[i - 1] - a
	if f == 0:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import ceil, floor, sqrt, log2, gcd
from heapq import heappush, heappop
abc = 'bcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		if arr[i] < arr[i + 1] - k:
			diff = arr[i + 1] - k - arr[i]
			if diff > m:
				flag = 1
				break
			else:
				m -= diff
		else:
			diff = arr[i] - max(0, arr[i + 1] - k)
			m += diff
	if flag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, m, k) = map(int, stdin.readline().split())
		blocks = map(int, stdin.readline().split())
		cur_block = next(blocks)
		result = 'YES'
		for _ in range(n - 1):
			next_block = next(blocks)
			m += min(cur_block, k + (cur_block - next_block))
			if m < 0:
				result = 'NO'
				break
			cur_block = next_block
		print(result)
main()


import sys
import math as mt
t = int(input())
for __ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ch = 0
	for i in range(n - 1):
		if h[i + 1] > h[i]:
			if h[i + 1] - h[i] >= k:
				req = h[i + 1] - h[i] - k
				if req <= m:
					m -= req
				else:
					ch = 1
			else:
				req = k - h[i + 1] + h[i]
				m += min(h[i], req)
		else:
			req = h[i] - h[i + 1] + k
			m += min(req, h[i])
	if ch == 0:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : list(map(int, sys.stdin.readline().split()))

def main():
	(t,) = input()
	for _ in range(t):
		(n, m, k) = input()
		h = [0] + input()
		key = True
		for i in range(1, n):
			if h[i] < h[i + 1] - k:
				if m >= h[i + 1] - h[i] - k:
					m -= h[i + 1] - h[i] - k
				else:
					key = False
					break
			else:
				m += h[i] - max(h[i + 1] - k, 0)
		print('YES' if key else 'NO')
main()


def block_adventure(n, m, k, cols):
	blocks = m
	for (i, v) in enumerate(cols[1:], start=1):
		blocks += cols[i - 1] - max(v - k, 0)
		if blocks < 0:
			return False
	return True
t = int(input().strip())
for _ in range(t):
	(n, m, k) = map(int, input().strip().split())
	cols = list(map(int, input().strip().split()))
	if block_adventure(n, m, k, cols):
		print('YES')
	else:
		print('NO')


import random
import math
from collections import defaultdict
import itertools
from sys import stdin, stdout
import operator

def main():
	z = ''
	for _ in range(int(stdin.readline())):
		(n, m, k) = list(map(int, input().split()))
		h = list(map(int, input().split()))
		flag = 1
		for i in range(1, n):
			if h[i] <= h[i - 1]:
				p = h[i] - k
				if p < 0:
					p = 0
				m += h[i - 1] - p
			else:
				p = h[i] - k
				if p < 0:
					p = 0
				m += h[i - 1] - p
				if m < 0:
					print('NO')
					flag = 0
					break
		if flag == 1:
			print('YES')
main()


n = int(input())
for k in range(n):
	array1 = list(map(int, input().split()))
	a = list(map(int, input().split()))
	l = array1[0]
	diff = array1[-1]
	c = array1[1]
	if l > 1:
		for k in range(0, l - 1):
			c += a[k] - max(a[k + 1] - diff, 0)
			if c < 0:
				break
		if c < 0:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


t = int(input())
while t > 0:
	t = t - 1
	(n, m, k) = map(int, input().split())
	a = input()
	A = list(map(int, list(a.split())))
	flag = 0
	for i in range(n - 1):
		if abs(A[i] - A[i + 1]) < k:
			if A[i] < A[i + 1]:
				m = m + (A[i] - max(A[i + 1] - k, 0))
			else:
				m = m + (A[i] - max(A[i + 1] - k, 0))
		elif abs(A[i] - A[i + 1]) > k:
			if A[i] > A[i + 1]:
				m = m + (A[i] - max(A[i + 1] - k, 0))
			elif m >= A[i + 1] - k - A[i]:
				m = m - (A[i + 1] - k - A[i])
			else:
				print('No')
				flag = 1
				break
		elif abs(A[i] - A[i + 1]) == k:
			if A[i] > A[i + 1]:
				m = m + (A[i] - max(A[i + 1] - k, 0))
	if flag == 0:
		print('Yes')


b = int(input())
otv = []
for i in range(0, b):
	u = 0
	vesot = []
	(n, m, k) = map(int, input().split())
	vesot = list(map(int, input().split()))
	for j in range(0, n - 1):
		v = vesot[j] - vesot[j + 1]
		if v <= k and v >= 0 - k:
			h1 = v - (0 - k)
			if h1 > vesot[j]:
				m += vesot[j]
			else:
				m += h1
		elif v <= k:
			h1 = 0 - k - v
			m -= h1
		else:
			h1 = v - (0 - k)
			if h1 > vesot[j]:
				m += vesot[j]
			else:
				m += h1
		if m < 0:
			otv.append('NO')
			u = 1
			break
	if u == 0:
		otv.append('YES')
print('\n'.join(otv))


testcases = int(input())
for need in range(testcases):
	(n, SIB, need) = map(int, input().split(' '))
	l = list(map(int, input().strip().split(' ')))
	flag = 0
	for i in range(len(l) - 1):
		SIB += l[i] - max(0, l[i + 1] - need)
		if SIB < 0:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	ck = 1
	for i in range(n - 1):
		l = lst[i + 1] - k
		if l < 0:
			l = 0
		if l > lst[i]:
			m -= l - lst[i]
		else:
			m += lst[i] - l
		if m < 0:
			ck = 0
			break
	if ck == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	flag = 1
	for i in range(n - 1):
		if arr[i] < arr[i + 1]:
			diff = arr[i + 1] - arr[i]
			if diff > k:
				m -= diff - k
				if m < 0:
					flag = 0
					break
			elif diff == k:
				continue
			elif arr[i] > 0:
				m += min(arr[i], k - diff)
		elif arr[i] == arr[i + 1]:
			if arr[i] > 0:
				m += min(arr[i], k)
		else:
			diff = arr[i] - arr[i + 1]
			if arr[i] > 0:
				m += min(arr[i], diff)
			if arr[i] - diff > 0:
				m += min(arr[i] - diff, k)
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	s = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		m += s[i] - max(0, s[i + 1] - k)
		if m < 0:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


from math import *
from collections import *
from itertools import *
from functools import *
from random import *

def getl(t=int):
	return [t(x) for x in input().split()]

def get(t=int):
	return t(input())
alphabet = [chr(x) for x in range(ord('a'), ord('z') + 1)]
alnum = lambda x: ord(x) - ord('a')

def main():
	for _ in range(get()):
		if test():
			print('YES')
		else:
			print('NO')

def test():
	(n, m, k) = getl()
	a = getl()
	for i in range(n - 1):
		if m >= a[i + 1] - a[i] - k:
			m -= a[i + 1] - a[i] - k
			a[i] += a[i + 1] - a[i] - k
			if a[i] < 0:
				m += a[i]
				a[i] = 0
		else:
			return False
	return True
main()


import math

class Read:

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	(n, m, k) = Read.list_int()
	h = Read.list_int()
	for i in range(1, n):
		h1 = h[i - 1]
		h2 = h[i]
		m += h1 - max(h2 - k, 0)
		if m < 0:
			print('NO')
			return
	print('YES')
query_count = Read.int()
for j in range(query_count):
	solve()


t = int(input())
for test_case in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	i = 0
	while i < n - 1 and m > -1:
		m += min(h[i] - h[i + 1] + k, h[i])
		i += 1
	if m > -1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	blocks = list(map(int, input().split()))
	x = 0
	while x < n - 1:
		if blocks[x] + k >= blocks[x + 1]:
			gain = blocks[x] + k - blocks[x + 1]
			if blocks[x] >= gain:
				m += gain
			else:
				m += blocks[x]
			x += 1
		elif blocks[x] + k + m >= blocks[x + 1]:
			m -= blocks[x + 1] - blocks[x] - k
			x += 1
		else:
			break
	if x == n - 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
from sys import setrecursionlimit as SRL
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
t = int(input())
while t:
	(n, m, k) = rrd()
	a = list(rrd())
	ok = False
	for i in range(n - 1):
		can = a[i] - max(a[i + 1] - k, 0)
		m += can
		if m < 0:
			print('NO')
			ok = True
			break
	if not ok:
		print('YES')
	t -= 1


import sys
I = lambda : int(input())
RL = readline = lambda : sys.stdin.readline().strip('\n')
RM = readmap = lambda x=int: map(x, readline().split(' '))
for _ in range(I()):
	(n, m, k) = RM()
	l = [*RM()]
	for i in range(n - 1):
		diff = l[i + 1] - l[i]
		if diff < k:
			m += min(l[i], k - diff)
		else:
			m -= diff - k
		if m < 0:
			print('NO')
			break
	else:
		print('YES')
quit()
(n, s) = (I(), RL())
l = ['0'] * 10
for i in s:
	if i == 'L':
		index = 0
		while l[index] == '1':
			index += 1
		l[index] = '1'
	elif i == 'R':
		index = 9
		while l[index] == '1':
			index -= 1
		l[index] = '1'
	else:
		l[int(i)] = '0'
print(''.join(l))


import time
t = int(input())
for i in range(0, t):
	(n, m, k) = tuple(map(int, input().split()))
	H = list(map(int, input().split()))
	ok = 1
	for j in range(0, n - 1):
		x = H[j] - H[j + 1]
		if k + x >= 0:
			m += min(k + x, H[j])
		elif m + k + x >= 0:
			m += k + x
		else:
			ok = 0
			break
	print('YES' if ok else 'NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	possible = True
	cur_h = h[0]
	for next_h in h[1:]:
		if cur_h + k < next_h:
			needed = next_h - cur_h - k
			if needed > m:
				possible = False
				break
			m -= needed
		else:
			m += min(cur_h, cur_h - (next_h - k))
		cur_h = next_h
	if possible:
		print('YES')
	else:
		print('NO')


tests = int(input())

def getBlocks(x, dif):
	blocks = 0
	if heights[x] < heights[x + 1]:
		blocks = k - dif
		if blocks >= heights[x]:
			return heights[x]
		else:
			return blocks
	else:
		blocks = dif
		heights[x] -= blocks
		if heights[x] >= k:
			return blocks + k
		else:
			return blocks + heights[x]

def getNeeded(dif):
	return dif - k

def test(bag, k, heights):
	for y in range(len(heights) - 1):
		dif = abs(heights[y] - heights[y + 1])
		if dif <= k:
			bag += getBlocks(y, dif)
		elif heights[y] > heights[y + 1]:
			bag += getBlocks(y, dif)
		else:
			blocks_needed = getNeeded(dif)
			if blocks_needed > bag:
				return False
			else:
				bag -= blocks_needed
	return True
for case in range(tests):
	(columns, bag, k) = map(int, input().split())
	heights = list(map(int, input().split()))
	if test(bag, k, heights):
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
T = int(input())
for i in range(T):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	i = 0
	while i + 1 < n:
		if abs(h[i + 1] - h[i]) <= k or h[i + 1] <= h[i]:
			m += max(0, min(h[i], k - (h[i + 1] - h[i])))
			i += 1
		elif abs(h[i + 1] - h[i]) <= m + k:
			m -= max(0, abs(h[i + 1] - h[i]) - k)
			i += 1
		else:
			break
	else:
		print('YES')
		continue
	print('NO')


from math import gcd

def input_ints():
	return list(map(int, input().split()))

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	t = int(input())
	for _ in range(t):
		(n, m, k) = input_ints()
		a = input_ints()
		ok = True
		for i in range(n - 1):
			if a[i] >= a[i + 1] - k:
				m += min(a[i], a[i] - a[i + 1] + k)
			else:
				d = a[i + 1] - k - a[i]
				if m < d:
					ok = False
				m -= d
		print('YES' if ok else 'NO')
main()


T = int(input())
result = ''
for _ in range(T):
	(n, m, k) = map(int, input().split())
	heights = [int(i) for i in input().split()]
	if n == 1:
		result += 'YES\n'
	else:
		cur = m
		i = 0
		while i < n - 1:
			next_height = max(0, heights[i + 1] - k)
			if next_height <= heights[i]:
				cur += heights[i] - next_height
				i += 1
			elif next_height - heights[i] <= cur:
				cur -= next_height - heights[i]
				i += 1
			else:
				break
		if i == n - 1:
			result += 'YES\n'
		else:
			result += 'NO\n'
print(result, end='')


from sys import stdin
input = lambda : stdin.readline()
from math import ceil, sqrt, gcd
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	flag = 'YES'
	for i in range(n - 1):
		if l[i + 1] > l[i]:
			if l[i + 1] - l[i] > k:
				if m < l[i + 1] - l[i] - k:
					flag = 'NO'
					break
				else:
					m -= l[i + 1] - l[i] - k
			elif l[i + 1] - l[i] < k:
				m += min(k - l[i + 1] + l[i], l[i])
		else:
			m += l[i] - l[i + 1] + min(k, l[i + 1])
	print(flag)


def possible(n, m, k, heights):
	for i in range(n - 1):
		difference = abs(heights[i] - heights[i + 1])
		if difference > k:
			if heights[i + 1] > heights[i]:
				if difference - k <= m:
					need_blocks = difference - k
					m = m - need_blocks
				else:
					return 'NO'
			else:
				need_blocks = difference - k
				if need_blocks <= heights[i]:
					heights[i] -= need_blocks
					m += need_blocks
				else:
					return 'NO'
				need_blocks = 2 * k
				if heights[i] < need_blocks:
					m += heights[i]
					heights[i] = 0
				else:
					m += need_blocks
		else:
			difference = heights[i] - heights[i + 1]
			if difference >= 0:
				need_blocks = difference + k
			else:
				need_blocks = k - abs(difference)
			if heights[i] < need_blocks:
				m += heights[i]
				heights[i] = 0
			else:
				m += need_blocks
	return 'YES'
s = int(input())
for _ in range(s):
	(n, m, k) = map(int, input().split())
	heights = list(map(int, input().split()))
	print(possible(n, m, k, heights))


for q in range(int(input())):
	(n, m, k) = [int(s) for s in input().split()]
	arr = [int(s) for s in input().split()]
	ans = 'YES'
	for i in range(1, len(arr)):
		t = arr[i] - (arr[i - 1] + k)
		arr[i - 1] += t
		m -= t
		m += min(-(arr[i] - (arr[i - 1] + k)), arr[i - 1])
		if m < 0:
			ans = 'NO'
			break
	print(ans)


total_case = int(input())
for ii in range(0, total_case):
	(n, m, k) = input().split()
	n = int(n)
	m = int(m)
	k = int(k)
	s = [0] * n
	temp = input().split()
	for i in range(0, n):
		s[i] = int(temp[i])
	check = True
	position = 0
	while check and position < n - 1:
		if s[position] + m >= s[position + 1] - k:
			m = m + min(s[position] - s[position + 1] + k, s[position])
			position = position + 1
		else:
			check = False
	if check:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	s = [int(i) for i in input().split(' ')]
	size = s[0]
	cubics = s[1]
	step = s[2]
	pos = 0
	hights = [int(i) for i in input().split(' ')]
	while pos != size - 1:
		if abs(hights[pos] - hights[pos + 1]) <= step:
			cubics += hights[pos] - max(0, hights[pos + 1] - step)
			pos += 1
			continue
		elif hights[pos] >= hights[pos + 1]:
			cubics += hights[pos] - max(0, hights[pos + 1] - step)
			pos += 1
			continue
		elif hights[pos] + cubics >= hights[pos + 1] - step:
			cubics -= max(0, hights[pos + 1] - step) - hights[pos]
			pos += 1
		else:
			pos = -1
			break
	if pos == size - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		x = h[i] - h[i + 1]
		if x >= 0:
			new = max(0, h[i + 1] - k)
			m += h[i] - new
		elif x >= -k:
			new = max(0, h[i + 1] - k)
			m += h[i] - new
		elif m >= -k - x:
			m -= -k - x
		else:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	l = [int(j) for j in input().split()]
	d = [0] * n
	s = m
	fl = 1
	for j in range(n - 1):
		t = max(0, l[j + 1] - k)
		if l[j] > t:
			s += max(l[j] - t, 0)
		else:
			s -= max(t - l[j], 0)
		if s < 0:
			fl = 0
	if fl:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = m
	f = 0
	for i in range(1, n):
		ans += a[i - 1] - max(a[i] - k, 0)
		if ans < 0:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	(*a,) = map(int, input().split())
	for i in range(n - 1):
		m += max(a[i] - max(0, a[i + 1] - k), a[i] - a[i + 1] - k)
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	for i in range(n - 1):
		c = arr[i + 1] - arr[i] - k
		if c < 0:
			if arr[i] - abs(c) < 0:
				m += arr[i]
			else:
				m += abs(c)
		else:
			m -= c
		if m < 0:
			print('NO')
			break
	else:
		print('YES')


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, sys.stdin.readline().split())

def Neo():
	return list(map(int, sys.stdin.readline().split()))
for i in range(I()):
	(n, m, k) = neo()
	h = Neo()
	for i in range(n - 1):
		m += h[i] - max(0, h[i + 1] - k)
		if m < 0:
			print('NO')
			break
	if m >= 0:
		print('YES')


a = int(input())

def f(n, m, k, alist):
	left = m
	h = alist
	for i in range(n - 1):
		if h[i] >= h[i + 1] and h[i] - h[i + 1] <= k:
			if h[i + 1] - k < 0:
				left = left + h[i]
			else:
				left = left + (h[i] - (h[i + 1] - k))
		elif h[i] <= h[i + 1] and h[i + 1] - h[i] <= k:
			if h[i + 1] - k < 0:
				left = left + h[i]
			else:
				left = left + (h[i] - (h[i + 1] - k))
		elif h[i] >= h[i + 1] and h[i] - h[i + 1] >= k:
			if h[i + 1] <= k:
				left = left + h[i]
			else:
				left = left - (h[i + 1] - k - h[i])
		elif h[i] <= h[i + 1] and h[i + 1] - h[i] >= k:
			left = left - (h[i + 1] - k - h[i])
		if left < 0:
			return False
	return True
for j in range(a):
	b = list(map(int, input().split()))
	n = b[0]
	m = b[1]
	k = b[2]
	alist = list(map(int, input().split()))
	if f(n, m, k, alist):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	H = [int(i) for i in input().split()]
	chk = True
	for i in range(n - 1):
		(h1, h2) = (H[i], H[i + 1])
		if h1 >= max(0, h2 - k):
			m += h1 - max(0, h2 - k)
		elif m >= h2 - k - h1:
			m -= h2 - k - h1
		else:
			chk = False
			break
	print('YES' if chk == True else 'NO')


for __ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	flg = True
	for (f, nx) in zip(arr, arr[1:]):
		tg = max(nx - k, 0)
		m -= tg - f
		if m < 0:
			flg = False
	print('YES' if flg else 'NO')


from math import *
t = int(input())
for y in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		if h[i + 1] - h[i] == k:
			continue
		elif h[i] > h[i + 1]:
			s = h[i + 1] - k
			if s < 0:
				m += h[i]
			else:
				m += h[i] - (h[i + 1] - k)
		else:
			if h[i + 1] - h[i] < k:
				s = h[i + 1] - k
				if k < h[i + 1]:
					m += h[i] - (h[i + 1] - k)
				else:
					m += h[i]
			else:
				m -= h[i + 1] - k - h[i]
			if m < 0:
				break
	else:
		print('YES')
		continue
	print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	columns = list(map(int, input().split()))
	bag = m
	ok = True
	for i in range(n - 1):
		if columns[i + 1] - columns[i] > k:
			bag -= columns[i + 1] - columns[i] - k
			if bag < 0:
				ok = False
				break
		else:
			bag += columns[i] - max(0, columns[i + 1] - k)
	print('YES' if ok else 'NO')


import sys

def play(n, m, k, towers):
	bblocks = m
	for i in range(n - 1):
		t1 = towers[i]
		t2 = towers[i + 1]
		dif = t1 - t2
		if dif + k < -1 * bblocks:
			return 'NO'
		else:
			a = dif + k
			if a > t1:
				a = t1
			bblocks += a
	return 'YES'
fin = sys.stdin
tests = int(fin.readline().rstrip())
for i in range(tests):
	a = [int(i) for i in fin.readline().rstrip('\n').split()]
	b = [int(i) for i in fin.readline().rstrip('\n').split()]
	print(play(*a, b))


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	need = 0
	avail = m
	win = 1
	for i in range(n - 1):
		if h[i] >= h[i + 1]:
			if h[i + 1] > k:
				avail += h[i] - h[i + 1] + k
			else:
				avail += h[i]
		else:
			need = max(0, h[i + 1] - k)
			if need < h[i]:
				avail += h[i] - need
			elif need - h[i] > avail:
				win = 0
				break
			else:
				avail -= need - h[i]
	if win:
		print('YES')
	else:
		print('NO')


def checkWin(n, m, k, a):
	if n == 1:
		return 'YES'
	for i in range(n - 1):
		diff = abs(a[i + 1] - a[i])
		if diff > k:
			if a[i] >= a[i + 1]:
				m += a[i] - a[i + 1]
				a[i] = a[i + 1]
				m += min(k, a[i])
			else:
				r = diff - k
				if m < r:
					return 'NO'
				m -= r
		elif a[i] >= a[i + 1]:
			m += a[i] - a[i + 1]
			a[i] = a[i + 1]
			m += min(k, a[i])
		else:
			r = k - diff
			m += min(r, a[i])
	return 'YES'
t = int(input())
for q in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	print(checkWin(n, m, k, a))


T = int(input())
for t in range(T):
	(n, m, k) = map(int, input().split())
	H = list(map(int, input().split()))
	is_win = True
	for i in range(n - 1):
		tbn = min(H[i] - H[i + 1] + k, H[i])
		m += tbn
		if m < 0:
			is_win = False
			break
	if is_win:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	H = input().split()
	pos = 1
	for j in range(n - 1):
		if int(H[j]) < int(H[j + 1]) - k:
			m -= int(H[j + 1]) - k - int(H[j])
			if m < 0:
				break
		elif int(H[j]) > int(H[j + 1]) - k:
			m += min(int(H[j]) - int(H[j + 1]) + k, int(H[j]))
		pos += 1
	if pos == n:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase

def solution(heights, n, bag, k):
	i = 0
	for i in range(n - 1):
		bag += heights[i] - max(0, heights[i + 1] - k)
		if bag < 0:
			print('NO')
			return
	print('YES')

def main():
	for _ in range(r_int()):
		(n, m, k) = r_array()
		heights = r_array()
		solution(heights, n, m, k)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


T = int(input())
for i in range(T):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		if h[i + 1] - h[i] > k:
			if m < h[i + 1] - h[i] - k:
				print('NO')
				break
			else:
				m -= h[i + 1] - h[i] - k
				h[i] = h[i + 1] - k
		else:
			b = h[i]
			h[i] = max(h[i + 1] - k, 0)
			m += b - h[i]
	else:
		print('YES')


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)

def solve():
	(n, b, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for i in range(1, n):
		b += a[i - 1] - max(0, a[i] - k)
		if b < 0:
			return False
	return True
for _ in range(int(input())):
	print('YES' if solve() else 'NO')


gi = lambda : list(map(int, input().split()))
for k in range(gi()[0]):
	(n, m, p) = gi()
	l = gi()
	j = 0
	while j < n - 1:
		if l[j] >= l[j + 1]:
			m += l[j] - max(0, l[j + 1] - p)
		elif l[j] < l[j + 1] and l[j + 1] - l[j] <= p:
			m += l[j] - max(0, l[j + 1] - p)
		else:
			m -= l[j + 1] - l[j] - p
			if m < 0:
				print('NO')
				break
		j += 1
	if m >= 0:
		print('YES')


for i in range(int(input())):
	(n, m, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
	else:
		for j in range(n - 1):
			mindelta = a[j + 1] - (a[j] + k)
			if a[j] + k >= a[j + 1]:
				m += min(a[j] + k - a[j + 1], a[j])
			elif a[j] + k + m >= a[j + 1]:
				m -= a[j + 1] - a[j] - k
			else:
				print('NO')
				break
		else:
			print('YES')


T = int(input())
for _ in range(T):
	(n, m, k) = tuple(map(int, input().split()))
	h = list(map(int, input().split()))
	for (i, v) in enumerate(h):
		if i == n - 1:
			print('YES')
			break
		elif h[i] > h[i + 1] - k:
			m += min(h[i] - h[i + 1] + k, h[i])
		elif h[i] < h[i + 1] - k:
			m -= h[i + 1] - k - h[i]
		if m < 0:
			print('NO')
			break


answer = []
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h_list = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			min_blocks_req = abs(h_list[i + 1] - k) if h_list[i + 1] > k else 0
			if h_list[i] > min_blocks_req:
				m += h_list[i] - min_blocks_req
			elif h_list[i] < min_blocks_req:
				if m >= min_blocks_req - h_list[i]:
					m -= min_blocks_req - h_list[i]
				else:
					print('NO')
					break
		else:
			print('YES')


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(n, m, k) = zz()
	l = zzz()
	ans = 'YES'
	x = l[0]
	for i in range(1, n):
		t = l[i]
		m += min(x, x - t + k)
		if m < 0:
			ans = 'NO'
			break
		x = t
	print(ans)


def get_possible_amassing(h1, h2, k):
	return min(h1 + k - h2, h1)

def is_travel_possible(m, k, hs):
	if len(hs) == 1:
		return 'YES'
	for i in range(len(hs) - 1):
		rq = get_possible_amassing(hs[i], hs[i + 1], k)
		m += rq
		if m < 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	(_, m, k) = map(int, input().split())
	print(is_travel_possible(m, k, list(map(int, input().split()))))


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	bag = m
	j = 0
	while j <= n:
		if j == n - 1:
			print('YES')
			break
		bag += arr[j] - max(0, arr[j + 1] - k)
		if bag < 0:
			print('NO')
			break
		else:
			j += 1


t = int(input())
for i in range(t):
	(n, m, k) = [int(i) for i in input().split()]
	h = [int(i) for i in input().split()]
	flag = 1
	for i in range(n - 1):
		m += h[i] - max(0, h[i + 1] - k)
		if m < 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	[n, m, k] = [int(x) for x in input().split()]
	if n == 1:
		h0 = int(input())
		h = [h0]
	else:
		h = [int(x) for x in input().split()]
	ok = True
	if n < 2:
		print('YES')
	else:
		for j in range(0, n - 1):
			ciel = max(0, h[j + 1] - k)
			if h[j] > ciel:
				m += h[j] - ciel
			elif h[j] < ciel:
				if m >= ciel - h[j]:
					m = m - (ciel - h[j])
				else:
					ok = False
					print('NO')
					break
		if ok:
			print('YES')


t = int(input(''))
for v in range(t):
	a = input('').split(' ')
	n = int(a[0])
	m = int(a[1])
	k = int(a[2])
	a = list(map(int, input('').split(' ')))
	diff = []
	nb = m
	res = True
	for i in range(n - 1):
		diff.append(a[i + 1] - a[i])
	for i in range(n - 1):
		if k - diff[i] > 0:
			if a[i] >= k - diff[i]:
				nb = nb - diff[i] + k
			else:
				nb = nb + a[i]
		else:
			nb = nb - diff[i] + k
		if nb < 0:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	f = True
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		if h[i] > h[i + 1]:
			m += h[i] - h[i + 1] + k
			h[i] = h[i + 1] - k
			if h[i] < 0:
				m -= abs(h[i])
				h[i] = 0
		elif h[i] == h[i + 1]:
			m += k
			h[i] -= k
			if h[i] < 0:
				m -= abs(h[i])
				h[i] = 0
		elif abs(h[i] - h[i + 1]) <= k:
			m += k - abs(h[i] - h[i + 1])
			h[i] -= k - abs(h[i] - h[i + 1])
			if h[i] < 0:
				m -= abs(h[i])
				h[i] = 0
		elif abs(h[i] - h[i + 1]) - k > m:
			f = False
			break
		else:
			m -= abs(h[i] - h[i + 1]) - k
			h[i] += abs(h[i] - h[i + 1]) - k
			if h[i] < 0:
				m -= abs(h[i])
				h[i] = 0
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	ok = True
	(n, bag, k) = map(int, input().split())
	heights = list(map(int, input().split()))
	current = 0
	while current < n - 1:
		diff = heights[current] - heights[current + 1]
		if diff >= -k:
			bag += min([diff + k, heights[current]])
			current += 1
		else:
			bag += diff + k
			if bag < 0:
				ok = False
				break
			current += 1
	if ok == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	(n, m, k) = map(int, input().split(' '))
	h = list(map(int, input().split(' ')))
	count = m
	flag = 0
	for i in range(n - 1):
		count += h[i] - max(0, h[i + 1] - k)
		if count < 0:
			flag = 1
			break
	if flag == 1 or count < 0:
		print('NO')
	else:
		print('YES')


def func(m, k, a):
	for i in range(len(a) - 1):
		if a[i] + k >= a[i + 1]:
			m += a[i] - max(0, a[i + 1] - k)
		else:
			m = m - max(a[i + 1] - k - a[i], 0)
			if m < 0:
				return 0
	return 1
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	res = func(m, k, a)
	if res:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split(' '))
	y = list(map(int, input().split()))
	j = 0
	f = 0
	while j < n - 1:
		if abs(y[j] - y[j + 1]) <= k:
			if y[j] > y[j + 1]:
				m += y[j] - y[j + 1]
				if y[j + 1] > k:
					m += k
				else:
					m += y[j + 1]
			elif y[j + 1] > y[j]:
				if k - abs(y[j] - y[j + 1]) < y[j]:
					m += k - abs(y[j] - y[j + 1])
				else:
					m += y[j]
			elif y[j] > k:
				m += k
			else:
				m += y[j]
		elif abs(y[j] - y[j + 1]) > k:
			if y[j] > y[j + 1]:
				m += y[j] - y[j + 1]
				if y[j + 1] > k:
					m += k
				else:
					m += y[j + 1]
			elif y[j + 1] > y[j] and m != 0:
				if m >= y[j + 1] - y[j] - k:
					m -= y[j + 1] - y[j] - k
				else:
					f = 1
					break
			else:
				f = 1
				break
		j += 1
	if f != 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	heights = list(map(int, input().split()))
	pos = True
	for (h1, h2) in zip(heights[:-1], heights[1:]):
		if h1 >= h2 - k:
			if h2 - k >= 0:
				m += h1 - (h2 - k)
			else:
				m += h1
		elif h2 - k - h1 <= m:
			m -= h2 - k - h1
		else:
			pos = False
	print('YES' if pos else 'NO')


import sys
from collections import Counter
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	res = 'YES'
	for i in range(n - 1):
		if h[i] >= h[i + 1]:
			m += min(h[i + 1], k) + h[i] - h[i + 1]
		elif h[i + 1] - h[i] > k and h[i + 1] > h[i]:
			if m < h[i + 1] - h[i] - k:
				res = 'NO'
				break
			else:
				m -= h[i + 1] - h[i] - k
		elif h[i + 1] - h[i] <= k and h[i + 1] > h[i]:
			m += min(k - h[i + 1] + h[i], h[i])
	print(res)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(ri(1)):
	(n, m, k) = ri()
	a = ri()
	ini = m
	status = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= k:
			ini += max(a[i] - max(a[i + 1] - k, 0), 0)
		elif a[i] >= a[i + 1]:
			ini += max(a[i] - max(a[i + 1] - k, 0), 0)
		elif ini >= a[i + 1] - k - a[i]:
			ini -= max(max(a[i + 1] - k - a[i], 0), 0)
		else:
			status = 0
			break
	if status:
		print('YES')
	else:
		print('NO')


import sys
n = int(sys.stdin.readline())
for i in range(n):
	res = 1
	prelim = sys.stdin.readline().split()
	col_num = int(prelim[0])
	block_in_beg = int(prelim[1])
	climb_diff = int(prelim[2])
	block_heights = sys.stdin.readline().split()
	for j in range(col_num):
		block_heights[j] = int(block_heights[j])
	for j in range(col_num - 1):
		height_diff = block_heights[j] - block_heights[j + 1]
		if height_diff < -1 * climb_diff:
			if height_diff + block_in_beg < -1 * climb_diff:
				print('NO')
				res = 0
				break
			else:
				block_in_beg += height_diff + climb_diff
		else:
			tmp_block_gain = height_diff + climb_diff
			if tmp_block_gain > block_heights[j]:
				block_in_beg += block_heights[j]
			else:
				block_in_beg += tmp_block_gain
	if res:
		print('YES')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 'YES'
	b = m
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			b += min(a[i] - a[i + 1] + k, a[i])
		elif a[i] < a[i + 1] and a[i] + k >= a[i + 1]:
			b += min(a[i] - (a[i + 1] - k), a[i])
		elif a[i] < a[i + 1] and a[i] + k < a[i + 1]:
			if b >= a[i + 1] - k - a[i]:
				b -= a[i + 1] - k - a[i]
			else:
				ans = 'NO'
				break
	print(ans)


num_iter = int(input())

def play_game(env, num_col, num_blk, k):
	for col in range(int(num_col) - 1):
		if env[col + 1] < env[col] + k:
			num_blk += min(env[col] + k - env[col + 1], env[col])
		elif env[col + 1] > env[col] + k:
			num_blk -= env[col + 1] - env[col] - k
			if num_blk < 0:
				return 'NO'
	return 'YES'
for it in range(num_iter):
	info = tuple(map(int, input().split(' ')))
	(num_col, num_blk, k) = info
	env = tuple(map(int, input().split(' ')))
	print(play_game(env, num_col, num_blk, k))


import sys, math, bisect
from random import randint
inf = float('inf')
mod = 998244353

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors

def isPrime(n, k=5):
	if n < 2:
		return True
	for i in range(0, k):
		a = randint(1, n - 1)
		if pow(a, n - 1, n) != 1:
			return False
	return True
from collections import deque, defaultdict, Counter
import heapq, string
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		m += arr[i] - max(0, arr[i + 1] - k)
		if m < 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline())
while t != 0:
	t -= 1
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	ok = True
	for i in range(n - 1):
		if a[i] >= a[i + 1] - k:
			if a[i + 1] - k < 0:
				m += a[i]
			else:
				m += a[i] - (a[i + 1] - k)
		else:
			m -= a[i + 1] - k - a[i]
		if m < 0:
			ok = False
			break
	if ok:
		stdout.write('YES' + '\n')
	else:
		stdout.write('NO' + '\n')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	block = m
	flag = 1
	for i in range(n - 1):
		block += h[i] - max(0, h[i + 1] - k)
		if block < 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


import sys

def input():
	return sys.stdin.readline()[:-1]
T = int(input())
for i in range(T):
	flag = True
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	for i in range(n - 1):
		x = max(h[i + 1] - k, 0)
		if x - h[i] > m:
			flag = False
			break
		else:
			m -= x - h[i]
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
T = int(input())
for i in range(T):
	(N, M, K) = [int(x) for x in stdin.readline().split()]
	arr = [int(x) for x in stdin.readline().split()]
	if N == 1:
		print('YES')
		continue
	flag = 0
	for i in range(1, N):
		gap = arr[i - 1] - arr[i]
		d = arr[i] - K
		if d < 0:
			d = 0
		if gap >= -K:
			M += arr[i - 1] - d
		else:
			fill_in = arr[i] - K - arr[i - 1]
			if M >= fill_in:
				M -= fill_in
			else:
				flag = 1
				print('NO')
				break
	if flag == 0:
		print('YES')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, m, k) = LI()
		a = LI()
		ok = 1
		t = a[0]
		for c in a[1:]:
			u = max(0, c - k)
			if u > t + m:
				ok = 0
				break
			m = t + m - u
			t = c
		rr.append(YES(ok))
	return JA(rr, '\n')
print(main())


def ans(n, m, k, a):
	ruk = m
	for i in range(n - 1):
		if a[i + 1] - a[i] >= k:
			ruk -= a[i + 1] - a[i] - k
			if ruk < 0:
				return False
		else:
			ruk += min(a[i] - a[i + 1] + k, a[i])
	return True
t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	a = [int(g) for g in input().split()]
	print('YES' if ans(n, m, k, a) else 'NO')


def is_pos(n, m, k, H):
	if n == 1:
		return 'YES'
	for i in range(n - 1):
		if H[i] - H[i + 1] >= 0:
			d = H[i] - H[i + 1] - k
			if d <= H[i]:
				d2 = H[i] - H[i + 1] + k
				if H[i] < d2:
					m += H[i]
				else:
					m += d2
			else:
				return 'NO'
		elif H[i] - H[i + 1] < 0 and abs(H[i] - H[i + 1]) <= k:
			d = H[i] - H[i + 1] + k
			if d <= H[i]:
				m += d
			else:
				m += H[i]
		elif H[i] - H[i + 1] < 0 and abs(H[i] - H[i + 1]) >= k:
			d = -k + H[i + 1] - H[i]
			if d <= m:
				m -= d
			else:
				return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	H = list(map(int, input().split()))
	print(is_pos(n, m, k, H))


def solve(n, m, k, h):
	for i in range(n - 1):
		cost = h[i + 1] - k - h[i]
		if cost < 0:
			m += min(h[i], -cost)
		elif cost > m:
			return False
		else:
			m -= cost
	return True
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	r = solve(n, m, k, h)
	print('YES' if r else 'NO')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	h = list(map(int, input().split()))
	n = l[0]
	m = l[1]
	k = l[2]
	flag = True
	for j in range(n - 1):
		if abs(h[j] - h[j + 1]) <= k:
			if h[j] > h[j + 1]:
				if h[j + 1] - k >= 0:
					m += h[j] - (h[j + 1] - k)
					h[j] = h[j + 1] - k
				else:
					m += h[j]
					h[j] = 0
			elif h[j + 1] - k >= 0 and h[j + 1] - k <= h[j]:
				m += h[j] - (h[j + 1] - k)
				h[j] = h[j + 1] - k
			else:
				m += h[j]
				h[j] = 0
		elif h[j] > h[j + 1]:
			if h[j + 1] - k >= 0:
				m += h[j] - (h[j + 1] - k)
				h[j] = h[j + 1] - k
			elif h[j + 1] - k < 0:
				m += h[j]
				h[j] = 0
		elif h[j] <= h[j + 1]:
			value = abs(h[j] - h[j + 1])
			diff = abs(value - k)
			if diff <= m:
				m -= diff
				continue
			else:
				flag = False
				break
		else:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	blocks = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		m += min(blocks[i] - blocks[i + 1] + k, blocks[i])
		if m < 0:
			flag = False
			break
	print('YES' if flag else 'NO')


def mp():
	return map(int, input().split())
t = int(input())
for tt in range(t):
	(n, m, k) = mp()
	a = list(mp())
	fail = False
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			m += min(a[i], a[i] - a[i + 1] + k)
		elif abs(a[i + 1] - a[i]) <= k:
			m += min(a[i], a[i] - a[i + 1] + k)
		elif m >= abs(a[i] - a[i + 1]) - k:
			m -= abs(a[i] - a[i + 1]) - k
		else:
			fail = True
			break
	if fail:
		print('NO')
	else:
		print('YES')


def answer(str1, str2):
	(n, m, k) = tuple(map(int, str1.split()))
	clos = list(map(int, str2.split()))
	flag = 1
	for i in range(len(clos)):
		if i == n - 1:
			break
		dif = clos[i + 1] - k - clos[i]
		if dif > 0:
			if dif <= m:
				m -= dif
				continue
			else:
				flag = 0
				break
		if clos[i + 1] - k < 0:
			m += clos[i]
			continue
		else:
			m += clos[i] - clos[i + 1] + k
			continue
	if flag:
		return 'YES'
	else:
		return 'NO'
T = int(input())
for t in range(T):
	str1 = input()
	str2 = input()
	print(answer(str1, str2))


inp = lambda : map(int, input().rstrip().split())
for i in range(int(input())):
	(n, m, k) = inp()
	h = list(inp())
	i = 0
	while i < n - 1 and m >= 0:
		x = h[i]
		y = h[i + 1]
		if x >= y:
			m += min(x - y + k, x)
			i += 1
		elif y > x and y - k - x > 0:
			diff = y - k - x
			if diff > m:
				m = -1
			else:
				m -= diff
				i += 1
		elif y > x:
			m += x - max(y - k, 0)
			i += 1
	if m >= 0:
		print('YES')
	else:
		print('NO')


def main():
	(n, m, k) = map(int, input().split())
	ok = 1
	arr = list(map(int, input().split()))
	for i in range(n - 1):
		l = arr[i] - max(0, arr[i + 1] - k)
		m += l
		if m < 0:
			ok = 0
	print('YES' if ok else 'NO')
for _ in range(int(input())):
	main()


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			(n, m, k) = invr()
			a = inlt()
			for i in range(n - 1):
				m += a[i] - max(0, a[i + 1] - k)
				a[i] = max(0, a[i + 1] - k)
				if m < 0:
					print('NO')
					break
			else:
				print('YES')
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def f(m, k, A):
	for i in range(len(A) - 1):
		diff = A[i + 1] - A[i]
		if diff > k + m:
			return False
		else:
			m += min(A[i], k - diff)
	return True
assert f(0, 2, [1, 3]) == True
assert f(0, 2, [1, 4]) == False
assert f(0, 2, [4, 1]) == True
assert f(0, 2, [3, 1]) == True
assert f(0, 2, [1000, 1]) == True
assert f(0, 8, [1, 9]) == True
assert f(0, 8, [1, 10]) == False
assert f(50, 160, [319, 47, 107, 192, 866, 475, 139, 594, 636, 345]) == False
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	A = [*map(int, input().split())]
	ans = f(m, k, A)
	print('YES' if ans else 'NO')


def solve():
	(n, m, k) = [int(i) for i in input().split()]
	H = [int(i) for i in input().split()]
	for i in range(n - 1):
		d = H[i] - max(H[i + 1] - k, 0)
		m += d
		H[i] -= d
		if m < 0:
			return False
	return True
t = int(input())
for _ in range(t):
	if solve():
		print('YES')
	else:
		print('NO')


for TT in range(1, int(input()) + 1):
	(n, m, k) = map(int, input().split())
	l = [*map(int, input().split())]
	res = True
	for i in range(n - 1):
		d = l[i + 1] - l[i]
		if d > k:
			m -= d - k
		else:
			m += min(l[i], k - d)
		res &= m >= 0
	print('YES' if res else 'NO')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	for i in range(n - 1):
		if -k <= a[i] - a[i + 1]:
			m += min(k + a[i] - a[i + 1], a[i])
		elif -k - m <= a[i] - a[i + 1]:
			m += a[i] - a[i + 1] + k
		else:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, m, k) = (int(j) for j in input().split())
	h = [int(j) for j in input().split()]
	ans = True
	for j in range(n - 1):
		d = h[j + 1] - h[j]
		if h[j + 1] < k:
			m += h[j]
		else:
			m += k - d
		if m < 0:
			ans = False
			break
	print('YES' if ans else 'NO')


testcases = int(input())
inputlist = []
for x in range(0, testcases):
	gamevalues = list(map(int, input().split()))
	blockheights = list(map(int, input().split()))
	inputlist.append(gamevalues)
	inputlist.append(blockheights)

def blockadventure(gamevalues, blockheights):
	stop = True
	n = gamevalues[0]
	ballbag = gamevalues[1]
	gameconstant = gamevalues[2]
	for x in range(0, n - 1):
		ballbag += blockheights[x] - max(0, blockheights[x + 1] - gameconstant)
		if ballbag < 0:
			stop = False
			return 'NO'
		else:
			continue
	if stop == True:
		return 'YES'
x = 0
while x < len(inputlist):
	print(blockadventure(inputlist[x], inputlist[x + 1]))
	x += 2


T = int(input())
while T > 0:
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pos = 0
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= k:
			pos += 1
			d = max(0, a[i + 1] - k)
			m += a[i] - d
		elif a[i] < a[i + 1]:
			d = max(0, a[i + 1] - k)
			m -= d - a[i]
			if m < 0:
				break
			else:
				pos += 1
		else:
			d = max(0, a[i + 1] - k)
			m += a[i] - d
			pos += 1
	T -= 1
	print('YES' if pos == n - 1 else 'NO')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, m, k) = list(map(int, input().split()))
	H = list(map(int, input().split()))
	ans = True
	for i in range(n - 1):
		diff = H[i] - H[i + 1]
		if diff > 0:
			m += min(diff + k, H[i])
		elif diff == 0:
			m += min(k, H[i])
		else:
			diff = abs(diff)
			if diff <= k:
				m += min(k - diff, H[i])
			else:
				m -= diff - k
		if m < 0:
			ans = False
			print('NO')
			break
	if ans:
		print('YES')


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, m, k) = int_array()
	a = int_array()
	f = 1
	for i in range(n - 1):
		min_req = max(a[i + 1] - k, 0)
		if a[i] >= min_req:
			m += a[i] - min_req
		elif min_req - a[i] <= m:
			m -= min_req - a[i]
		else:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	flag = True
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	for i in range(n - 1):
		next_h = h[i + 1]
		our_h = max(0, next_h - k)
		if our_h > h[i] + m:
			flag = False
			break
		m = m + h[i] - our_h
	print('YES' if flag else 'NO')


qq = int(input())
for q in range(qq):
	(n, m, k) = map(int, input().split())
	dat = list(map(int, input().split()))
	can = True
	for i in range(n - 1):
		ne = dat[i + 1] - k
		ne = 0 if ne < 0 else ne
		if ne < dat[i]:
			m += dat[i] - ne
		else:
			m -= ne - dat[i]
			if m < 0:
				can = False
	print('YES' if can else 'NO')


from sys import *
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	bag = m
	for l in range(n - 1):
		j = abs(arr[l] - arr[l + 1])
		if arr[l] >= arr[l + 1]:
			bag += min(j + k, arr[l])
		elif arr[l] < arr[l + 1]:
			if k < j:
				bag -= j - k
			else:
				bag += min(k - j, arr[l])
		if bag < 0:
			break
	if bag >= 0:
		print('YES\n')
	else:
		print('NO\n')


import math
import copy
from decimal import *

def solve():
	t = 1
	t = int(input())
	for _ in range(t):
		(n, m, k) = map(int, input().split())
		a = list(map(int, input().split()))
		i = 0
		ok = True
		while i < n - 1 and ok:
			if a[i] >= a[i + 1]:
				x = max(0, a[i + 1] - k)
				y = a[i] - x
				a[i] -= y
				m += y
				i += 1
			elif max(0, a[i + 1] - k) <= a[i]:
				x = max(0, a[i + 1] - k)
				y = a[i] - x
				m += y
				a[i] = x
				i += 1
			else:
				y = max(a[i + 1] - k, 0)
				x = y - a[i]
				if m >= x:
					m -= x
					a[i] += x
					i += 1
				else:
					ok = False
		if ok and i == n - 1:
			print('YES')
		else:
			print('NO')
solve()


import sys
input = sys.stdin.readline

def judge(n, m, k, H):
	for i in range(n - 1):
		(now, nxt) = (H[i], H[i + 1])
		if now < nxt:
			d = nxt - now
			if d - k > m:
				return 'NO'
			if d > k:
				m -= d - k
			else:
				m += now - max(0, nxt - k)
		else:
			m += now - max(0, nxt - k)
	return 'YES'
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	H = list(map(int, input().split()))
	print(judge(n, m, k, H))


t = int(input())
for q in range(t):
	temp = input().split(' ')
	n = int(temp[0])
	m = int(temp[1])
	k = int(temp[2])
	arr = [int(x) for x in input().split()]
	lose = False
	for i in range(len(arr)):
		if i != 0 and (m < 0 or arr[i - 1] < 0):
			print('No')
			break
		elif i == len(arr) - 1:
			print('YES')
			break
		if arr[i + 1] - arr[i] != k:
			m -= arr[i + 1] - arr[i] - k
			arr[i] = arr[i + 1] - k
			if arr[i] < 0:
				m += arr[i]
				arr[i] = 0


for t in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	dep = m
	for i in range(n - 1):
		if l[i + 1] > l[i] + k:
			need = l[i + 1] - (l[i] + k)
			if need > dep:
				print('NO')
				break
			dep -= need
		else:
			dep += min(l[i], l[i] + k - l[i + 1])
	else:
		print('YES')


t = int(input())
while t > 0:
	t = t - 1
	res = True
	(n, m, k) = [int(x) for x in input().split(' ')]
	arr = [int(x) for x in input().split(' ')]
	for i in range(0, n - 1):
		m += arr[i] - max(0, arr[i + 1] - k)
		if m < 0:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	while t:
		t -= 1
		(n, m, k) = input().split()
		n = int(n)
		m = int(m)
		k = int(k)
		h = [int(i) for i in input().split()]
		possible = True
		for i in range(n - 1):
			if abs(h[i] - h[i + 1]) <= k:
				if h[i] > h[i + 1]:
					m += h[i] - h[i + 1] + min(k, h[i + 1])
				else:
					m += min(h[i], k - (h[i + 1] - h[i]))
			elif h[i] < h[i + 1]:
				if h[i + 1] - h[i] > m + k:
					possible = False
					break
				else:
					m -= h[i + 1] - h[i] - k
			else:
				m += h[i] - h[i + 1] + min(k, h[i + 1])
		if possible:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for z in range(t):
	(n, m, k) = map(int, input().split())
	data = []
	data[:] = map(int, input().split())
	prev = data[0]
	flag = 0
	if n > 1:
		for i in range(n - 1):
			curr = data[i + 1]
			if prev >= curr:
				m += prev - curr + min(curr, k)
			elif curr - prev < k:
				m += min(prev, k - curr + prev)
			elif curr - prev > k:
				if m < curr - prev - k:
					flag = 1
					break
				else:
					m -= curr - prev - k
			prev = curr
		if flag == 1:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	(n, m, k) = rinput()
	a = rlinput()
	bag = m
	flag = True
	for i in range(n - 1):
		done = False
		diff = a[i + 1] - a[i]
		if diff >= 0 and bag >= diff - k:
			done = True
			bag -= max(-a[i], diff - k)
		elif diff <= 0:
			done = True
			bag += min(a[i], k - diff)
		if not done:
			flag = False
			break
		if done and i == n - 2:
			flag = True
	print('YES' if flag else 'NO')


t = int(input())
while t > 0:
	t -= 1
	flag = 0
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	for i in range(n - 1):
		diff = arr[i] - arr[i + 1]
		x = -k - diff
		if x < 0 and abs(x) > arr[i]:
			x = -arr[i]
		m -= x
		if m >= 0:
			continue
		else:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


def solve(n, m, k, hs):
	for i in range(n - 1):
		if hs[i] <= hs[i + 1]:
			if hs[i] + m >= hs[i + 1] - k:
				diff = hs[i + 1] - k - hs[i]
				if diff < 0:
					m += min(hs[i], -diff)
				else:
					m -= diff
			else:
				return 'NO'
		else:
			m += min(hs[i], hs[i] - (hs[i + 1] - k))
	return 'YES'
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	hs = list(map(int, input().split()))
	print(solve(n, m, k, hs))


t = int(input())
for l in range(t):
	(n, m, k) = map(int, input().split())
	b = list(map(int, input().split()))
	f = 1
	for i in range(n - 1):
		if b[i + 1] - k <= b[i]:
			if b[i + 1] <= k:
				m += b[i]
			else:
				m += b[i] - (b[i + 1] - k)
		else:
			m -= b[i + 1] - k - b[i]
		if m < 0:
			f = 0
			break
	print('YES' if f == 1 else 'NO')


cases = int(input())
game = list()
for i in range(cases):
	game.append(list(map(int, input().split())) + list(map(int, input().split())))
for i in game:
	for j in range(i[0] - 1):
		i[1] += i[3 + j] - i[4 + j] + min(i[2], i[4 + j])
		if i[1] < 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	x = []
	if n == 1:
		print('YES')
	else:
		q = 1
		for i in range(n - 1):
			z = a[i] - a[i + 1]
			if z >= 0:
				m += z
				m += min(k, a[i] - z)
				q = 1
			elif abs(z) > k:
				y = a[i + 1] - k - a[i]
				if m >= y:
					m = m - y
				else:
					q = 0
					break
			else:
				y = a[i] - (a[i + 1] - k)
				m += min(y, a[i])
		if q == 0:
			print('NO')
		else:
			print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = [int(i) for i in input().split()]
	ans = True
	for i in range(n - 1):
		x = min(k + h[i] - h[i + 1], h[i])
		m += x
		if m < 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(n, m, k) = [int(x) for x in input().split()]
	l = [int(x) for x in input().split()]
	for i in range(n - 1):
		if l[i] < l[i + 1]:
			if l[i + 1] - l[i] > k:
				m -= l[i + 1] - l[i] - k
			else:
				m += min(k - (l[i + 1] - l[i]), l[i])
		else:
			m += l[i] - l[i + 1] + min(k, l[i + 1])
		if m < 0:
			print('NO')
			break
	if m >= 0:
		print('YES')


import sys
t = int(input())
buf = []
for _ in range(t):
	(n, m, k) = map(int, input().split())
	hhh = list(map(int, input().split()))
	remain = m
	cur = hhh[0]
	for h in hhh[1:]:
		if cur + remain + k < h:
			buf.append(False)
			break
		remain = cur + remain - max(0, h - k)
		cur = h
	else:
		buf.append(True)
print('\n'.join(('yes' if ans else 'no' for ans in buf)))


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write
L = list
M = map

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def checkPath(source, destination, g):
	visited = [0] * 101
	q = Q()
	q.append(source)
	visited[source] = 1
	while q:
		node = q.popleft()
		if node == destination:
			return 1
		for v in g[node]:
			if not visited[v]:
				q.append(v)
				visited[v] = 1
	return 0

def main():
	for _ in range(int(INPUT())):
		(n, m, k) = M(int, INPUT().split())
		a = L(M(int, INPUT().split()))
		for i in range(n - 1):
			m += a[i] - max(0, a[i + 1] - k)
			if m < 0:
				PRINT('NO\n')
				break
		else:
			PRINT('YES\n')
main()


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	lis = list(map(int, input().split()))
	c = 1
	for i in range(1, n):
		ll = abs(lis[i] - lis[i - 1])
		if lis[i] > lis[i - 1]:
			if ll <= k:
				m += lis[i - 1] - max(lis[i] - k, 0)
			else:
				m -= ll - k
			lis[i - 1] = max(lis[i] - k, 0)
		else:
			if lis[i] - k >= 0:
				m += ll + k
			else:
				m += ll + lis[i]
			lis[i - 1] = max(lis[i] - k, 0)
		if m < 0:
			print('No')
			c = 0
			break
	if c == 1:
		print('YES')


from sys import stdin

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())
for _ in range(ii()):
	p = 0
	(n, k, m) = mi()
	a = li()
	for i in range(n - 1):
		x = max(0, a[i + 1] - m)
		if a[i] < x:
			k -= x - a[i]
			if k < 0:
				p = 1
				break
		else:
			k += a[i] - x
	print(['YES', 'NO'][p])


tests = int(input())
for i in range(tests):
	(n, m, k) = [int(x) for x in input().split()]
	heights = [int(x) for x in input().split()]
	pos = True
	for s in range(n - 1):
		if heights[s + 1] - heights[s] - k >= 0:
			m -= heights[s + 1] - heights[s] - k
		else:
			m += min(heights[s], -(heights[s + 1] - heights[s] - k))
		if m < 0:
			pos = False
	if pos:
		print('YES')
	else:
		print('NO')


def bagfill(h, bag, k):
	if len(h) == 1:
		return True
	for i in range(len(h) - 1):
		bag += h[i] - max(0, h[i + 1] - k)
		if bag < 0:
			return False
	return True
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	if bagfill(h, m, k):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	nmk = input().split()
	n = int(nmk[0]) - 1
	m = int(nmk[1])
	k = int(nmk[2])
	stolbs = input().split()
	stolb_now = 0
	high_now = int(stolbs[0])
	possible = 'YES'
	while stolb_now < n:
		high_next = int(stolbs[stolb_now + 1])
		ideal_now = high_next - k
		if ideal_now < 0:
			ideal_now = 0
		if high_now < ideal_now:
			m -= ideal_now - high_now
			if m < 0:
				possible = 'NO'
				break
		elif high_now > ideal_now:
			m += high_now - ideal_now
		high_now = high_next
		stolb_now += 1
	print(possible)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def line():
	return map(int, input().split())

def num():
	return int(input())
from itertools import repeat, tee

def pairwise(it):
	(a, b) = tee(iter(it))
	next(b)
	return zip(a, b)
t = num()
for _ in repeat(None, t):
	(n, m, k) = line()
	hs = list(line())
	for (a, b) in pairwise(hs):
		if a < b - k:
			m -= b - k - a
			if m < 0:
				print('no')
				break
		else:
			m += a - max(b - k, 0)
	else:
		print('yes')


def main():
	tc = int(input())
	while tc > 0:
		tc -= 1
		line = input().split()
		n = int(line[0])
		m = int(line[1])
		k = int(line[2])
		v = [int(x) for x in input().split()]
		ok = True
		for i in range(n - 1):
			t = max(0, v[i + 1] - k)
			m += v[i] - t
			if m < 0:
				ok = False
		if ok:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	p = 0
	for i in range(n - 1):
		if a[i] > a[i + 1]:
			m = m + (a[i] - a[i + 1])
			if a[i + 1] - k >= 0:
				m = m + k
			else:
				m = m + a[i + 1]
		elif a[i] < a[i + 1]:
			q = a[i + 1] - a[i]
			if q <= k:
				if a[i + 1] - k < 0:
					m += a[i]
				else:
					m += a[i] - (a[i + 1] - k)
			elif m >= q - k:
				m = m - (q - k)
				a[i] = a[i] + (q - k)
			else:
				p = p + 1
				break
		elif a[i] - k >= 0:
			m = m + k
		else:
			m = m + a[i]
	if p == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	a = list(map(int, input().split()))
	n = a[0]
	m = a[1]
	k = a[2]
	d = 0
	h = list(map(int, input().split()))
	for j in range(0, n - 1):
		if h[j] - h[j + 1] >= 0:
			m += h[j] - h[j + 1]
			h[j] = h[j + 1]
		if h[j] - h[j + 1] <= 0:
			if h[j + 1] - h[j] >= k:
				if m >= h[j + 1] - h[j] - k:
					m -= h[j + 1] - h[j] - k
					h[j] += h[j + 1] - h[j] - k
				else:
					d += 1
					break
			if h[j + 1] - h[j] < k and h[j] - (k - (h[j + 1] - h[j])) > 0:
				m += k - (h[j + 1] - h[j])
				h[j] -= k - (h[j + 1] - h[j])
			elif h[j + 1] - h[j] < k and h[j] - (k - (h[j + 1] - h[j])) <= 0:
				m += h[j]
				h[j] = 0
	if d != 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	row = list(map(int, input().split()))
	flag = True
	for i in range(n - 1):
		if row[i] >= row[i + 1]:
			m += min(row[i], k + row[i] - row[i + 1])
		elif row[i + 1] - row[i] <= k:
			m += min(row[i], row[i] - (row[i + 1] - k))
		elif row[i + 1] - k - row[i] <= m:
			m -= row[i + 1] - k - row[i]
		else:
			flag = False
			break
	print('YES') if flag else print('NO')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ans = 'yes'
	for i in range(n - 1):
		diff = h[i] - h[i + 1] + k
		t = diff - max(diff - h[i], 0)
		if diff + m >= 0:
			m += t
			h[i] -= t
		else:
			ans = 'no'
			break
	print(ans)


import collections
for t in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ans = 'YES'
	for i in range(n - 1):
		if abs(h[i] - h[i + 1]) > k:
			d = h[i] - h[i + 1]
			if d < 0 and m >= abs(d) - k:
				m -= -k - d
			elif d > 0:
				m += min(d + k, h[i])
			else:
				ans = 'NO'
				break
		else:
			d = h[i] - h[i + 1]
			if d >= 0:
				m += min(d + k, h[i])
			else:
				m += min(k + d, h[i])
	print(ans)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, sys.stdin.readline().split())

def Neo():
	return list(map(int, sys.stdin.readline().split()))
for i in range(I()):
	(n, m, k) = neo()
	A = Neo()
	if n == 1:
		print('YES')
		continue
	f = 0
	for i in range(n - 1):
		if A[i] >= A[i + 1]:
			m += A[i] - A[i + 1]
			m += min(k, A[i + 1])
		elif A[i + 1] - A[i] <= k:
			m += min(k - (A[i + 1] - A[i]), A[i])
		else:
			t = A[i + 1] - A[i] - k
			m -= t
			if m < 0:
				f = 1
				break
	print('YES') if f == 0 else print('NO')


n = int(input())
for i in range(0, n):
	p = input().rstrip().split(' ')
	q = input().rstrip().split(' ')
	flag = 0
	capacity = int(p[1])
	for j in range(0, len(q) - 1):
		A = abs(int(q[j + 1]) - int(q[j]))
		if A <= int(p[2]):
			B = int(q[j + 1]) - int(p[2])
			if B <= 0:
				capacity += int(q[j])
			else:
				capacity += int(q[j]) - B
		else:
			V = A - int(p[2])
			if int(q[j]) >= int(q[j + 1]):
				N = int(q[j + 1]) - int(p[2])
				if N <= 0:
					capacity += int(q[j])
				else:
					capacity += int(q[j]) - N
			elif V <= capacity:
				capacity -= V
			else:
				flag = 1
				break
	if flag == 0:
		print('YES')
	else:
		print('NO')


def solve(n, m, k, ar):
	for i in range(0, n - 1):
		m += ar[i] - max(0, ar[i + 1] - k)
		if m < 0:
			print('NO')
			return
	print('YES')
q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	solve(n, m, k, ar)


import sys
import math
import random
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(n, m, k) = invr()
	ara = inara()
	flag = True
	for i in range(n - 1):
		if ara[i] >= ara[i + 1] - k:
			hobe = max(0, ara[i + 1] - k)
			m += ara[i] - hobe
		else:
			lagbe = ara[i + 1] - k - ara[i]
			if m >= lagbe:
				m -= lagbe
			else:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	(n, m, k) = [int(j) for j in input().split()]
	h = [int(j) for j in input().split()]
	f = 1
	if n == 1:
		print('Yes')
		continue
	for i in range(n - 1):
		if h[i] < h[i + 1]:
			if h[i + 1] - h[i] > k:
				m -= h[i + 1] - h[i] - k
			else:
				m += min(h[i], k - (h[i + 1] - h[i]))
		elif h[i] >= h[i + 1]:
			m += h[i] - h[i + 1] + min(k, h[i + 1])
		if m < 0:
			f = 0
			print('NO')
			break
	if f:
		print('YES')


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	x = 0
	for i in range(n):
		try:
			m += l[i] - max(0, l[i + 1] - k)
		except:
			print('YES')
			x = 1
			break
		if m < 0:
			print('NO')
			x = 1
			break


t = int(input())
for j in range(0, t):
	l2 = [int(x) for x in input().split()]
	n = l2[0]
	m = l2[1]
	k = l2[2]
	l1 = [int(x) for x in input().split()]
	possible = True
	for i in range(0, n - 1):
		if l1[i] >= l1[i + 1]:
			final_height_i = max(l1[i + 1] - k, 0)
			can_remove_blocks = l1[i] - final_height_i
			m += can_remove_blocks
		elif l1[i] < l1[i + 1]:
			if l1[i] < l1[i + 1] - k:
				val = l1[i + 1] - k - l1[i]
				if m >= val:
					m -= val
				else:
					possible = False
					break
			else:
				final_height_i = max(l1[i + 1] - k, 0)
				can_remove_blocks = l1[i] - final_height_i
				m += can_remove_blocks
	if possible == False:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = [int(o) for o in input().split()]
	a = a[:]
	cb = m
	i = 0
	flag = 0
	while i < n - 1:
		cb += a[i]
		a[i] = 0
		if cb >= max(a[i + 1] - k, 0):
			cb -= max(a[i + 1] - k, 0)
			i += 1
		else:
			flag = 1
			break
	print('YES' if flag == 0 else 'NO')


def func():
	for t in range(int(input())):
		(n, m, k) = [int(x) for x in input().split()]
		h = [int(x) for x in input().split()]
		poss = 0
		for i in range(1, n):
			req = max(0, h[i] - k)
			if h[i - 1] >= req:
				m += h[i - 1] - req
			elif m + h[i - 1] >= req:
				m -= req - h[i - 1]
				m = max(0, m)
			else:
				poss = 1
		if poss:
			print('NO')
		else:
			print('YES')
func()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	flag = 1
	for i in range(n - 1):
		if l[i + 1] > l[i]:
			z = l[i + 1] - k
			ne = z - l[i]
			if ne < 0:
				m = m + min(l[i], -ne)
			if ne <= m:
				m = m - max(0, ne)
			else:
				flag = 0
				break
		if l[i + 1] <= l[i]:
			z = l[i] - l[i + 1]
			x = min(l[i + 1], k)
			m = m + z + x
	if flag == 1:
		print('YES')
	else:
		print('NO')


import sys, math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	q = 0
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for j in range(len(a) - 1):
		m = m + min(a[j] - a[j + 1] + k, a[j])
		if m < 0:
			q = 1
			print('NO')
			break
	if q == 0:
		print('YES')


for t in range(int(input())):
	(n, bag, k) = map(int, input().split())
	h = list(map(int, input().split()))
	ans = 'YES'
	for i in range(1, n):
		req = max(h[i] - k, 0)
		extra = h[i - 1] - req
		bag += extra
		if bag < 0:
			ans = 'NO'
			break
	print(ans)


def calc(n, backpack, k, level):
	for i in range(n - 1):
		diff = level[i + 1] - level[i]
		if diff > k:
			backpack -= diff - k
			if backpack < 0:
				return False
		else:
			backpack += min(k - diff, level[i])
	return True
for _ in range(int(input())):
	(n, backpack, k) = map(int, input().split())
	level = list(map(int, input().split()))
	print('YES') if calc(n, backpack, k, level) else print('NO')


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	f = False
	for i in range(n - 1):
		d = a[i + 1] - a[i]
		if d > k + m:
			print('NO')
			f = True
			break
		elif d < 0:
			m += min(abs(d) + k, a[i])
		elif d <= k:
			m += min(k - d, a[i])
		else:
			m -= d - k
	if not f:
		print('YES')


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b):
	return abs(a[0] - b[0]) + abs(b[1] - a[1])

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def eld(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()

def fac(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= MOD
	return ans
for _ in range(int(input())):
	(n, m, k) = arrIN()
	h = arrIN()
	i = 0
	while i < n - 1:
		if abs(h[i] - h[i + 1]) <= k:
			if h[i] >= h[i + 1]:
				t = min(h[i] - h[i + 1], k)
				m += t
				h[i] -= t
			if h[i + 1] >= h[i]:
				t = max(0, h[i + 1] - k)
				m += h[i] - t
				h[i] -= h[i] - t
			i += 1
		else:
			if h[i] >= h[i + 1]:
				m += h[i] - h[i + 1] - k
				h[i] -= h[i] - h[i + 1] - k
				if h[i] >= h[i + 1]:
					t = min(h[i] - h[i + 1], k)
					m += t
					h[i] -= t
				if h[i + 1] >= h[i]:
					t = max(0, h[i + 1] - k)
					m += h[i] - t
					h[i] -= h[i] - t
			else:
				req = h[i + 1] - h[i] - k
				if req > m:
					print('NO')
					break
				else:
					m -= req
			i += 1
	if i == n - 1:
		print('YES')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	p = 1
	for i in range(n - 1):
		if not p:
			continue
		if a[i] < a[i + 1] and a[i + 1] - a[i] > k:
			m -= a[i + 1] - k - a[i]
		else:
			m += a[i] - max(0, a[i + 1] - k)
		if m < 0:
			p = 0
	print('YES' if p else 'NO')


t = int(input())
for j in range(t):
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	b = m
	p = 1
	f = 0
	i = 0
	for j in range(n - 1):
		x = h[j + 1] - k
		if x < 0:
			x = 0
		b += h[j] - x
		if b < 0:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


import sys
from collections import defaultdict
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(n, m, k) = map(int, input().split())
		h = list(map(int, input().split()))
		bag = m
		ok = True
		for i in range(n - 1):
			a = h[i]
			b = h[i + 1]
			if a + k < b:
				to_add = b - k - a
				if to_add > bag:
					ok = False
					break
				bag -= to_add
			else:
				to_bag = min(a, a - (b - k))
				bag += to_bag
		print('YES' if ok else 'NO')
main()


t = int(input())
while t:
	(n, m, k) = map(int, input().split())
	h = input().split()
	for i in range(n):
		h[i] = int(h[i])
	flag = True
	for j in range(n - 1):
		if h[j + 1] - h[j] > k:
			need = h[j + 1] - k - h[j]
			if m >= need:
				m -= need
			else:
				flag = False
		else:
			extra = h[j] - max(h[j + 1] - k, 0)
			m += extra
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


x = int(input())
for __ in range(x):
	(a, b, k) = map(int, input().split())
	n = list(map(int, input().split()))
	f = 0
	for i in range(1, a):
		p = n[i] - k
		if p < 0:
			p = 0
		if p >= 0:
			if n[i - 1] - p >= 0:
				b += n[i - 1] - p
			elif b >= n[i - 1] - p:
				b += n[i - 1] - p
			else:
				f = 1
		else:
			f = 1
		if b < 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


import sys
import os
from io import BytesIO, IOBase

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import gcd
for _ in range(ii()):
	(n, m, k) = mi()
	a = li()
	f = 0
	for i in range(n - 1):
		m += min(a[i] - a[i + 1] + k, a[i])
		if m < 0:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	lose = False
	for i in range(n - 1):
		diff = h[i + 1] - h[i]
		if diff > m + k:
			print('NO')
			lose = True
			break
		else:
			m += h[i] - max(h[i + 1] - k, 0)
	if not lose:
		print('YES')


test = int(input())
for _ in range(test):
	(n, bag, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	temp = 0
	for i in range(n - 1):
		tmp = arr[i + 1] - k
		if tmp < 0:
			tmp = 0
		if tmp > arr[i]:
			bag -= tmp - arr[i]
		else:
			bag += arr[i] - tmp
		if bag < 0:
			temp = 1
			break
	if temp == 0:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
for i in range(n):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	t = 0
	for j in range(n - 1):
		m += l[j] - max(0, l[j + 1] - k)
		if m < 0:
			t = 1
			break
	if t == 1:
		print('NO')
	else:
		print('YES')


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	flag = True
	for j in range(n - 1):
		if h[j + 1] - h[j] > k:
			m -= h[j + 1] - h[j] - k
		else:
			m += h[j] + min(0, k - h[j + 1])
		if m < 0:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	res = 'YES'
	for (i, x) in enumerate(lst[:-1]):
		diff = abs(x - lst[i + 1])
		if x >= lst[i + 1]:
			m += diff + min(k, lst[i + 1])
		elif diff <= k:
			m += min(x, k - diff)
		elif m >= diff - k:
			m -= diff - k
		else:
			res = 'NO'
			break
	print(res)


from sys import stdin
input = stdin.readline
for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	bag = m
	for i in range(n - 1):
		bag += h[i]
		h[i] = 0
		dif = h[i + 1] - h[i]
		if dif <= k:
			continue
		elif dif > k and dif - k <= bag:
			bag -= dif - k
		else:
			print('NO')
			break
	else:
		print('YES')


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
t = ii()
for i in range(t):
	(n, m, k) = mi()
	d = li()
	f = True
	for i in range(n - 1):
		if d[i] + k >= d[i + 1]:
			m += min(d[i], d[i] + k - d[i + 1])
		elif m < d[i + 1] - (d[i] + k):
			f = False
			break
		else:
			m -= d[i + 1] - (d[i] + k)
	print('NO') if not f else print('YES')


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = True
	for i in range(n - 1):
		required = max(l[i + 1] - k, 0)
		m += l[i] - required
		if m < 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def inp():
	return int(input())

def solve():
	(n, m, k) = [int(x) for x in input().split()]
	h = [int(x) for x in input().split()]
	bg = m
	for i in range(n - 1):
		tgt = max(0, h[i + 1] - k)
		if h[i] >= tgt:
			bg += h[i] - tgt
			continue
		if tgt - h[i] > bg:
			return False
		bg -= tgt - h[i]
	return True
for _ in range(inp()):
	if solve():
		print('YES')
	else:
		print('NO')


def fPass(hl, n, m, k):
	for i in range(n - 1):
		m += hl[i] - max(hl[i + 1] - k, 0)
		if m < 0:
			return False
	return True
tc = int(input())
rl = []
for i in range(tc):
	(n, m, k) = list(map(int, input().split()))
	hl = list(map(int, input().split()))
	rl.append(fPass(hl, n, m, k))
[print('YES' if r else 'NO') for r in rl]


import sys
t = int(sys.stdin.readline())

def solve(num_cols, bag_count, min_jump_height, cols):
	for i in range(num_cols):
		if i + 1 < num_cols:
			if cols[i] <= cols[i + 1]:
				error = cols[i + 1] - min_jump_height - cols[i]
				if abs(error) > cols[i] and error < 0:
					error = -1 * cols[i]
				bag_count -= error
			else:
				error = cols[i] - (cols[i + 1] - min_jump_height)
				if error > cols[i]:
					error = cols[i]
				bag_count += error
		if bag_count < 0:
			return 'NO'
	return 'YES'
for i in range(t):
	(n, m, k) = sys.stdin.readline().split(' ')
	n = int(n)
	m = int(m)
	k = int(k)
	h = sys.stdin.readline().split(' ')
	heights = [int(i) for i in h]
	print(solve(n, m, k, heights))


for i in range(int(input())):
	(n, bag, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	x = 1
	while x < n:
		if arr[x - 1] >= arr[x]:
			bag += arr[x - 1] - arr[x] + min(k, arr[x])
			x += 1
		else:
			req = arr[x] - arr[x - 1] - k
			if req <= 0:
				bag += min(abs(req), arr[x - 1])
				x += 1
			elif req > bag:
				print('NO')
				break
			else:
				bag -= req
				x += 1
	if x == n:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
for _ in range(int(ri())):
	(n, m, k) = Ri()
	a = Ri()
	flag = True
	for i in range(n - 1):
		a[i] += m
		if a[i] > a[i + 1]:
			m = a[i] - max(0, a[i + 1] - k)
		elif a[i] + k < a[i + 1]:
			flag = False
			break
		else:
			m = a[i] - max(0, a[i + 1] - k)
	if not flag:
		NO()
	else:
		YES()


from os import linesep

def fmatr(matrix, lnsep: str=linesep, fieldsep: str=' ') -> str:
	return lnsep.join(map(lambda row: fieldsep.join(map(str, row)), matrix))

def fbool(boolval: int) -> str:
	return ['No', 'Yes'][boolval]

def solve() -> None:
	t = int(input())
	ans = [None] * t
	ti = 0
	for i in range(t):
		(n, m, k) = map(int, input().split())
		h = list(map(int, input().split()))
		subans = True
		for j in range(1, n):
			shouldBeH = max([0, h[j] - k])
			dh = h[j - 1] - shouldBeH
			if dh < -m:
				subans = False
				break
			m += dh
		ans[i] = subans
	print(linesep.join(list(map(lambda bl: fbool(bl).upper(), ans))))
solve()


from sys import stdin
t = int(stdin.readline())
for T in range(0, t):
	(n, m, k) = (int(i) for i in stdin.readline().split())
	h = list((int(i) for i in stdin.readline().split()))
	if n == 1:
		print('YES')
		continue
	for i in range(0, n - 1):
		if h[i] >= h[i + 1] - k:
			if h[i + 1] - k > 0:
				m += h[i] - (h[i + 1] - k)
			else:
				m += h[i]
		elif h[i] < h[i + 1] - k:
			m -= h[i + 1] - k - h[i]
			if m < 0:
				print('NO')
				break
		if i == n - 2:
			print('YES')


t = int(input())
for j in range(t):
	(n, m, k) = map(int, input().split())
	f = True
	a = list(map(int, input().split()))
	i = 0
	while f and i < n - 1:
		if abs(a[i + 1] - a[i]) <= k or a[i] > a[i + 1]:
			m += a[i] - max(a[i + 1] - k, 0)
		elif a[i + 1] - a[i] - k <= m:
			m -= a[i + 1] - a[i] - k
		else:
			f = False
		i += 1
	if f:
		print('YES')
	else:
		print('NO')


import sys
from sys import stdin
tt = int(stdin.readline())
ANS = []
for loop in range(tt):
	(n, m, k) = map(int, stdin.readline().split())
	h = list(map(int, stdin.readline().split()))
	nsum = h[0] + m
	ans = 'YES'
	for i in range(1, n):
		if nsum < h[i] - k:
			ans = 'NO'
			break
		nsum += h[i]
		nsum -= max(0, h[i] - k)
	ANS.append(ans)
print('\n'.join(ANS))


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	z = list(map(int, input().split()))
	ans = True
	for j in range(n - 1):
		m += z[j] - max(0, z[j + 1] - k)
		if m < 0:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


case = int(input())
for i in range(0, case):
	(n, m, k) = map(int, input().split())
	col = list(map(int, input().split()))
	cur = col[0]
	col.pop(0)
	text = 'YES'
	for next in col:
		if next - (cur + m) > k:
			text = 'NO'
			break
		else:
			m -= max(next - k, 0) - cur
			cur = next
	print(text)


def isPossible(n, m, k, tower):
	for i in range(len(tower) - 1):
		if abs(tower[i + 1] - tower[i]) > k:
			if tower[i + 1] > tower[i]:
				if tower[i + 1] - k - tower[i] > m:
					return False
				m -= tower[i + 1] - k - tower[i]
			else:
				m += abs(tower[i + 1] - tower[i])
				tower[i] = tower[i + 1]
				m += min(tower[i], tower[i] - (tower[i + 1] - k))
		elif tower[i + 1] > tower[i]:
			m += min(tower[i], tower[i] - (tower[i + 1] - k))
		else:
			m += abs(tower[i + 1] - tower[i])
			tower[i] = tower[i + 1]
			m += min(tower[i], tower[i] - (tower[i + 1] - k))
	return True
for t in range(int(input())):
	(n, m, k) = tuple(map(int, input().split()))
	tower = list(map(int, input().split()))
	if isPossible(n, m, k, tower):
		print('YES')
	else:
		print('NO')


num_test_cases = int(input())
for test_case in range(num_test_cases):
	(n, m, k) = map(int, input().split(' '))
	heights = list(map(int, input().split(' ')))
	is_possible = True
	for i in range(n - 1):
		delta = heights[i] - heights[i + 1]
		if delta < 0:
			if -delta <= k:
				m += min(k + delta, heights[i])
			elif -delta <= k + m:
				m += k + delta
			else:
				is_possible = False
				break
		else:
			m += min(k + delta, heights[i])
	if not is_possible:
		print('NO')
	else:
		print('YES')


T = int(input())
for t in range(T):
	nmk = list(map(int, input().split(' ')))
	h = list(map(int, input().split(' ')))
	i = 0
	while i < nmk[0] - 1:
		if h[i] >= h[i + 1] - nmk[2]:
			nmk[1] = nmk[1] + (h[i] - max(h[i + 1] - nmk[2], 0))
			i = i + 1
		elif h[i] + nmk[1] >= h[i + 1] - nmk[2]:
			nmk[1] = nmk[1] - (h[i + 1] - nmk[2] - h[i])
			i = i + 1
		else:
			print('NO')
			break
	if i == nmk[0] - 1:
		print('YES')


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	s = [int(i) for i in input().split()]
	c = 1
	for i in range(n - 1):
		if s[i] >= s[i + 1]:
			m += min(s[i] - s[i + 1] + k, s[i])
		elif s[i + 1] - s[i] > k:
			m -= s[i + 1] - k - s[i]
		else:
			m += min(k - (s[i + 1] - s[i]), s[i])
		if m < 0:
			c = 0
			break
	if c:
		print('YES')
	else:
		print('NO')


def int_multiple():
	return [int(c) for c in input().split()]

def int_single():
	return int(input())

def str_multiple():
	return [c for c in input().split()]

def str_single():
	return input()
t = int_single()
res = []
for i in range(t):
	(n, m, k) = int_multiple()
	l = int_multiple()
	no = False
	for j in range(n - 1):
		m -= max(0, l[j + 1] - k) - l[j]
		if m < 0:
			no = True
			break
	if no:
		res.append('NO')
	else:
		res.append('YES')
for r in res:
	print(r)


def max_to_take(h1, h2, k):
	if h1 >= h2:
		x = h1 - h2
		return x + k if h1 - x - k >= 0 else h1
	else:
		return k - (h2 - h1) if h1 - (k - (h2 - h1)) >= 0 else h1
test_cases = int(input())
for _ in range(test_cases):
	[n, m, k] = list(map(int, input().split(' ')))
	h = list(map(int, input().split(' ')))
	for i in range(n):
		if i == n - 1:
			print('YES')
			break
		if h[i] <= h[i + 1] and h[i + 1] - h[i] < k or h[i] >= h[i + 1]:
			m += max_to_take(h[i], h[i + 1], k)
		else:
			needed = h[i + 1] - h[i] - k
			if needed > m:
				print('NO')
				break
			else:
				m -= needed


import math

def can_win(n, m, step, hi):
	for i in range(n - 1):
		h = hi[i]
		hn = hi[i + 1]
		diff = h - hn
		if diff < 0:
			if abs(diff) <= step:
				m += min(h, step - abs(diff))
			else:
				m -= abs(diff) - step
				if m < 0:
					return 'NO'
		else:
			m += diff + min(step, hn)
	return 'YES'
n = int(input())
for i in range(n):
	(n, m, k) = list(map(int, input().split()))
	hi = list(map(int, input().split()))
	print(can_win(n, m, k, hi))


import sys
import os
from io import IOBase, BytesIO

def main():
	for tc in range(int(input())):
		(n, m, k) = get_ints()
		arr = get_array()
		ans = 'YES'
		for i in range(n - 1):
			x = max(0, arr[i + 1] - k)
			if arr[i] > arr[i + 1]:
				m += arr[i] - x
			elif arr[i] + m + k < arr[i + 1]:
				ans = 'NO'
				break
			elif arr[i] + k >= arr[i + 1]:
				m += arr[i] - x
			else:
				tmp = arr[i + 1] - (arr[i] + k)
				m -= tmp
		print(ans)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


import sys, math, bisect
from collections import defaultdict
M = 10 ** 9 + 7

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a
		b >>= 1
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def factor(n):
	potentional_p = 3
	itog_list = {}
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			if n in itog_list:
				itog_list[n] += 1
			else:
				itog_list[n] = 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			if potentional_p in itog_list:
				itog_list[potentional_p] += 1
			else:
				itog_list[potentional_p] = 1
		potentional_p += 2
	return itog_list
t = int(input())
for _ in range(t):
	flag = 0
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			m += abs(a[i] - a[i + 1])
			m += min(a[i + 1], k)
		elif a[i] < a[i + 1]:
			if a[i + 1] - a[i] <= k:
				m += min(k - a[i + 1] + a[i], a[i])
			elif m >= a[i + 1] - a[i] - k:
				m -= a[i + 1] - a[i] - k
			else:
				flag = 1
				break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	inp1 = [int(j) for j in filter(None, input().split(' '))]
	heights = [int(j) for j in filter(None, input().split(' '))]
	inventory = inp1[1]
	k = inp1[2]
	output = 'YES'
	for j in range(len(heights) - 1):
		inventory += heights[j]
		if heights[j + 1] >= k and inventory - heights[j + 1] >= -k:
			inventory -= heights[j + 1] - k
		elif heights[j + 1] < k and inventory - heights[j + 1] >= -k:
			continue
		else:
			output = 'NO'
	print(output)


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	t = rsingle_int()
	for i in range(t):
		(n, m, k) = rmult_int()
		cols = rmult_int()
		possible = True
		for i in range(n - 1):
			if cols[i] >= cols[i + 1] - k:
				if cols[i + 1] >= k:
					m += cols[i] - cols[i + 1] + k
				else:
					m += cols[i]
			else:
				m -= cols[i + 1] - k - cols[i]
				if m < 0:
					possible = False
					break
		if possible:
			print('YES')
		else:
			print('NO')
main()


def solve():
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	h = a[0]
	for i in range(1, n):
		g = a[i]
		f = max(0, g - k)
		if h + m < f:
			return False
		else:
			m += h - f
		h = g
	return True
t = int(input())
for tc in range(t):
	if solve():
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m, l) = map(int, input().split())
	h = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		if h[i] + l >= h[i + 1]:
			m += min(h[i], h[i] - h[i + 1] + l)
		elif h[i] + l < h[i + 1]:
			if h[i] + l + m < h[i + 1]:
				flag = 1
				break
			else:
				m -= h[i + 1] - (h[i] + l)
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split(' '))
	l = list(map(int, input().split()))
	d = True
	for i in range(n - 1):
		if l[i + 1] - k <= 0:
			m = m + l[i]
		elif l[i] < l[i + 1] - k:
			if m < l[i + 1] - k - l[i]:
				d = False
				break
			else:
				m = m + l[i] + k - l[i + 1]
		else:
			m = m + l[i] + k - l[i + 1]
	if d:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	(n, m, k) = map(int, input().split())
	columns = list(map(int, input().split()))
	success = True
	for i in range(n - 1):
		if columns[i] + k >= columns[i + 1]:
			m += min(columns[i] - columns[i + 1] + k, columns[i])
		else:
			m -= columns[i + 1] - columns[i] - k
			if m < 0:
				success = False
				break
	if success:
		print('YES')
	else:
		print('NO')


t = int(input())
for t_num in range(t):
	(n, m, k) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	ok = True
	for i in range(n - 1):
		if h[i] >= h[i + 1]:
			m += h[i] - h[i + 1]
			m += min(k, h[i + 1])
		else:
			least = h[i + 1] - k
			if least <= 0:
				m += h[i]
			elif h[i] >= least:
				m += h[i] - least
			elif least - h[i] <= m:
				m -= least - h[i]
			else:
				ok = False
				break
	print('YES' if ok else 'NO')


t = int(input())

def func(n, m, k, ht):
	flag = 1
	for curr in range(n - 1):
		prev = ht[curr]
		nex = ht[curr + 1]
		if nex > prev + k + m:
			flag = 0
			break
		elif nex > prev + k:
			m -= nex - prev - k
			curr += 1
		else:
			curr += 1
			if k > nex:
				m += prev
			else:
				m += k + prev - nex
	if flag == 0:
		print('NO')
	else:
		print('YES')
for i in range(t):
	temp = input().split()
	n1 = int(temp[0])
	m1 = int(temp[1])
	k1 = int(temp[2])
	ht1 = [int(char) for char in input().split()]
	func(n1, m1, k1, ht1)


t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	it = list(map(int, input().split()))
	dp = [0] * n
	dp[0] = m
	st = False
	for i in range(1, n):
		if it[i] > it[i - 1] + k:
			dp[i] = dp[i - 1] - (it[i] - it[i - 1] - k)
		elif it[i] < it[i - 1] - k:
			dp[i] = dp[i - 1] + it[i - 1] - it[i]
			dp[i] += min(it[i], k)
		elif it[i - 1] >= it[i]:
			dp[i] = dp[i - 1] + it[i - 1] - it[i]
			dp[i] += min(k, it[i])
		elif it[i - 1] < it[i]:
			dp[i] = dp[i - 1] + min(k - (it[i] - it[i - 1]), it[i - 1])
		if dp[i] < 0:
			st = True
			break
	if st:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
	for i in range(n - 1):
		dif = arr[i + 1] - k
		if dif < 0:
			dif = 0
		if arr[i] >= dif and arr[i] >= 0:
			m += arr[i] - dif
		else:
			m -= arr[i + 1] - k - arr[i]
		if m < 0:
			print('NO')
			break
		if i == n - 2:
			print('YES')


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ok = True
	for i in range(n - 1):
		p = abs(a[i] - a[i + 1])
		if a[i] > a[i + 1]:
			m += p
			m += min(k, a[i] - p)
		elif p > k and m < p - k:
			ok = False
			break
		elif p > k:
			m -= p - k
		else:
			m += min(k - p, a[i])
	if ok:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	X = list(map(int, input().split()))
	Columns = list(map(int, input().split()))
	Answer = True
	for index in range(X[0] - 1):
		if Columns[index] >= Columns[index + 1]:
			X[1] += max(Columns[index] - max(0, Columns[index + 1] - X[2]), 0)
			continue
		if Columns[index + 1] - Columns[index] <= X[2]:
			X[1] += max(Columns[index] - max(0, Columns[index + 1] - X[2]), 0)
			continue
		if Columns[index + 1] - X[2] <= X[1] + Columns[index]:
			X[1] -= Columns[index + 1] - X[2] - Columns[index]
			continue
		else:
			Answer = False
			break
	print('YES' if Answer else 'NO')


from math import *
MOD = int(1000000000.0) + 7

def nextInt():
	return int(input())

def nextInts():
	return list(map(int, input().split()))

def YN(x):
	return 'YES' if x else 'NO'

def solve():
	(n, m, k) = nextInts()
	h = nextInts()
	for i in range(n - 1):
		m += h[i]
		m -= max(0, h[i + 1] - k)
		if m < 0:
			return False
	return True
t = nextInt()
for i in range(t):
	print(YN(solve()))


m = int(input())

def find_ans():
	(n, m, k) = map(int, input().split())
	s = list(map(int, input().split()))
	for i in range(n - 1):
		if s[i] <= s[i + 1]:
			diff = s[i + 1] - s[i]
			if diff > k:
				if diff - m > k:
					return 'NO'
				else:
					m -= diff - k
			else:
				to_add = max(s[i + 1] - k, 0)
				m += s[i] - to_add
		else:
			diff = s[i] - s[i + 1]
			to_add = max(s[i + 1] - k, 0)
			m += s[i] - to_add
	return 'YES'
for i in range(m):
	print(find_ans())


def input(f):
	(t,) = map(int, f.readline().split())
	for _ in range(t):
		(n, m, k) = map(int, f.readline().split())
		h = list(map(int, f.readline().split()))
		yield (n, m, k, h)

def solve(n, m, k, h):
	for i in range(n - 1):
		hp = h[i]
		hn = h[i + 1]
		if hp <= hn:
			if hn - k < hp:
				m += max(0, min(hp, k - (hn - hp)))
			else:
				m -= hn - hp - k
				if m < 0:
					return 'NO'
		else:
			m += hp - hn
			if hn >= k:
				m += k
			else:
				m += hn
	return 'YES'
import sys
for (n, m, k, h) in input(sys.stdin):
	print(solve(n, m, k, h))


for _ in range(int(input())):
	(n, bag, k) = [int(i) for i in input().split()]
	data = [int(i) for i in input().split()]
	good = True
	for i in range(n - 1):
		bag += data[i] - max(0, data[i + 1] - k)
		if bag < 0:
			good = False
			break
	if good:
		print('YES')
	else:
		print('NO')


test_count = int(input())
ans = []
for test in range(test_count):
	(n, m, k) = [int(i) for i in input().split()]
	h = [int(i) for i in input().split()]
	passed = True
	for j in range(1, n):
		current = h[j - 1]
		next = h[j] - k if h[j] - k >= 0 else 0
		m += current - next
		if m < 0:
			passed = False
			break
	ans.append('YES' if passed else 'NO')
print(*ans, sep='\n')


t = int(input())
for i in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	flag = 0
	for j in range(0, n - 1):
		val = max(0, l[j + 1] - k)
		if l[j] > val:
			m += l[j] - val
		elif val - l[j] <= m:
			m -= val - l[j]
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def game(arr, n, m, k):
	i = 0
	ans = True
	for i in range(n - 1):
		val = max(0, arr[i + 1] - k)
		if val < arr[i]:
			m += arr[i] - val
		elif val - arr[i] > m:
			ans = False
			break
		else:
			m -= val - arr[i]
	if ans:
		return 'YES'
	else:
		return 'NO'
t = int(input())
while t:
	nmk = list(map(int, input().rstrip().split()))
	n = nmk[0]
	m = nmk[1]
	k = nmk[2]
	arr = list(map(int, input().rstrip().split()))
	print(game(arr, n, m, k))
	t = t - 1


t = int(input())
for ijk in range(0, t):
	(n, m, k) = map(int, input().strip().split())
	h = list(map(int, input().strip().split()))
	flag = 0
	for i in range(0, n):
		if i == n - 1:
			flag = 1
			break
		elif h[i] >= h[i + 1]:
			m += min(h[i], h[i] - h[i + 1] + k)
		else:
			req = h[i + 1] - k
			if h[i] >= req:
				m += min(h[i], h[i] - req)
			else:
				reqc = req - h[i]
				if reqc > m:
					flag = 0
					break
				else:
					m -= reqc
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
(n, m, k) = (0, 0, 0)
h = 0
tam = 0
kq = 0
for i in range(t):
	(n, m, k) = map(int, input().split())
	h = list(map(int, input().split()))
	kq = 1
	for j in range(n - 2):
		if h[j + 1] - k <= h[j] <= h[j + 1] + k:
			if h[j + 1] - k < 0:
				m = m + h[j]
			else:
				m = m + (h[j] - h[j + 1] + k)
		elif h[j] > h[j + 1] + k:
			if h[j + 1] - k < 0:
				m = m + h[j]
			else:
				m = m + (h[j] - (h[j + 1] - k))
		elif h[j] < h[j + 1] - k:
			if h[j] + m >= h[j + 1] - k:
				tam = h[j + 1] - k - h[j]
				m = m - tam
			else:
				kq = 0
				break
	if h[n - 2] + m < h[n - 1] - k:
		kq = 0
	if kq == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
out = []
for i in range(t):
	nmk = [int(c) for c in input().split()]
	hi = [int(c) for c in input().split()]
	if nmk[0] == 1:
		out.append('YES')
		continue
	else:
		out.append('YES')
		for j in range(nmk[0] - 1):
			if hi[1 + j] <= nmk[2]:
				nmk[1] += hi[j]
			else:
				nmk[1] += hi[j] - (hi[1 + j] - nmk[2])
			if nmk[1] < 0:
				out[i] = 'NO'
				break
for i in range(t):
	print(out[i])


t = int(input())
while t:
	t -= 1
	[n, m, k] = [int(item) for item in input().split(' ')]
	block = [int(item) for item in input().split(' ')]
	bag = m
	ans = True
	for i in range(n - 1):
		diff = block[i + 1] - block[i]
		if diff > k:
			if diff > bag + k:
				print('NO')
				ans = False
				break
			else:
				bag -= diff - k
		else:
			m = block[i + 1] - k
			m = max(m, 0)
			bag += block[i] - m
	if ans:
		print('YES')


import sys

def check(n, m, k, h):
	hnow = h[0]
	for hi in h[1:]:
		t = max(hi - k, 0)
		if hnow <= t:
			m -= t - hnow
			if m < 0:
				return 'NO\n'
		else:
			m += hnow - t
		hnow = hi
	return 'YES\n'
T = int(input())
for _ in range(T):
	(N, M, K) = map(int, sys.stdin.readline().split())
	H = list(map(int, sys.stdin.readline().split()))
	sys.stdout.write(check(N, M, K, H))


def solve(hts, n, m, k, ans):
	bag = m
	for i in range(n - 1):
		if hts[i] >= hts[i + 1]:
			bag += hts[i] - hts[i + 1]
			hts[i] = hts[i + 1]
			bag += min(hts[i], k)
		elif hts[i + 1] - hts[i] > k:
			x = hts[i + 1] - hts[i] - k
			if bag >= x:
				bag -= x
			else:
				ans.append('NO')
				return
		else:
			x = k - hts[i + 1] + hts[i]
			bag += min(x, hts[i])
	ans.append('YES')

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(n, m, k) = map(int, input().split())
		hts = list(map(int, input().split()))
		solve(hts, n, m, k, ans)
	for i in ans:
		print(i)
main()


def solve():
	input1 = list(map(int, input().split()))
	n = input1[0]
	m = input1[1]
	k = input1[2]
	blocks = list(map(int, input().split()))
	status = 'YES'
	for i in range(0, n - 1):
		x = blocks[i] - blocks[i + 1] + k
		if x > blocks[i]:
			x = blocks[i]
		m += x
		if m < 0:
			status = 'NO'
			break
	print(status)
t = int(input())
for tt in range(1, t + 1):
	solve()