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:
N=int(input())
ans=0
for i in range(1,N+1):
  if i*(i+1)//2>=N:
    ans=i
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)
n =ip()
s = 0
a = 0
while s<n:
    a+=1
    s+=a
print(a)

Submission status: Accepted

Solution code:
n = int(input())

tmp = 0

for i in range(n+1):
    tmp += i
    if tmp >= n:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc056/tasks/arc070_a
# C - Go Home
X = int(input().split()[0])
total = 0
for x in range(1, X+1):
    total += x
    if total >= X:
        break

ans = x

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import math

X = int(input())

i = math.ceil(np.sqrt(2*np.abs(X)+0.25)-0.5)

print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    for n in range(1, X+1):
        lower = (n-1)*n//2
        upper = n*(n+1)//2
        if lower < X <= upper:
            return n



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

Submission status: Accepted

Solution code:
# Go Home
S = int(input())
count = 0
for t in range(S):
    if (t*(t+1))/2 >= S:
        break
    else:
        count = count + 1

print(count)

Submission status: Accepted

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

n=(sqrt(8*x+1)-1)*0.5
n=ceil(n)

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
x=int(input())
a=1
for i in range(10**9):
  a+=i
  if a>x:
    print(i)
    sys.exit()

Submission status: Accepted

Solution code:
N = int(input())

acc = 0
for i in range(N+1):
    acc += i
    if acc >= N:
        print(i)
        exit()

Submission status: Accepted

Solution code:
from math import sqrt, floor, ceil


n = int(input())
if floor(sqrt(n * 2)) * ceil(sqrt(n * 2)) < n * 2:
    print(ceil(sqrt(n * 2)))
else:
    print(floor(sqrt(n * 2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

X = int(sys.stdin.readline())
print(int(math.ceil((-1 + math.sqrt(1 + 8 * X)) / 2)))

# ans = 0
# x = 1
# s = 0
# while s < X:
#     s += x
#     x += 1
# print(x - 1)
#

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

X = int(sys.stdin.readline())
ans = 0
x = 1
s = 0
while s < X:
    s += x
    x += 1
print(x - 1)

Submission status: Accepted

Solution code:
X = int(input())
N = int((- 1 + (1 + 8 * X)**0.5) / 2)
if X != N*(N+1)//2:
    print(N+1)
else:
    print(N)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(X: int):

    def isOK(m):
        return X <= m*(m+1)/2

    ng = -1
    ok = X

    while abs(ok - ng) > 1:
        mid = (ok + ng)//2
        if isOK(mid):
            ok = mid
        else:
            ng = mid
    print(ok)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    X=int(input())
    p = 0
    count = 0
    for i in range(1,X+1):
        count += 1
        p += i
        if p < X:
            continue
        else:
            break

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    X = inputInt()
    
    ans = 0
    total = 0
    for i in range(1,X+1):
        total += i
        if total >= X:
            ans = i
            break
            
    print(ans)
    
    
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    X = inputInt()
    
    ans = (math.sqrt(8*X+1)-1)/2
    
    print(int(math.ceil(ans)))
    
    
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
sums = 0
while sums < X:
    ans += 1
    sums += ans
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = X
for n in range(1, X):
    if n * (n + 1) >= 2 * X:
        ans = min(ans, n)
        break

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

i = 1
c = 1
while c<x:
    i+=1
    c+=i
if 1<x-c and x-c<=i:
    ans = i-1
else:
    ans = i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import collections
import itertools
import sys

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

x=getint()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
for i in range(0, 10**9):
  low = (i - 1 * (i)) / 2
  high = (i * (i + 1)) / 2
  if(low < x and x <= high):
    print(i)
    exit()

Submission status: Accepted

Solution code:
X = int(input())

cnt = 0
total = 0
i = 1
while True:
  total += i
  cnt += 1
  if total >= X:
    break
  i += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 56 C

def resolve():
    x = int(input())
    n = 1
    while True:
        if (n*(n+1))//2 >= x:
            break
        else:
            n += 1
    print(n)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X: int):
    print(math.ceil((math.sqrt(8*X+1)-1) / 2))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = abs(int(input()))

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

Submission status: Accepted

Solution code:
from sys import stdin
X = int(stdin.readline().rstrip())
ans = 0
while ans*(ans+1) < 2*X:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
sum_step = 0
cnt = 1
while True:
  sum_step += cnt
  if sum_step >= N:
    print(cnt)
    break
  cnt += 1

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    i = 1
    t = 0
    while X > t:
        t += i
        i += 1
    print(i - 1)


main()

Submission status: Accepted

Solution code:

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = [0]
c = 0
while True:
    c += 1
    k = A[-1] + c
    if k >= X:
        break
    A.append(k)

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#h,w
def main():
	x = int(input())
	s = 0
	i = 1
	while s<x:
		s += i
		i += 1
	print(i-1)


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:



def main():
    num = int(input())

    ans_ind = 1
    ans_sum = 0
    while ans_sum < num:
        ans_sum += ans_ind
        ans_ind += 1

    print(ans_ind - 1)







if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

x = int(input())

t = (-1+math.sqrt(8*x+1))/2

if t.is_integer():
    print(int(t))
else:
    print(int(t)+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LS()
    if a == b:
        print("H")
    else:
        print("D")
    return

#B
def B():
    w, a, b = LI()
    a, b = min(a, b), max(a, b)
    if w + a >= b:
        print(0)
        return
    print(b-a-w)
    return

#C
def C():
    n = II()
    x = 0
    for i in range(1, 10 ** 5):
        x += i
        if n <= x:
            print(i)
            return
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Accepted

Solution code:
x=int(input())
n=0
c=0
while 1:
  if(x<=n):
    print(c)
    exit()
  c+=1
  n+=c

Submission status: Accepted

Solution code:
def main():
    x=int(input())
    ans = max((-1+(1+8*x)**0.5)/2,(-1-(1+8*x)**0.5)/2)
    ans = -1*(ans//-1)
    print(int(ans))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

print(int(-(-(-1 + (1 + 8 * X) ** 0.5) // 2)))

Submission status: Accepted

Solution code:

X = int(input())

ans = 0
cnt = 0

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


print (cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(X: int):
    i = 1
    while i * (i + 1) // 2 < X:
        i += 1
    ret = i
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
for i in range(1,X+1):
    ans += i
    if ans >= X:
        print(i)
        exit()

Submission status: Accepted

Solution code:
x=int(input())
# import queue

# q = queue.Queue()

# q.put(0)
# q.put("")
i=0
now=0
while 1:
    i+=1
    now+=i
    if now>=x:
        print(i)
        break

Submission status: Accepted

Solution code:
x = int(input())
mv = 10**6
cnt = 0
for i in range(mv):
  cnt += i
  if cnt >= x:
    print(i)
    exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
y=int((x*2)**0.5)
yy=(y*(y+1))//2
while yy<x:
    y+=1
    yy+=y
print(y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
カンガルー
時刻iで長さiのジャンプをするx-i,x,x+i
0からスタートして、座標Xにつくまでの時間
"""

X = int(input())
# 大体のやつ
n = int((2*X)**0.5)+1
S = n*(n+1)//2

if S-X >= n:
    print(n-1)
else:
    print(n)

Submission status: Accepted

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

def eq(x):
    a1 = (-1 + sqrt(1-4*(-2*x)))/2
    a2 = (-1 - sqrt(1-4*(-2*x)))/2
    if a1 >= 0 and a2 >= 0:
        return int(ceil(min(a1, a2)))
    elif a1 >= 0 and a2 < 0:
        return int(ceil(a1))
    return int(ceil(a2))
n = eq(x)
for n in range(n, -1, -1):
    if n*(n+1) - 2*x < 0:
        break
print n + 1

Submission status: Accepted

Solution code:
X = int(input())
s = 0
for i in range(100000000):
    if s < X:
        s += i
    elif s >= X:
        t = i-1
        break
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
sum=0
for i in range(X+1):
    sum+=i
    if sum>=X:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

X = n()

for x in range(1, X):
    if x * (x + 1) // 2 >= X:
        print(x)
        import sys
        sys.exit()

print(X)

Submission status: Accepted

Solution code:
x = int(input())
time = 0
dis = 0

while True:
    time += 1
    dis += time
    if dis >= x:
        break
print(time)

Submission status: Accepted

Solution code:
# encoding: utf-8
import sys
# input = sys.stdin.readline

X = int(input())

tmp = 0
for ans in range(1, X + 1):
    tmp += ans
    if tmp >= X: break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans =0
for i in range(1,x+1):
    ans += i
    if ans>=x:
        print(i)
        exit()

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
for i in range(1,X+1):
    ans += i
    if ans >= X:
        print(i)
        exit()

Submission status: Accepted

Solution code:
X = int(input())

x = 0
count = 1
while x < X:
    x += count
    count +=1

print (count-1)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def main():
    X = 2*int(input())
    n = 1
    while X > n*(n+1):
        n += 1
    print(n)
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(i)

Submission status: Accepted

Solution code:
x=int(input())
c=0
s=0
while x>s:
    c+=1
    s+=c
print(c)

Submission status: Accepted

Solution code:
# すべて取らないといけないとき、例えばN=15は[1, 2, 3, 4, 5]で5になる。このあと16~(15+6-1)=20までは6でいけるやろ、そういうことじゃ

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

Submission status: Accepted

Solution code:
x=int(input())
i=1
a=1
while a>0:
    a=x-i*(i+1)/2
    i+=1
    
print(i-1)

Submission status: Accepted

Solution code:
X = int(input())

n = 1
while True:
  if X > n*(n-1)//2 and X <= n*(n+1)//2:
    print(n)
    exit()
  else:
    n += 1

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x = int(input())
t=0
move=0
while move < x:
    t+=1
    move+=t
print(t)

Submission status: Accepted

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

N, = map(int, input().split())

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

Submission status: Accepted

Solution code:
# ABC056C - Go Home (ARC070C)
x = int(input())
for i in range(1, x + 1):
    if i * (i + 1) * 0.5 >= x:
        print(i)
        break

Submission status: Accepted

Solution code:

N = int(input())

count = 0
i = 0
buff = 0
a = []
ans = 0
while True:
    a.append(buff)
    if buff >= N:
        break
    i += 1
    buff += i
print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

solution = (-1 + math.sqrt(1 + 8 * X)) / 2
print(math.ceil(solution))

Submission status: Accepted

Solution code:
X = int(input())

i, n = 0, 0
while n < X:
	i += 1
	n += i

#print(i, n)

if n == X:
	print(i)
	exit()

if n - X < i:
	print(i)
	exit()

j, d = 0, []
while X < n:
	j += 1
	n -= j
	d += [abs(X - n)]

#print(d)

if 0 in d:
	print(i)
	exit()

l, r = d[-1], d[-2]
print(i + min(abs(l), abs(r)) + 1)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

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

def main():
  n=I()
  c=1
  sm=1
  while True:
    if sm>=n:
      return c
    c+=1
    sm+=c

print(main())

Submission status: Accepted

Solution code:
import math
X = int(input())
a = int((2*X)**0.5)
if((a+1)*a//2<X):
    a+=1
print(a)

Submission status: Accepted

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

ans = math.ceil((-1 + (1+8*n)**(1/2))/2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
cnt = 0
while cnt < n:
  ans += 1
  cnt += ans
print(ans)

Submission status: Accepted

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



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

Submission status: Accepted

Solution code:
import sys

x = int(input())

for t in range(x+1):
    if int(t*(t+1)/2) >= x:
        print(t)
        sys.exit()

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:
a = int(input())
time = 0
d = 0
while(1):
  if a <= d:
    print(time)
    break
  time += 1
  d += time

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
"""解答
1 + 2 + 3 + ... + t >= X
のとき、Xを満たす和を作れるので、このときのtが答え。

なぜなら、左辺の和がXを超えた場合、
・1を引く（t=1のときジャンプしない）
・2を引く（t=2のときジャンプしない）
・3を引く（t=3のときジャンプしない）
...
という風にできるから。

左辺は、和の公式で (1+t)*t/2 で求まる。
よって、
(1+t)*t/2 >= X
t^2 + t - 2X >= 0

2次方程式の解の公式より、
t = -1±√(1+4*2X)/2

計算量はO(1)
"""
import math

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

    t = (-1 + math.sqrt(1+4*2*X))/2  # tは必ず正なので±は+の場合のみでOK
    t = math.ceil(t)

    print(t)
        

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
"""解答
1 + 2 + 3 + ... + t >= X
のとき、Xを満たす和を作れるので、このときのtが答え。

なぜなら、左辺の和がXを超えた場合、
・1を引く（t=1のときジャンプしない）
・2を引く（t=2のときジャンプしない）
・3を引く（t=3のときジャンプしない）
...
という風にできるから。

左辺は、和の公式で (1+t)*t/2 で求まる。
よって、
(1+t)*t/2 >= X
t^2 + t - 2X >= 0

2次方程式の解の公式より、
t = -1±√(1+4*2X)/2

計算量はO(1)
"""
import math

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

    t = (-1 + math.sqrt(1+4*2*X))/2  # tは必ず正なので+の場合のみでOK
    t = math.ceil(t)

    print(t)
        

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
# 全力で右に進んで見る
# 行き過ぎてたら1回休憩に変更するだけでよい

X = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())
N=0
M=0
while M<X:
    N+=1
    M+=N
print(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(n)

Submission status: Accepted

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

print(i)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
C - Go Home
https://atcoder.jp/contests/abc056/tasks/arc070_a

"""
import sys


def solve(X):
    def is_reachable(n):
        if ((1+n)*n)//2 >= X:
            return True
        return False

    ub, lb = 10**5, 0
    while ub - lb > 0:
        mid = (ub + lb) // 2
        if is_reachable(mid):
            ub = mid
        else:
            lb = mid + 1
    return ub


def main(args):
    X = int(input())
    ans = solve(X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
X = int(input())

sum = 0
for i in range(1, 10**9+1):
    sum += i
    if sum >= X:
        break

print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7


X = int(input())
position = 0
cnt = 0
for i in range(1,mod):
    cnt += 1
    position += i
    if position >= abs(X):
        break

print(cnt)

Submission status: Accepted

Solution code:
X = int(input())
s = 0
for i in range(10**5):
    if s < X <= s + i:
        break
    s += i
print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
a,i=[0],1
while a[-1]<10**9:
    a.append(i*(i+1)//2)
    i+=1
print(bisect.bisect_left(a,int(input())))

Submission status: Accepted

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

Submission status: Accepted

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

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())
S = 0
for i in range(1,X+1):
    S += i
    if S>=X:break
print(i)

Submission status: Accepted

Solution code:
x = int(input())

s = 0
ans = x
for i in range(1, x):
    s += i
    if x <= s:
        ans = i
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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