Problem:


Score : 200 points

Problem Statement

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 1

6

Sample Output 1

3

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

Sample Input 2

2

Sample Output 2

2

He can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.

Sample Input 3

11

Sample Output 3

5



Sample input:
6


Sample output:
3

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/24
Solved on 2019/3/
@author: shinjisu
"""


# ABC 056 C - Go Home
def getInt(): return int(input())
def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替
class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    X = getInt()
    d.dmp((X), 'X')
    pos = [0]
    for i in range(1, 10*9+1):
        nextPos = []
        for a in pos:
            nextPos.append(a-i)
            nextPos.append(a)
            nextPos.append(a+i)
        pos = nextPos
        #d.dmp((pos), 'pos')
        if X in pos:
            break
    return i


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  # 1,ans
    for elm in ans[1]:
        print(elm)
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
def f(i):
    return i*(i+1)/2

for i in range(1,10**10000000):
    if  f(i) >= X:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
def f(i):
    return i*(i+1)/2

for i in range(1,10**100000000000):
    if  f(i) >= X:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
def f(i):
    return i*(i+1)/2

for i in range(1,10**1000000000000000):
    if  f(i) >= X:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

X = int(input())

ans = float('inf')


def bfs(s, g):
    Q = [[s, 0]]

    while Q:
        p = Q.pop(0)
        time = p[1]
        cur = p[0]
        if abs(cur) > X:
            continue
        if cur == g:
            return time
        else:
            time += 1
            Q.append([cur+time, time])
            Q.append([cur-time, time])
            Q.append([cur, time])


print(bfs(0, X))

Submission status: Time Limit Exceeded

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

X = int(input())

ans = float('inf')


def bfs(s, g):
    Q = [[s, 0]]

    while Q:
        p = Q.pop(0)
        time = p[1]
        if p[0] == g:
            return time
        else:
            time += 1
            Q.append([p[0]+time, time])
            Q.append([p[0]-time, time])
            Q.append([p[0], time])


print(bfs(0, X))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
def bfs(position=[0],depth=1):
    queue = []
    for p in position:
        for dx in [-depth,0,depth]:
            nextp = p + dx
            if nextp == X:
                return depth
            queue.append(nextp)
    position = queue[:]
    if depth == 10**5:
        return depth
    return bfs(position,depth+1)
print(bfs())

Submission status: Time Limit Exceeded

Solution code:
int_x = int(input())

li_dist = list()
for i in range(1, int_x + 1):
    if len(li_dist) == 0:
        li_dist = [i, -i, 0]
    else:
        li_dist = [x + y for x in [i, -i, 0] for y in li_dist]

    if int_x in li_dist:
        print(i)
        exit(0)

Submission status: Time Limit Exceeded

Solution code:
import bisect
x = int(input())
a = [1]
s = 1
for i in range(2, x+1):
    s += i
    a.append(s)

if x in a:
    print(a.index(x) + 1)
    exit()

print(bisect.bisect_right(a, x)+1)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
a = [1]
s = 1
for i in range(2, x+1):
    s += i
    a.append(s)

if x in a:
    print(a.index(x) + 1)
    exit()

for i in a:
    if x < i:
        print(a.index(i)+1)
        break

Submission status: Time Limit Exceeded

Solution code:
from collections import  deque

x = int(input())

q = deque()
q.append((0, 0)) # (t, pos)
while q:
    t, pos = q.popleft()
#     print(t, pos)
    if pos == x:
        print(t)
        break
    else:
        q.append((t+1, pos))
        q.append((t+1, pos+t+1))
        if pos-t >= 1:
            q.append((t+1, pos-t-1))

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
A=[]
for i in range(1,X+1):
    A.append(i)
    if sum(A)>=X:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
X = int(input())

sumX = []
sum = 0
for i in range(1,X+1):
    sum += i
    sumX.append(sum)

# print(sumX)

for i in range(X):
    j = X - i 
    if X > sumX[j-1]:
        print(j+1)
        exit()

print(1)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = []

def move(x, T):
    for i in range(T, 0, -1):
        if x >= i:
            x -= i
    if x == 0:
        return T
        
    else:
        return 100000000

for i in range(1, 50000):
    ans.append(move(X, i))

print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = 100000000
def move(x, T):
    for i in range(T, 0, -1):
        if x >= i:
            x -= i
    if x == 0:
        return T
    else:
        return 100000000

for i in range(1, 50000):
    ans = min(ans, move(X, i))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = pow(10, 9)
for t in range(X + 1):
  if t*(t+1) / 2 >= X and t < ans:
    ans = t
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import Queue
t = int(input())

queue = Queue.Queue()
queue.put([0,0])
while True :
	x = queue.get()
	if x[0] == t:
		print x[1]
		break

	else :
		queue.put([ x[0]+x[1]+1 , x[1]+1 ])
		queue.put([ x[0] , x[1]+1])
		if x[0] - (x[1]+1) > 0 :
			queue.put([x[0]-(x[1]+1),x[1]+1])

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
res = []
for i in range(1, X + 1):
    res.append(i)
    if sum(res) == X:
        break
    elif X - sum(res) >= i + 1:
        continue
    else:
        t = (i + 1) - (X - sum(res))
        res[res.index(t)] = 0
print(len(res))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
a = [[]]
a[0].append(0)
n=0
flag = False
while(True):
    n+=1
    a.append([])
    for p in a[n-1]:
        a[n].append(p)
        a[n].append(p-n)
        a[n].append(p+n)
        if p==X or p-n==X or p+n==X:
            print(n)
            flag = True
            break
    if flag:
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
pos = [0]

for i in range(1,X+1):
	tmp = []
	for j in pos:
		tmp.append(j + i)
		if j + i ==  X:
			print(i)
			exit(0)

	pos.extend(tmp)
	pos = list(set(pos))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = []
def f(n, l):
  for i in range(1, n+1):
    sum = 0
    l.append(i)
    for j in range(len(l), 0, -1):
      if not sum + l[j-1] > n:
        sum += l[j-1]
      
      if sum == n:
        return i

print(f(n, l))

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
i = 1
while True:
    bef = sum(range(1,i))
    i += 1
    aft = sum(range(1,i))
    if bef < num <= aft:
        print(i-1)
        break

Submission status: Time Limit Exceeded

Solution code:
import queue
q = queue.Queue()
x = int(input())


start_position = 0
start_time = 0


def k():
    while q.not_empty:
        position, time = q.get()
        if position == x:
            return time
        else:
            q.put((position - (time + 1), time + 1))
            q.put((position + (time + 1), time + 1))
            q.put((position, time + 1))


q.put((start_position, start_time))

print(k())

Submission status: Time Limit Exceeded

Solution code:
import queue

if __name__ == "__main__":
    X = int(input())
    q = queue.Queue()
    qq = queue.Queue()
    q.put((0, 0))
    while True:
        x, t = q.get()
        if x == X :
            print(t)
            break
        t += 1
        q.put((x, t))
        q.put((x+t, t))
        q.put((x-t, t))

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

n = int(raw_input())
q = deque()
q.append((n,0))
idx = 0

while True:
    target, layer = q.popleft()
    if target - (layer+1) == 0:
        break
    q.append((target - (layer+1), layer+1))
    q.append((target, layer+1))

    if layer > 44721:
        print "error"
        break
print layer+1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
P = {0}
i=1
while True:
    Q = {0}
    for p in P:
        Q.add(p+i)
        Q.add(p-i)
    P = P.union(Q)
    if X in P:
        print(i)
        break
    i = i+1

Submission status: Time Limit Exceeded

Solution code:
X = map(int,input().split())
#X=7
P = {0}
i=1
while True:
    Q = {0}
    for p in P:
        Q.add(p+i)
        Q.add(p-i)
    P = P.union(Q)
    if X in P:
        print(i)
        break
    i = i+1

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

x = int(input())
i, pos = 0, set([0])

while True:
    inner = False
    new_pos = set()
    for p in pos:
        if p + i == x or p - i == x:
            inner = True
            break
        new_pos.add(p)
        new_pos.add(p + i)
        new_pos.add(p - i)

    if inner:
        print(i)
        break

    pos = new_pos
    i += 1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
s = t = 0
while s < X:
    s = 0
    t += 1
    for i in range(t+1):
        s += i
print(t)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

import itertools

def main():
    X = int(raw_input())
    jumpTime = [ i for i in xrange(1,X+1) ]
    candidate = []
    for i in xrange(1, len(jumpTime)+1):
       candidate.append(list(itertools.combinations(jumpTime, i)))
    correct = []
    for can in candidate:
        for c in can:
            if sum(c) == X:
                correct.append(c)
    correctMax = map(max, correct)
    print min(correctMax)
        

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

def sum(a):
    x = 0
    for i in range(a+1):
        x += i
    return x

for i in range(1,X+1):
    if sum(i)>= X:
        result = i
        break

print(result)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
 
dx =[0, 1]
 
l = [0]
i = 0
 
while(n not in l):
    i += 1
    l = list(set(l))
    for j in range(len(l)):
        a = l[0]
        l.remove(l[0])
        for k in range(2):
            l.append(a + dx[k]*i)
 
 
print(i)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
 
dx =[-1, 0, 1]
 
l = [0]
i = 0
 
while(n not in l):
    i += 1
    l = list(set(l))
    for j in range(len(l)):
        a = l[0]
        l.remove(l[0])
        for k in range(3):
            l.append(a + dx[k]*i)
 
 
print(i)

Submission status: Time Limit Exceeded

Solution code:
def main():
    X = int(raw_input())

    for time in xrange(1, 10**9):
        place = 0

        for i in range(time):
            place += (i + 1)

        if place == X:
            print time
            return
        elif X < place:

            plan = [1] * time

            flag = True
            while flag:
                # decrease 3 bit
                for i in range(len(plan)):
                    if plan[i] != -1:
                        plan[i] -= 1
                        break
                    else:
                        plan[i] = 1
                    if i == len(plan) - 1:
                        flag = False

                if flag:
                    place = 0
                    for i in range(time):
                        place += plan[i] * (i + 1)
                    if place == X:
                        print time
                        return

main()

Submission status: Time Limit Exceeded

Solution code:
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline




def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func()
    top_str = input_raw.strip().split()
    [X] = [int(top_str[0])]
    #jump(0, 0, 0, X)
    pos_list =[0]
    visited_set = set([0])
    directions = [-1, 0, 1]
    i = 0;
    while X not in pos_list:
        i += 1
        new_pos_list =set([])
        for now_pos in pos_list:
            for direct in directions:
                new_pos = now_pos + i * direct
                #if abs(new_pos - X) <= abs(now_pos - X):
                if new_pos not in visited_set or direct == 0:
                        visited_set.add(now_pos + i * direct)
                        new_pos_list.add(now_pos + i * direct)
        pos_list = set(new_pos_list)


    print i




if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

dx =[-1, 0, 1]

l = [0]
i = 0

while True:
    for x in l:
        if x == n:
            break
    for j in range(len(l)):
        a = l[0]
        l.pop(l[0])
        for k in range(3):
            l.append(a + dx[k]*(i+1))


print(i)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

a = int(raw_input())

result = 0

def conv(x, n):
    if x < 0: return None
    if n < 2 or 16 < n: return None

    if x == 0: return 0

    nchar = '0123456789ABCDEF'
    digit = 0

    result = ''

    while x > 0:
        result = nchar[x % n] + result
        x = x / n

    return result

def get_data(num):
    l = []
    result = []
    for n in range(1,num+1):
        l.append([-n, 0, n])
    for i in range(0, 3**num):
        hen = str(conv(i, 3))
        while len(hen) < num:
            hen = '0' + hen
        r = 0
        for j in range(0,num):
            s = hen[j]
            r += int(l[j][int(hen[j])])
        result.append(r)
    return list(set(result))

rrrr = 0
tmp = a
aaa = 1
while 1:
    tmp = tmp/aaa
    if tmp<=1:
        break
    aaa += 1
        
i = aaa
while 1:
    if a in get_data(i):
        rrrr = i
        break
    i += 1



# 出力
print rrrr

Submission status: Time Limit Exceeded

Solution code:
def main():
    X = int(raw_input())

    for time in xrange(1, 10**9):
        place = 0

        for i in range(time):
            place += (i + 1)

        if place == X:
            print time
            return
        elif X < place:

            plan = [1] * time

            flag = True
            while flag:
                # decrease 3 bit
                for i in range(len(plan)):
                    if plan[i] != -1:
                        plan[i] -= 1
                        break
                    else:
                        plan[i] = 1
                    if i == len(plan) - 1:
                        flag = False

                if flag:
                    place = 0
                    for i in range(time):
                        place += plan[i] * (i + 1)
                    if place == X:
                        print time
                        return
                    elif place < X:
                        flag = False


main()

Submission status: Time Limit Exceeded

Solution code:
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

g_end_flag = False
g_result = 0


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func()
    top_str = input_raw.strip().split()
    [X] = [int(top_str[0])]
    #jump(0, 0, 0, X)
    pos_list =[0]
    directions = [-1, 0, 1]
    i = 0;
    while X not in pos_list:
        i += 1
        new_pos_list =set([])
        for now_pos in pos_list:
            for direct in directions:
                #if (now_pos + i * direct) not in new_pos_list:
                new_pos_list.add(now_pos + i * direct)
        pos_list = list(new_pos_list)


    print i




if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
L = [sum(range(i+1)) for i in range(X+1) if sum(range(i+1))<X]
print(len(L))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

n = x // 2
m = n // 2

while True:
    cur = n * (n + 1) // 2
    if cur - n < x <= cur:
        print(n)
        break
    if cur < n:
        n += m
        m //= 2
    else:
        n -= m
        m //= 2

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

a = int(raw_input())

result = 0

def conv(x, n):
    if x < 0: return None
    if n < 2 or 16 < n: return None

    if x == 0: return 0

    nchar = '0123456789ABCDEF'
    digit = 0

    result = ''

    while x > 0:
        result = nchar[x % n] + result
        x = x / n

    return result

def get_data(num):
    l = []
    result = []
    for n in range(1,num+1):
        l.append([-n, 0, n])
    for i in range(0, 3**num):
        hen = str(conv(i, 3))
        while len(hen) < num:
            hen = '0' + hen
        r = 0
        for j in range(0,num):
            s = hen[j]
            r += int(l[j][int(hen[j])])
        result.append(r)
    return list(set(result))

rrrr = 0
i = 1
while 1:
    if a in get_data(i):
        rrrr = i
        break
    i += 1



# 出力
print rrrr

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
time = 0
while True:
    if sum(range(time+1)) >= X:
        break
    time+=1
print(time)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
dist = [0]
prev_dist = [0]
time = 0
while not X in dist:
    time += 1
    for i in prev_dist:
        if not i+time in dist: dist.append(i+time)
        if not i-time in dist: dist.append(i-time)
    prev_dist = dist[:]
print(time)

Submission status: Memory Limit Exceeded

Solution code:
import bisect
x=int(input())
l=[(i*(i+1))//2 for i in range(10000000)]
print(bisect.bisect_left(l,x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 15:44:49 2020

@author: liang
"""

X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
for i in range(1,10**5):
  now=(i*(i+1))//2
  if now==x:
    print(i)
    break

  if x<now:
    print(i)
    break

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
A = 0
for i in range(1, 100000):
  A += i
  if X <= A:
    print(i)
    break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

cnt = 0
s = 0
for i in range(1, X+1):
  cnt += 1
  s += i
  if s >= X:
    break

print(cnt)

Submission status: Accepted

Solution code:
x = int(input())

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

print(i)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
x = int(input())

i = 0

while True:
  tmp = int((i*(i+1))/2)
  if tmp >= x:
    print(i)
    exit()
  else:
    i += 1

Submission status: Accepted

Solution code:
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float('inf')
mod = 10**9 + 7

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse=False):
    data.sort(key=lambda x:x[col],reverse=revese)
    return data

def mymax(data):
    M = -1*float('inf')
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float('inf')
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def mydictvaluesort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[1] )

def mydictkeysort(dictionary):
    return sorted( dictionary.items(), key=lambda x:x[0] )

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(' ')
        elif type(ls[0])==str:
            print(' '.join(ls))
        elif type(ls[0])==int:
            print(' '.join(map(str,ls)))
        else:
            print('Output Error')
    else:
        if len(ls)==0:
            print('')
        elif type(ls[0])==str:
            print(''.join(ls))
        elif type(ls[0])==int:
            print(''.join(map(str,ls)))
        else:
            print('Output Error')

def I():
    return int(input())

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

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

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

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

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())


x = I()

n = ceil( ( -1 + sqrt(1+8*x) )/2 )
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
for i in range(1,10**5):
    if x<=(i*(i+1))//2:
        print(i)
        break

Submission status: Accepted

Solution code:
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):
    # print(L[i])
    if L[i] >= X:
        ans = i
        break


print(ans)

Submission status: Accepted

Solution code:
X = int(input())

l = 0
r = 10**9

while r-l>1:
    tmp = (l+r)//2
    if (tmp+1)*tmp//2 >= X:
        r = tmp
    else:
        l= tmp

print(r)

Submission status: Accepted

Solution code:
x=int(input())

num=0
cnt=0

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

Submission status: Accepted

Solution code:
X = int(input())

t = 0
Sum = 0
while Sum < X:
    t += 1
    Sum += t

print(t)

Submission status: Accepted

Solution code:
x = int(input())

rest = x

for i in range(1,x+1):
    if i < rest:
        rest -= i
    else:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
s=0
i=0
while s<x:
    i+=1
    s+=i

print(i)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
place = 0
i = 1

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
n = 1
while True:
    if n*(n+1)//2 >= X:
        print(n)
        break
    n +=1

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    dist = 0

    for i in range(1, N + 1):
        dist += i
        if dist >= N:
            print(i)
            exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

# 1, 2, 3, ... , nの総和がX以上ならば、
# 適当に保持をいれることでたどり着ける
# 総和の公式は(1 + n)*n//2

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# C - Go Home
def main():
    x = int(input())
    cnt = 0
    for i in range(x + 1):
        cnt += i
        if cnt >= x:
            print(i)
            exit()
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

import math as m

t = int(m.sqrt(X*2))
if t*(t+1)/2 < X:
  t += 1

print(t)