There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.
During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.
That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.
The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.
Find the earliest possible time to reach coordinate X.

-----Constraints-----
 - X is an integer.
 - 1≤X≤10^9

-----Input-----
The input is given from Standard Input in the following format:
X

-----Output-----
Print the earliest possible time for the kangaroo to reach coordinate X.

-----Sample Input-----
6

-----Sample Output-----
3

The kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.

Difficulty: EASY

Solutions:
x = int(input())
ans = 0
a = 0
for i in range(1, x + 1):
	a += i
	ans += 1
	if a >= x:
		print(ans)
		break


import math
x = int(input())
ans = math.ceil((-1 + math.sqrt(8 * x + 1)) / 2)
print(ans)


x = int(input())
t = 0
while t * (t + 1) // 2 < x:
	t += 1
print(t)


import math
x = int(input())
cnt = 0
while x > 0:
	cnt += 1
	x -= cnt
print(cnt)


def main():
	import sys
	pin = sys.stdin.readline
	pout = sys.stdout.write
	perr = sys.stderr.write
	X = int(pin())
	i = 1
	while i <= X:
		if i * (i + 1) >= 2 * X:
			print(i)
			return
		i += 1
	return
main()


x = int(input())
cur = 0
for i in range(0, 45000):
	cur += i
	if x <= cur:
		print(i)
		break


X = int(input())
N = 1
while N * (N + 1) // 2 < X:
	N += 1
print(N)


def solve():
	X = int(input())
	now = 0
	for i in range(X + 1):
		now += i
		if now >= X:
			return i
print(solve())


x = int(input())
ub = 10 ** 9
lb = 0
while ub - lb > 1:
	mid = (lb + ub) // 2
	if mid * (mid + 1) // 2 >= x:
		ub = mid
	else:
		lb = mid
print(ub)


x = int(input())
s = 0
for i in range(1, x + 1):
	s += i
	if s >= x:
		print(i)
		return


x = int(input())
cnt = 0
s = 0
for i in range(1, x + 1):
	cnt += 1
	s += i
	if s >= x:
		break
print(cnt)


X = int(input())
sum_i = 0
for i in range(1, 10 ** 5):
	sum_i += i
	if sum_i >= X:
		ans = i
		break
print(ans)


x = int(input())
ans = 0
while True:
	if ans * (ans + 1) / 2 >= x:
		print(ans)
		break
	ans += 1


x = int(input())
res = 0
i = 1
while res < x:
	res += i
	i += 1
print(i - 1)


import math
X = int(input())
ruto = math.ceil(math.sqrt(2 * X)) + 1
kari = ruto ** 2 + ruto
ans = 1
for i in range(ruto - 1, 0, -1):
	if i ** 2 + i < 2 * X:
		ans = i + 1
		break
	kari = i ** 2 + i
print(ans)


ma = lambda : map(int, input().split())
lma = lambda : list(map(int, input().split()))
tma = lambda : tuple(map(int, input().split()))
ni = lambda : int(input())
yn = lambda fl: print('Yes') if fl else print('No')
import collections
import math
import itertools
import heapq as hq
x = ni()
tmp = 0
for i in range(1, 10 ** 9):
	tmp += i
	if tmp >= x:
		break
print(i)


n = int(input())
ans = 0
Ans = 1
while ans < n:
	ans += Ans
	Ans += 1
print(Ans - 1)


X = int(input())
from itertools import count
for t in count(1, 1):
	if (t - 1) * t >= 2 * (X - t):
		print(t)
		break


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


X = int(input())
t = 0
Sum = 0
while Sum < X:
	t += 1
	Sum += t
print(t)


x = int(input())
ans = int((x * 2) ** 0.5)
while 1:
	if ans * (ans + 1) // 2 >= x:
		print(ans)
		break
	ans += 1


x = int(input())
i = 1
tmp = 0
while tmp < x:
	tmp += i
	i += 1
print(i - 1)


x = int(input())
t = 0
while True:
	if not t * (t + 1) / 2 >= x:
		t += 1
	else:
		break
print(t)


x = int(input())
place = 0
i = 1
while 1:
	if place + i >= x:
		print(i)
		break
	else:
		place += i
		i += 1


x = int(input())
i = 1
while i * (i + 1) // 2 < x:
	i += 1
print(i)


X = int(input())
t = int((2 * X) ** 0.5) + 1
ans = 0
for i in range(t, 0, -1):
	if X <= i * (i + 1) / 2:
		ans = i
	else:
		break
print(ans)


x = int(input())
n = 1
while n * (n + 1) // 2 < x:
	n += 1
print(n)


X = int(input())
L = [0]
for i in range(1, 10 ** 5):
	L.append(L[i - 1] + i)
ans = 0
for i in range(1, X + 1):
	if L[i] >= X:
		ans = i
		break
print(ans)


x = int(input())
ok = x
ng = -1
while ok - ng > 1:
	mid = (ok + ng) // 2
	if mid * (mid + 1) // 2 >= x:
		ok = mid
	else:
		ng = mid
print(ok)


from math import floor
X = int(input())
for n in range(1, floor(X / 2) + 2):
	if n * (n + 1) // 2 >= X:
		ans = n
		break
print(ans)


import math
X = int(input())
P = math.ceil((-1 + (1 + 8 * X) ** (1 / 2)) / 2)
print(P)


import sys
stdin = sys.stdin

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

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

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

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

def main():
	x = ni()
	d = 0
	for i in range(1, x + 1):
		d += i
		if d >= x:
			print(i)
			return

def __starting_point():
	main()
__starting_point()


def get_index(n):
	i = 1
	while True:
		if n <= piramid(i):
			return i - 1
		i += 1

def piramid(n):
	return n * (n + 1) // 2
n = int(input())
index = get_index(n)
print(index + 1)


x = int(input())
(ans, k, i) = (0, 1, 0)
while 1:
	ans += k
	if ans >= x:
		break
	k += 1
print(k)


import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop
INPUT = lambda : sys.stdin.readline().rstrip()
INT = lambda : int(INPUT())
MAP = lambda : map(int, INPUT().split())
S_MAP = lambda : map(str, INPUT().split())
LIST = lambda : list(map(int, INPUT().split()))
S_LIST = lambda : list(map(str, INPUT().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	X = INT()
	i = 1
	ans = 0
	while 1:
		X -= i
		ans += 1
		if X <= 0:
			break
		i += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
tmp = 0
for i in range(1, n + 1):
	tmp += i
	if tmp >= n:
		print(i)
		break


X = int(input())
import math as m
t = int(m.sqrt(X * 2))
if t * (t + 1) / 2 < X:
	t += 1
print(t)


N = int(input())
for i in range(1, N // 2 + 10):
	tmp = (i + 1) * i // 2
	if N - tmp == 0:
		print(i)
		return
	if N - tmp < i + 1:
		print(i + 1)
		return


x = int(input())
ans = 0
for t in range(10 ** 9):
	if t * (1 + t) // 2 >= x:
		ans = t
		break
print(ans)


x = int(input())
i = 1
while True:
	if (i + 1) * i // 2 >= x:
		print(i)
		break
	i += 1


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


i = 1
import copy
X = int(input())
s = 0
while True:
	s += copy.copy(i)
	if s >= X:
		print(i)
		return
	i += 1


X = int(input())
i = 0
while i <= X:
	c = i * (i + 1) / 2
	if c >= X:
		print(i)
		break
	i += 1


X = int(input())
X2 = X * 2
k = 1
while True:
	if k * (k + 1) >= X2:
		print(k)
		return
	k += 1


x = int(input())
cnt = 0
i = 0
while i < x:
	i += cnt
	cnt += 1
print(cnt - 1)


import math
x = int(input())
i = math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2)
print(i)


X = int(input())
a = 0
b = 1
while a < X:
	a += b
	b += 1
print(b - 1)


x = int(input())
sum = 0
for i in range(1, 100000):
	sum += i
	if sum >= x:
		print(i)
		break


def main():
	x = int(input())
	n = 0
	i = 1
	while n < x:
		n += i
		i += 1
	print(i - 1)

def __starting_point():
	main()
__starting_point()


x = int(input())
ans = 0
k = 0
t = 0
while k < x:
	k = t * (t + 1) / 2
	t += 1
ans = t - 1
print(ans)


x = int(input())
ans = 0
pos = 0
while pos < x:
	pos += ans + 1
	ans += 1
print(ans)


X = int(input())
for i in range(1, 100000):
	if X <= i * (i + 1) // 2:
		print(i)
		break


x = int(input())
t = 0
p = 0
while p < x:
	t += 1
	p += t
print(t)


def main():
	x = int(input())
	cnt = 0
	for i in range(x + 1):
		cnt += i
		if cnt >= x:
			print(i)
			return

def __starting_point():
	main()
__starting_point()


x = int(input())
ans = 0
while True:
	if (1 + ans) * ans // 2 >= x:
		print(ans)
		return
	ans += 1


import math

def goukei(n):
	return int(n * (n + 1) / 2)
x = int(input())
tmp = int(math.sqrt(2 * x))
while goukei(tmp) < x:
	tmp += 1
print(tmp)


x = int(input())
sn = 0
for i in range(1, 10 ** 5):
	sn = sn + i
	if sn >= x:
		print(i)
		break


X = int(input())
cnt = 0
dist = 0
while dist < X:
	cnt += 1
	dist += cnt
print(cnt)


x = int(input())
for n in range(1, x + 1):
	s = n * (n + 1) / 2
	if s >= x:
		print(n)
		return


X = int(input())

def sum_num(x):
	A = [0]
	counter = 0
	for i in range(1, 10 ** 7):
		counter += i
		A.append(counter)
		if A[-2] <= x <= counter:
			return A
print(len(sum_num(X)) - 1)


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

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

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

def X():
	return list(input())

def L():
	return list(input().split())

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

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 1
ans = 0
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
N = k()
for i in range(1, N + 1):
	if 2 * N <= (i + 1) * i:
		print(i)
		break


x = int(input())
for i in range(1000000000):
	if x <= i * (i + 1) / 2:
		print(i)
		return


X = int(input())
SUM = 0
for i in range(1, 10 ** 6):
	SUM += i
	if SUM >= X:
		print(i)
		return


N = int(input())
ans = 0
CN = 0
while CN < N:
	ans += 1
	CN += ans
print(ans)


import sys
X = int(input())
if not 1 <= X <= 10 ** 9:
	return
res = 0
count = 0
for I in range(1, X + 1):
	count += 1
	res += count
	if res >= X:
		print(count)
		return


x = int(input())
i = 1
cum = [0]
while cum[-1] < 10 ** 9:
	cum += [cum[-1] + i]
	i += 1
import bisect
index = bisect.bisect_left(cum, x)
print(index)


x = int(input())
max = 0
total = 0
for i in range(1, x + 1):
	total += i
	if total >= x:
		max = i
		break
print(max)


x = int(input())
ans = 0
while ans * (ans + 1) / 2 < x:
	ans += 1
print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
from decimal import *

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

def INT():
	return int(input())

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

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

def ZIP(n):
	return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
X = Decimal(INT())
print(((Decimal(-1) + (8 * X).sqrt()) / Decimal(2)).quantize(Decimal('0'), rounding=ROUND_CEILING))


x = int(input())
num = 0
cnt = 0
for i in range(1, 10 ** 9):
	num += i
	cnt += 1
	if num >= x:
		break
print(cnt)


N = int(input())
for i in range(1, 10 ** 5):
	if i * (i + 1) // 2 >= N:
		print(i)
		return


def main():
	x = int(input())
	answer = 0
	tmp = 0
	for i in range(10 ** 9):
		tmp += i
		if tmp >= x:
			answer = i
			break
	print(answer)

def __starting_point():
	main()
__starting_point()


import math
print(math.ceil((math.sqrt(1 + 8 * int(input())) - 1) / 2))


x = int(input())
ans = 0
i = 0
while True:
	i += 1
	x -= i
	ans += 1
	if x <= 0:
		break
print(ans)


from math import sqrt
x = int(input())
print(int(-(-(-1 + sqrt(1 + 8 * x)) // 2)))


X = int(input())
Cnt = 0
Sum = 0
while Sum < X:
	Cnt += 1
	Sum += Cnt
print(Cnt)


x = int(input())
ans = 0
res = 1
while ans < x:
	ans += res
	res += 1
print(res - 1)


s = int(input())
n = 1
s2 = 0
while True:
	s2 = n * (n + 1) // 2
	if s2 >= s:
		print(n)
		break
	else:
		n = n + 1


X = int(input())
ans = 0
tmp = 0
i = 1
while True:
	tmp += i
	if tmp >= X:
		print(i)
		break
	i += 1


x = int(input())
t = 0
c = 0
while True:
	if c >= x:
		break
	t += 1
	c += t
print(t)


X = int(input())
m = 0
ans = 0
for i in range(1, X + 1):
	if X <= m:
		break
	m += i
	ans += 1
print(ans)


import math
X = int(input())
n = math.ceil((math.sqrt(1 + 8 * X) - 1) / 2)
ans = n
print(ans)


X = int(input())
i = 0
cnt = 0
while cnt < X:
	cnt += i + 1
	i += 1
print(i)


x = int(input())
(y, i) = (1, 1)
while y < x:
	i += 1
	y += i
print(i)


X = int(input())
pos = 0
i = 0
while pos < X:
	i += 1
	pos += i
print(i)


X = int(input())
time = 0
pos = 0
while pos < X:
	time += 1
	pos += time
print(time)