You have $n$ stacks of blocks. The $i$-th stack contains $h_i$ blocks and it's height is the number of blocks in it. In one move you can take a block from the $i$-th stack (if there is at least one block) and put it to the $i + 1$-th stack. Can you make the sequence of heights strictly increasing?

Note that the number of stacks always remains $n$: stacks don't disappear when they have $0$ blocks.


-----Input-----

First line contains a single integer $t$ $(1 \leq t \leq 10^4)$ — the number of test cases.

The first line of each test case contains a single integer $n$ $(1 \leq n \leq 100)$. The second line of each test case contains $n$ integers $h_i$ $(0 \leq h_i \leq 10^9)$ — starting heights of the stacks.

It's guaranteed that the sum of all $n$ does not exceed $10^4$.


-----Output-----

For each test case output YES if you can make the sequence of heights strictly increasing and NO otherwise.

You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as positive answer).


-----Examples-----

Input
6
2
1 2
2
1 0
3
4 4 4
2
0 0
3
0 1 0
4
1000000000 1000000000 1000000000 1000000000
Output
YES
YES
YES
NO
NO
YES


-----Note-----

In the first test case there is no need to make any moves, the sequence of heights is already increasing.

In the second test case we need to move one block from the first stack to the second. Then the heights become $0$ $1$.

In the third test case we could move one block from the first stack to the second and then from the second to the third, which would make the heights $3$ $4$ $5$.

In the fourth test case we can't make a move, but the sequence is not increasing, so the answer is NO.

In the fifth test case we can only make one move (from the second to the third stack), which would make the heights $0$ $0$ $1$. Both $0$ $1$ $0$ and $0$ $0$ $1$ are not increasing sequences, so the answer is NO.

Source: codeforces | Difficulty: EASY
Tags: Implementation

Greedy algorithms


Solutions:
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	lst = list(map(int, input().split()))
	ex = 0
	cur = 0
	okay = True
	for i in range(n):
		if lst[i] >= ex:
			cur += lst[i] - ex
		elif lst[i] <= ex:
			cur += lst[i]
			if cur >= ex:
				cur = cur - ex
			else:
				okay = False
				break
		ex += 1
	if okay == True:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split()
	c = []
	for j in a:
		c.append(int(j))
	bl = True
	for k in range(0, len(c) - 1):
		o = c[k]
		c[k] = k
		c[k + 1] = o - k + c[k + 1]
		if c[k + 1] < k + 1:
			bl = False
			break
	if bl:
		print('YES')
	else:
		print('NO')


import os, 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))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
from functools import lru_cache
R = range
for i in R(ii1()):
	n = ii1()
	arr = iia()
	curr_sum = 0
	arr_sum = 0
	flag = True
	for i in R(n):
		curr_sum += i
		arr_sum += arr[i]
		if curr_sum > arr_sum:
			flag = False
			break
	print('YES' if flag else 'NO')


from sys import stdin
t = int(input())
for i in range(t):
	n = int(input())
	h = list(map(int, stdin.readline().split(' ')))
	l = len(h)
	s = 0
	sum = 0
	for k in range(l):
		s += h[k]
		sum += k
		if s < sum:
			print('NO')
			break
	else:
		print('YES')


tests = int(input())
for _ in range(tests):
	n = int(input())
	b = [int(i) for i in input().split()]
	res = 1
	cumu = 0
	mini = 0
	for k in range(n):
		cumu += b[k]
		mini += k
		if cumu < mini:
			res = 0
	print('YES' if res else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	summing = 0
	flag = False
	for (i, item) in enumerate(a):
		if a[i] + summing >= i and summing >= 0:
			summing += a[i] - i
		else:
			flag = True
			print('NO')
			break
	if flag is False:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	h = list(map(int, input().strip().split()))[:n]
	sum = 0
	pre = 0
	ok = True
	for i in range(0, n, 1):
		sum = sum + h[i]
		pre = pre + h[i]
		if pre < i:
			ok = False
			break
		pre = pre - i
	n = n * (n - 1) // 2
	if sum >= n and ok:
		print('YES')
	else:
		print('NO')
	t = t - 1


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


from functools import lru_cache
from collections import defaultdict, deque, Counter
import sys
input = sys.stdin.readline

class Solution:

	def shiftStacks(self, n, array):
		num = 0
		for i in range(n):
			if array[i] > i:
				num += array[i] - i
			else:
				num -= i - array[i]
			if num < 0:
				return 'NO'
		if num >= 0:
			return 'YES'
		return 'NO'
solution = Solution()
t = int(input())
for _ in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	print(solution.shiftStacks(n, array))


def solve(n):
	sum = 0
	sum_i = 0
	for i in range(len(n)):
		sum = sum + n[i]
		sum_i = sum_i + i
		if sum < sum_i:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	_ = input()
	n = [int(x) for x in input().split()]
	print(solve(n))


t = int(input())
for i in range(t):
	n = int(input())
	need = 0
	have = 0
	ans = True
	a = [int(i) for i in input().split()]
	for j in range(n):
		need += j
		have += a[j]
		if have < need:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


from sys import stdin

def main():
	cases = int(stdin.readline().strip())
	while cases:
		n = int(stdin.readline().strip())
		v = [int(x) for x in stdin.readline().split()]
		aux = 0
		ok = True
		for i in range(n):
			if v[i] > i:
				aux += v[i] - i
				v[i] = i
			elif v[i] + aux >= i:
				aux -= i - v[i]
				v[i] = i
			else:
				ok = False
		if ok:
			print('YES')
		else:
			print('NO')
		cases -= 1
main()


def solve(n, h):
	have = 0
	need = 0
	for i in range(n):
		need += i
		have += h[i]
		if need > have:
			return 'NO'
	return 'YES'
t = int(input())
for q in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	print(solve(n, h))


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


n = int(input())
ans = []
for i in range(n):
	a = int(input())
	numlist = [int(num) for num in input().split()]
	com = numlist[0]
	jg = 1
	for i in range(1, a):
		com += numlist[i]
		if com >= i:
			com -= i
		else:
			ans.append('NO')
			jg = 0
			break
	if jg == 1:
		ans.append('YES')
for i in ans:
	print(i)


from sys import stdin, stdout
for _ in range(int(input())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	last = arr[-1]
	flag = 0
	for (i, v) in enumerate(arr):
		if v < i:
			flag = 1
			break
		elif i == n - 1:
			break
		else:
			add = v - i
			arr[i + 1] += add
	if arr[-1] < last or flag == 1:
		stdout.write('NO\n')
	else:
		stdout.write('YES\n')


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


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	h = [int(i) for i in input().split()]
	s = 0
	for i in range(n):
		s += h[i]
		if s < i * (i + 1) // 2:
			ans.append('NO')
			break
	else:
		ans.append('YES')
for i in ans:
	print(i)


for s in [*open(0)][2::2]:
	i = t = q = f = 0
	for x in s.split():
		t += int(x)
		q += i
		f |= t < q
		i += 1
	print('YNEOS'[f::2])


t = int(input())

def check(n, list):
	c = n * (n - 1) * 0.5
	if list == []:
		return 'YES'
	if sum(list) < c:
		return 'NO'
	elif list[-1] > sum(list) - (n - 2) * (n - 1) * 0.5:
		return 'NO'
	else:
		return check(n - 1, list[:n - 1])
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(check(n, a))


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


T = int(input())
N = []
Blocks = []
for i in range(T):
	n = int(input())
	blocks = list(map(int, input().split(' ')))
	N.append(n)
	Blocks.append(blocks)
for i in range(T):
	n = N[i]
	blocks = Blocks[i]
	req_sum = n * (n - 1) / 2
	block_sum = 0
	im_sum = 0
	flag = 0
	for j in range(len(blocks)):
		block_sum = block_sum + blocks[j]
		im_sum = im_sum + j
		if block_sum < im_sum:
			break
		if block_sum >= req_sum:
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = a[0]
	c = 0
	f = 0
	for i in range(1, n):
		s += a[i]
		c += i
		if s < c:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


import sys
input = sys.stdin.readline

def inpit():
	return int(input())

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

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

def inpspint():
	return map(int, input().split())
t = inpit()
for i in range(t):
	n = inpit()
	l = inplt()
	f = False
	for i in range(n - 1):
		if l[i] != 0:
			l[i + 1] = l[i + 1] + l[i] - i
			l[i] = l[i] - (l[i] - i)
		if l[i + 1] <= l[i]:
			print('NO')
			f = True
			break
	if not f:
		print('YES')


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


def ass(a, b):
	if a != b:
		print(f'Assertion error: {a} != {b}')
	else:
		print('OK')

def intline():
	return [int(item) for item in input().split()]

def line():
	return [item for item in input().split()]

def dump(lst):
	for (i, item) in enumerate(lst):
		print(i, item)

def binsearch(arr, a, b):
	m = (a + b) // 2
	if a >= b:
		return a - 1 if arr[a] == 0 else a
	return binsearch(arr, a, m - 1) if arr[m] == 0 else binsearch(arr, m + 1, b)

def f(arr):
	for i in range(len(arr) - 1):
		amount = arr[i] - i
		if amount >= 0:
			arr[i] -= amount
			arr[i + 1] += amount
	for i in range(len(arr) - 1):
		if arr[i] >= arr[i + 1]:
			return 'NO'
	return 'YES'
t = intline()[0]
for i in range(t):
	n = intline()[0]
	print(f(intline()))


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
mod = 10 ** 9 + 7
Mod = 998244353
INF = float('inf')

def flush():
	sys.stdout.flush()
tc = 1
(tc,) = inp()
for _ in range(tc):
	(n,) = inp()
	a = inp()
	Min = 0
	for i in range(n):
		if a[i] < Min:
			print('NO')
			break
		if i + 1 < n:
			a[i + 1] += a[i] - Min
		Min += 1
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	heights = list(map(int, input().split()))
	can_increase = 'YES'
	left = 0
	for i in range(n):
		left += heights[i] - i
		if left < 0:
			can_increase = 'NO'
	print(can_increase)


for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	flag = False
	extra = 0
	for i in range(n):
		arr[i] += extra
		extra = arr[i] - i
		if extra < 0:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


import sys
t = int(sys.stdin.readline())
for case in range(t):
	n = int(input())
	nums = [int(i) for i in sys.stdin.readline().split()]
	can = True
	for i in range(1, n):
		nums[i] += nums[i - 1] - (i - 1)
		if nums[i] <= i - 1:
			can = False
			break
	if can:
		sys.stdout.write('YES\n')
	else:
		sys.stdout.write('NO\n')


for j in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	t = 'YES'
	s = 0
	for i in range(0, n):
		s += a[i]
		if s < i * (i + 1) // 2:
			t = 'NO'
	print(t)


test = int(input())
result = []

def Multiple_Plus(x):
	s = 0
	for i in range(1, x + 1):
		s += i
	return s
for i in range(test):
	plus = [0]
	rec = False
	n = int(input())
	block = input().split()
	for j in range(n):
		block[j] = int(block[j])
	for j in range(n):
		total = plus[j] + block[j]
		plus.append(total)
		if total < Multiple_Plus(j):
			rec = True
			result.append('NO')
			break
	if rec == False:
		result.append('YES')
for i in range(test):
	print(result[i])


T = int(input())
while T >= 1:
	n = int(input())
	arr = list(map(int, input().split()))
	check = True
	pis = 0
	for i in range(n):
		pis += arr[i]
		if pis < i * (i + 1) // 2:
			check = False
			break
	if check == True:
		print('YES')
	else:
		print('NO')
	T -= 1


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	s = 0
	for j in l:
		s = s + j
		ans.append(s)
	s = 0
	flag = 1
	for j in range(1, n):
		s = s + j
		if ans[j] >= s:
			continue
		else:
			flag = 0
			print('NO')
			break
	if flag == 1:
		print('YES')
	t = t - 1


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


import sys
import math
input = sys.stdin.readline
t = int(input())
for test in range(t):
	n = int(input())
	h = list(map(int, input().split(' ')))
	res = True
	s = 0
	for i in range(1, n + 1):
		s += h[i - 1]
		if s < (i - 1) * i / 2:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = 'YES'
	sumcomp = 0
	mincomp = 0
	for i in range(len(a)):
		sumcomp += a[i]
		mincomp += i
		if sumcomp < mincomp:
			ans = 'NO'
			break
	print(ans)


q = int(input())
for _ in range(q):
	length = int(input())
	alist = [*map(int, input().split())]
	asum = 0
	res = 'YES'
	for i in range(length):
		asum += alist[i] - i
		if asum < 0:
			res = 'NO'
			break
	print(res)


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


for _ in range(int(input())):
	n = int(input())
	need = 0
	have = 0
	enough = True
	arr = list(map(int, input().split()))
	for i in range(n):
		need += i
		have += arr[i]
		if need > have:
			enough = False
	print('YES' if enough else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	data = list(map(int, input().split()))
	(rem, f) = (0, False)
	for j in range(n):
		if rem + data[j] < j:
			f = True
			break
		else:
			rem += data[j] - j
	if f:
		print('No')
	else:
		print('Yes')


import sys
from math import inf
import os
from io import BytesIO, IOBase
from collections import Counter
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')
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	sm = 0
	want = 0
	ans = 'YES'
	for i in range(n):
		if arr[i] < i:
			ans = 'NO'
			break
		mv = arr[i] - i
		if i + 1 < n:
			arr[i + 1] += mv
	print(ans)


def solve(n, a):
	a.append(-1)
	for i in range(n):
		if a[i] >= i:
			a[i + 1] += a[i] - i
			a[i] = i
		else:
			print('NO')
			return
	print('YES')
t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	solve(n, a)


from typing import List

def valid(values: List[int], extra: int=0) -> bool:
	for index in range(len(values)):
		extra = extra + values[index]
		if extra < index:
			return False
		extra = extra - index
	return True

def read_input(filename: str=None) -> None:
	from sys import stdin
	stdin = open(filename) if filename else stdin
	cases = int(stdin.readline())
	while cases:
		cases = cases - 1
		_ = stdin.readline()
		values = list(map(int, stdin.readline().split()))
		print('YES') if valid(values) else print('NO')

def main():
	read_input()
main()


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


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if a[i] > i:
			g = a[i] - i
			a[i + 1] += g
			a[i] -= g
	can = True
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			can = False
			break
	print('yes' if can else 'no')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	bol = True
	for j in range(n):
		s += a[j]
		if s < j * (j + 1) // 2:
			bol = False
			break
	if bol:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	s = 0
	t = 0
	for (i, e) in enumerate(a):
		t += i
		s += e
		if s < t:
			print('NO')
			break
	else:
		print('YES')


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


for i in [*open(0)][2::2]:
	(*a,) = map(int, i.split())
	c = 0
	b = 'YES'
	for (i, j) in enumerate(a):
		c += j - i
		if 0 > c:
			b = 'NO'
			break
	print(b)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		h = list(map(int, input().split()))
		h = [-1] + h
		ans = True
		for i in range(1, n):
			(prev, now, nex) = (h[i - 1], h[i], h[i + 1])
			h[i] = prev + 1
			h[i + 1] = nex + (now - prev - 1)
			if h[i] >= h[i + 1]:
				ans = False
				break
		for i in range(1, n):
			if h[i] <= h[i - 1]:
				ans = False
		if ans:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	c = 0
	sum = 0
	n = int(input())
	a = list(map(int, input().split()))
	for j in range(n):
		temp = j * (j + 1) // 2
		sum += a[j]
		if sum < temp:
			c = 1
			break
	if sum >= temp and c != 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = 1
	need = 0
	have = 0
	for i in range(n):
		need += i
		have += l[i]
		if need > have:
			print('NO')
			f = 0
			break
	if f == 1:
		print('YES')


remained_test_cases = int(input())
while remained_test_cases > 0:
	N = int(input())
	heights = list(map(int, input().split()))
	sum1 = 0
	sum_of_i = 0
	flag = True
	for i in range(N):
		sum1 = sum1 + heights[i]
		sum_of_i = sum_of_i + i
		if sum1 < sum_of_i:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	remained_test_cases = remained_test_cases - 1


from sys import stdin

def main():
	t = int(stdin.readline().strip())
	for _ in range(t):
		n = int(stdin.readline().strip())
		l = list(map(int, stdin.readline().split()))
		if n != 1:
			i = 0
			band = True
			while i + 1 < n and band:
				c = l[i] - i
				if c < 0:
					band = False
				else:
					l[i + 1] += c
					l[i] = i
				if l[i] >= l[i + 1]:
					band = False
				i += 1
			if band:
				print('YES')
			else:
				print('NO')
		else:
			print('YES')
main()


for s in [*open(0)][2::2]:
	l = [*map(int, s.split())]
	s = 0
	for i in range(len(l)):
		s += l[i] - i
		if s < 0:
			break
	print('YNEOS'[s < 0::2])


from builtins import *
arithmetical_progression_sum = lambda arr: len(arr) * (arr[0] + arr[-1]) / 2

def f1(hs_i):
	for j in range(2, len(hs_i) + 1):
		if sum(hs_i[:j]) < arithmetical_progression_sum(range(j)):
			print('NO')
			return
	print('YES')
t = int(input())
ns = []
hs = []
for i in range(t):
	ns.append(int(input()))
	hs.append(list(map(int, input().split(' '))))
list(map(f1, hs))


from array import array

def solve(n, hs):
	su = 0
	for (i, h) in enumerate(hs):
		su += h
		if su < i * (i + 1) // 2:
			return 'NO'
	return 'YES'

def main():
	ans = []
	t = int(input())
	for _ in range(t):
		n = int(input())
		hs = list(map(int, input().split(' ')))
		ans.append(solve(n, hs))
	for a in ans:
		print(a)
main()


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


t = int(input(''))
for test in range(t):
	n = int(input(''))
	blck = input('')
	blck_lst = [int(i) for i in blck.split()]
	if n == 1:
		print('YES')
	else:
		blck_sum = sum(blck_lst)
		min_blck = n * (n + 1) / 2 - n
		if blck_sum >= min_blck:
			flag = True
			for i in range(len(blck_lst) - 1):
				if blck_lst[i] >= i:
					if blck_lst[i] > i:
						blck_lst[i + 1] += blck_lst[i] - i
						blck_lst[i] = i
				else:
					flag = False
					break
			if flag:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
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')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	for i in range(1, n):
		t = max(0, l[i - 1] - i + 1)
		l[i] += t
		l[i - 1] -= t
	for i in range(1, n):
		if l[i] <= l[i - 1]:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	s = 0
	flag = True
	x = 0
	for i in range(n):
		s += h[i]
		x += i
		if s >= x:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	s = True
	for i in range(len(h)):
		if sum(h[:i + 1]) < i * (i + 1) // 2:
			s = False
	if s:
		print('YES')
	else:
		print('NO')


times = int(input())
for _ in range(times):
	length = int(input())
	nums = list(map(int, input().split()))
	cangive = 0
	yes = True
	for x in range(length):
		if nums[x] < x:
			if nums[x] + cangive < x:
				yes = False
				break
			else:
				cangive = cangive - abs(nums[x] - x)
		else:
			cangive = cangive + nums[x] - x
	if yes:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	f = 0
	for i in range(n - 1):
		if l[i] < i:
			f = 1
			break
		else:
			l[i + 1] += l[i] - i
			l[i] = i
	if f == 1:
		print('NO')
	else:
		f = 0
		for i in range(1, n):
			if l[i] <= l[i - 1]:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')


import math

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

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

def binn(dp, it):
	left = 0
	right = len(dp)
	while left <= right:
		mid = (left + right) // 2
		if dp[mid] == it:
			return mid
		elif dp[mid] < it:
			left = mid + 1
		else:
			right = mid - 1
	return -1

def is_pow2(x):
	flag = [0] * 32
	for i in range(32):
		flag[i] = 2 ** i
	if x in flag:
		return True
	return False

def solve():
	n = int(input())
	a = inp()
	flag = True
	hate = 0
	for i in range(n):
		if a[i] >= i:
			hate += a[i] - i
			a[i] = i
		elif hate + a[i] >= i:
			hate = hate + a[i] - i
			a[i] = i
		else:
			flag = False
			print('no')
			break
	if flag:
		print('yes')
t = int(input())
for _ in range(t):
	solve()


import collections

def solveTestCase():
	(n,) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	_min = 0
	for i in range(len(a) - 1):
		if a[i] < _min:
			print('NO')
			return
		else:
			a[i + 1] += a[i] - _min
			a[i] = _min
			_min += 1
	if a[-1] < _min:
		print('NO')
	else:
		print('YES')
t = int(input().split()[0])
while t > 0:
	t -= 1
	solveTestCase()


for s in [*open(0)][2::2]:
	S = v = i = 0
	for n in map(int, s.split()):
		S += n
		i += 1
		v += 2 * S < i * i - i
	print('YNEOS'[v > 0::2])


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


import math

def solve(n, a):
	have = need = 0
	for i in range(n):
		need += i
		have += a[i]
		if have < need:
			return 'NO'
	return 'YES'
t = int(input())
for t in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	result = solve(n, a)
	print(result)


import sys

def f2(n, h):
	a = h.copy()
	for i in range(n - 1):
		a[i + 1] = a[i] - i + a[i + 1]
		a[i] = i
		if a[i + 1] <= a[i]:
			return 0
	return 1
input = sys.stdin.read()
data = list(map(int, input.split()))
t = data[0]
l = 0
for i in range(t):
	n = data[1 + l]
	h = data[2 + l:l + 2 + n]
	f = f2(n, h)
	if f == 0:
		print('NO')
	if f != 0:
		print('YES')
	l = l + n + 1


result = []
cases = int(input())

def judge(arr, n):
	for i in range(2, n + 1):
		if (i - 1) * i // 2 > sum(arr[0:i]):
			return False
	return True
for i in range(cases):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	if judge(arr, n):
		result.append('YES')
	else:
		result.append('NO')
for _ in result:
	print(_)


t = int(input())
for _ in range(t):
	n = int(input())
	S = 0
	Sum = 0
	ans = True
	a = [int(i) for i in input().split()]
	for j in range(n):
		S = S + j
		Sum = Sum + a[j]
		if Sum < S:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	h = [int(i) for i in input().split()]
	exp = 0
	curr = 0
	flag = 1
	for i in range(n):
		exp += i
		curr += h[i]
		if exp > curr:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin
lst = list(map(int, stdin.read().split()))
s = 0

def inp(n=1):
	global s
	ret = lst[s:s + n]
	s += n
	return ret

def inp1():
	return inp()[0]
t = inp1()
for _ in range(t):
	b = inp1()
	h = inp(b) + [10 * 9 + 7]
	status = 'YES'
	cur = 0
	for i in range(b):
		d = h[i] - cur
		if d < 0:
			status = 'NO'
			break
		else:
			h[i + 1] += d
		cur += 1
	print(status)


from sys import stdin as cin
lmap = lambda f, v: list(map(f, v))

def can_raise(h):
	for i in range(len(h) - 1):
		if h[i] < i:
			return 'NO'
		h[i + 1] += h[i] - i
	return 'YES' if h[-1] >= len(h) - 1 else 'NO'

def main():
	t = int(next(cin).strip())
	for i in range(t):
		n = int(next(cin).strip())
		h = lmap(int, next(cin).strip().split())
		print(can_raise(h))
main()


def ganda_ques(h, n):
	for i in range(0, n):
		temp = h[i] - i
		if temp < 0:
			return 'NO'
		if i < n - 1:
			h[i] = i
			h[i + 1] += temp
		else:
			return 'YES'
for _ in range(int(input())):
	n = int(input())
	h = list(map(int, input().split()))
	print(ganda_ques(h, n))


answers = []

def solve(n, arr):
	if n == 1:
		answers.append('YES')
		return
	for i in range(n - 1):
		if arr[i] < i:
			answers.append('NO')
			return
		else:
			rem = arr[i] - i
			arr[i + 1] += rem
			arr[i] = i
	if arr[-1] < n - 1:
		answers.append('NO')
		return
	for i in range(n - 1):
		if arr[i] >= arr[i + 1]:
			answers.append('NO')
			return
	answers.append('YES')
T = int(input())
while T:
	n = int(input())
	arr = [int(x) for x in input().split()]
	solve(n, arr)
	T -= 1
for ans in answers:
	print(ans)


for _ in range(int(input())):
	n = int(input())
	h = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	for i in range(1, n):
		if sum(h[:i + 1]) < (i + 1) * i // 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	carry = 1
	flag = 1
	for i in range(n):
		carry = lis[i] - i + carry
		if carry < 1:
			flag = 2
			break
	print('NO' if flag == 2 else 'YES')


import sys
ip = sys.stdin.readline
for _ in range(int(ip())):
	n = int(ip())
	a = [*map(int, ip().split())]
	extra = 0
	flag = True
	for i in range(n):
		if a[i] >= i:
			extra += a[i] - i
		else:
			diff = i - a[i]
			if diff <= extra:
				extra -= diff
			else:
				flag = False
				break
	print('YNEOS'[not flag::2])


for _ in range(int(input())):

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


def func(n, lis):
	for i in range(n - 1):
		c = lis[i] - i
		if c < 0:
			return 'NO'
		lis[i] = lis[i] - c
		lis[i + 1] = lis[i + 1] + c
	for i in range(1, n):
		if lis[i] <= lis[i - 1] or lis[i] < 0:
			return 'NO'
	return 'YES'
x = int(input())
lis = []
for i in range(x):
	n = int(input())
	f = list(map(int, input().split()))
	ans = func(n, f)
	lis.append(ans)
for i in lis:
	print(i)


t = int(input())
for i in range(0, t):
	n = int(input())
	c = 0
	x = [int(a) for a in input().split()]
	need = 0
	sum = 0
	for j in range(0, n):
		need = need + j
		sum = sum + x[j]
		if sum < need:
			c += 1
			print('NO')
			break
	if c == 0:
		print('YES')


read = lambda : map(int, input().split())
n = int(input())
for t in range(n):
	n = int(input())
	a = list(read())
	f = 1
	s = 0
	mn = 0
	for i in range(n):
		s += a[i]
		if s - mn < i:
			f = 0
			break
		mn += i
	print('YES' if f else 'NO')


import sys
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 function(hs):
	x = 0
	for i in range(len(hs)):
		if hs[i] > i:
			x += hs[i] - i
			hs[i] = i
		else:
			val = i - hs[i]
			if x >= val:
				x -= val
			else:
				print('NO')
				return
	print('YES')

def main():
	t = inp()
	for case in range(t):
		n = inp()
		hs = inlt()
		function(hs)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = list(range(n))
	b = []
	b1 = []
	for i in range(n):
		b.append(sum(a[0:i + 1]))
		b1.append(sum(a1[0:i + 1]))
	f = False
	for i in range(n):
		if b[i] < b1[i]:
			f = True
	if f:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	(*li,) = map(int, input().split())
	(sum1, j) = (0, 0)
	for i in range(x):
		sum1 += li[i]
		j += i
		if sum1 < j:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.readline

def sum_up_to_n(n):
	return n * (n + 1) // 2

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		H = [int(x) for x in input().split()]
		current = 0
		f = True
		for (i, h) in enumerate(H):
			if h + current >= i:
				current = h + current - i
			else:
				f = False
				break
		if f:
			print('YES')
		else:
			print('NO')
main()


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


T = int(input())
for _ in range(T):
	n = int(input())
	ls = list(map(int, input().split()))
	ans = 'YES'
	need = 0
	have = 0
	for i in range(n):
		need += i
		have += ls[i]
		if have < need:
			ans = 'NO'
			break
	print(ans)


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


t = int(input())
for _ in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	s = 0
	flg = True
	for i in range(n):
		s += h[i]
		if s < i * (i + 1) // 2:
			flg = False
			break
	print('YES' if flg else 'NO')


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
		t -= 1
		continue
	sums = 0
	prev = 0
	flag = 0
	for i in range(len(arr)):
		prev = (i - 1) * i // 2
		if sums - prev + arr[i] < i:
			flag = 1
			break
		sums += arr[i]
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


from collections import Counter

def stack(length, arr):
	for i in range(length - 1):
		store = arr[i] - i
		arr[i] -= store
		if store < 0:
			return 'NO'
		else:
			arr[i + 1] += store
	if length > 1 and arr[-1] <= arr[-2]:
		return 'NO'
	return 'YES'
for test in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(stack(n, lst))


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	x = sum(h)
	if x >= n * (n - 1) // 2:
		pref_sum = 0
		chk = True
		for i in range(n):
			if i * (i - 1) // 2 > pref_sum:
				chk = False
				break
			else:
				pref_sum += h[i]
		if chk:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys

def debug(*args):
	print(*args, file=sys.stderr)

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

def read_int():
	return int(sys.stdin.readline().strip())

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

def read_str_split():
	return list(sys.stdin.readline().strip())

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

def Main():
	t = read_int()
	for _ in range(t):
		n = read_int()
		h = read_int_list()
		block = 0
		flag = True
		for i in range(n - 1):
			if block <= h[i]:
				h[i + 1] += h[i] - block
				h[i] = block
			else:
				flag = False
			block += 1
		if h[n - 1] < block:
			flag = False
		print('Yes' if flag else 'No')
Main()


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


for _ in range(int(input())):
	n = int(input())
	t = 0
	for (i, x) in enumerate(map(int, input().split())):
		t += x - i
		if t < 0:
			print('NO')
			break
	else:
		print('YES')


res = []
for _ in range(int(input())):
	n = int(input())
	zoz = [int(x) for x in input().split()]
	suma = 0
	count = 0
	for i in zoz:
		suma += i
		count += 1
		if count * (count - 1) / 2 > suma:
			res.append('NO')
			break
	else:
		res.append('YES')
for i in res:
	print(i)


def solve(n, a):
	if n == 1:
		return 'YES'
	for i in range(1, n):
		a[i] += a[i - 1] - i + 1
		if a[i] < i:
			return 'NO'
	return 'YES'
t = int(input())
ret = []
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	ret.append(solve(n, a))
print('\n'.join(ret))


import math
from collections import defaultdict
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	j = 0
	poss = 1
	while j < n - 1:
		if b[j] >= j:
			b[j + 1] += b[j] - j
		else:
			poss = 0
			break
		j += 1
	if b[-1] >= n - 1 and poss:
		print('YES')
	else:
		print('NO')


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


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


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


n1 = int(input())

def fun(a):
	if len(a) == 1:
		return True
	s = a[0]
	for i in range(1, len(a)):
		if a[i] + s >= i:
			s = a[i] + s - i
		else:
			return False
	return True
for _ in range(n1):
	n = int(input())
	a = [int(item) for item in input().split()]
	ans = fun(a)
	if ans is True:
		print('YES')
	else:
		print('NO')


import math

def solve(n):
	l = input().split(' ')
	hs = [int(i) for i in l]
	if len(hs) == 1:
		return 'YES'
	i = 0
	while i < len(hs) - 1:
		if hs[i] >= i:
			hs[i + 1] = hs[i + 1] + hs[i] - i
			hs[i] = i
		else:
			return 'NO'
		i += 1
	if hs[-1] > hs[-2]:
		return 'YES'
	return 'NO'
tc = int(input())
for _ in range(tc):
	n = int(input())
	print(solve(n))


t = int(input())
for i in range(t):
	n = int(input())
	st = list(map(int, input().split()))
	n_sum = 0
	for i in range(n):
		c_sum = st[i] + n_sum
		th = i
		n_sum = c_sum - th
		if n_sum < 0:
			print('NO')
			break
	else:
		print('YES')


def answer2(ary):
	s = sum(ary)
	t_s = 0
	n = len(ary)
	if n % 2 == 0:
		t_s = (n - 1) * (n / 2)
	else:
		t_s = (n - 1) * ((n - 1) / 2) + (n - 1) / 2
	if s >= t_s:
		return 'YES'
	else:
		return 'NO'

def answer(ary):
	s = 0
	t_s = 0
	n = len(ary)
	for i in range(n):
		t_s += i
		s += ary[i]
		if s < t_s:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	n = [0] * t
	stacks = [None] * t
	for j in range(t):
		n[j] = int(input())
		stacks[j] = [int(i) for i in input().split()]
	for j in range(t):
		print(answer(stacks[j]))
main()


import math
try:
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		extra = 0
		ans = 'YES'
		for i in range(n):
			if arr[i] >= i:
				extra += arr[i] - i
			else:
				extra -= i - arr[i]
				if extra < 0:
					ans = 'NO'
					break
		print(ans)
except:
	pass


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l1.append(int(input()))
	l2.append([int(x) for x in input().split()])
for i in range(n):
	sum = 0
	flag = True
	for j in range(l1[i]):
		sum = sum + l2[i][j]
		if sum < j * (j + 1) // 2:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')
print()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = 0
	ans = 'YES'
	for i in range(n):
		s += arr[i]
		if s < i * (i + 1) // 2:
			ans = 'NO'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	s = 0
	flag = True
	for i in range(n):
		c += i
		s += l[i]
		if c > s:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	sys.stdin.readline()
	result = 'YES'
	current = 0
	a = map(int, sys.stdin.readline().strip().split())
	for (key, val) in enumerate(a):
		if val + current < key:
			result = 'NO'
			break
		else:
			current += val - key
	print(result)


import sys

def main():
	pass

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	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]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

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

def iinp():
	return int(input())

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
for __ in range(iinp()):
	n = iinp()
	h = llinp()
	prev = 0
	f = 0
	for i in range(n - 1):
		if h[i] < prev:
			f = 1
			break
		elif h[i] == prev:
			prev += 1
		else:
			h[i + 1] += h[i] - prev
			h[i] = prev
			prev += 1
	if h[-1] >= prev and f == 0:
		print('YES')
	else:
		print('NO')


import math
import string
import random
import sys
from random import randrange
from collections import deque
from collections import defaultdict
from bisect import bisect, bisect_right, bisect_left

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

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
for _ in range(int(input())):
	n = int(data())
	a = mdata()
	sm = sum(a)
	rqsm = n * (n - 1) // 2
	if sm >= rqsm:
		for i in range(n - 1):
			if a[i] >= i:
				dff = a[i] - i
				a[i] = i
				a[i + 1] += dff
		poss = True
		for i in range(n - 1):
			if a[i] >= a[i + 1]:
				poss = False
				break
		if poss:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


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


import sys
input = sys.stdin.readline

def solution(n, h):
	sum_ = h[0]
	for pos in range(1, n):
		sum_ += h[pos]
		if sum_ < pos * (pos + 1) // 2:
			print('NO')
			return
	print('YES')
T = int(input())
for t in range(T):
	n = int(input())
	h = list(map(int, input().split()))
	solution(n, h)


for _ in range(int(input())):
	x = int(input())
	l1 = list(map(int, input().split()))
	y = len(l1)
	ac = True
	for k in range(len(l1)):
		c = sum(l1[0:k + 1])
		y = len(l1[0:k + 1])
		z = y - 1
		d = int(z * (z + 1) / 2)
		if c < d:
			ac = False
	if ac:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	s = 0
	b = [int(x) for x in input().split()]
	d = []
	for i in range(a):
		s += b[i]
		d.append(s >= i * (i + 1) / 2)
	print('YES') if all(d) else print('NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())

def check(arr):
	for x in range(len(arr) - 1):
		if arr[x + 1] <= arr[x]:
			return 'NO'
	return 'YES'
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n - 1):
		diff = arr[i] - i
		if diff > 0:
			arr[i + 1] += diff
			arr[i] = i
	print(check(arr))


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


import sys

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

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

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

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

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		arr = get_list()
		summ = 0
		f = 0
		for i in range(n):
			summ += arr[i]
			if summ < i * (i + 1) // 2:
				f = 1
				break
		if f:
			get_print('NO')
		else:
			get_print('YES')
solve()


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	summ = l[0]
	desired = 0
	flag = 0
	for i in range(1, n):
		desired += i
		summ += l[i]
		if desired > summ:
			flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


import sys
import math

def fn(n, a):
	for i in range(n - 1):
		t = a[i]
		a[i] = i
		a[i + 1] = a[i + 1] + t - a[i]
		if a[i] >= a[i + 1]:
			print('NO')
			return 0
	print('YES')
	return 1
input = sys.stdin.read()
data = list(map(int, input.split()))
t = data[0]
l = 0
for i in range(t):
	n = data[1 + l]
	a = data[l + 2:l + 2 + n]
	l = l + 1 + n
	fn(n, a)


from collections import defaultdict
import math

def solution():
	t = int(input())
	out = ''
	while t > 0:
		n = int(input())
		h = list(map(int, input().split(' ')))
		found = True
		for i in range(0, n, 1):
			temp = h[i] - i
			h[i] = i
			if temp >= 0 and i + 1 < n:
				h[i + 1] = h[i + 1] + temp
			if i + 1 < n and h[i] >= h[i + 1]:
				found = False
				break
		if found:
			out += 'YES\n'
		else:
			out += 'NO\n'
		t -= 1
	print(out)
solution()


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

def ii():
	return int(I().strip())

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

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

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

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

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True

def main():
	ans = ''
	for _ in range(ii()):
		n = ii()
		arr = li()
		tmp = 'YES'
		for i in range(n - 1):
			if arr[i] >= i:
				extra = arr[i] - i
				arr[i] -= extra
				arr[i + 1] += extra
			else:
				tmp = 'NO'
		if arr[n - 1] < n - 1:
			tmp = 'NO'
		ans += tmp + '\n'
	print(ans)
main()


for i in range(int(input())):
	(n, l, a, position, flag) = (int(input()), list(map(int, input().split())), 0, 0, True)
	for i2 in range(n):
		a += i2
		position += l[i2]
		if position < a:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	add = 0
	for i in range(n):
		if a[i] < i:
			if i - a[i] <= add:
				add -= i - a[i]
			else:
				print('No')
				return
		else:
			add += a[i] - i
	print('Yes')
for _ in range(int(input())):
	main()


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	heights = list(map(int, sys.stdin.readline().split()))
	value = heights[0]
	for i in range(1, n):
		if heights[i] + value >= i:
			value = heights[i] + value - i
		else:
			print('NO')
			break
	else:
		print('YES')


for z in [*open(0)][2::2]:
	(s, a) = (0, 'YES')
	for (i, j) in enumerate(z.split()):
		s += int(j) - i
		if s < 0:
			a = 'NO'
	print(a)


t = input()
t = int(t)
while t > 0:
	grzes = 0
	n = input()
	n = int(n)
	h = input().split()
	for i in range(n):
		h[i] = int(h[i])
		if h[i] > i:
			grzes += h[i] - i
			h[i] = i
		elif grzes >= i - h[i]:
			grzes += h[i]
			grzes -= i
			h[i] = i
		else:
			print('NO')
			break
		if i == n - 1:
			print('YES')
	t -= 1


def solve(arr):
	n = len(arr)
	if sum(arr) < n * (n - 1) // 2:
		return 'NO'
	s = 0
	for i in range(n):
		s += arr[i] - i
		if s < 0:
			return 'NO'
	return 'YES'
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans.append(solve(arr))
for i in ans:
	print(i)


t = int(input())
for testcases in range(t):
	r = 0
	n = int(input())
	harr = list(map(int, input().split()))
	count = 1
	for i in range(1, n):
		har2 = harr[0:i + 1]
		l = len(har2)
		if sum(har2) >= l * (l - 1) / 2:
			count += 1
		else:
			print('NO')
			break
	if count == n:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	elif n == 2:
		if a[0] == 0 and a[1] == 0:
			print('NO')
			continue
		print('YES')
	else:
		sum = 0
		s = 0
		ans = 'YES'
		for i in range(n):
			sum += a[i]
			s += i
			if sum < s:
				ans = 'NO'
				break
		print(ans)


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2
import bisect
import sys
import copy

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

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

def input():
	return sys.stdin.readline().strip()
from math import ceil
import heapq
for i in range(int(input())):
	n = int(input())
	a = get_array()
	sumi = 0
	flag = 0
	for i in range(len(a)):
		sumi += a[i]
		if sumi >= i * (i + 1) // 2:
			pass
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys, heapq
from collections import defaultdict, deque
import math
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():
	test = inp()
	for _ in range(test):
		n = inp()
		stacks = inlt()
		for i in range(n - 1):
			if stacks[i] >= i:
				stacks[i + 1] += stacks[i] - i
				stacks[i] = i
		isIncreasing = True
		for i in range(1, n):
			if stacks[i] <= stacks[i - 1]:
				isIncreasing = False
				break
		if isIncreasing:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	temp = a[0]
	flag = True
	for i in range(1, n):
		if a[i] + temp < i:
			flag = False
			break
		else:
			temp = temp + a[i] - i
	print('YES') if flag else print('NO')


q = int(input())
for _ in range(q):
	n = int(input())
	able = 1
	a = list(map(int, input().split()))
	summ = 0
	for i in range(n):
		if a[i] >= i:
			summ += a[i] - i
			a[i] = i
		elif a[i] < i and summ >= i - a[i]:
			summ -= i - a[i]
		elif summ < i - a[i]:
			able = 0
			break
	if able:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def fun(x):
	return x * (x + 1) // 2
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	su = [ar[0]]
	for i in range(1, n):
		su.append(su[-1] + ar[i])
	flag = True
	for i in range(n):
		if su[i] < fun(i):
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


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


import sys

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
for i in range(int(input())):
	n = int(sys.stdin.readline().strip())
	ar = get_list()
	pre_sum = 0
	for j in range(n):
		pre_sum += ar[j]
		if (j + 1) * (j - 0) // 2 > pre_sum:
			print('NO')
			break
		elif j == n - 1:
			print('YES')


t = int(input())
for T in range(t):
	n = int(input())
	h = [int(x) for x in input().split()]
	can_move = 0
	if h[0] > 0:
		can_move = h[0]
	ans = 'YES'
	for i in range(1, n):
		if h[i] + can_move < i:
			ans = 'NO'
			break
		can_move += h[i] - i
	print(ans)


import math

def main():
	t = int(input())
	for _ in range(t):
		print(case())

def case():
	n = int(input())
	h = list(map(int, input().split()))
	for i in range(1, n + 1):
		if sum(h[:i]) < (i - 1) * i / 2:
			return 'NO'
	return 'YES'
main()


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	heights = list(map(int, sys.stdin.readline().split()))
	for i in range(n):
		if sum(heights[:i + 1]) < i * (i + 1) // 2:
			print('NO')
			break
	else:
		print('YES')


def solve() -> bool:
	n = int(input())
	hs = input().split()
	balance = 0
	for i in range(0, n):
		balance += int(hs[i])
		balance -= i
		if balance < 0:
			return False
	return True
t = int(input())
for _ in range(0, t):
	ans = solve()
	if ans:
		print('YES')
	else:
		print('NO')
pass


for cvx in range(int(input())):
	h = int(input())
	num = 0
	all = 0
	ind = True
	str = input().split()
	for i in range(h):
		if num <= int(str[i]):
			all += int(str[i]) - num
		elif all >= num - int(str[i]):
			all -= num - int(str[i])
		else:
			ind = False
			break
		num += 1
	if ind:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	m = int(input())
	x = 0
	verdict = 'YES'
	nums = input().split()
	for i in range(m):
		nums[i] = int(nums[i])
	for i in range(m):
		x += nums[i] - i
		if x < 0:
			verdict = 'NO'
	print(verdict)


import sys
import math
from sys import stdin, stdout

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

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

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

def Solution(arr, n):
	extra = arr[0]
	for i in range(n - 1):
		extra = extra - i - 1 + arr[i + 1]
		if extra < 0:
			print('NO')
			return
	print('YES')

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = get_ints_in_list()
		Solution(arr, n)
main()


from collections import *
for _ in range(int(input())):
	n = int(input())
	h = list(map(int, input().split()))
	c = 0
	f = True
	for i in range(n):
		if i == 0:
			c += h[i]
			h[i] = 0
			continue
		if h[i] > h[i - 1]:
			c += h[i] - h[i - 1] - 1
			h[i] = h[i - 1] + 1
		else:
			c = c - h[i - 1] + h[i] - 1
			h[i] = h[i - 1] + 1
			if c < 0:
				f = False
				break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	heights = map(int, input().split())
	moving_bls_am = 0
	for (i, h) in enumerate(heights):
		moving_bls_am += h
		if moving_bls_am < i:
			print('NO')
			break
		moving_bls_am -= i
	else:
		print('YES')


import sys
from collections import *
import math
import bisect

def input():
	return sys.stdin.readline()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	summ = 0
	ans = True
	for i in range(n):
		if a[i] > i:
			summ += a[i] - i
		elif a[i] < i:
			diff = i - a[i]
			summ -= diff
		if summ < 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def stack(s, l):
	su = ind = 0
	for i in range(l):
		su += s[i]
		ind += i
		if ind > su:
			return 'NO'
	return 'YES'
n = int(input())
while n > 0:
	l = int(input())
	s = [int(i) for i in input().split()]
	print(stack(s, l))
	n -= 1


from math import sqrt
import operator
import sys
inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def read_str():
	return input().rstrip()

def check_seq(n, h):
	if n == 1:
		return 'YES'
	add_blocks = 0
	for i in range(n):
		if h[i] + add_blocks >= i:
			add_blocks += h[i] - i
			continue
		else:
			return 'NO'
	return 'YES'

def main():
	samples = read_one_int()
	for _ in range(samples):
		n = read_one_int()
		h = read_list_of_ints()
		res = check_seq(n, h)
		print(res)
main()


def solve(n, arr):
	t = arr[0]
	for i in range(1, n):
		if arr[i] >= i:
			t += arr[i] - i
		elif arr[i] + t >= i:
			t -= i - arr[i]
		else:
			return False
	return t >= 0
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if solve(n, arr):
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	(s, a_c) = (0, 0)
	for i in range(n):
		a_c += i
		s += a[i]
		if s < a_c:
			print('NO')
			break
	else:
		print('YES')
for _ in range(int(input())):
	solve()


def check(heights, start):
	if len(heights) == 1:
		return heights[0] >= start
	if heights[0] < start:
		return False
	else:
		heights[1] += heights[0] - start
		return check(heights[1:], start + 1)
T = int(input())
for _ in range(T):
	n = int(input())
	heights = [int(h) for h in input().split()]
	if check(heights, 0):
		print('YES')
	else:
		print('NO')


def Ans():
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('Yes')
		return
	a[1] += a[0]
	a[0] = 0
	i = 1
	while i < n:
		s = a[i - 1] + 1
		if a[i] < s:
			print('No')
			return
		if i < n - 1:
			a[i + 1] += a[i] - s
			a[i] = s
		i += 1
	print('Yes')
_UN1_ = int(input())
for _UN2_ in range(_UN1_):
	Ans()


trails = int(input())
answer_list = []
for x in range(trails):
	number = int(input())
	numbers = input().split(' ')
	possible = True
	needed = 0
	index = -1
	have = 0
	for s in numbers:
		index += 1
		needed += index
		have += int(s)
		if have < needed:
			possible = False
	if possible == True:
		answer_list.append('YES')
	else:
		answer_list.append('NO')
for g in answer_list:
	print(g)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	now = 0
	flag = 'YES'
	for (i, x) in enumerate(a):
		if x + now < i:
			flag = 'NO'
			break
		else:
			now += x - i
	print(flag)


import math
from collections import defaultdict
from math import comb
from sys import stdout
NO = 'NO'
YES = 'YES'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def z_func(s):
	n = len(s)
	z = [0] * n
	l = r = 0
	for i in range(1, n):
		if r >= i:
			z[i] = min(z[i - l], r - i + 1)
		while z[i] + i < n and s[z[i]] == s[z[i] + i]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
global_ans = []

def p(a):
	global_ans.append(a)

def solve():
	n = input_int()
	a = input_list_int()
	d = 0
	k = 0
	for i in a:
		v = d + i
		if v >= k:
			d = v - k
			k += 1
		else:
			p('NO')
			return
	p('YES')
query_count = 1
query_count = input_int()
while query_count:
	query_count -= 1
	solve()
for global_ans_line in global_ans:
	print(global_ans_line)


testcasenum = int(input())
results = []
for i in range(testcasenum):
	n = int(input())
	heights = [int(x) for x in input().split()]
	result = 'YES'
	iterator = 0
	credit = 0
	for j in heights:
		if j + credit >= iterator:
			credit = credit + (j - iterator)
			iterator = iterator + 1
		else:
			result = 'NO'
			break
	results.append(result)
for j in results:
	print(j)


import sys

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	array = get_array()
	s = 0
	f = 0
	for i in range(0, n):
		if array[i] >= i:
			s += array[i] - i
		elif s >= i - array[i]:
			s = s - (i - array[i])
		else:
			f = 1
		if f == 1:
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


time = int(input())
while time > 0:
	time -= 1
	x = int(input())
	height = list(map(int, input().split()))
	total = 0
	bound = 0
	yn = True
	for i in range(x):
		bound += i
		total += height[i]
		if total < bound:
			yn = False
			break
	if yn:
		print('YES')
	else:
		print('NO')


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
GAP = 2
for t in [wtf[i:i + GAP] for i in range(1, len(wtf), GAP)]:
	n = int(t[0])
	H = list(map(int, t[1].split()))
	f = True
	for i in range(n):
		if H[i] - i < 0:
			f = False
			break
		if i + 1 < n:
			H[i + 1] += H[i] - i
		H[i] = i
	print('YES' if f else 'NO')