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: Wrong Answer

Solution code:
from sys import stdin
import bisect

n = int(stdin.readline().rstrip())

li = []
point = 0
for i in range(1,10**9):
    point += i
    li.append(point)
    if point >= 10**9:
        break

print(n-li[bisect.bisect(li,n)-1]+bisect.bisect(li,n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    X = int(inputs[0])
    i = 1
    current = 0
    while current <= X:
        current += i
        i += 1
    return i - 1


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
x=int(input())
k=0
j=0
for i in range(x):
  if j<x:
    j+=i
    k+=1
  else:
    print(k-1)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
t = 1
while True:
    if X-((t+1)*t)//2<t+1:
        break
    t += 1
T = t-1
T1 = X-((T+1)*T)//2
L = ((T+2)*(T+1))//2-(T+2)-(T+3)
T2 = X-L
print(min(T1,T2))

Submission status: Wrong Answer

Solution code:
X = int(input())
t = 1
while True:
    if X-((t+1)*t)//2<t+1:
        break
    t += 1
print(X-(t*(t-1))//2)

Submission status: Wrong Answer

Solution code:
n=int(input())
sm=0 
i=1 
cnt=0 
while sm<n or abs(sm-n)%2: 
    cnt+=1 
    sm+=i
    i+=1 
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# C - Go Home

X = int(input())

# バックジャンプは考慮しなくてよい
# 次に2回連続で飛んだらXを飛び越してしまうなら止まる

t = 0
current = 0
while current + (t+1) + (t+2) <= X:
    current += t+1
    t += 1

print(t + ((X - current) - (t+1)) + 1)

Submission status: Wrong Answer

Solution code:
# C - Go Home

X = int(input())

# バックジャンプは考慮しなくてよい
# 次に2回連続で飛んだらXを飛び越してしまうなら止まる

t = 0
current = 0
while current + (t+1) + (t+2) <= X:
    current += t+1
    t += 1
    print(current)

print(t + ((X - current) - (t+1)) + 1)

Submission status: Wrong Answer

Solution code:
# C - Go Home

X = int(input())

# バックジャンプは考慮しなくてよい
# 次に2回連続で飛んだらXを飛び越してしまうなら止まる

jump = 0
current = 0
while current + jump + (jump + 1) <= X:
    current += jump
    jump += 1

print(X - current)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
X=int(input())

i=1
while True:
    if (X-i)<i+1:
        print(X)
        exit()
    else:
        X-=i
        i+=1

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    import math
    import collections
    import itertools

    input = sys.stdin.readline().rstrip

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

    # i -= 2
    # print(x - i * (i + 1) // 2)
    print(i)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    import math
    import collections
    import itertools

    input = sys.stdin.readline().rstrip

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

    i -= 1
    print(x - i * (i + 1) // 2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#k*(k+1)/2>=xな最小のkでよいか。
x = int(input())

k = int((x*2+1/4)**(1/2)+ 1/2)

if k*(k+1) >= 2*x:
    k -= 1

print(k+1)

Submission status: Wrong Answer

Solution code:
x = int(input())

k = int((x*2+1/4)**(1/2)+ 1/2)

if k*(k+1) == 2*x:
    print(k)

else:
    #ans1 = x-(k-1)*(k-2)//2
    t = x - (k-2)*(k-3)//2
    ans = (t+2)//2
    #print(ans1,ans2)

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
for n in range(1,X):
  if n*(n-1)<=2*(X-1)<n*(n+1):
    print(n)
    exit()
if X==0:print("0")
if X==1:print("1")

Submission status: Wrong Answer

Solution code:
X = int(input())
for n in range(1,X):
  if n*(n-1)<=2*(X-1)<n*(n+1):
    print(n)

if X==1:print("1")

Submission status: Wrong Answer

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

print("1")

Submission status: Wrong Answer

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

print(1)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    x = int(input())
    for i in range(x+1):
        if i*(i+1)>x:
            print(i)
            sys.exit()

if __name__ == "__main__":
    sys.exit(main())

Submission status: Wrong Answer

Solution code:
n=int(input())

ans=0
i=0
while n>i:
    i+=1
    n-=i
print(i+n)

Submission status: Wrong Answer

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

x = int(input())

t = 0
k = 0
while True:
    t += 1
    if k + t == x:
        break
    elif k + 2 * t + 1 > x:
        continue
    else:
        k += t

print(t)

Submission status: Wrong Answer

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

x = int(input())

t = 0
k = 0
while k != x:
    t += 1
    if k + t == x:
        break
    elif k + 2 * t + 1 > x:
        continue
    else:
        k += t

print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())

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

Submission status: Wrong Answer

Solution code:
from math import floor
x = int(input())
a = floor((2*x)**.5)
while a * (a + 1) < x:
  a += 1
  
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
t = [i for i in range(X+1)]
t.pop(0)
import itertools
time = 10e9
ans = 0
for i in range(1,X):
    for c in itertools.combinations(t,i):
        if sum(c) == X:
            if(c[-1] <= time):
                time = c[-1]
print(time)

Submission status: Wrong Answer

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):
    s = i * (i + 1) // 2
    if s >= x:
        print(i)
        break

Submission status: Wrong Answer

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: Wrong Answer

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


main()

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
x = int(input())
left = x
for i in range(1,x+1):
    if i < left-i:
        left -= i
    elif i == left:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
step=0
while step<n:
  ans+=1
  step+=ans
if step==n:
  print(ans)
else:
  print(ans-1+(n-(step-ans)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
m = (2*X)**(0.5)
if m - int(m) == 0:n = int(m) - 1
else:n = int(m)
d = X - n*(n+1)//2
if d == 0:print(n)
else:print(n+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x=int(input())
tl=[]
for i in range(1,x):
    tl+=[i]
    if sum(tl)>=x:
        print(len(tl))
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
i = 0
buff = 0

while True:

    if 0 < N - (buff+i+1) <= i+1:
        i += 1
        continue
    i += 1
    buff += i

    if N == buff:
        break


print(i)

Submission status: Wrong Answer

Solution code:
X = int(input())
sum = 0
count = 1

while X > sum:
    sum += count
    count += 1

if (X == sum):
    print(count-1)
else:
    print(X-(sum-(count-1))+ (count-2))

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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


print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(int((2*int(input())+1/4)**0.5-1/2)+1)

Submission status: Wrong Answer

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

x = int(input())

def answer(x):
    for i in range(x):
        if(i*(i+1)//2 <= x):
            continue
        else:
            return i

print(answer(x))

Submission status: Wrong Answer

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

x = int(input())

def answer(x):
    for i in range(x):
        if(i*(i+1)//2 < x):
            continue
        else:
            return i

result = answer(x)

if(result == "None"):
    print(x)
else:
    print(answer(x))

Submission status: Wrong Answer

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

x = int(input())

def answer(x):
    for i in range(x):
        if(i*(i+1)//2 < x):
            continue
        else:
            return i

print(answer(x))

Submission status: Wrong Answer

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

x = int(input())

print(x*(x+1)/2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N = (-1 + (1 + 8 * X)**(1 / 2)) / 2
if N / 1 == N // 1:
    print(N // 1)
else:
    print(math.ceil(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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_right(x_list, n)
    idx -= 2
    print(n-x_list[idx])

Submission status: Wrong Answer

Solution code:
n = int(input())
st = 1
pt = 1
while st < n:
    st = pt * (pt+1)//2
    pt += 1
print(pt-1)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())

    i = 1
    while N > 0:
        if N == i:
            return i
        elif N >= 2 * i + 1:
            N -= i
            i += 1
        else:
            i += 1


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Solution code:
X = int(input())

left = 0    # ng
right = X   # ok
mid = X
while left + 1 < right:
    mid = (left + right) // 2
    if mid * (mid+1) // 2 >= X:
        right = mid
    else:
        left = mid

print(mid + 1)

Submission status: Wrong Answer

Solution code:
# 累積和してXを越えるところまでいったら、そこまでの数の組み合わせで達成できる
# （ことがエスパーでわかる）

X = int(input())
arr = [i for i in range(1, X + 1)]
ans = 0
for i in range(1, X):
    arr[i] += arr[i - 1]
    if arr[i] >= X:
        ans = i + 1
        break
print(ans)

Submission status: Wrong Answer

Solution code:
Acsum=[]
acsum=0
for i in range(4*10**4):
  acsum+=i
  Acsum.append(acsum)
def binarysearch(x):
  ng=-1
  ok=4*10**4
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if Acsum[mid]>=x:
      ok=mid
    else:
      ng=mid
  return ok
n=abs(int(input()))
print(binarysearch(n))

Submission status: Wrong Answer

Solution code:
Acsum=[]
acsum=0
for i in range(4*10**4):
  acsum+=i
  Acsum.append(acsum)
def binarysearch(x):
  ng=-1
  ok=4*10**4
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if Acsum[mid]>=x:
      ok=mid
    else:
      ng=mid
  return ok
n=int(input())
print(binarysearch(n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
for t in range(math.ceil(math.sqrt(X))):
    if t*(t+1)//2>=X:
        print(t)
        break

Submission status: Wrong Answer

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


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


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


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


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

Submission status: Wrong Answer

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


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


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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

i = 1
while x != 0:
  if 2 * i + 1 <= x:
    x -= i
    i += 1
  else:
    i = x
    break
print(i)

Submission status: Wrong Answer

Solution code:
a=s=0
x=int(input())
if x==11:
  exit()
while True:
  if s>=x:
    break
  s+=a
  a+=1
print(a-1)

Submission status: Wrong Answer

Solution code:
ans = (int(input())*8 + 1)**0.5 - 1
if not ans.is_integer():
    ans += 2
print(ans//2)

Submission status: Wrong Answer

Solution code:
y=int(input())*2
a=[x*(x+1) for x in range(100000) if x*(x+1)<=y]
print(len(a))

Submission status: Wrong Answer

Solution code:
import fileinput


def algorithm(X):
    return int(X // 2) if X > 2 else X


def pass_inputs(input_lines):
    X = input_lines[0][0]
    return algorithm(X)


def convert_int(s):
    try:
        r = int(s)
    except ValueError:
        r = s
    return r


def run():
    out = pass_inputs([[convert_int(v) for v in l.strip().split(" ")] for l in fileinput.input()])
    print(out)


if __name__ == "__main__":
    run()

Submission status: Wrong Answer

Solution code:
X=int(input())
Dear=0
time=0
while Dear!=X:

    if (X-(Dear+time)>=time+1) :
        Dear+=time

    if X==Dear+time:
        print(time)
        exit(0)
    time+=1

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 0
s_m = 10**9
for i in range(int(pow(X,1/2))):
	ans +=1
	x = i+1
	s_n = X - 1/2*x*(x+1)
	if s_n >= s_m:
		break
	s_m = s_n
print(ans+1)

Submission status: Wrong Answer

Solution code:
X = int(input())


def solve(X):
    for n in range(1, X*X):
        if n*(n-1)//2 < X <= n*(n+1)//2:
            return n
    return 0

print(solve(X))

Submission status: Wrong Answer

Solution code:
a = int(input())

for i in range(1,10**5):
  k = a - i
  if k == 0:
    print(i)
  elif k < i + 1:
    continue
  elif k >= i + 1:
    a -= i

Submission status: Wrong Answer

Solution code:
x = int(input())
i = 1
count = 0
while True:
    if i == 1:
        t = x
    s = t - i
    if s == 0:
        break
    elif s >= i + 1:
        t = s
    else:
        t = s + i
    i += 1

print(i)

Submission status: Wrong Answer

Solution code:
X = int(input())

r = 1
num = 0

while num >= X:
    num += r
    r += 1

print(r-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
def f1(n):
  return (n+1)*n//2
def f2(n):
  return int((-1+pow(1+8*n, 1/2))/2)
y = f2(x)
while True:
    if f1(y) < x <= f1(y+1):
        print(y+2)
        break
    elif f1(y)==x:
        print(y)
        break
    else:
        y+=1

Submission status: Wrong Answer

Solution code:
iX = int(input())
iK =  int((2*(iX)) ** 0.5)
for k in [iK,iK+1]:
    if k*(k-1) < iX *2 <= (k)*(k+1):
        print(iX,k)
        exit()

Submission status: Wrong Answer

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

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

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

print(min(ans))

Submission status: Wrong Answer

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

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

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

print(min(ans))

Submission status: Wrong Answer

Solution code:
X = int(input())

i = 1
x = X
while(True):
    if x == i:
        print(i)
        break
    elif x >= (i * 2 + 1):
        x = x - i
        i += 1
    elif x < i:
        x = x + i
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

i = 1
x = X
while(True):
    if x == i:
        print(i)
        break
    elif x >= (i * 2 + 1):
        x = x - i
        i += 1
    elif x < i:
        break
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

i = 1
x = X
while(True):
    if x == i:
        print(i)
        break
    elif x >= (i * 2 + 1):
        x = x - i
        i += 1
    elif x < i:
        break
    else:
        i += 1
    print(i, x)

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1
s = 1

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

print(c)

Submission status: Wrong Answer

Solution code:
x = int(input())
n = (2*x+0.25)**0.5-0.5
print(-int(-n))

Submission status: Wrong Answer

Solution code:
x = int(input())

t =0

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

Submission status: Wrong Answer

Solution code:
x = int(input())

t =0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans, temp, idx = 0, 0, 1
while temp:
  temp += idx
  idx += 1
  ans += 1
  if temp == x:
    break
  if temp > x:
    ans -= 1
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep  2 11:49:26 2018
ABC056C
@author: maezawa
"""

x = int(input())

fib = [0, 1]
i = 2
j = 0
while j < x:
    j = fib[i-1] + i
    fib.append(j)
    i += 1
print(i-1)

Submission status: Wrong Answer

Solution code:
print(int((2*int(input()))**0.5))

Submission status: Wrong Answer

Solution code:

N = int(input())
X = []
x = 1
i = 1
while x<10**9+1:
    X.append(x)
    i += 1
    x += i
    
for i,x in enumerate(X):
    if x < N:
        continue
    else:
        print(i+1)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

now=0
c=1

while now<n:
  now+=c
  c+=1
  
print(c)

Submission status: Wrong Answer

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

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

print(i)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x):
  j = i + 1
  if x == j:
    print(j)
    break
  elif x - j <= j:
    continue
  else:
    x -= j

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

if bin(X)[2:].count("1") == 1 :
    print(X)
else :
    print(X >> 1)

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(0, X):
    X -= (i+1)
    if X <= 0:
        print(i+1)

Submission status: Wrong Answer

Solution code:
x = int(input())
k, t = x, 1

while 2 * t < k:
    k -= t
    t += 1

if x == 2:
    print(1)
else:
    print(k)

Submission status: Wrong Answer

Solution code:
X=int(input())
cnt=1
while X!=0:
  if X==cnt:
    X-=cnt
  elif X-cnt >= cnt+1:
    X-=cnt
    cnt+=1
  else:
    cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
num = 0
for i in range(n):
	num += i
	if n<=num:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
print(int(math.sqrt(2*n))+1)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

  print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = 1
b = N
for i in range(1, N + 1):
    if a + i >= b:
        break
    else:
        a = i
        b -= i

print(b)

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right, insort_left, insort_right


def solve():
    x = int(input())
    cumulative_sum = [(k * (k - 1)) // 2 for k in range(1, 46)]
    target = bisect_left(cumulative_sum, x)
    if x in cumulative_sum:
        print(cumulative_sum.index(x))
    else:
        print(min(target - 2 + (x - cumulative_sum[target - 1] + 1), target + 2))


solve()

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right, insort_left, insort_right


def solve():
    x = int(input())
    cumulative_sum = [(k * (k - 1)) // 2 for k in range(1, 46)]
    target = bisect_left(cumulative_sum, x)
    if x in cumulative_sum:
        print(cumulative_sum.index(x))
    else:
        print(target - 2 + (x - cumulative_sum[target - 1] + 1))


solve()

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right, insort_left, insort_right


def solve():
    x = int(input())
    cumulative_sum = [(k * (k - 1)) // 2 for k in range(1, 46)]
    target = bisect_left(cumulative_sum, x)
    if x in cumulative_sum:
        print(cumulative_sum.index(x))
    else:
        print(target - 1 + (x - cumulative_sum[target - 1]))


solve()