You are standing on the $\mathit{OX}$-axis at point $0$ and you want to move to an integer point $x > 0$.

You can make several jumps. Suppose you're currently at point $y$ ($y$ may be negative) and jump for the $k$-th time. You can:

either jump to the point $y + k$

or jump to the point $y - 1$.

What is the minimum number of jumps you need to reach the point $x$?


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The first and only line of each test case contains the single integer $x$ ($1 \le x \le 10^6$) — the destination point.


-----Output-----

For each test case, print the single integer — the minimum number of jumps to reach $x$. It can be proved that we can reach any integer point $x$.


-----Examples-----

Input
5
1
2
3
4
5
Output
1
3
2
3
4


-----Note-----

In the first test case $x = 1$, so you need only one jump: the $1$-st jump from $0$ to $0 + 1 = 1$.

In the second test case $x = 2$. You need at least three jumps:

the $1$-st jump from $0$ to $0 + 1 = 1$;

the $2$-nd jump from $1$ to $1 + 2 = 3$;

the $3$-rd jump from $3$ to $3 - 1 = 2$;

Two jumps are not enough because these are the only possible variants:

the $1$-st jump as $-1$ and the $2$-nd one as $-1$ — you'll reach $0 -1 -1 =-2$;

the $1$-st jump as $-1$ and the $2$-nd one as $+2$ — you'll reach $0 -1 +2 = 1$;

the $1$-st jump as $+1$ and the $2$-nd one as $-1$ — you'll reach $0 +1 -1 = 0$;

the $1$-st jump as $+1$ and the $2$-nd one as $+2$ — you'll reach $0 +1 +2 = 3$;

In the third test case, you need two jumps: the $1$-st one as $+1$ and the $2$-nd one as $+2$, so $0 + 1 + 2 = 3$.

In the fourth test case, you need three jumps: the $1$-st one as $-1$, the $2$-nd one as $+2$ and the $3$-rd one as $+3$, so $0 - 1 + 2 + 3 = 4$.

Difficulty: EASY
Tags: Mathematics

Constructive algorithms

Starter code:

Solutions:
from math import sqrt

def findclosest(a):
	a1 = 1
	b1 = 1
	c1 = -1 * 2 * a
	d = b1 ** 2 - 4 * a1 * c1
	x = (-1 * b1 + sqrt(d)) / 2
	if x - int(x) == 0:
		return [x]
	return [int(x), int(x + 1)]

def findclosest2(a):
	a1 = 1
	b1 = 1
	c1 = -1 * 2 * (a + 2)
	d = b1 ** 2 - 4 * a1 * c1
	x = (-1 * b1 + sqrt(d)) / 2
	if x - int(x) == 0:
		return [x]
	return [int(x), int(x + 1)]
for i in range(int(input())):
	x = int(input())
	l = int(findclosest(x)[0])
	s = sum(list(range(l + 1)))
	if x == s:
		print(l)
	else:
		print(l + 1 + (x - (s + l + 1) == -1))


for _ in range(int(input())):
	n = int(input())
	i = 0
	summ = 0
	while summ < n:
		i += 1
		summ = i * (i + 1) // 2
	if summ == n + 1:
		i += 1
	print(i)


from collections import defaultdict, deque, Counter, OrderedDict
import sys
from bisect import bisect_left

def main():
	t = int(input())
	arr = []
	mp = {}
	(curr, count) = (0, 1)
	for i in range(1, 2000):
		curr += i
		arr.append(curr)
		mp[curr] = count
		count += 1
	while t:
		t -= 1
		n = int(input())
		i = bisect_left(arr, n)
		if n == arr[i] - 1:
			print(mp[arr[i]] + 1)
		else:
			print(mp[arr[i]])
main()


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
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 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 primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

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 maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

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

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def chk(n, d):
	if str(d) in str(n):
		return True
	return False
for xyz in range(0, int(input())):
	x = int(input())
	n = 1
	while n * (n + 1) < 2 * x:
		n += 1
	maxval = n * (n + 1) // 2
	if maxval == x + 1:
		print(n + 1)
	else:
		print(n)


import math
t = int(input())

def solve():
	x = int(input())
	c = math.ceil((math.sqrt(1 + 8 * x) - 1) / 2)
	if c * (c + 1) / 2 == x + 1:
		return c + 1
	return c
for i in range(t):
	output = solve()
	print(output)


for _ in range(int(input())):
	n = int(input())
	suma = 0
	t = 1
	while suma < n:
		suma += t
		t += 1
	t -= 1
	if suma == n:
		print(t)
	elif suma - n == 1:
		print(t + 1)
	else:
		print(t)


def sum_nat_no(n):
	natsum = 0
	i = 0
	while natsum < n:
		i += 1
		natsum = i * (i + 1) // 2
	if natsum - 1 == n:
		return i + 1
	else:
		return i
for _ in range(int(input())):
	x = int(input())
	print(sum_nat_no(x))


import math
t = int(input())
for _ in range(t):
	x = int(input())
	d = math.sqrt(1 + 8 * x)
	n = math.ceil((-1.0 + d) / 2.0)
	m = n * (n + 1) / 2
	if m == x:
		print(n)
	elif m - 1 == x:
		print(n + 1)
	else:
		print(n)


MOD = 1000000007

def si():
	return input()

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

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

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

def out(v):
	print(v)

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

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

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

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

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

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
import math
t = ii()
while t:
	t -= 1
	n = ii()
	x = (pow(8 * n + 1, 0.5) - 1) / 2
	if x.is_integer():
		print(int(x))
	else:
		x = int(x) + 1
		if x * (x + 1) // 2 - n <= 1:
			print(x + 1)
		else:
			print(x)


for _ in range(int(input())):
	x = int(input())
	t = c = 0
	for i in range(1, 10000):
		t += i
		c += 1
		if t >= x:
			break
	print(c + 1) if t - 1 == x else print(c)


for _ in range(int(input())):
	n = int(input())
	s = 0
	f = 0
	c = 0
	for i in range(1, n + 1):
		s = s + i
		c += 1
		if s == n:
			f = 1
			break
		elif s > n:
			break
	if f == 1:
		print(c)
	else:
		if s - n == 1:
			c += 1
		print(c)


from math import sqrt

def main():
	t = int(input())
	for tc in range(t):
		x = int(input())
		min_n = (sqrt(1 + 8 * x) - 1) / 2
		if int(min_n) == min_n:
			print(int(min_n))
		else:
			min_n = int(min_n)
			dif = x - min_n * (min_n + 1) // 2
			if dif > min_n - 1:
				print(min_n + 2)
			else:
				print(min_n + 1)
ints = lambda : list(map(int, input().split()))
main()


mod = 1000000007
from math import factorial, ceil, pow, sqrt, floor, gcd
from sys import stdin, stdout
from collections import defaultdict, Counter, deque
for _ in range(int(stdin.readline())):
	x = int(stdin.readline())
	t = int(sqrt(1 + 8 * x)) - 1
	t = t // 2
	ans = t
	if x == t * (t + 1) // 2:
		print(ans)
	else:
		t += 1
		ans += 1
		if x == t * (t + 1) // 2 - 1:
			print(ans + 1)
		else:
			print(ans)


import sys, string
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	cnt = 1
	while cnt * (cnt + 1) // 2 < n:
		cnt += 1
	res = cnt * (cnt + 1) // 2
	if n == res - 1:
		print(cnt + 1)
	else:
		print(cnt)


T_ON = 1
DEBUG_ON = 0
MOD = 998244353

def solve():
	x = read_int()
	k = 1
	while True:
		a = k * (k + 1) // 2
		if a >= x:
			break
		k += 1
	if a - x == 1:
		k += 1
	print(k)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def dbg(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
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 read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

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

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

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

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


import math
t = int(input())
for i in range(t):
	n = int(input())
	pk = 1
	c = 0
	ans = 0
	while True:
		if c + pk < n:
			ans += 1
			c += pk
			pk += 1
		elif c + pk == n:
			ans += 1
			c += pk
			print(ans)
			break
		else:
			if c + pk - 1 == n:
				print(ans + 2)
			else:
				print(ans + 1)
			break


from math import sqrt
for _ in range(int(input())):
	x = int(input())
	jumps = (sqrt(1 + 8 * x) - 1) / 2
	if jumps == int(jumps):
		print(int(jumps))
	else:
		jumps = int(jumps) + 1
		if x == jumps * (jumps + 1) / 2 - 1:
			print(jumps + 1)
		else:
			print(jumps)


for t in range(int(input())):
	x = int(input())
	y = int((x * 2) ** 0.5)
	while y * (y + 1) // 2 < x:
		y += 1
	while y * (y + 1) // 2 >= x:
		y -= 1
	if x == (y + 1) * (y + 2) // 2 - 1:
		print(y + 2)
	else:
		print(y + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	temp = int((n * 2) ** 0.5)
	if (temp ** 2 + temp) / 2 == n + 1:
		print(temp + 1)
	elif (temp ** 2 + temp) / 2 >= n:
		print(temp)
	else:
		print(temp + 1)


import math
t = int(input())
while t:
	t = t - 1
	x = int(input())
	n = math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)
	s = n * (n + 1) // 2
	if s - x == 1:
		print(n + 1)
	else:
		print(n)


for _ in range(int(input())):
	(n, jumps) = (int(input()), 0)
	while jumps * (jumps + 1) / 2 < n:
		jumps += 1
	if jumps * (jumps + 1) / 2 == n + 1:
		jumps += 1
	print(jumps)


from math import sqrt
from math import ceil
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	x = int(ceil(sqrt(float(1 + 8 * n))) // 2)
	if (x * x + x) // 2 - n == 1:
		print(x + 1)
	else:
		print(x)


from math import *
t = int(input())
a = []
for i in range(t):
	x = int(input())
	a.append(x)
for i in range(t):
	s = ceil((-1 + sqrt(1 + 8 * a[i])) / 2)
	if s * (s + 1) // 2 - a[i] == 1:
		s += 1
	print(s)


for _ in range(int(input())):
	n = int(input())
	s = 0
	for i in range(1, 1500):
		s += i
		if s >= n:
			break
	x = s - n
	if x == 0:
		print(i)
	else:
		if x == 1:
			i += 1
		print(i)


import math
t = int(input())
for _ in range(t):
	x = int(input())
	n = round(math.sqrt(2 * x))
	s = (1 + n) * n // 2
	while s > x:
		n -= 1
		s = (1 + n) * n // 2
	while s < x:
		n += 1
		s = (1 + n) * n // 2
	if s == x:
		print(n)
	elif s > x + 1:
		print(n)
	else:
		print(n + 1)


def main():
	x = int(input())
	cur = 0
	cnt = 0
	while cur < x:
		cnt += 1
		cur += cnt
	print(cnt + 1 if cur - 1 == x else cnt)
tt = int(input())
for _ in range(tt):
	main()


import math

def isvalid(s):
	k = (-1 + math.sqrt(1 + 8 * s)) / 2
	return int(math.ceil(k))
for _ in range(int(input())):
	n = int(input())
	nw = isvalid(n)
	sum1 = (nw + 1) * nw // 2
	if n == 1:
		print(1)
	elif n == 2:
		print(3)
	elif sum1 == n:
		print(nw)
	elif sum1 - n == 1:
		print(nw + 1)
	else:
		print(nw)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	now = 0
	if n == 2:
		print(3)
		continue
	for i in range(1, n + 1):
		count += 1
		now += i
		if now >= n:
			break
	if now != n and now - 1 == n:
		print(count + 1)
	else:
		print(count)


for i in ' ' * int(input()):
	x = int(input())
	k = int((2 * x) ** 0.5)
	n = 0
	for j in range(k - 5, k + 5):
		if j * (j - 1) / 2 < x <= j * (j + 1) / 2:
			n = j
			break
	if x == n * (n + 1) // 2 - 1:
		print(n + 1)
	else:
		print(n)


t = int(input())
for _ in range(t):
	x = int(input())
	for i in range(1, x + 1):
		if i * (i + 1) >= 2 * x:
			break
	k = i * (i + 1) // 2
	print(i + 1 if k == x + 1 else i)


t = int(input())
all = []
for i in range(t):
	x = int(input())
	all.append(x)
for item in all:
	i = 0
	while (1 + i) * i // 2 < item:
		i += 1
	if (1 + i) * i // 2 == item:
		print(i)
	else:
		s = (i + 1) * i // 2
		for j in list(reversed(range(1, i + 1))):
			if s - j - 1 >= item:
				s = s - j - 1
		print(i + s - item)


def read():
	return [int(x) for x in input().split()]
(ca,) = read()
for _ in range(ca):
	(n,) = read()
	t = round((n * 2) ** 0.5) - 1
	while t * (t + 1) // 2 < n:
		t += 1
	print(t if (t + 1) * t // 2 != n + 1 else t + 1)


import math
t = int(input())
for _ in range(t):
	x = int(input())
	if x == 1:
		print(1)
		continue
	elif x == 2:
		print(3)
		continue
	elif x == 3:
		print(2)
		continue
	double_x = 2 * x
	steps = 0
	for n in range(int(math.sqrt(double_x)), double_x):
		if n * (n + 1) >= double_x:
			steps = n
			break
	position = steps * (steps + 1) / 2
	if position == x + 1:
		steps += 1
	print(steps)


import math
T = int(input(''))
for i in range(T):
	n = int(input())
	m = math.ceil((-1 + math.sqrt(8 * n + 1)) / 2)
	num = m * (m + 1) // 2
	if num - n == 1:
		print(m + 1)
	else:
		print(m)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	i = 0
	while n > 0:
		i += 1
		n -= i
	if n == -1:
		i += 1
	print(i)


from math import ceil, sqrt
EPS = 1e-07
t = int(input())
for _ in range(t):
	x = int(input())
	n = (-1 + sqrt(8 * x + 1)) / 2
	if abs(n - ceil(n)) < EPS:
		print(int(n))
		continue
	else:
		n = ceil(n)
		if n * (n + 1) / 2 - x == 1:
			print(n + 1)
			continue
		else:
			print(n)


t = int(input())
for i in range(t):
	n = int(input())
	u = 1
	while u * (u + 1) / 2 < n:
		u += 1
	a = u * (u + 1) / 2
	c = a - n
	for j in range(1, u + 1):
		if c == j + 1:
			c = c - j - 1
	print(int(u + c))


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
from collections import defaultdict
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=10 ** 9 + 5, func=lambda a, b: min(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: max(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 = (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 = l + (r - l) // 2
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
for ik in range(int(input())):
	n = int(input())
	for i in range(1, 2001):
		t = i * (i + 1) // 2
		if t >= n:
			e = 0
			if t - n == 1:
				e = 1
			print(i + e)
			break


import sys

def main():

	def modst(a, s):
		ret = 1
		while s:
			if s % 2:
				ret = ret * a % mod
			a = a * a % mod
			s //= 2
		return ret

	def Cnk(n, k):
		return (k <= n and n >= 0) * (f[n] * modst(f[k] * f[n - k] % mod, mod - 2) % mod)
	x = int(sys.stdin.readline().strip())
	(n, d) = (0, 1)
	while n + d < x:
		n += d
		d += 1
	print(d + (n + d == x + 1))
for i in range(int(input())):
	main()


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

	def fun(n):
		return n * (n + 1) // 2
	n = int(input())
	for i in range(3000):
		if fun(i) >= n:
			k = i
			break
	delta = fun(k) - n
	if delta == 1:
		print(k + 1)
	else:
		print(k)


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	s = 1
	c = 0
	while c < n:
		c += s
		a += 1
		s += 1
	if c > n and c - n == 1:
		a += 1
	print(a)


t = int(input())
r = str()

def numbersteps(k):
	n = int(((1 + k * 8) ** (1 / 2) - 1) / 2)
	if n * (n + 1) / 2 == k:
		return n
	if k == (n + 1) * (n + 2) / 2 - 1:
		return n + 2
	else:
		return n + 1
for i in range(t):
	x = int(input())
	r = r + str(numbersteps(x)) + '\n'
print(r)


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(d,) = gil()
	n = 0
	while n * (n + 1) // 2 < d:
		n += 1
	v = n * (n + 1)
	v //= 2
	if v == d:
		print(n)
	elif v - d == 1:
		print(n + 1)
	elif v - d < n + 1:
		print(n)
	else:
		print(0)


def binS(num):
	start = 1
	end = 1500
	while start <= end:
		mid = (start + end) // 2
		if mid * (mid + 1) // 2 == num:
			return mid
		elif mid * (mid + 1) // 2 < num:
			start = mid + 1
		else:
			end = mid - 1
	if mid * (mid + 1) // 2 < num:
		mid += 1
	return mid
t = int(input())
for case in range(t):
	x = int(input())
	ind = binS(x)
	print(ind + 1 * (ind * (ind + 1) // 2 - 1 == x))


for t in range(int(input())):
	x = int(input())
	if x == 1:
		print(1)
	else:
		sum = 0
		count = 0
		while sum < x:
			sum += count + 1
			count += 1
		if sum == x or sum != x + 1:
			print(count)
		else:
			print(count + 1)


for _ in range(int(input())):
	x = int(input())
	ans = (1 + 8 * x) ** 0.5 - 1
	ans = ans / 2
	x = x + 1
	temp = (1 + 8 * x) ** 0.5 - 1
	temp = temp / 2
	if ans % 1 == 0:
		print(int(ans))
	elif temp % 1 == 0:
		print(int(ans) + 2)
	else:
		print(int(ans) + 1)


import math
for tt in range(int(input())):
	n = int(input())
	val = math.ceil((-1 + math.sqrt(1 + 8 * n)) / 2)
	if val * (val + 1) // 2 - n != 1:
		print(val)
	else:
		print(val + 1)


from math import sqrt, ceil
for ii in range(int(input())):
	n = int(input())
	x = ceil((-1 + sqrt(1 + 8 * n)) / 2)
	s = x * (x + 1) // 2
	if s - n == 1:
		print(x + 1)
	else:
		print(x)


t = int(input())
for _ in range(t):
	x = int(input())
	n = 0
	while n * (n + 1) / 2 < x:
		n += 1
	if n * (n + 1) / 2 - x == 1:
		print(n + 1)
	else:
		print(n)


for _ in range(int(input())):
	x = int(input())
	sum = 0
	i = 1
	if x == 1:
		print(1)
		continue
	while sum < x:
		sum += i
		i += 1
	if sum == x + 1:
		print(i)
	else:
		print(i - 1)


import math
num_cases = int(input())
for i in range(num_cases):
	destination = input()
	destination = int(destination)
	steps = math.ceil((-1 + math.sqrt(1 + 8 * destination)) / 2)
	extra_dist = steps * (steps + 1) / 2 - destination
	if extra_dist == 1:
		steps = steps + 1
	else:
		steps = steps
	print(steps)


for i in range(int(input())):
	n = int(input())
	k = int((8 * n + 1) ** 0.5 - 1) // 2
	if k * (k + 1) // 2 == n:
		print(k)
	elif (k + 1) * (k + 2) // 2 - n > 1:
		print(k + 1)
	else:
		print(k + 2)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	x = int(input())
	ok = 2000
	ng = 0
	while abs(ok - ng) > 1:
		m = (ok + ng) // 2
		if m * (m + 1) // 2 >= x:
			ok = m
		else:
			ng = m
	if ok * (ok + 1) // 2 != x + 1:
		print(ok)
	else:
		print(ok + 1)


t = int(input())
for zm in range(t):
	n = int(input())
	for i in range(100000000):
		if n <= i * (i + 1) / 2:
			if n == i * (i + 1) / 2 - 1:
				print(i + 1)
			else:
				print(i)
			break


t = int(input())
for i in range(t):
	a = int(input())
	i = 1
	ans = 0
	while ans < a:
		ans = ans + i
		i = i + 1
	if ans == a + 1:
		print(i)
	else:
		print(i - 1)


import math
n = int(input())
for _ in range(n):
	x = int(input())
	z = (math.sqrt(x * 8 + 1) - 1) / 2
	m = math.ceil(z)
	sum = m * (m + 1) // 2
	if sum - 1 == x:
		print(m + 1)
	else:
		print(m)


import math
t = int(input())
for _ in range(t):
	x = int(input())
	root = math.sqrt(1 + 8 * x)
	req = (root - 1) // 2
	curr = req * (req + 1) // 2
	if curr == x:
		print(int(req))
	else:
		req += 1
		currVal = req * (req + 1) // 2
		diff = currVal - x - 1
		if 0 < diff <= req:
			print(int(req))
		else:
			print(int(req + diff + 1))


import math
l = []
s = 0
for i in range(1, 1415):
	s += i
	l.append(s)
for _ in range(int(input())):
	x = int(input())
	p = int(math.sqrt(x * 2))
	if l[p - 1] - 1 == x:
		print(p + 1)
	elif l[p - 1] < x:
		print(p + 1)
	elif l[p - 1] == x:
		print(p)
	else:
		print(p)


for t in range(int(input())):
	x = int(input())
	l = 0
	r = x
	while l < r - 1:
		m = (l + r) // 2
		if m * (m + 1) // 2 <= x:
			l = m
		else:
			r = m
	if l * (l + 1) // 2 == x:
		print(l)
	elif r * (r + 1) // 2 == x + 1:
		print(r + 1)
	else:
		print(r)


import math
import sys
import bisect
from heapq import heapify, heappop, heappush
from itertools import *
from collections import deque, OrderedDict
sys.setrecursionlimit(10 ** 6)
II = lambda : sys.stdin.readline()
inp = lambda : int(II())
inpm = lambda : map(int, II().split())
inpl = lambda : list(inpm())
arr_mn = lambda _n, _m: [[0 for __ in range(_m)] for _ in range(_n)]
arr_nn = lambda _n: arr_mn(_n, _n)
EPS = 1e-09
INF = int(1e+18)
MOD = int(1000000000.0) + 7
N = 2000009

def solve():
	x = inp()
	step = 1
	s = 0
	while s < x:
		s += step
		step += 1
	if s - x == 1:
		print(step)
	else:
		print(step - 1)

def main():
	t = inp()
	for i in range(t):
		solve()
main()


tc = int(input())
for t in range(tc):
	dest = int(input())
	ptr = 0
	k = 1
	count = 0
	while ptr < dest:
		ptr += k
		k += 1
		count += 1
	if ptr - dest == 1:
		count += 1
	print(count)


T = int(input())
for z in range(T):
	n = int(input())
	N = (-1 + (1 + 8 * n) ** 0.5) // 2
	N = int(N)
	add = N * (N + 1) // 2
	if add == n:
		print(N)
	else:
		add = (N + 2) * (N + 1) // 2
		if add - n == 1:
			print(N + 2)
		else:
			print(N + 1)


import os, sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		x = int(input())
		ans = 0
		n = 1
		while ans < x:
			ans += n
			n += 1
		if x == ans - 1:
			print(n)
		else:
			print(n - 1)
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()


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	x = (-1 + (1 + 8 * n) ** 0.5) / 2
	if x == math.floor(x):
		print(int(x))
	else:
		p = math.ceil(x)
		if p * (p + 1) // 2 - 1 == n:
			print(int(x + 2))
		else:
			print(int(x + 1))


for u in range(int(input())):
	n = int(input())
	c = 0
	while n > 0:
		c += 1
		n -= c
	if n == -1:
		c += 1
	print(c)


from math import ceil, sqrt
for _ in range(int(input())):
	x = int(input())
	c = ceil((sqrt(1 + 8 * x) - 1) / 2)
	n = c * (c + 1) // 2
	if n - x == 1:
		print(c + 1)
	else:
		print(c)


t = int(input())
for i in range(t):
	n = int(input())
	counter = 1
	sum = 0
	m = 1
	while sum <= n:
		sum += m
		if sum == n:
			break
		elif sum < n:
			counter += 1
			m += 1
		else:
			counter += 1
			break
	if sum - n > 1:
		print(counter - 1)
	else:
		print(counter)


t = int(input())
while t > 0:
	n = int(input())
	i = 1
	if n == 2:
		print(3)
	else:
		for i in range(1, n):
			if i * (i + 1) >= 2 * n:
				break
		k = i * (i + 1) // 2
		if k == n + 1:
			ans = i + 1
		else:
			ans = i
		print(ans)
	t = t - 1


t = int(input())
a = []
for _ in range(t):
	x = int(input())
	y = 0
	k = 0
	sum1 = 0
	while sum1 < x:
		k += 1
		sum1 += k
		if sum1 - x == 1:
			k += 1
	a.append(k)
for i in a:
	print(i)


for _ in range(int(input())):
	n = int(input())
	for i in range(1, n + 1):
		if i * (i + 1) >= 2 * n:
			break
	k = i * (i + 1) // 2
	if k == n + 1:
		print(i + 1)
	else:
		print(i)


for _ in range(int(input())):
	a = int(input())
	b = int((1 + 8 * a) ** 0.5)
	c = int((b - 1) / 2)
	if b * b == 1 + 8 * a:
		print(c)
	elif a == (c + 1) * (c + 2) / 2 - 1:
		print(c + 2)
	else:
		print(c + 1)


import math
for i in range(int(input())):
	x = int(input())
	value = (-1 + pow(1 + 8 * x, 0.5)) / 2
	numbers = math.floor(value)
	ceil = math.ceil(value)
	if numbers == ceil:
		newx = x
	else:
		newx = numbers * (numbers + 1) // 2 + ceil
	if newx - x == 0:
		print(numbers)
	elif newx - x == 1:
		print(numbers + 2)
	else:
		print(numbers + 1)


for _ in range(int(input()) if True else 1):
	n = int(input())
	c = 0
	for i in range(1, n + 1):
		if i * (i + 1) // 2 >= n:
			c = i
			v = i * (i + 1) // 2
			break
	if v - n == 1:
		print(c + 1)
	else:
		print(c)


import math
a = int(input())
b = []
for c in range(a):
	d = int(input())
	b.append(d)
c = []
for e in b:
	f = (-1 + math.sqrt(1 + 8 * e)) / 2
	g = int(math.ceil(f))
	h = g * (g + 1) / 2
	h = int(h)
	if e == h - 1:
		c.append(g + 1)
	else:
		c.append(g)
for i in c:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	i = 1
	sum = 0
	cnt = 0
	while sum < n:
		sum += i
		cnt += 1
		i += 1
	if sum == n or sum - n > 1:
		print(cnt)
	else:
		print(cnt + 1)


for _ in range(int(input())):
	n = int(input())
	s = 0
	for i in range(1, 10 ** 9):
		s += i
		if s == n:
			print(i)
			break
		elif s - 1 == n:
			print(i + 1)
			break
		elif s >= n:
			print(i)
			break


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import defaultdict as dd
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdmap = lambda : map(int, stdstr().split())
stdarr = lambda : list(map(int, stdstr().split()))
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	j = 0
	while n > 0:
		j += 1
		n -= j
	if n == -1:
		print(j + 1)
	else:
		print(j)


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 msi():
	return map(str, input().strip().split(' '))

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

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

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

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

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

def is_integer(n):
	return math.ceil(n) == math.floor(n)

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

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 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 and n > 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):
	if y == 0:
		return 1
	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):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	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)]
	(prime[0], prime[1]) = (False, False)
	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

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.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
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	x = scanner()
	n = 1
	while n * (n + 1) // 2 < x:
		n += 1
	v = n * (n + 1) // 2
	if v - x == 1:
		print(n + 1)
	else:
		print(n)
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')
t = scanner()
for i in range(t):
	solve()


import math
for _ in range(int(input())):
	n = int(input())
	k = math.ceil(math.sqrt(8 * n + 1))
	if n == 2:
		print(3)
	elif math.sqrt(8 * n + 9) % 1 == 0:
		print(1 + math.ceil((k - 1) / 2))
	else:
		print(math.ceil((k - 1) / 2))


for s in [*open(0)][1:]:
	x = int(s)
	k = int(((1 + 8 * x) ** 0.5 - 1) / 2) + 1
	d = k * k + k - 2 * x
	print(k - 1 + (d < 2 * k) + (d == 2))


for _ in range(int(input())):
	x = int(input())
	t = int((1 + 8 * x) ** (1 / 2)) - 1
	t = t // 2
	if t * (t + 1) // 2 != x:
		t = t + 1
	if t * (t + 1) // 2 == x + 1:
		t = t + 1
	print(t)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if math.sqrt(8 * n + 1) == int(math.sqrt(8 * n + 1)):
		print(int(int(int(math.sqrt(8 * n + 1)) - 1) / 2))
	else:
		temp = int(int(math.sqrt(8 * n + 1) - 1) / 2)
		temp2 = temp
		temp2 += 1
		if int(temp2 * (temp2 + 1) / 2) == n + 1:
			print(temp2 + 1)
		else:
			print(temp2)


from math import sqrt, ceil
t = int(input())
for i in range(t):
	n = int(input())
	sol = ceil((-1 + sqrt(1 + 8 * n)) / 2)
	r = (-1 + sqrt(1 + 8 * (n + 1))) / 2
	if r.is_integer():
		print(sol + 1)
	else:
		print(sol)


t = int(input())
while t:
	x = int(input())
	if x == 1:
		print(x)
	else:
		temp = int(pow(2 * x, 0.5))
		k = 0
		if temp * (temp + 1) == 2 * x:
			print(temp)
		else:
			m = 0
			if temp * (temp + 1) > 2 * x:
				m = temp * (temp + 1) // 2 - x + temp
			else:
				temp += 1
				m = temp * (temp + 1) // 2 - x + temp
			if m - temp == 1:
				print(m)
			else:
				print(temp)
	t -= 1


t = int(input())
for i in range(t):
	x = int(input())
	k = (-1 + (1 + 8 * x) ** 0.5) / 2
	j = int(k) + 1
	if k == int(k):
		print(int(k))
	elif j * (j + 1) // 2 - 1 == x:
		print(j + 1)
	else:
		print(j)


import math
t = int(input())
for i in range(t):
	x = int(input())
	ans = math.ceil((math.sqrt(8 * x + 1) - 1) / 2)
	com = ans * (ans + 1) / 2
	if com - x == 1:
		ans += 1
	print(ans)


import os
from math import factorial
import sys
from io import BytesIO, IOBase

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

def IIX():
	return (int(x) for x in sys.stdin.readline().split())

def II():
	return int(inp())

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

def LS():
	return list(map(str, inp().split()))

def L(x):
	return list(x)

def out(var):
	return sys.stdout.write(str(var))

class GraphAL:

	def __init__(self, Nodes, isDirected=False):
		self.nodes = [x for x in range(1, Nodes + 1)]
		self.adj_list = {}
		self.isDirected = isDirected
		for node in self.nodes:
			self.adj_list[node] = []

	def add_edge(self, x, y):
		self.adj_list[x].append(y)
		if self.isDirected == False:
			self.adj_list[y].append(x)

	def return_graph(self):
		return self.adj_list

class GraphAM:

	def __init__(self, Nodes, isDirected=False):
		self.adj_matrix = [[0] * (Nodes + 1) for x in range(Nodes + 2)]
		self.isDirected = isDirected

	def add_edge(self, x, y):
		if self.isDirected:
			self.adj_matrix[x][y] = 1
		elif self.isDirected == False:
			self.adj_matrix[x][y] = 1
			self.adj_matrix[y][x] = 1

	def delete_edge(self, x, y):
		if self.isDirected:
			self.adj_matrix[x][y] = 0
		if self.isDirected == False:
			self.adj_matrix[x][y] = 0
			self.adj_matrix[y][x] = 0

	def degree(self, x):
		l = self.adj_matrix[x]
		return l.count(1)

	def return_graph(self):
		return self.adj_matrix

def solve():
	x = II()
	(y, q1) = (0, 0)
	while y < x:
		q1 += 1
		y += q1
	print(q1 + (x == y - 1))
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.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		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')
try:
	t = II()
	for _ in range(t):
		solve()
except EOFError as e:
	out('')
except RuntimeError as r:
	out('')


for t in range(int(input())):
	x = int(input())
	n = int(((8 * x + 1) ** 0.5 - 1) / 2)
	if n / 2 * (n + 1) == x:
		print(n)
	elif (n + 1) * (n + 2) / 2 - 1 == x:
		print(n + 2)
	else:
		print(n + 1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	cnt = 0
	z = 0
	i = 1
	while z < n:
		z += i
		cnt += 1
		i += 1
	if z == n + 1:
		print(cnt + 1)
	elif z == n:
		print(cnt)
	else:
		print(cnt)


def helper(l, r, x):
	while l < r:
		mid = l + r >> 1
		if x > (mid + 1) * mid // 2:
			l = mid + 1
		elif x == (mid + 1) * mid // 2:
			return mid
		else:
			r = mid
	return l
t = int(input().strip())
for i in range(t):
	x = int(input().strip())
	k = helper(1, x, x)
	if k * (k + 1) // 2 == x or k * (k + 1) // 2 - x > 1:
		print(k)
	else:
		print(k + 1)


pas = [i * (i + 1) // 2 for i in range(2 * 10 ** 3)]

def dico(l, x):
	(i, j) = (0, len(l) - 1)
	while i <= j:
		ind = (i + j) // 2
		if l[ind] == x:
			i = ind
			break
		elif l[ind] < x:
			i = ind + 1
		else:
			j = ind - 1
	return i
for _ in range(int(input())):
	n = int(input())
	i = dico(pas, n)
	print(i + pas[i] - n if pas[i] - n <= 1 else i)


from math import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import search
inp = lambda : int(input())
li = lambda : list(map(int, input().split()))
lb = lambda : list(map(int, input()))
ls = lambda : list(input())
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def solve(__=1):
	for _ in range(__):
		x = inp()
		n = int(((8 * x + 1) ** 0.5 - 1) / 2)
		if n * (n + 1) == 2 * x:
			print(n)
		elif (n + 1) * (n + 2) == 2 * x + 2:
			print(n + 2)
		else:
			print(n + 1)
solve(inp())


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	ans = 0
	k = 1
	while ans < n:
		ans = ans + k
		k = k + 1
	if ans == n + 1:
		print(k)
	else:
		print(k - 1)


t = int(input())
for u in range(t):
	n = int(input())
	(i, s, x) = (0, 0, 0)
	while s < n:
		s += i
		x = i
		i += 1
	if s - n == 1:
		print(x + 1)
	else:
		print(x)


t = int(input())
a = [1]
i = 2
while a[-1] < 1000050:
	a.append(a[-1] + i)
	i += 1
n = len(a)
for i10 in range(t):
	x = int(input())
	l = 0
	r = n
	while l + 1 != r:
		m = (l + r) // 2
		if a[m] <= x:
			l = m
		else:
			r = m
	if a[l] < x:
		l += 1
	if a[l] == x + 1:
		print(l + 2)
	else:
		print(l + 1)


import math
for test in range(int(input())):
	k = int(input())
	n = math.floor(math.sqrt(2 * k))
	if n * (n + 1) // 2 < k:
		n += 1
	if n * (n + 1) // 2 == k + 1:
		n += 1
	print(n)


t = int(input())
for i in range(t):
	x = int(input())
	(a, b) = (0, 1500)
	while b - a > 5:
		c = (a + b) // 2
		if c * (c + 1) // 2 >= x:
			b = c + 2
		else:
			a = c - 2
	for j in range(a, b):
		if j * (j + 1) // 2 >= x:
			break
	if j * (j + 1) // 2 != x + 1:
		print(j)
	else:
		print(j + 1)


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(3)
		continue
	val = (-1 + pow(1 + 4 * (2 * n), 0.5)) / 2
	if val == int(val):
		print(int(val))
	else:
		val = int(val) + 1
		ts = val * (val + 1) // 2
		if ts - n == 1:
			print(val + 1)
		else:
			print(val)


def solve(n):
	s = 0
	for i in range(1, n + 1):
		s += i
		if s == n:
			return i
		if s > n:
			break
	if s - n == 1:
		return i + 1
	else:
		return i
for _ in range(int(input())):
	print(solve(int(input())))


t = int(input())
import math
for i in range(t):
	x = int(input())
	n = math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)
	if n * (n + 1) * 0.5 == x:
		print(n)
	elif n * (n + 1) * 0.5 - x == 1:
		print(n + 1)
	else:
		print(n)


for _ in range(int(input())):
	x = int(input())
	steps = 0
	while steps * (steps + 1) < 2 * x:
		steps += 1
	if steps * (steps + 1) / 2 == x + 1:
		steps += 1
	print(steps)


n = int(input())
for i in range(n):
	r = int(input())
	i = 1
	j = 1000000
	while i < j:
		m = (i + j) // 2
		s = m * (m + 1) // 2
		if s >= r:
			j = m
		else:
			i = m + 1
	if i * (i + 1) // 2 - r == 1:
		i += 1
	print(i)


import sys, math

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

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

def lmii():
	return list(mii())

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

def main():
	pos = []
	flag = -1
	N = 10 ** 6
	for i in range(1, N):
		r = i * (i + 1) // 2
		if r <= 10 ** 6:
			pos.append(r)
		else:
			flag = i
			break
	z = flag * (flag + 1) // 2
	pos.append(z)
	for _ in range(ii()):
		n = ii()
		ans = 0
		for j in range(len(pos)):
			if n > pos[j]:
				continue
			elif n == pos[j]:
				ans = j + 1
				break
			else:
				ans = j + 1
				if n == pos[j] - 1:
					ans += 1
				break
		print(ans)
main()


def hops(a):
	n = int((-1 + (1 + 8 * a) ** (1 / 2)) / 2)
	q = n * (n + 1) / 2
	z = a - q
	if z == 0:
		return n
	elif z == n:
		return n + 2
	else:
		return n + 1
for i in range(int(input())):
	a = int(input())
	print(hops(a))


t = int(input())
import math

def nearestSum(num):
	ans = (math.sqrt(1 + 8 * num) - 1) * 0.5
	if ans == int(ans):
		return (int(ans), True)
	return (int(ans + 1), False)
for i in range(t):
	n = int(input())
	(ans, flag) = nearestSum(n)
	if flag:
		print(ans)
	else:
		c = int(ans * (ans + 1) / 2 - n)
		if c == 1:
			print(ans + c)
		else:
			print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	p = math.ceil(math.sqrt(n * 8 + 1))
	l = math.ceil((p - 1) / 2)
	c = l * (l + 1)
	c = c // 2
	if c - 1 == n:
		print(l + 1)
	else:
		print(l)


from sys import stdin, stdout
from math import sqrt, ceil

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

def solve():
	x = II()
	y = ceil(sqrt(x + x + 0.25) - 0.5)
	d = y * (y + 1) // 2
	diff = d - x
	if diff == 1:
		ans = y + 1
	else:
		ans = y
	stdout.write('{} \n'.format(ans))
t = II()
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	x = int(input())
	scitanec = 1
	sucet = 0
	pocet = 0
	while True:
		sucet += scitanec
		scitanec += 1
		pocet += 1
		if sucet >= x:
			if 0 < sucet - x - 1 <= x:
				print(pocet)
			else:
				print(pocet + (sucet - x))
			break


t = int(input())
for tt in range(t):
	n = int(input())
	k = 0
	i = 0
	c = 0
	while i < n:
		k += 1
		i += k
		c += 1
	if i - n == 1:
		print(c + 1)
	else:
		print(c)


import math

def solve(x):
	n = math.ceil((-1 + (1 + 8 * x) ** 0.5) / 2.0)
	diff = n * (n + 1) / 2 - x
	return n + 1 if diff == 1 else n
t = int(input().strip())
with open('output.txt', 'w') as output:
	for i in range(t):
		x = int(input().strip())
		res = int(solve(x))
		print(res)


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)

def enough(n, x):
	return n * (n + 1) // 2 - x

def bs(x):
	(l, r) = (1, 10 ** 6)
	ans = 0
	while l < r:
		mid = (l + r) // 2
		ans = enough(mid, x)
		if ans >= 0:
			r = mid
		else:
			l = mid + 1
	return (l, l * (l + 1) // 2 - x)
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007
for _ in range(int(input())):
	n = int(input())
	(a, b) = bs(n)
	print(a + 1 if b == 1 else a)


from sys import stdin
cas = int(stdin.readline().strip())
ans = 0

def sm(x):
	return x * (x + 1) // 2
for ca in range(cas):
	x = int(stdin.readline().strip())
	for i in range(1000000):
		if sm(i) >= x:
			if sm(i) - x == 1:
				print(i + 1)
			else:
				print(i)
			break


l = {n * (n + 1) // 2: n for n in range(1, 1415)}
for _ in [0] * int(input()):
	x = int(input())
	for i in l:
		if i >= x:
			break
	if x == i - 1:
		print(l[i] + 1)
	else:
		print(l[i])


T = int(input())
for __ in range(T):
	x = int(input())
	(l, r) = (0, x)
	fin = 0
	while l <= r:
		mid = l + (r - l) // 2
		next = mid * (mid + 1) // 2
		if next >= x:
			fin = mid
			r = mid - 1
		else:
			l = mid + 1
	if x - fin * (fin + 1) / 2 == -1:
		print(fin + 1)
	else:
		print(fin)


from sys import stdin, stdout
t = int(stdin.readline())
pre_calculated = [i * (i + 1) // 2 for i in range(0, 1415)]
while t:
	x = int(stdin.readline())
	if x == 2:
		print(3)
	elif x in pre_calculated:
		print(pre_calculated.index(x))
	else:
		start = 0
		end = 1414
		at = -1
		while start <= end:
			mid = start + (end - start) // 2
			if pre_calculated[mid] < x:
				at = mid
				start = mid + 1
			elif pre_calculated[mid] > x:
				end = mid - 1
		if x == pre_calculated[at] - 1 or pre_calculated[at + 1] - 1 == x:
			print(pre_calculated[at + 1] - pre_calculated[at] + 1)
		else:
			print(pre_calculated[at + 1] - pre_calculated[at])
	t -= 1


from sys import stdout, stdin, maxsize
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	z = 1 + 8 * n
	k = z ** 0.5
	k = k - 1
	k = k / 2
	z = int(k)
	k = z * (z + 1) // 2
	if k == n:
		stdout.write(str(z) + '\n')
	elif k < n:
		z += 1
		k = z * (z + 1) // 2
		if k - n == 1:
			stdout.write(str(z + 1) + '\n')
		else:
			stdout.write(str(z) + '\n')


for i in range(int(input())):
	x = int(input())
	y = 0
	i = 1
	while y < x:
		y += i
		i += 1
	if y == x + 1:
		print(i)
	else:
		print(i - 1)


for _ in range(int(input())):
	n = int(input())
	s = 0
	i = 0
	while s < n:
		s = s + i
		i = i + 1
	if s == n + 1:
		print(i)
	else:
		print(i - 1)


for _ in ' ' * int(input()):
	a = int(input())
	s = 0
	j = 1
	ans = 1
	for i in range(1, 1500):
		s += i
		if s == a:
			ans = i
			break
		elif s - 1 == a:
			ans = i + 1
			break
		elif s > a:
			ans = i
			break
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	j = 1
	while a < n:
		a += j
		j += 1
	if a - 1 == n:
		print(j)
	else:
		print(j - 1)


t = int(input())
while t:
	t -= 1
	x = int(input())
	count = 0
	while x > 0:
		count += 1
		x -= count
	if x == -1:
		count += 1
	print(count)


t = int(input())
for i in range(t):
	n = int(input())
	k = 1
	while k * (k + 1) // 2 < n:
		k = k + 1
	if n == k * (k + 1) // 2 - 1:
		print(k + 1)
	else:
		print(k)


import sys
import math
from decimal import *
z = int(input())
for contorr in range(z):
	n = int(input())
	if n == 1:
		print(1)
	elif n == 2:
		print(3)
	else:
		x_2 = int(((8 * n + 1) ** (1 / 2) - 1) / 2)
		if x_2 * (x_2 + 1) / 2 == n:
			print(x_2)
		else:
			x_2 += 1
			if x_2 * (x_2 + 1) / 2 == n + 1:
				x_2 += 1
			print(x_2)


for i in range(int(input())):
	x = int(input())
	l = 1
	r = x
	ans = 0
	while l <= r:
		mid = l + (r - l) // 2
		value = mid * (mid + 1) // 2
		if l == r and value < x and (x <= (mid + 1) * (mid + 2) // 2):
			ans += 1
		if value < x:
			l = mid + 1
		elif value > x:
			r = mid - 1
		elif value == x:
			ans = 0
			break
	g = mid + ans
	if x + 1 == g * (g + 1) // 2:
		print(g + 1)
	else:
		print(g)


import sys
import math
import bisect
import heapq
from sys import stdin, stdout
from math import gcd, floor, sqrt, log, ceil
from collections import defaultdict as dd
from collections import Counter as cc
from bisect import bisect_left as bl
from bisect import bisect_right as br
sys.setrecursionlimit(100000000)
intinp = lambda : int(input().strip())
stripinp = lambda : input().strip()
fltarr = lambda : list(map(float, input().strip().split()))
intarr = lambda : list(map(int, input().strip().split()))
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
MOD = 1000000007
sums = []
for i in range(1, 1415):
	sums.append(i * (i + 1) // 2)
num_cases = intinp()
for _ in range(num_cases):
	x = intinp()
	ind = bl(sums, x)
	if sums[ind] == x:
		print(ind + 1)
	elif sums[ind] == x + 1:
		print(ind + 2)
	else:
		print(ind + 1)


import math

def main(x):
	root = (-1 + math.sqrt(1 + 8 * (x + 1))) / 2
	floor = math.floor(root)
	if root - floor < 1e-10:
		return floor + 1
	else:
		root = (-1 + math.sqrt(1 + 8 * x)) / 2
		return math.ceil(root)
t = int(input())
for _ in range(t):
	x = int(input())
	res = main(x)
	print(res)

def test1():
	assert True == False

def test2():
	assert True == False

def test_min():
	assert True == False

def test_max():
	assert True == False


import sys
t = int(sys.stdin.readline().strip())
for j in range(t):
	n = int(sys.stdin.readline().strip())
	total = 0
	idx = 1
	if n == 1:
		print(1)
	elif n == 2:
		print(3)
	elif n == 3:
		print(2)
	else:
		while total < n:
			total += idx
			idx += 1
		if total - n == 1:
			print(idx)
		else:
			print(idx - 1)


for _ in range(int(input())):
	x = int(input())
	current = 0
	jumps = 0
	while current < x:
		jumps += 1
		current += jumps
	if current - x == 1:
		print(jumps + 1)
	else:
		print(jumps)


for _ in range(int(input())):
	n1 = int(input())
	for j in range(1, n1 + 1):
		if j * (j + 1) >= 2 * n1:
			break
	res = j * (j + 1) // 2
	if res == n1 + 1:
		print(j + 1)
	else:
		print(j)


from math import ceil, sqrt
t = int(input())
for i_t in range(t):
	x = int(input())
	min_n = ceil((sqrt(1 + 8 * x) - 1) / 2)
	max_x_can_reach = min_n * (min_n + 1) // 2
	if x == max_x_can_reach - 1:
		min_n += 1
	print(min_n)


t = int(input())
for i in range(t):
	x = int(input())
	j = 0
	inc = 1
	count = 0
	while True:
		if j >= x:
			break
		j = j + inc
		inc += 1
		count += 1
	if j == x:
		print(count)
	elif j - x == 1:
		print(count + 1)
	else:
		print(count)


for _ in range(int(input())):
	x = int(input())
	c = 0
	n = 0
	i = 1
	while n < x:
		n += i
		i += 1
		c += 1
	if n - x == 1:
		print(c + 1)
	else:
		print(c)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)

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

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

def SI():
	return sys.stdin.readline().strip()
for _ in [0] * II():
	t = II()
	n = math.ceil(((8 * t + 1) ** 0.5 - 1) / 2)
	if (1 + n) * n // 2 != t + 1:
		print(n)
	else:
		print(n + 1)


num_test_cases = int(input())
for i in range(0, num_test_cases):
	dest = int(input())
	num = int((-1 + (1 + 8 * dest) ** 0.5) // 2)
	if num * (num + 1) == dest * 2:
		print(num)
	elif (num + 1) * (num + 2) == (dest + 1) * 2:
		print(num + 2)
	else:
		print(num + 1)


import math
t = int(input())
for _ in range(t):
	x = int(input())
	for i in range(int(math.sqrt(x)) - 1, x + 1):
		if i * (i + 1) / 2 == x:
			print(i)
			break
		elif i * (i + 1) / 2 - x == 1:
			print(i + 1)
			break
		elif i * (i + 1) / 2 - x > 0 and i * (i + 1) / 2 - x < i:
			print(i)
			break


import math

def jumps(x):
	s = math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)
	ans = s * (s + 1) // 2
	k = ans - 1 - x
	if k > 0 or k < 0:
		return s
	if k == 0:
		return s + 1
t = int(input())
for x in range(t):
	print(jumps(int(input())))


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil, log
from bisect import bisect_left as bl
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')
for _ in range(int(input())):
	x = int(input())
	root = ceil((-1 + (1 + 8 * x) ** 0.5) / 2)
	d = root * (root + 1) // 2 - x
	if d == 0:
		print(root + d)
	elif d == 1:
		print(root + 1)
	else:
		print(root)


from math import *
t = int(input())
for i in range(t):
	x = int(input())
	pocet = 0
	sucet = 0
	if (-1 + sqrt(1 + 4 * 2 * x)) % 2 != 0:
		pocet = int((-1 + sqrt(1 + 4 * 2 * x)) // 2 + 1)
	else:
		pocet = int((-1 + sqrt(1 + 4 * 2 * x)) // 2)
	sucet = pocet * (pocet + 1) // 2
	if 0 < sucet - x - 1 <= x:
		print(pocet)
	else:
		print(pocet + (sucet - x))


import math

def sum(n):
	return n * (n + 1) / 2
t = int(input())
for i in range(t):
	n = int(input())
	v = math.ceil((math.sqrt(1 + 8 * n) - 1) / 2)
	print(v + 1 if sum(v) - n == 1 else v)


from math import *
t = int(input())
for i in range(t):
	x = int(input())
	n = ceil((-1 + sqrt(1 + 8 * x)) / 2)
	p = n * (n + 1) // 2 - x - 1
	if p == 0:
		print(n + 1)
	else:
		print(n)


from bisect import bisect_left
xs = [0]
for i in range(1, 1500):
	xs.append(xs[len(xs) - 1] + i)
for _ in range(0, int(input())):
	x = int(input())
	y = bisect_left(xs, x)
	if xs[y] == x:
		print(y)
	else:
		print(bisect_left(xs, x + 2))


for _ in range(int(input())):
	n = int(input())
	jump = 0
	value = 0
	while value < n:
		jump += 1
		value += jump
	if value == n + 1:
		print(jump + 1)
	else:
		print(jump)


for i in range(int(input())):
	n = int(input())
	det = (-1 + (1 + 8 * n) ** 0.5) / 2
	if int(det) - det == 0:
		print(int(det))
	else:
		det = det // 1
		temp = det * (det + 1) // 2
		if temp + det == n:
			print(int(det + 2))
		else:
			print(int(det + 1))


for _ in range(int(input())):
	n = int(input())
	y = 0
	while n > 0:
		y += 1
		n -= y
	if n == -1:
		y += 1
	print(y)


import math
t = int(input())
for i in range(t):
	x = int(input())
	n = (math.sqrt(8 * x + 1) - 1) / 2
	m = (math.sqrt(8 * (x + 1) + 1) - 1) / 2
	if int(n) == int(m):
		print(math.ceil(n))
	else:
		print(math.ceil(n) + 1)


import sys
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	ans = 0
	c = 0
	i = 1
	f = False
	while c < n:
		c += i
		i += 1
		ans += 1
		if c == n:
			f = True
			break
	if f == True:
		print(ans)
		continue
	t = n - (c - i + 1)
	if ans - 1 > t:
		print(ans)
	else:
		print(ans + c - n)


for _ in range(int(input())):
	n = int(input())
	x = (1 + 8 * n) ** 0.5 - 1
	x = x / 2
	if int(x) == x:
		print(int(x))
	else:
		x = int(x) + 1
		ans = x * (x + 1)
		ans = ans // 2
		if ans - 1 == n:
			print(x + 1)
		else:
			print(x)


t = int(input())
for i in range(t):
	x = int(input())
	res = 0
	curr = 0
	count = 0
	while res < x:
		curr += 1
		res += curr
		count += 1
	if res - 1 == x:
		print(count + 1)
	else:
		print(count)


import math

def f(k):
	n = round(math.sqrt(2 * k))
	if n * (n + 1) // 2 == k + 1:
		n += 1
	return n
for _ in range(int(input())):
	print(f(int(input())))


import math
t = int(input())
for _ in range(t):
	x = int(input())
	step = int(math.sqrt(x * 2))
	ans = 0
	for k in range(5):
		if (step + k) * (step + k + 1) // 2 - x > 1 or (step + k) * (step + k + 1) // 2 == x:
			ans = step + k
			break
	print(ans)


for j in range(int(input())):
	a = int(input())
	(i, sum) = (1, 0)
	for i in range(1, a + 1):
		sum += i
		if sum >= a:
			break
	if a != sum - 1:
		print(i)
	else:
		print(i + 1)


t = int(input())
d = [1]
for i in range(1, 3000):
	d.append(d[i - 1] + i + 1)
n = len(d) - 1
for _ in range(t):
	x = int(input())
	if x > 3:
		l = 0
		r = n
		while l < r:
			m = l + (r - l) // 2
			if d[m] <= x:
				l = m + 1
				if d[m] == x:
					upper = m
				if l < len(d) and d[l] == x:
					upper = l
			else:
				r = m
		if d[l - 1] == x:
			print(l)
		elif d[l] - 1 == x:
			print(l + 2)
		else:
			print(l + 1)
	elif x == 1:
		print(1)
	elif x == 2:
		print(3)
	elif x == 3:
		print(2)


import math

def f(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	x = int(input())
	tmp = ((8 * x + 1) ** 0.5 - 1) / 2
	minK = math.ceil(tmp)
	lastK = math.floor(tmp)
	res = f(minK)
	needToRemove = res - x
	if needToRemove == 0:
		print(minK)
	elif needToRemove == 1:
		print(minK + 1)
	elif needToRemove <= lastK + 1:
		print(minK)
	else:
		print('this shouldnt happen', minK)


from math import ceil
t = int(input())

def main(x):
	if x < 1:
		return -x
	D = 1 + 8 * x
	n = (D ** 0.5 - 1) / 2
	n = ceil(n)
	y = n * (n + 1) // 2
	z = n * (n - 1) // 2
	if x == y - 1:
		return n + 1
	else:
		return n
for _ in range(t):
	print(main(int(input())))


from math import *
for i in range(int(input())):
	x = int(input())
	n = (sqrt(1 + 8 * x) - 1) / 2
	if n % 1 == 0:
		print(int(n))
	elif ((int(n) + 1) ** 2 + (int(n) + 1)) / 2 - x == 1:
		print(int(n) + 2)
	else:
		print(int(n) + 1)


from math import ceil, floor, sqrt
for _ in range(int(input())):
	x = int(input())
	jumps = 0
	while jumps * (jumps + 1) < 2 * x:
		jumps += 1
	s = int(jumps * (jumps + 1) // 2)
	if s == x + 1:
		jumps += 1
	print(jumps)


import math

def jumps(x):
	start = math.floor(pow(x, 0.5))
	while 1:
		summ = start * (start + 1) / 2
		if summ >= x:
			break
		start += 1
	if summ - x == 1:
		start += 1
		return start
	else:
		return start
t = int(input())
for i in range(0, t):
	x = int(input())
	print(jumps(x))


import math
tri = [q * (q + 1) // 2 - 1 for q in range(1414)]
for _ in range(int(input())):
	x = int(input())
	if x in tri:
		print(math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2) + 1)
	else:
		print(math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2))


t = int(input())
for i in range(t):
	n = int(input())
	for j in range(n + 1):
		if j * (j + 1) // 2 >= n:
			if j * (j + 1) // 2 - 1 == n:
				print(j + 1)
			else:
				print(j)
			break


import math
t = int(input())
for i in range(t):
	x = int(input())
	k = math.ceil(((1 + 8 * x) ** 0.5 - 1) / 2)
	xx = k * (k + 1) // 2
	if xx - x == 1:
		print(k + 1)
	else:
		print(k)


for _ in range(int(input())):
	x = int(input())
	y = 0
	step = 1
	while y < x:
		y += step
		step += 1
	if y == x + 1:
		step += 1
	print(step - 1)


from math import sqrt, ceil
for I in range(int(input())):
	X = int(input())
	pos = ceil((-1 + sqrt(1 + 8 * X)) / 2)
	Last = pos * (pos + 1) // 2
	if Last == X or Last != X + 1:
		print(pos)
	else:
		print(pos + 1)


import math

def steps(x):
	d = 1 + 8 * x
	return (-1 + math.sqrt(d)) / 2

def x_by_k(k):
	return int((1 + k) * k / 2)

def is_replaceable_exists(k, delta_x):
	possible_replaceables = [item for item in range(1, k)]
	p = delta_x - 1
	if p in possible_replaceables:
		return True
	return False

def main():
	n = int(input())
	result = []
	for _ in range(n):
		target_x = int(input())
		k = steps(target_x)
		if k.is_integer():
			result.append(int(k))
		else:
			k = math.ceil(k)
			current_x = x_by_k(k)
			if is_replaceable_exists(k, current_x - target_x):
				result.append(k)
			else:
				result.append(k + current_x - target_x)
	for item in result:
		print(item)
main()


for _ in range(int(input())):
	n = int(input())
	i = 0
	x = 0
	y = 1
	while x < n:
		x += y
		y += 1
		i += 1
	diff = x - n
	if diff == 1:
		print(i + 1)
	else:
		print(i)


import math
for _ in range(int(input())):
	target = int(input())
	n = math.ceil((-1 + (1 + 8 * target) ** 0.5) / 2)
	if n * (n + 1) / 2 - target == 1:
		n += 1
	print(n)


for i in range(int(input())):
	x = int(input())
	ans = 1
	m = 0
	while m < x:
		m = m + ans
		ans += 1
	if m - x == 1:
		print(ans)
	else:
		print(ans - 1)


for _ in range(int(input())):
	n = int(input())
	c = s = 0
	f = False
	for i in range(1, 10 ** 6 + 1):
		if n == s:
			f = True
			break
		elif s > n:
			q = i
			break
		s += i
		c += 1
	if f:
		print(c)
	elif s - 1 - n == 0:
		print(c + 1)
	else:
		print(c)


def solution(num):
	(n, count) = get_num(num)
	if n - 1 == num:
		return count + 1
	return count

def get_num(num):
	i = 0
	count = 0
	while num - i > 0:
		i += count + 1
		count += 1
	return (i, count)
loop = int(input())
for i in range(loop):
	print(solution(int(input())))


from math import ceil, sqrt

def check(x):
	res = ceil((sqrt(1 + 8 * x) - 1) / 2)
	if res * (res + 1) / 2 - x == 1:
		return res + 1
	return res
for q in range(int(input())):
	x = int(input())
	print(check(x))


import math
t = int(input())
for i in range(t):
	y = int(input())
	x = int((math.sqrt(1 + 8 * y) - 1) // 2)
	if x * (x + 1) // 2 == y:
		print(x)
	elif (x + 1) * (x + 2) // 2 - y == 1:
		print(x + 2)
	else:
		print(x + 1)


import math
for i in range(int(input())):
	n = int(input())
	s = math.ceil((math.sqrt(1 + 8 * n) - 1) / 2)
	if (s + 1) * s // 2 == n:
		print(s)
	elif s * (s + 1) // 2 - n == 1:
		print(s + 1)
	elif s * (s + 1) // 2 - n > 1:
		print(s)


t = int(input())

def solve():
	x = int(input())

	def bs_right():
		left = -1
		right = 1000000000
		while right - left > 1:
			mid = (right + left) // 2
			s = (1 + mid) * mid // 2
			if s < x:
				left = mid
			else:
				right = mid
		return right
	first_case = bs_right()
	if (1 + first_case) * first_case // 2 - 1 == x:
		print(first_case + 1)
	else:
		print(first_case)
for i in range(t):
	solve()


def find(a):
	if a == 1:
		return 1
	if a == 2:
		return 3
	si = 1
	ei = a
	while si < ei:
		n = (si + ei) // 2
		mid = n * (n + 1) // 2
		if mid == a:
			return n
		if mid - 1 == a:
			return n + 1
		if mid > a:
			ei = n
		else:
			si = n + 1
	qq = si * (si + 1) // 2
	if qq < a:
		return si + 1
	return si
t = int(input())
for _ in range(t):
	a = int(input())
	print(find(a))


def read_int():
	return int(input())
t = read_int()
for case_num in range(t):
	x = read_int()
	lo = 1
	hi = x
	found = False
	while lo <= hi:
		mid = lo + hi >> 1
		dist = mid * (mid + 1) // 2
		if dist == x:
			found = True
			print(mid)
			break
		if dist < x:
			lo = mid + 1
		else:
			hi = mid - 1
	if not found:
		if lo * (lo + 1) // 2 - x >= 2:
			print(lo)
		else:
			print(lo + 1)


import math

def find_num(num):
	num = int(num)
	closest = math.ceil((math.sqrt(8 * num + 1) - 1) / 2)
	sum_all = int((1 + closest) * closest / 2)
	if sum_all == num:
		return closest
	elif sum_all - num == 1:
		return closest + 1
	else:
		return closest
for i in range(int(input())):
	print(str(find_num(input())))


for _ in range(int(input())):
	given_num = int(input())
	mx_num = int((2 * given_num) ** 0.5)
	while mx_num * (mx_num + 1) // 2 < given_num:
		mx_num += 1
	extra_travelled = mx_num * (mx_num + 1) // 2 - given_num
	stepList = [i for i in range(1, mx_num + 1)]
	if extra_travelled == 1:
		print(mx_num + 1)
	else:
		print(mx_num)


import math
for _ in range(int(input())):
	n = int(input())
	k = 2 * n
	k = int(math.sqrt(k))
	for i in range(k - 2, k + 2):
		m = i * (i + 1) // 2
		if m == n:
			ans = i
			break
		if m > n:
			if m - n == 1:
				ans = i + 1
			else:
				ans = i
			break
	print(ans)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
from bisect import bisect_left
mx = 10 ** 6 + 5
s = 0
ss = []
for i in range(mx):
	s += i
	ss.append(s)
	if ss[-1] > mx:
		break
for _ in range(II()):
	x = II()
	i = bisect_left(ss, x)
	if ss[i] == x + 1:
		print(i + 1)
	else:
		print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(4002):
		if i * (i + 1) // 2 >= n:
			flag = i
			break
	if flag * (flag + 1) // 2 == n:
		print(flag)
	elif flag * (flag + 1) // 2 == n + 1:
		print(flag + 1)
	else:
		print(flag)