# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676516 | QwertyPi | Odd-even (IZhO11_oddeven) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
from math import sqrt
n = int(input())
def isqrt(n):
x = n
y = (x + 1) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x
x = isqrt(n * 2)
while x * (x - 1) // 2 >= n:
x -= 1
while x * (x + 1) // 2 < n:
x += 1
print(n * 2 - x)