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:
x = int(input())

# 1,[2],3,[4,5],6,[7,8,9],10 ...

ans = (-1+(8*x+1)**0.5)/2
ans = -(-ans//1)

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
now = 0
time = 0
for i in range(1,10**5):
    if X - now - i >= i + 1:
        now += i
        time += 1
    elif X - now == i:
        now += i
        time += 1
        break
    else:
        time += 1
print(time)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np
import bisect
X = int(input())
A = np.cumsum(range(1, 10 ** 6))
if np.any(A == X):
    print(A.tolist().index(X) + 1)
else:
    idx = bisect.bisect_left(A, X)
    print(X - A[idx - 1] + idx)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np
import bisect
X = int(input())
A = np.cumsum(range(1, 10 ** 5))
if np.any(A == X):
    print(np.where(A == X)[0][0] + 1)
else:
    idx = bisect.bisect_left(A, X)
    print(X - A[idx - 1] + idx)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import math
import sys
from collections import defaultdict
input = sys.stdin.readline
s= int(input())

ans = 0
for i in range(100000000):
    ans +=i
    if ans >= s and (ans - s) %2 == 0:
        print(i)
        sys.exit()

Submission status: Wrong Answer

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

    t = 0
    now = 0
    for i in range(1, x):
        if x - now == i:
            t = i
            break
        if x - now == (i + 1):
            t = i + 1
            break
        else:
            now += i

    print(t)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

distance = 0
count = 0

i = 1
while distance < x:
    distance += i
    if distance > x:
        distance -= i
        break
    count += 1
    i += 1

if x == distance:
    print(count)
else:
    print(count + x - distance)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(0,10000):
    ix = i*(i+1)/2
    if x <= ix :
        print(i)
        exit()

Submission status: Wrong Answer

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

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())
num = 0
for i in range(1,40000):
    num += i
    if num >= x:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n = int(open(0).read())
i = 0
while i*(i+1)//2 <= n:
    i += 1
print(n - (i-1)*i//2 + i-1)

Submission status: Wrong Answer

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

    l = [int(x) for x in range(1, x)]
    for i in range(len(l)):
        if l[i]*(l[i]+1)//2 >= x:
            return i+1


print(solve())

Submission status: Wrong Answer

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

    l = [int(x) for x in range(1, int(x**0.5)+10)]
    for i in range(len(l)):
        if l[i]*(l[i]+1)//2 >= x:
            return i+1


print(solve())

Submission status: Wrong Answer

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

    l = [int(x) for x in range(1, int(x**0.5)+3)]
    for i in range(len(l)):
        if l[i]*(l[i]+1)//2 >= x:
            return i+1


print(solve())

Submission status: Wrong Answer

Solution code:
n = int(input())

t = 0
while t*(t+1) <=2*n:
    t += 1
print(t)

Submission status: Wrong Answer

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

left=0
right=x
while right-left>1:
  mid=(left+right)//2
  print(mid)
  if (mid**2+mid)/2==x:
    right=mid
    break
  if (mid**2+mid)/2<x:
    left=mid
  else:
    right=mid
print(right)

Submission status: Wrong Answer

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

left=0
right=x
while right-left>1:
  mid=(left+right)//2
  
  if (mid**2+mid)/2==x:
    break
  if (mid**2+mid)/2<x:
    left=mid
  else:
    right=mid
print(right)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
n = math.ceil(math.sqrt(x*2))
s = [list(map(int,bin(x)[2:].zfill(n))) for x in range(2**n)]
t = 0
c = 0
min = x
for i in range(2**n):
    for j in range(len(s[i])):
        t+=s[i][j]*(j+1)
        if s[i][j]==1:
            c =j+1
    if t==x and c<min:
        min =c
print(c)

Submission status: Wrong Answer

Solution code:
import math
def main():
    X = int(input())
    T = int( (-1 + math.sqrt(8*X+1))/2 )
    print(T)
            
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    X = int(input())
    for i in range(1, 100000):
        if X == i:
            print(i)
            break
        elif X - i <= i + 1:
            pass
        else:
            X -= i
            
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    X = int(input())
    for i in range(1, 89500):
        if X == i:
            print(i)
            break
        elif X - i < i + 1:
            pass
        else:
            X -= i
            
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

num = 1

while num**2+num < 2*x:
    print(num,num**2-num)
    num += 1

print(num)

Submission status: Wrong Answer

Solution code:

def myAnswer(X:int) -> int:
   if(X <= 1): return X
   ans = [0]
   total = 0
   for i in range(1,X):
      total += i
      if(total == X): 
         # print(total,X)
         return i
      if(total >= X):break
      ans.append(total)
      
   # print(ans,total,i)
   return X - ans[-2]
def modelAnswer():
   return
def main():
   X = int(input())
   print(myAnswer(X))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def create_koho(X):
    koho = [1]
    koho_sum = 1
    i = 1
    while koho_sum <= X:
        i += 1
        koho.append(i)
        koho_sum += i

    return koho


X = int(input())
koho = create_koho(X)
nokori = X
ans = 0
for i in reversed(koho):
    if nokori >= i:
        nokori -= i
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
i=1
x=0
while True:
    if x+i==X or x-i==X:
        i+=1
        break
    elif 2*i+1==abs(X-x):
        i+=2
        break
    elif 2*i+1<abs(X-x):
        if X>x:
            x+=i
        else:
            x-=i
    i+=1
print(i-1)

Submission status: Wrong Answer

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

for t in range(ceil(sqrt(x))+10):
    if t*(t+1)//2>=x:
        print(t)
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
k = 0
while x - k > 0:
    for i in range(int((2*(x-k))**0.5),int((2*(x+1-k))**0.5)+2):
        if i*(i+1) == 2*(x - k):
            #print(i,k)
            print(i+k)
            break
    else:
        k += 1
        continue
    break
else:
    print(k)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
k = 0
while x - k > 0:
    for i in range(int((2*(x-k))**0.5),int((2*(x+1-k))**0.5)+1):
        if i*(i+1) == 2*(x - k):
            #print(i,k)
            print(i+k)
            break
    else:
        k += 1
        continue
    break
else:
    print(k)

Submission status: Wrong Answer

Solution code:
x = int(input())
a = b = x // 2
if x % 2 == 1:
    a += 1
ans = b
if a > (b * (b - 1)) // 2:
    ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(1,100001):
  t=i*(i+1)//2
  s=(i+1)*(i+2)//2
  if t<x<=s:
    print(i+1)
    exit(0)

Submission status: Wrong Answer

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


def main():
    x = int(input())
    straight = 0
    while True:
        if x < sum_from_1(straight):
            straight -= 1
            break
        straight += 1
    answer = straight + (x - sum_from_1(straight))
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
N=int(-0.5+(0.25+X)**0.5)+1
for k in range(2):
    N-=k
    if 0.5*N*(N+1)<=X<(N+2)*(N+1):
        print(N)
        break
'''
count=0
x=[[0]]
for k in range(0,1000000):
    if X in x[k]:
        print(k)
        break
    x.append(list(set(x[k])))
    for j in range(len(x[k])):
        x[k+1].append(x[k][j]+k+1)
        x[k+1].append(x[k][j]-k-1)
    x[k+1]=list(set(x[k+1]))
'''

Submission status: Wrong Answer

Solution code:
x = int(input())
#h, w = list(map(int, input().split()))
#((n+1)*n)//2 >= x
# (n+1)*n = 2*x
n = 1
a = ((n+1)*n)//2
while a < x:
    a = ((n+1)*n)//2
    n += 1
print(n)

Submission status: Wrong Answer

Solution code:
x = int(input())
#h, w = list(map(int, input().split()))
#((n+1)*n)//2 >= x
# (n+1)*n = 2*x
n = 1
a = ((n+1)*n)//2
while a < x:
    a = ((n+1)*n)//2
    n += 1
print(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:
import sys
n = int(input())
tmp = 0
INF = 10*11
for i in range(1,INF):
    tmp += i
    if tmp >= n:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
# X
# 1, X - 1
# 1, 2, X - 3
# 1, 2, 3, X - 6
# ...
# 1, 2, 3, ..., k, X - sum(1:k)

# max k s.t. X - (k ** 2 + k) / 2 - k > 0

X = int(input())

# 1st ans
k = 0
while X - (k ** 2 + k) / 2 - k > 0:
    k += 1

k -= 1
ans1 = X - (k ** 2 + k) // 2

# 2nd ans
d = X
k = 1
while d >= k:
    d -= k
    k += 1

if d == 0:
    ans2 = k - 1
else:
    ans2 = min(d, k - d) + k + 1

# final ans
print(min(ans1, ans2))

Submission status: Wrong Answer

Solution code:
# X
# 1, X - 1
# 1, 2, X - 3
# 1, 2, 3, X - 6
# ...
# 1, 2, 3, ..., k, X - sum(1:k)

# max k s.t. X - (k ** 2 + k) / 2 - k > 0

X = int(input())

k = 0
while X - (k ** 2 + k) // 2 - k > 0:
    k += 1
k -= 1

d = X - (k ** 2 + k) // 2
while k < d:
    k += 2
    if k < d:
        d -= 1
    else:
        break

print(min(k, d))

Submission status: Wrong Answer

Solution code:
# X
# 1, X - 1
# 1, 2, X - 3
# 1, 2, 3, X - 6
# ...
# 1, 2, 3, ..., k, X - sum(1:k)

# max k s.t. X - (k ** 2 + k) / 2 - k > 0

X = int(input())

k = 0
while X - (k ** 2 + k) // 2 - k > 0:
    k += 1
k -= 1

d = X - (k ** 2 + k) // 2
t = 1
ans = d
while True:
    if k + t + 1 > d:
        break
    if ((t ** 2 + (2 * (k + 1) - 1) * t) - d) == (k + t + 1):
        ans = k + t + 1
        break
    t += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# X
# 1, X - 1
# 1, 2, X - 3
# 1, 2, 3, X - 6
# ...
# 1, 2, 3, ..., k, X - sum(1:k)

# max k s.t. X - (k ** 2 + k) / 2 - k > 0

X = int(input())

k = 0
while X - (k ** 2 + k) / 2 - k > 0:
    k += 1
k -= 1

print(int(X - (k ** 2 + k) / 2))

Submission status: Wrong Answer

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

print(max(x-tmp, t))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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*(1+ok)//2 != n:
  ok+=1
print(ok)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())

if n == 1:
    print(1)
elif n == 2 or n == 3:
    print(2)
elif n == 4:
    print(3)
else:
    print(n//2)

Submission status: Wrong Answer

Solution code:
x = int(input())

for t in range(1000000000):
    if 2 * x < t * (t + 1):
        print(t)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

for t in range(1000000000):
    if 2 * x < t * (t + 1):
        print(t + 1)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
x = abs(int(input()))

# case of 98: (n-1)**2<n(n-1)<196<=n(n+1)<(n+1)**2, m=np.floor((2n)**1/2)-1,+1,+2  
# x - m(m-1)/2 until m-1, [x - m(m-1)/2] - m = wait, +add after wait (+1)

n = int(np.floor((2*x)**(1/2)))
m_cand = [n-1,n,n+1,n+2,n+3]


for i in m_cand:
    if (i*(i+1)<=2*x) & ((i+1)*(i+2)>2*x):
        m = i
        break
        
ans = m-1 + (x - m*(m-1)/2 - m) + 1
print(int(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

cnt = 0
i = 1

while cnt >= x:
    cnt += i
    i += 1

print(i-1)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

if abs(a * (a + 1) // 2 - X) < abs((a - 1) * a // 2 - X):
  ans = a + X - a * (a + 1) // 2
else:
  a -= 1
  ans = a + X - a * (a + 1) // 2
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = X
now = 0
for i in range(X+1):
    now += i
    if now == X:
        ans = i
        break
    elif now > X:
        ans = min(X, i - 1 + X - (now - i))
        break

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
X = int(input())

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

print(ans)

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l,r=0,10**9
while l+1!=r:
    m=(l+r)/2
    if m*(m+1)//2==n:
        print(m)
        exit()
    elif m*(m+1)//2>n:
        r=m
    else:
        l=m
print(r)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
s = int(math.ceil(x**(0.5)))
ss = s*(s+1)//2
if ss < x: print(s+1)
else: print(s)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
s = int(math.ceil(x**(0.5)))
s = s*(s+1)//2
if  s < x: print(int(math.ceil(x**(0.5))+1))
else: print(int(math.ceil(x**(0.5))))

Submission status: Wrong Answer

Solution code:
x = int(input())
s = x//2
s = s*(s+1)//2
if  s < x: print(x//2 + 1)
else: print(x//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#ABC056

x = int(input())

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

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
y = math.floor(x / 2)
if y == 1:
    print(x)
else:
    print(y)

Submission status: Wrong Answer

Solution code:
n = int(input())
i, t = 0, 0
while i < n:
    t += 1
    i += t
if i == n:
    print(t)
else:
    d = n - (i - t - (t-1))
    print(d)

Submission status: Wrong Answer

Solution code:
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(readline())
i = 1
while x:
    if x >= i and (x-i==0 or x-i>=i+1):
        x -= i
    i += 1

print(i-1)

Submission status: Wrong Answer

Solution code:
x = int(input())
t = int(x ** 0.5)
min_d = int(t * 0.5 * (t + 1))
if min_d < x:
  print(t + 1)
else:
  print(t)

Submission status: Wrong Answer

Solution code:
x = int(input())
t = int(x ** 0.5)
min_d = int(t * 0.5 * (t + 1))
if min_d == x:
  print(t)
elif (min_d + 2) <= x:
  print(t + 2)
else:
  print(t + 1)

Submission status: Wrong Answer

Solution code:
x = int(input())
t = int(x ** 0.5)
min_d = t * 0.5 * (t + 1)
if min_d == x:
  print(t)
elif (min_d + 2) <= x:
  print(t + 2)
else:
  print(t + 1)

Submission status: Wrong Answer

Solution code:
x = int(input())
t = int(x ** 0.5)
min_d = t * 0.5 * (t + 1)
if min_d == x:
  print(t)
elif min_d < x:
  print(t + 2)
else:
  print(t + 1)

Submission status: Wrong Answer

Solution code:
x = int(input())
t = int(x ** 0.5)
min_d = t * (t + 1) * 0.5
if min_d == x:
  print(t)
else:
  if min_d + t + 1 == x:
    print(t+1)
  elif min_d + t + 1 < x:
    print(t + 2)
  else:
    print(t + 3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(l-n*(n+1)//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

t = 1
while True:
	if X-t>t:
		X-=t
	if X-t==0:
		break
	t += 1
print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def kangaru(x):
    count = 0
    i = 1
    while count != x:
        if count + (i * 2 + 1) <= x:
            count += i
        elif count + i == x:
            count += i
        i += 1
    return i - 1

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n = int(input())
#for i in range(10**5):
s = int((2*n)**(1/2))
for i in range(s-1,s+1):
    if n <= i*(i+1)/2: 
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
now = 0
i = 0
while True:
    i += 1
    if i == X - now:
        now += i
    elif i * 2 < X - now:
        now += i
    if now == X:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1:
  print(1)
if X==2:
  print(2)
else:
  ans=X//2
  print(ans)

Submission status: Wrong Answer

Solution code:
# むねん

Submission status: Wrong Answer

Solution code:
X = int(input())

count = 0

for i in range(1, X):
  count += i
  if count >= X:
    print(i)
    quit()

Submission status: Wrong Answer

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

cumsum = [0 for _ in range(10**5)]
for i in range(1, 10**5):
    cumsum[i] = cumsum[i-1] + i

def solve1(X):
    ok = 1
    for i, c in enumerate(cumsum):
        if i == X:
            ok = i
            break
        if X - c > i:
            ok = (X - c)
        else:
            break
    return ok

def solve2(X):
    ok = 1
    for i, c in enumerate(cumsum):
        if i == X:
            ok = i
            break
        if X - c > i:
            ok = (X - c)
        else:
            # i+1マイナスに動く,そっから(i+1+X-c)秒になるのを待つ
            ok = i + X - c
            break
    return ok



def main():
    X = I()
    s1 = solve1(X)
    s2 = solve2(X)
    print(min(s1, s2))
main()

Submission status: Wrong Answer

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

cumsum = [0 for _ in range(10**5)]
for i in range(1, 10**5):
    cumsum[i] = cumsum[i-1] + i

def solve1(X):
    ok = 1
    for i, c in enumerate(cumsum):
        if i == X:
            ok = i
            break
        if X - c > i:
            ok = (X - c)
        else:
            break
    return ok

def solve2(X):
    ok = 1
    for i, c in enumerate(cumsum):
        if i == X:
            ok = i
            break
        if X - c > i:
            ok = (X - c)
        else:
            remain = X - c
            ok = remain + (i + 1)
            # time = X - c + (i + 1)
            break
    return ok



def main():
    X = I()
    s1 = solve1(X)
    s2 = solve2(X)
    print(min(s1, s2))
main()

Submission status: Wrong Answer

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

cumsum = [0 for _ in range(10**5)]
for i in range(1, 10**5):
    cumsum[i] = cumsum[i-1] + i

def main():
    X = I()
    ok = 1
    for i, c in enumerate(cumsum):
        if i == X:
            ok = i
            break
        if X - c > i:
            ok = (X - c)
        else:
            break
    print(ok)

main()

Submission status: Wrong Answer

Solution code:
n  = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
l, r = 0, 100000
while l + 1 < r:
  m = (l + r) / 2
  if m * (m + 1) // 2 < N:
    l = m
  else:
    r = m
print(r)

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:
X = int(input())
ans = 0
for i in range(X):
    ans += i
    if ans >= X:
        print(i)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
r=0
while 1:
  if x-r==r+1:
    print(r)
    exit()
  if x-r==r+2:
    print(r+2)
    exit()
  r+=1

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
X = int(input().rstrip())
S = 0
i = 1
while S < X:
    S += i
    i += 1
if S == X:
    print(i - 1)
else:
    j = S - X
    ans_1 = (i - 1) + 2 * j
    S -= (i-1)
    j = X - S
    ans_2 = (i - 2) + 2 * j
    print(min(ans_1, ans_2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
if x%2==1:
    print(x//2+1)
else:
    print(x//2)

Submission status: Wrong Answer

Solution code:
X=int(input())
#幅
from collections import deque
def dfs_2(start,goal):
  q = deque([])   # スタック
  q.append([start])
  flg = 0
  while flg==0:
    p = q.popleft()         # スタック取りだし（先頭）
    jp = len(p)
    if p[-1]-jp == goal or p[-1]+jp == goal:
      print(p)
      return jp
    else:
      p0 = [p[-1]]
      pp = [p[-1]+jp]
      pm = [p[-1]-jp]
      q.append(p+pp)# スタック追加
      q.append(p+pm)
      q.append(p+p0)

print(dfs_2(0,X))

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X = I()
    def solve(x):
        res = (-1+sqrt(1+8*x))/2
        return res + (int(res)==res)
    print(int(solve(X)))
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X = I()
    def solve(x):
        res = (-1+sqrt(1+8*x))/2
        if res != int(res):
            res = int(res)
            res += solve(x-(res+1)*res/2)
        return res
    print(int(solve(X)))
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import bisect

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

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

if n == li[bisect.bisect_left(li,n)]:
    print(bisect.bisect_left(li,n))
    exit()
b = bisect.bisect_left(li,n)-1
a = n-li[b]
print(a+b)