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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
cum = [0]*(10**5+10)
ans = None
for i in range(1, 10**5 + 1):
    cum[i] = cum[i-1] + i

for t in range(1, 10**5 + 1):
    if cum[t] >= X:
        ans = t
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
reached, ans = 0, 0
while reached < x:
    reached += ans
    if reached >= x:
        break
    ans += 1
    # print(reached, ans)
print(ans)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    x = i_input()
    l = [0]
    for i in range(1,10**6):
        l.append(l[i-1]+i)

    for i,k in enumerate(l):
        if x <= k:
            print(i)
            exit()


if __name__=="__main__":
    main()

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

Submission status: Accepted

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

print(solve())

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:
#43 C - Go Home
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)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	x = int(input())
	#b , c = tin()
	#s = input()	
	s=0
	for i in range(mod):
		s+=i
		if s >= x:
			return i
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

X = INT()
i = 1
place = 0

while place < X:
    place += i
    i += 1

ans = i - 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Created on 2020/08/28

@author: harurun
'''
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()

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    x = I()
    ans = 0
    cnt = 0

    while cnt<x:
        ans += 1
        cnt += ans

    print(ans)
    
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
sum,cnt=0,0
while sum<=10**9:
  cnt+=1
  if sum<x<=sum+cnt:
    print(cnt)
    break
  sum+=cnt

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

s = 1
i = 1
while s < x:
    i += 1
    s += i

print(i)

Submission status: Accepted

Solution code:
X=int(input())
ct=1
sum=1
while X>sum:
  ct+=1
  sum+=ct
print(ct)

Submission status: Accepted

Solution code:
X = int(input())
x = 0
time = 0
while x < X:
    time += 1
    x += time
print(time)

Submission status: Accepted

Solution code:
import math
x = int(input())

cnt = 0
while x > 0:
    cnt += 1
    x -= cnt
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans = 0
Ans = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	n=II()
	for i in range(10**10):
		if (i*(i+1))//2>=n:
			print(i)
			exit()




if __name__ == "__main__":
	main()

Submission status: Accepted

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

X = INT()

A = []
tmp = 0
for i in range(1, X+1):
    tmp += i
    A.append(tmp)
    if tmp >= X:
        print(i)
        break

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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 fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()

A = []
for i in range(1, 2 * (int(sqrt(X))+1)):
    a =  i * (i + 1) // 2
    # print(a)
    if a <= X:
        A.append(a)
    else:
        ans = len(A)
        mi = A.pop()
        ma = a
        break
# print(mi, ma)
# print(ans)
if mi == X:
    print(ans)
else:
    print(ans+1)

Submission status: Accepted

Solution code:
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 map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return 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))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x = I()
t = 0
while (t*(t+1))/2 < x:
    t += 1
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


def binary_search(n) -> int:
    target = n * 2
    left, right = 0, target
    while right - left != 1:
        mid = (left + right) // 2
        if mid * mid + mid < target:
            left = mid
        elif mid * mid + mid > target:
            right = mid
        elif mid * mid + mid == target:
            return mid
    return right


print(binary_search(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

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())
for i in range(10**6):
    if i*(i+1)//2 >= x:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
target = int(raw_input())
t = 0
while(target):
	target -= min(target, t + 1)
	t +=1
print t

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import ceil
def input(): return sys.stdin.readline().strip()

def main():
    X = int(input())
    val = (1 + 8 * X) ** 0.5 - 1
    print(ceil(val / 2))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt
x = int(input())

print(int(-(-(-1+sqrt(1+8*x))//2)))

Submission status: Accepted

Solution code:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-08-17 15:42
# @url:https://atcoder.jp/contests/abc056/tasks/arc070_a
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

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 main():
    x=int(input())
    ans=math.ceil((math.sqrt(8*x+1)-1)/2)
    print (ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())
#階差数列
y,i=1,1
while y<x:
  i+=1
  y+=i
print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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())
ans=0
while True:
    if ans*(ans+1)/2 >= x:
        print(ans)
        break
    ans+=1

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return 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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
i = 0

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

Submission status: Accepted

Solution code:
import math

def goukei(n):
    return int(n*(n+1)/2)

x = int(input())
tmp = int(math.sqrt(2 * x))
#print(tmp,goukei(tmp))
while goukei(tmp)<x:
    tmp += 1

print(tmp)

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:
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

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

Submission status: Accepted

Solution code:
X=int(input())

number=0
for n in range(1,pow(10,8)):
    number+=n
    if number>=X:
        break
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
X=int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

time = 0
pos = 0
while pos < X:
    time += 1
    pos += time

print(time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

if X in (1, 2):
    print(X)
    exit()

for i in range(2, 10**5):
    a = i * (i+1) / 2
    if a - (i-1) <= X <= a:
        print(i)
        exit()

Submission status: Accepted

Solution code:
X=int(input())
for i in range(int((2*X)**0.5)-2,10**9):
  if 2*X<=i*(i+1):
    print(i)
    break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
X=int(input())

tmp = 0

for i in range(1,X+1):
    tmp = tmp+i
    if X <= tmp:
        print(i)
        sys.exit()

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

x = inint()

ans = 0

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import math

x = int(input())

y = int(math.sqrt(2*x))
for i in range(y+1, 0, -1):
    if i * (i + 1) < 2 * x:
        print(i + 1)
        break

if x == 1:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
  X = int(input())
  ans = 0
  cnt = 0
  while cnt<X:
    ans += 1
    cnt += ans
  return ans
print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
cnt = 0
while x>0:
  cnt += 1
  x = max(0,x-cnt)
print(x+cnt)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())
fac = {}
fac[0] = 0
for i in range(1, 50000):
    fac[i] = fac[i-1]+i
    if fac[i]>=10**9:
        break

for i in range(1, 50000):
    f = fac[i]
    if f>=X:
        print(i)
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-07-31 13:48:14 +0900
# LastModified: 2020-07-31 14:24:21 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd
from math import sqrt


def main():
    X = abs(int(input()))
    s = (-1+sqrt(1+8*X))/2
    if s.is_integer():
        s = int(s)
    else:
        s = int(s) + 1
    print(s)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)

def calcTime(x,n=0):
  if n*(n+1)//2 >= x:
    return n
  else:
    return calcTime(x,n+1)

x = int(input())
print(calcTime(x))

Submission status: Accepted

Solution code:
def calcTime(x):
  n = 0
  while True:
    if n*(n+1)//2 > x:
   	  return n
    elif n*(n+1)//2 == x:
      return n
    else:
      n += 1

x = int(input())
ans = calcTime(x)
print(ans)

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:
import math

X = int(input())

x = max(0, int(math.sqrt(X)) - 10)

while True:
    xx = x * (x + 1) // 2
    if X <= xx:
        print(x)
        exit()
    else:
        x += 1

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


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


def solve():
    """
    X+i+(i+1)+(i+2)+..
    
    X < n*(n+1)//2

    n*(n+1)//2-(n-1)*n//2 > n ?
    n//2(2) > n ? false
    """
    X = read_int()
    if X == 1:
        return 1
    low, high = 1, 10**9
    while high-low > 1:
        mid = low+(high-low)//2
        if mid*(mid+1)//2 >= X:
            high = mid
        else:
            low = mid
    if high*(high+1)//2 == X:
        return high
    return high


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x = int(input())
a = int((x * 2)**0.5)
while a * (a + 1) // 2 > x:
    a -= 1
print(a + (a * (a + 1) // 2 != x))

Submission status: Accepted

Solution code:
x = int(input())

s = 0
i = 1
while True:
    s += i
    if s >= x:
        print(i)
        break
    i += 1

Submission status: Accepted

Solution code:
x = int(input())
'''
t =  1, 2, 3, 4, 5, 6,...
d+ = 1, 3, 6,10,15,21,...
x = 11のとき、
t = 5,d+ = 15より、t = 4で一回休みすればいい
-> 行き過ぎたら一回休み
'''
i = 0
d = 0
while True:
    i += 1
    d += i
    if x <= d:
        ans = i
        break
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
for i in range(int((2 * X)**0.5) - 2, 10**9):
  if 2 * X <= i * (i + 1):
    print(i)
    break

Submission status: Accepted

Solution code:
import math
x = int(input())
abs_x = abs(x)

num = 0
i = 1
while abs_x > num:
  num += i
  i += 1
print(i - 1)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    X = int(readline())

    for i in range(X + 1):
        if i * (i + 1) // 2 >= X:
            ans = i
            break

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# でました 「最大（この問題の場合は毎回右に移動する）で移動したとき、今より前の地点は、『今まで動いたiのいずれかを省く』ことで到達してたことにできる」というやつ（わかりにくい
# なので、xに到達した時点でそれまでの値はすべて実現可能という感じ

from math import ceil
x = int(input())
tmp = 0
for i in range(x + 1):
    tmp += i
    if tmp >= x:
        print(i)
        exit()

print("うんち！")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
ans = -1
c = 0
for i in range(1, 10**6):
    c += i
    if 0 <= c - X <= i:
        ans = i
        break
print(ans)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

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

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    X = ii()
    s = 0
    i = 1
    while s < X:
        s += i
        i += 1
    print(i-1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def main():
    X=int(input())
    s=0
    i=0
    while s<X:
        i+=1
        s+=i
    print(i)
if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

K=0
while (K*(K+1))//2<X:
    K+=1
print(K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
t = 1
for t in range(1,X+1):
  total = t*(t+1)/2
  if total>=X:
    break
print(t)

Submission status: Accepted

Solution code:
X = int(input())
a = 0
d = 0

while d<X:
  a+=1
  d+=a

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans=0
l_befor=0
for n in range(10**7):
    l_befor = n+l_befor
    if l_befor >= X:
        ans=n
        break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
i = 1
while N>0:
  N -= i
  i += 1
print(i-1)

Submission status: Accepted

Solution code:
X = int(input())
i = 0
k = 0
while k < X:
    i += 1
    k += i
print(i)

Submission status: Accepted

Solution code:
X = int(input())
count = 0
step = 0
while X > step:
    count += 1
    step += count
print(count)

Submission status: Accepted

Solution code:
x = int(input())

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