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:
# -*- coding: utf-8 -*-
X = int(input())
maxdist = 0
for i in range(1,X+1):
    maxdist = maxdist + i
    if maxdist > X:
        print("%d" % i)
        break
    elif maxdist == X:
        print("%d" % i)
        break

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    ttl = 0
    for i in range(1, X + 1):
        ttl += i
        if X <= ttl:
            print(i)
            return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict


# 初項a，交差dの数列n個の和
def arithmetic_series(a, d, n):
    return n * (2 * a + (n - 1) * d) // 2


def main():
    X = int(input())
    for i in range(10 ** 9):
        if X <= arithmetic_series(1, 1, i):
            print(i)
            return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python

x = int(input())

t = 0

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

Submission status: Accepted

Solution code:
import sys, array, re, functools
input = lambda: sys.stdin.readline()
@functools.lru_cache(maxsize = 10000)

def Main():
  x = int(input())
  lb = -1
  ub = 123456789
  
  while ub - lb > 1:
    mid  = (ub + lb)//2
    s = mid*(mid + 1)//2
    
    if s >= x:
      ub = mid
      # ans = mid
    else:
      lb = mid
  
  print(ub)
if __name__ == '__main__':
  Main()

Submission status: Accepted

Solution code:
import math

x = math.fabs(int(input()))

i = 0
s = 0

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

print(i)

Submission status: Accepted

Solution code:
def calc(x):
	tmp = 0
	i = 1
	while True:
		tmp += i
		if tmp >= x:
			return i
		else:
			i += 1

x = int(raw_input())

print calc(x)

Submission status: Accepted

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

Submission status: Accepted

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

print(i)

Submission status: Accepted

Solution code:
X = int(input())
s = 0
for t in range(10**9):
    if s >= X:
        print(t-1)
        break
    s += t

Submission status: Accepted

Solution code:
from math import sqrt, ceil
y = int(input())
print(ceil(sqrt(y * 2 + 0.25) - 0.5))

Submission status: Accepted

Solution code:
X = int(input())
t = 0
tsum = 0
tset = []
while X > tsum:
    t += 1
    tsum += t
    tset.append(t)
print(len(tset))

Submission status: Accepted

Solution code:
X = int(input())
step = 1

while X > 0:
    X -= step
    step += 1

print(step-1)

Submission status: Accepted

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

while x > 0:
    x -= i
    i += 1

print(i-1)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    a = int(input())
    left = 0
    right = 1 << 50
    while (right - left > 1):
        med = (right + left) // 2
        if (med * (med + 1) >= 2 * a):
            right = med
        else:
            left = med
    print (right)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    X = int(raw_input())
    step = 0
    for i in xrange(1,X+1):
        step += i
        if step >= X:
            break
    print i

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#ABC056C

x=int(raw_input())

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = abs(int(input()))

    s = 0
    for i in range(0,10 ** 9):
        if s >= x: 
            print(i - 1)
            break
        s += i

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = abs(int(input()))

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

Submission status: Accepted

Solution code:
import math
X = int(input())
n = int(math.sqrt(2*X) -2)

def sum(a):
    return a*(a+1)/2

result = 0

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

print(result)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import sys

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

    t = 1

    while calc_sum(t) < x:
        t += 1

    print(t)

def calc_sum(t):
    return t * (t + 1) // 2

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3

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

print(int(math.ceil(k)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(n):
    return (n * (n + 1)) // 2


def main():
    inp = int(input())
    l, u = 0, 1000000
    while l < u:
        mid = (l + u) // 2
        if f(mid) >= inp:
            u = mid
        else:
            l = mid + 1
    print(u)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt, ceil

def quad_solve(X):
	return int(ceil((-1 + sqrt(1 + 8*X)) / 2))

X = int(raw_input())
i = 0
print quad_solve(X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(raw_input())

i = 0
x = 0
while x < X:
    i += 1
    x += i
print i

Submission status: Accepted

Solution code:
x = int(input())

lb = -1
ub = 1145141919
ans = 0

while ub - lb > 1:
    mid = (lb + ub) // 2
    s = mid * (mid + 1) // 2
    if s >= x:
        ub = mid
        ans = mid
    else:
        lb = mid

print(ub)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
'''
def search(t, x, i):
    global X
    if x == X:
        return t
    elif x > X:
        ans1 = search(i, x, i+1)
        ans2 = search(i, x-i, i+1)
        return min(ans1, ans2)
    else:
        ans3 = search(i, x+i, i+1)
        return ans3
'''
X = int(input())
p, i = (0,0)
while True:
    p += i
    i += 1
    if p >= X:
        break
print(i-1)
'''
ans = search(0, 0, 1)
print(ans)
'''

Submission status: Accepted

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


def f(x):
    for n in range(0, x + 1):
        s = n * (n + 1) / 2
        if s >= x:
            return n


print(f(x))

Submission status: Accepted

Solution code:
# coding: utf-8

X = int(raw_input())

a = 1
n = 1
while(n < 1000000000):
    a = n-1 + a
    if a > X:
        print n-1
        exit()
    elif a == X:
        print n
        exit()
    n+=1

Submission status: Accepted

Solution code:
X = input()

r = 0
i = 0
a = 0
prev = 0
while True:
    i += 1
    a += i
    if prev < X and X <= a:
        r = i
        break
    prev = a

print r

Submission status: Accepted

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

i = math.sqrt(2*x)
print(round(i))

Submission status: Accepted

Solution code:
X = int(input())

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

print(i)

Submission status: Accepted

Solution code:
#coding:utf-8
# x=int(raw_input())  # 1 # 一つの数字のみ
# w, a, b =map(int,raw_input().split())  # 2 3  # 二つの数字

x =input()
sums=0
for i in range(44722):
    sums += i
    # if x == place:
    # print sum
    # print i
    if sums < x:
        pass
    elif sums >= x:
        print i
        break
    # print i
    # print "max",sums
    # print "i",i
# print pl?ace

Submission status: Accepted

Solution code:
X = int(raw_input())
m=0
for i in xrange(1, X+1):
	m+=i
	if m >= X:
		print i
		break

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
x = int(input())
d,i = [0,0]

while True:
    d += i
    i += 1
    if x <= d:
        break
print(i-1)

Submission status: Accepted

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

    n = 1
    while True:
        if n * (n + 1) >= 2 * X:
            break
        else:
            n += 1
    print(n)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
i = abs(int(raw_input()))
c = 0
while i > 0:
	c += 1
	i -= c
print c

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
count = 0
sumnum = 0
X = abs(X)
while True:
    count += 1
    sumnum += count
    if sumnum >= X:
        break
print(count)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = int(input())

    total = i = 0
    while total < x:
        total += i
        i += 1

    print(i - 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def nal(): return list(map(int, stdin.readline().split()))
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())

x = ni()

c = 1
ans = 1
while(True):
    if(x <= c):
        print(ans)
        break
    else:
        ans += 1
        c += ans

Submission status: Accepted

Solution code:
X = int(input())

x = 0
t = 0
i = 1
sum = 0
while(sum <= X):
	sum += i
	if(sum >= X):
		print(i)
		exit()
	i += 1

Submission status: Accepted

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

Submission status: Accepted

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

    xi = 0
    t = 0
    for i in range(1, X + 1):
        xi += i
        t += 1
        if xi >= X:
            print(str(t))
            break

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = input()
counter = 1
while(counter*(counter+1)/2<X):
    counter += 1

print(counter)

Submission status: Accepted

Solution code:
x = int(input())
x = 2*x

n = 0
while 1:
    if x <= n * n + n:
        print(n)
        break
    else:
        n += 1

Submission status: Accepted

Solution code:
X = int(input())
point = 0
time = 0
#shortest = 
if X >= 0:
    while point < X:
        time += 1
        point += time
print(time)

Submission status: Accepted

Solution code:
import math
k = int(input())
n = (math.sqrt(1 + 8*k) - 1) * 0.5
N = math.ceil(n)
print(N)

Submission status: Accepted

Solution code:
N=int(input())
ans=int((1+(8*N-7)**0.5)/2)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

d = 0
i = 0

while(d < X):
    i += 1
    d += i

print(i)

Submission status: Accepted

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

X = int(input())

k = int((2 * X + 1 / 4)**(1 / 2) -1 / 2)
while (k * (k + 1)) // 2 < X:
	k = k + 1

print(k)

Submission status: Accepted

Solution code:
X = int(raw_input())

i = 1
res = 0
while True:
    res += i
    if res >= X:
        break
    i += 1
print i

Submission status: Accepted

Solution code:
X=int(input())
i=1
while 1:
    S = i*(i+1)/2
    if X<=S:
        break
    i+=1
print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

i = 0
goukei = 0

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

print(i)

Submission status: Accepted

Solution code:
X = int(input())

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

print(i)

Submission status: Accepted

Solution code:
X = int(input().strip())
 
t = 0
x = 0
if X == 0:
	print(0)
else:
	while(True):
		t += 1
		x += t
		if x >= X:
			print(t)
			break

Submission status: Accepted

Solution code:
import math
x = int(input())
print(int(round(math.sqrt(2*x))))

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:
import math
x = int(input())
print(math.ceil((-1+(1+8*x)**0.5)/2))

Submission status: Runtime Error

Solution code:
s, c = map(int, input().split())
c = c//2

if s == c:
    print(s)
elif s > c:
    print(c)
elif s < c:
    t = c - s
    print(s + t//2)

Submission status: Runtime Error

Solution code:
x = int(input())

t = 1
while true:
    if (1 + t) * t / 2 > x:
        print(t)
    else:
        t += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

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):
    tmp += i
    A.append(tmp)
    if tmp > X:
        break

for i in range(1, len(A)+1):
    tmp += i
    if X <= A[i]:
        print(i+1)
        break

Submission status: Runtime Error

Solution code:
x = int(input())

index = 0
for i in range(1,x+1):
  if i*(i-1) < (x-index):
    index+=i
  else:
    ans = x-index
    break
#  print(i,index)
print(ans)

Submission status: Runtime Error

Solution code:
x = int(input())

index = 0
for i in range(1,x+1):
  if (i-1)*2 < (x-index):
    index+=i
  else:
    ans = x-index
    break
#  print(i,index)
print(ans)

Submission status: Runtime Error

Solution code:
import math
X = int(input())
ruto = math.ceil(math.sqrt(2*X))+1
kari = ruto**2+ruto
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: Runtime Error

Solution code:
import math
X = int(input())
ruto = math.ceil(math.sqrt(2*X))
kari = ruto**2+ruto
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: Runtime Error

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

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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(pow(n*2,0.5)//1+1,0,-1):
  if i*(i-1)<2*n:
    continue
  else:
    print(i+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X=int(input())
dp=[0]*(X+1)
for i in range(1,10**5):
    if (i-1)*i//2<X<=i*(i+1)//2:
        print(i)
        break

Submission status: Runtime Error

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





@lru_cache(None)
def rec(x,t,curr):
    # print(x,t,curr)
    if(x==curr):
        return t
    if(t>x):
        return x
    return min(rec(x,t+1,curr+t+1),rec(x,t+1,curr),rec(x,t+1,curr-t-1))




X=l()[0]
print(min(rec(X,1,1),rec(X,1,0),rec(X,1,-1)))

Submission status: Runtime Error

Solution code:
# ABC 056 C
X =int(input())
for t in range(10**9):
    if t * (t+1)/2 >=X:
        print(t)
        exit()a

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())

dp=[float('inf')]*(x+1)
dp[0]=0
for i in range(1,x+1):
    for j in range((i-1)*i//2+1):
        if 0<=j<=x and 0<=i+j<=x:
            dp[i+j]=min(dp[i+j],i)
print(dp[x])

Submission status: Runtime Error

Solution code:
x = int(input())

dp=[float('inf')]*(x+1)
dp[0]=0
for i in range(1,x+1):
    for j in range((i-1)*i//2+1):
        if j<=x and i+j<=x:
            dp[i+j]=min(dp[i+j],i)
print(dp[x])

Submission status: Runtime Error

Solution code:
x=int(input())
y=((2*x)**0.5)//1
y-=1
for i in range(y,y+x):
    if (i+1)*1//2>=x:
        print(i)
        exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
a=[]
for i in range(1,10**5):
  a+=i
  if a>=n:
    break
print(i)

Submission status: Runtime Error

Solution code:
n=input()
a=[]
for i in range(1,10**5):
  a+=i
  if a>=n:
    break
print(i_

Submission status: Runtime Error

Solution code:
def main():
    import sys
    x=int(input())
    cnt=0
    if x==1:
        print(1)
        sys.exit()
    for i in range(1,x):
        if cnt<x:
            cnt+=i
        else:
            t=i-1
            break
    print(t)

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    x=int(input())
    cnt=0
    for i in range(1,x):
        if cnt<x:
            cnt+=i
            print(i,cnt)
        else:
            print(i,cnt)
            t=i-1
            break
    print(t)

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
X = int(input())

ans = 10**9

def func(current, t):
    global ans
    if ans < t or current > X:
        return
    if current == X :
        ans = min([ans, t])
        return

    func(current+(t+1), t+1)
    func(current-(t+1), t+1)
    func(current, t+1)

func(0, 0)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(40000)
def func(pos, t, x):

    if pos + t == x:
        return t
    elif pos + t < x:
        new_pos = pos + t
        t += 1
        return func(new_pos, t, x)
    else:
        new_pos = pos - t
        t -= 1
        return func(new_pos, t, x)
    
def slove(x):
    ans = func(0,0,x)
    return ans
if __name__ == "__main__":
    x = int(input())
    print(slove(x))

Submission status: Runtime Error

Solution code:
def func(pos, t, x):
    if pos + t == x:
        return t
    elif pos + t < x:
        new_pos = pos + t
        t += 1
        return func(new_pos, t, x)
    else:
        new_pos = pos - t
        t -= 1
        return func(new_pos, t, x)
      
def slove(x):
    ans = func(0,0,x)
    return ans

if __name__ == "__main__":
    x = int(input())
    print(slove(x))

Submission status: Runtime Error

Solution code:
import numpy as np

x = int(input())

t = (-1 + np.sqrt(1 + 8 * x)) /? 2
t = int(t)

print(t + 1)

Submission status: Runtime Error

Solution code:
n = int(input())
ng =0 ok=n
while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if mid*(1+mid)//2>=n:
    ok=mid
  else:
    ng = mid
if ok != n:
  ok+=1
print(ok)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())
a = [i for i in range(1, 10**5)]

from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))

Submission status: Runtime Error

Solution code:
X = int(input())

sum_ = [0] * (X // 2 + 1)
a = [i for i in range(1, X//2 + 1)]
for i in range(X//2):
    sum_[i + 1] = sum_[i] + a[i]
import bisect
print(bisect.bisect_left(sum_, X))

Submission status: Runtime Error

Solution code:
X = int(input())

sum_ = [0] * (X + 1)
a = [i for i in range(1, X + 1)]
for i in range(X):
    sum_[i + 1] = sum_[i] + a[i]
import bisect
print(bisect.bisect_left(sum_, X))

Submission status: Runtime Error

Solution code:
x = int(input())
ans = 10**9
def bfs(i,a):
    if a == x:
        global ans
        ans = min(ans,i-1)
    elif i<=x:
        bfs(i+1,a+i)
        bfs(i+1,a)
        bfs(i+1,a-i)
bfs(0,0)
print(ans)

Submission status: Runtime Error

Solution code:
x=int(input())
n=0
while 2x>n*n+n:
  n+=1
print(n)

Submission status: Runtime Error

Solution code:
def main():
    from itertools import accumulate
    x = int(input())
    l = list(range(0, x + 1))
    r = accumulate(l)

    for i, p in enumerate(r):
        if p == x:
            print(i)
            break
        if p + (i + 2) == x:
            print(i + 2)
            break


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
X = int(input())
arr = np.arange(1, 10)
arr = arr * (arr + 1) / 2
# print(arr)
# print(arr >= X)
ans = np.nonzero(arr >= X)[0].min() + 1
print(ans)

Submission status: Runtime Error

Solution code:
l=int(input())
n=0
while l>n*(n+1):
    n=n+1
if (l-n*(n+1)//2)==0:
    print(n)
else:
    print(x-n*(n+1)//2)

Submission status: Runtime Error

Solution code:
from itertools import combinations

int_x = int(input())

answer = int_x

for i in range(1, int_x + 1):
    c = combinations(range(1, int_x + 1), i)
    for w_c in c:
        if sum(w_c) == int_x:
            answer = min(answer, max(w_c))
print(answer)

Submission status: Runtime Error

Solution code:
import itertools

int_x = int(input())
answer = int_x
for i in range(1, int_x + 1):
    for v in itertools.combinations(range(1, int_x + 1), i):
        if sum(v) == int_x:
            answer = min(answer, max(v))
print(answer)

Submission status: Runtime Error

Solution code:
import itertools

int_x = int(input())
answer = int_x
for i in range(1, int_x):
    for v in itertools.combinations(range(1, int_x + 1), i):
        if sum(v) == int_x:
            answer = min(answer, max(v))
print(answer)

Submission status: Runtime Error

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

N, M = MAP()
if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(M - 2)
elif M == 1:
    print(N - 2)
else:
    print((N - 2) * (M - 2))


#A = [[0] * W for i in range(H)]
#C = ["o" * W for i in range(H)] 
#C = ["#"*(W+2)] + ["#"+C[i]+"#" for i in range(H)] + ["#"*(W+2)]
#dx = [1, 1, 0, -1, -1, -1, 0, 1]
#dy = [0, 1, 1, 1, 0, -1, -1, -1]
#
#for h in range(H):
#    for w in range(W):
#        for i in range(8):
#            if C[h+1+dx[i]][w+1+dy[i]] == "o":
#                A[h][w] += 1
#ans = 0
#for h in range(H):
#    for w in range(W):
#        if A[h][w] % 2 == 0:
#            ans += 1
#
#print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# t を前から試してｘ以下か判定する
x = int(input())
for i in range(x):
    if i*(i+1)/2 > x:
        ans =i
        break 
print(ans)

Submission status: Runtime Error

Solution code:
X=int(input())
import numpy as np
dp = np.zeros(X+1, dtype = int) #xに到達できる判定
dp[0] = 1
for t in range(1,X+1):
    if dp[X-t]==1:
        print(t)
        break
    else:
        dp[t:] = dp[:X+1-t]

Submission status: Runtime Error

Solution code:
X=int(input())
import numpy as np
dp = np.zeros(X+1, dtype = int) #xに到達できる判定
dp[0] = 1
for t in range(1,X+1):
    if dp[X-t]==1:
        print(t)
        break
    else:
        dp[t:] = dp[:X+1-t]
    print(dp)

Submission status: Runtime Error

Solution code:
X=int(input())
import numpy as np
dp=[[False]*(X+1) for _ in range(X+1)]
dp[0][0]=True
for t in range(1,X+1):
  if dp[t-1][X-t]==True:
    ans = t
    break
  for x in range(0,X+1):
    if x>=t:
      dp[t][x]=dp[t-1][x-t]
    else:
      dp[t][x]=dp[t-1][x]
print(ans)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
print([2, 1][m > 1])

Submission status: Runtime Error

Solution code:
x = int(input())
'''
if x == 1:
    ans = 1
elif x == 2:
    ans = 2
elif x == 3:
    ans = 2
elif x == 4:
    ans = 3
elif x == 5:
    ans = 3
elif x == 6:
    ans = 3
elif x == 7:
    ans = 4
elif x == 8:
    ans = 4
elif x == 9:
    ans = 4
elif x == 10:
    ans = 4
11から15までは5
122333444455555...の群数列
'''
for i in range(1,x):
    if i*(i-1)/2 < x <= i*(i+1)/2:
        ans = i
        break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

X = n()

dp = [0] * (X+1)
dp[1] = 1
for i in range(2, X+1):
    j = dp[i-1]
    if dp[i - j] < dp[i-1]:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+1
print(dp[X])

Submission status: Runtime Error

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

X = n()

dp = [0] * (X+1)
dp[1] = 1
for i in range(2, X+1):
    if dp[i - dp[i-1]] < dp[i-1]:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+1
print(dp[X])

Submission status: Runtime Error

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

X = n()

dp = [0] * (X+1)
dp[1] = 1
for i in range(2, X+1):
    if dp[i - dp[i-1]] < dp[i-1]:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+1

print(dp[X])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())

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

print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import bisect
x = int(input())
num_list = list(range(x))
a = [0]*x
a[0] = num_list[0]
for i in range(1,x):
    a[i] = a[i-1] + num_list[i]
print(bisect.bisect_left(a, x))

Submission status: Runtime Error

Solution code:
def an(a, b):  # a is time b is place
    if a > b:
        return float('INF')
    elif a == b:
        return a
    else:
        return min(an(a + 1, b), an(a + 1, b - a))


X = int(input())
print(an(1, X))

Submission status: Runtime Error

Solution code:
import sys
f = open('ABC.txt', 'r')
sys.stdin = f

import bisect
n = int(input())
x = 0
i = 1
x_list = []

while x <= n:
  x += i
  if x > n:
    break
  x_list.append(x)
  i += 1

if n == 2:
  print(2)
else:
  if n in x_list:
    print(x_list.index(n)+1)"""
  else:
    idx = bisect.bisect_left(x_list, n)
    idx -= 2
    print(n-x_list[idx])"""

Submission status: Runtime Error

Solution code:
a = int(input())
s = 0
if i < 3:print(a)
else:
    for i in range(1,a):

        s+=i
        if s-i < a <= s:
            print(i)
            break

Submission status: Runtime Error

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