Problem:
 Score : 300 points    Problem Statement Given an integer N , find the base -2 representation of N .  Here, S is the base -2 representation of N when the following are all satisfied:   S is a string consisting of 0 and 1 .  Unless S =  0 , the initial character of S is 1 .  Let S = S_k S_{k-1} ... S_0 , then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N .   It can be proved that, for any integer M , the base -2 representation of M is uniquely determined.      Constraints  Every value in input is integer.  -10^9 \leq N \leq 10^9         Input Input is given from Standard Input in the following format:  N       Output Print the base -2 representation of N .        Sample Input 1 -9      Sample Output 1 1011  As (-2)^0 + (-2)^1 + (-2)^3 = 1 + (-2) + (-8) = -9 , 1011 is the base -2 representation of -9 .       Sample Input 2 123456789      Sample Output 2 11000101011001101110100010101       Sample Input 3 0      Sample Output 3 0

Solution (Python):
n=int(input())
flg = 0
if n < 0:
    n *= -1
    flg = 1
l=list(map(int,str(bin(n))[2:]))
for i in range(1,len(l)+3): 
    try:
        if l[-i] == 2:
            l[-i] = 0
            if i == len(l):
                l.insert(0,1)
            else:
                l[-(i+1)]+=1
        if i%2==flg and l[-i]==1:
            if i == len(l):
                l.insert(0,1)
            else:
                l[-(i+1)]+=1
    except:
        pass
s = ''.join([str(x) for x in l])
print(s)

Solution (Python):
n=int(input())

if n==0:
    ans="0"
else:
    ans=""
    while n!=0:
        ans=str(n%2)+ans
        n=-1*(n//2)
ans=int(ans)
print(ans)

Solution (Python):
n = int(input())
li = []
res = n % (-2)
ans = n // (-2)
ans1 = n
if res != 0:
    res = ans1 - (-2) * (ans + 1)
    ans = ans + 1
ans1 = ans
li.append(res)
p = 0
if ans == 0 or ans == 1:
    p = 1
    if ans == 1:
      li.append(ans)
while p == 0:
  res = ans % (-2)
  ans = ans // (-2)
  if res != 0:
      res = ans1 - (-2) * (ans + 1)
      ans = ans + 1
  ans1 = ans
  li.append(res)
  if ans == 0 or ans == 1:
    p = 1
    if ans == 1:
      li.append(ans)
li = [str(n) for n in li]
pr = ""
for i in range(len(li)):
  pr += li[-1-i]
print(pr)

Solution (Python):
N = int(input())
if N == 0:
    ans = '0'
else:
    ans = ''
    while N != 0:
        ans = str(N % 2) + ans
        N = -(N // 2)
print(ans)

Solution (Python):
n = int(input())

ans = 0
if n != 0:
    s = ''
    while n != 0:
        if n % 2 != 0:
            n -= 1
            s = '1' + s
        else:
            s = '0' + s
        n //= -2
    ans = s

print(ans)

Solution (Python):
import sys
from math import ceil

N = int(input())
ans = []

if N == 0:
    print(0)
    sys.exit()

while N != 1:
    if N % 2 == 0:
        ans.append('0')
    else:
        ans.append('1')
    N = ceil(N / -2)
    
ans.append('1')
ans = ''.join(ans)
print(ans[::-1])

Solution (Python):
def 解():
    iN = int(input())
    ans = []
    while True:
        if iN in {1,0}:
            ans.append(iN)
            break
        if iN < 0 :
            if iN == -1:
                iN = 1
                ans.append(1)
            else:
                iN *= -1
                ans.append(iN % 2)
                if iN % 2 :
                    iN //= 2
                    iN += 1
                else:
                    iN //= 2

        else:
            ans.append(iN % 2)
            iN //= 2
            iN *= -1
    print("".join(map(str,ans[::-1])))
解()

Solution (Python):
N = int(input())
ans = ""
v = 0
i = 0
while N != 0:
    if N % 2**(i+1) == 2**i:
        N -= (-2)**i
        ans += "1"
    else:
        ans += "0"
    i += 1

if len(ans) == 0:
    ans = "0"
print(ans[::-1])

Solution (Python):
n=int(input())
i=0

if(n==0):
    print(0)
elif(n>0):
    tmp=1
    mainasu=0
    i=1
    while(tmp < n):
        tmp+=4**i
        mainasu-=2*4**(i-1)
        i+=1
    x=bin(n-mainasu)
    for i in range(2,len(x)):
        if(i%2==1):
            if(x[i]=="1"):
                print("0",end="")
            else:
                print("1",end="")
        else:
            print("{}".format(x[i]),end="")
    print()
else:
    tmp=-2
    mainasu=1
    i=1
    while(n < tmp):
        tmp-=2*4**i
        mainasu+=4**i
        i+=1
    x=bin(mainasu-n)
    for i in range(2,len(x)):
        if(i%2==1):
            if(x[i]=="1"):
                print("0",end="")
            else:
                print("1",end="")
        else:
            print("{}".format(x[i]),end="")
    print()

Solution (Python):
N = input()
res = []
while N != 0:
	if N % (-2) == 0:
		res.append("0")
	else:
		res.append("1")
		N -= 1
	N //= (-2)
if len(res) == 0:
	res.append("0")
print "".join(reversed(res))

Solution (Python):
N=int(input().strip())
i=0
S=""
if N==0:
    print(0)
else:
    while N!=0:
        if N%(2**(i+1))==0:
            sp="0"
        else:
            sp="1"
        S=sp+S
        N=N-(int(sp)*((-2)**i))
    
        i=i+1

    print(int(S))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

    if N == 0:
        print(0)
        return

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

    ans = ""
    total = 0
    for i in range(31, 0, -1):

        l, r = dp[i - 1]
        if i % 2 == 0:
            a = 2 ** i
        else:
            a = -(2 ** i)

        rest = N - total

        if l + a <= rest <= r + a:
            total += a
            ans += "1"
        else:
            ans += "0"

    if N - total == 1:
        ans += "1"
    else:
        ans += "0"
    print(ans.lstrip("0"))


if __name__ == '__main__':
    main()

Solution (Python):
def base2_number(n):
    result = ""
    while True:
        rem = n % 2
        if rem:
            n -= 1
        n = n // -2
        result += str(abs(rem))
        if n == 0:
            break
    return int(result[::-1])
n = int(input())
print(base2_number(n))

Solution (Python):
N = int(input())
S = ''
ans_l = []
if N != 0:
	while N != 0:
		if N % 2 == 0:
			N = N // (-2)
			S = '0' + S
		else:
			N = (N-1) // (-2)
			S = '1' + S
else:
	S = '0'
print(S)

Solution (Python):
import math
N = int(input())
 
def minus_2(n):
    ans = ''
    if n == 1:
        ans += '1'
    elif n == 0:
        ans += '0'
    else:
        while n != 1:
            if n % 2 == 0:
                ans += '0'
            else:
                ans += '1'
            n = math.ceil(n/-2)
        ans += '1'
        ans = ans[::-1]
        
    return ans
 
print(minus_2(N))

Solution (Python):
n=int(input())
a=''
while (n!=0):
    if n%2==0:
        a='0'+a
        n/=-2
    else:
        a='1'+a
        n-=1
        n/=-2
if(a==""):
    a='0'
print(a)

Solution (Python):
N = int(input())
ans = N
result = []
nishin = ''
if(N == 0):
    nishin = '0'
    print(nishin)
    exit()
while ans != 0:
    if(ans % 2 == 1):
        ans = (ans-1)/(-2)
        result.append(1)
    else:
        ans = ans/(-2)
        result.append(0)

result.reverse()
for i in range(len(result)):
    nishin = nishin+str(result[i])
print(nishin)

Solution (Python):
N = int(input())
t = ""
if N == 0:
    print(0)
else:
    while N != 0:
        if N % -2:
            t += "1"
            N -= 1
        else:
            t += "0"
        N /= -2

    print(t[::-1])

Solution (Python):
N = int(input())
if N == 0:
    print('0')
else:
    k = 1
    ans = []
    while(True):
        if N % ((-2) ** k) == 0:
            ans.append('0')
        else:
            ans.append('1')
            N -= (-2) ** (k - 1)
        if N == 0:
            break
        else:
            k += 1
    print(''.join(ans[::-1]))

Solution (Python):
n = int(input())
k = 1
kotae = []
kotae2 = []

if n != 0:
    while n != 0:
        if n % ((-2) ** k) == 0:
            kotae.append(0)
        else:
            kotae.append(1)
            n = n - ((-2) ** (k - 1))
        k = k + 1

    for i in kotae[::-1]:
        kotae2.append(str(i))

    print("".join(kotae2))
else:
    print(0)

Solution (Python):
n=int(input())
ans=[]
a=n
while a!=0:
    ans.append(a%2)
    a=(a-a%2)//(-2)
if ans==[]:
    ans=[0]
print(''.join(map(str, reversed(ans))))

Solution (Python):
N = int(input())

ans = []
while N != 0:
    ans.append(N % 2)
    N = (N - N % 2) // -2

if ans == []:
    ans =[0]

print(''.join(map(str, reversed(ans))))

Solution (Python):
n = int(input())
ant = 0
if n == 0:
    ant = 1
ans = ''
for i in range(10000):
    if n == 0:
        break
    if n % 2 ** (i + 1) == 0: 
        ans = '0' + ans
    else:
        n -= (-2)**i
        ans = '1' + ans
if ant == 0:
    print(ans)
else:
    print('0')

Solution (Python):
N = int(input())
ans = ''
N1 = N
i = 1
if N == 0:
    print('0')
else:
    while N1 != 0:
        if N1 % 2 == 0:
            ans = '0'+ans
            N1 =int(N1/2)
        else:
            ans = '1'+ans
            N1 = int((N1-i)/2)
        i *= -1
    print(ans)

Solution (Python):

N=int(input())
S=""
for i in range(50):
    if N%(-2)==0:
        S="0"+S
    else:
        S="1"+S
        N-=1
    N=N//(-2)
print(int(S))

Solution (Python):
n=input()
s=[]
n=int(n)
i=0
while n!=0:
  if n%2**(i+1)==0:
    s.append("0")
  else:
    s.append("1")
    n-=(-2)**i
  i+=1
s.reverse()
if s==[]:
  s=["0"]
print("".join(s))

Solution (Python):
N = int(input())
if N == 0:
    print('0')
    exit()
check = 1
now = 0
ans = ''
count = 1
while True:
    check *= 2
    a = N%check

    if now == N:
        break    
    else:
        if (a-now)%check != 0:
            ans = ans + '1'
            now += count
        else:
            ans = ans + '0'
        count *= -2

print(ans[::-1])

Solution (Python):
def m():
    n = int(input())
    L = 32
    a = [0] * L
    b = [0] * L
    b[0], b[1] = 1, -2
    ans = ["0"] * L
    for i in range(L):
        a[i] = (-2) ** i

    for i in range(2, L):
        b[i] = a[i] + b[i-2]
    
    def solve(p):
        if p == 0:
            return
        if p < 0:
            for j in range(1, L, 2):
                if p >= b[j]:
                    p -= a[j]
                    ans[j] = "1"
                    solve(p)
                    break
        else:
            for j in range(0, L, 2):
                if p <= b[j]:
                    p -= a[j]
                    ans[j] = "1"
                    solve(p)
                    break
    solve(n)
    ans.reverse()
    return int("".join(ans))


print(m())

Solution (Python):
n=int(input())
def isdig(n):
  if n>=0:
    digit=0
    while n>2**digit:
      n-=2**digit
      digit+=2
  else:
    digit=1
    while n<-2**digit:
      n+=2**digit
      digit+=2
  return digit
x=["0"]*(isdig(n)+1)
while n!=0:
  digit=isdig(n)
  if digit%2==0:
    n-=2**digit
  else:
    n+=2**digit
  x[digit]="1"
x.reverse()
print("".join(x))

Solution (Python):
N = int(input())
result = []
def change(num):
    if num != 0:
        div = num // (-2)
        mod = num % (-2)
        if mod == -1:
            div += 1
            mod = 1
        result.append(mod)
        if div == 1:
            result.append(div)
            print(''.join(map(str, result[::-1])))
        else:
            n = div
            change(n)
    else:
        print(0)
change(N)

Solution (Python):
N=int(input())
ans=""
while N!=0:
    if N%2!=0:
        
        ans="1"+ans
        N-=1
    else:
        ans="0"+ans
    N=N/-2   
if ans=="":
    ans="0"
print(ans)

Solution (Python):

def change_2r(N):
    if N==0:
        return [0]
    list=[]
    while N>=2:
        list.append(N%2)
        N=int((N-N%2)/2)
    list.append(1)
    return list
  

def moveup(N,i):
    if len(N)<=i:
        N.append(1)
    else:
        if N[i]==0:
            N[i]=1
        elif N[i]==1:
            N[i]=0
            moveup(N,i+1)

N=int(input())
i=0
if N>=0:
    Nlist=change_2r(N)
    while i<len(Nlist):
        if i%2!=0 and Nlist[i]==1:
            moveup(Nlist,i+1)
        i+=1
else:
    N=-N
    Nlist=change_2r(N)
    while i<len(Nlist):
        if i%2==0 and Nlist[i]==1:
            moveup(Nlist,i+1)
        i+=1
        
Nlist.reverse()
print(''.join(map(str,Nlist)))

Solution (Python):
def f(N):
    if N == 0 or N == 1:
        return str(N)
    else:
        return f(N // 2 * -1) + str(N % 2)

N = int(input())
print(f(N))

Solution (Python):
import sys

N = int(input())

k = 0
S = []
while 1:
    if N % 2 == 0:
        S.append(0)
    else:
        N -= (-1) ** k
        S.append(1)
    N /= 2
    k += 1
    if N == 0:
        break

for i in S[::-1]:
    sys.stdout.write(str(i))
sys.stdout.write('\n')

Solution (Python):
N = int(raw_input())
res = []
base = N
x = 1
if base == 0:
    print(0)
else:
    while True:
        if base == 0:
            break
        if base % (2 ** x) != 0:
            res.append(1)
            base -= (-2) ** (x-1)
        else:
            res.append(0)
        x += 1
    print(''.join([str(i) for i in reversed(res)]))

Solution (Python):
N = int(input())
anslist = []
i = 0
j = 1
key = 0
while True:
    if N == 0:
        break
    if N % pow(-2, i + 1) != 0:
        anslist.append(1)
        N -= pow(- 2, i)
        key += pow(-2, i)
    else:
        anslist.append(0)
    i += 1
    
if len(anslist) == 0:
    anslist.append(0)
for i in anslist[::-1]:
    print(i, end = "")
print()

Solution (Python):
n = int(input())
s = ""
k = 0
while n!=0:
  if n%(2**(k+1)) == 2**k:
    if k%2 == 0:
      n -= 2**k
    else:
      n += 2**k
    s = "1"+s
  else:
    s = "0"+s
  k += 1

if s=="":
  s="0"

print("".join(s))

Solution (Python):
n = int(input())
def divminus2(n):
    if n%2 == 1:
        q = n // -2 + 1
        r = n % 2
    else:
        q = n // -2
        r = 0
    return q,r

ans_list = []
while n != 0:
    q,r = divminus2(n)
    n = q
    ans_list.append(str(r))

ans_list.reverse()
if ans_list == []:
    print("0")
else:
    print("".join(ans_list))

Solution (Python):
n = int(input())
def divminus2(n):
    if n%2 == 1:
        q = n // -2 + 1
        r = abs(n % 2)
    else:
        q = n // -2
        r = 0
    return q,r

ans_list = []
while n != 0:
    q,r = divminus2(n)
    n = q
    ans_list.append(str(r))

ans_list.reverse()
if ans_list == []:
    print("0")
else:
    print("".join(ans_list))

Solution (Python):
n = int(input())
def divminus2(n):
    if n%2 == 1:
        q = n // -2 + 1
        r = abs(n % 2)
    else:
        q = n // -2
        r = 0
    return q,r

ans_list = []
while n != 0:
    q,r = divminus2(n)
    n = q
    ans_list.append(str(r))

ans_list.reverse()
if ans_list == []:
    print("0")
else:
    print("".join(ans_list))

Solution (Python):
n = int(input())
ans = ""

if n == 0: 
    ans = "0"
    
while n != 0:
    if n % 2 == 0:
        ans += "0"
    else:
        ans += "1"
        n -= 1

    n = n//-2
print(ans[::-1])

Solution (Python):
n=int(input())
s=''
if n==0:s='0'
while n!=0:
    if n%2==0:s+='0'
    else:s+='1'
    n=-(n//2)
print(s[::-1])

Solution (Python):
n=int(input())
a=[]
while n!=0:
 if n%2==0:
  a.append('0')
 else:
  a.append('1')
  n=n-1
 n=n//-2
if a==[]:
 print(0)
else:
 a.reverse()
 print(''.join(a))

Solution (Python):
n = int(input())
s = ""
while(n != 0):
    if n % -2 == 0:
        s  = "0" + s
    else:
        s  = "1" + s
        n = n - 1
    n //= -2
if s == "":
    s = "0"
print(s)

Solution (Python):
def solve():
    n = int(input())
    s = ''
    t = 1
    if n == 0:
        print(0)
        return
    while n != 0:
        a = abs(n % 2)
        s = str(a) + s
        n -= a * t
        n = int(n / 2)
        t *= -1
    print(s)


solve()

Solution (Python):
n = int(input())
if n > 0:key = 1
if n < 0:key = 0
lis = []
if n == 0:
  lis.append("0")
while abs(n) >= 1:
  if n % 2 == 1:
    n -= 1
    lis.insert(0,"1")
  else:
    lis.insert(0,"0")
  n = n // (-2)
print("".join(lis))

Solution (Python):
n = int(input())

if n == 0:
	print('0')
	exit()

i = 0
s = ''
while n != 0:
	if n % (2**(i+1)) != 0:
		s += '1'
		n -= (-2)**i
	else:
		s += '0'
	i += 1

print(s[::-1])

Solution (Python):
N = int(input())

A=[]
n=N

for i in range(32):
    if n % 2 != 0:
        A.append(1)
        n -= 1
    else:
        A.append(0)
        
    n /= -2
    
ret=""
flg=0
for i in range(len(A)-1,-1,-1):
    if A[i] != 0:
        flg = 1
    if flg != 0:
        ret += str(A[i])
    
if ret=="":
    ret = "0"
print (ret)

Solution (Python):

n = int(input())

if n==0:
    print ('0')
    exit()

i=0
s=''
while(n!=0):
    if n%(2**(i+1))!=0:
        s+='1'
        n-=(-2)**i
    else:
        s+='0'
    i+=1
print (s[::-1])

Solution (Python):
n = int(input())
s = ''
 
if n == 0:
    print(0)
    exit()
 
i = 0
while n != 0:
    if n % (2 ** (i+1)) != 0:
        s += '1'
        n -= (-2) ** i
    else:
        s += '0'
    i += 1
print(s[::-1])

Solution (Python):
N = int(input())

if N == 0:
    print(0)
else:
    ans = ""
    while abs(N) > 0:
        mod = N % (-2)
        N //= -2
        N += (mod < 0)
        ans += str(abs(mod))

    print(ans[::-1])

Solution (Python):
N = int(input())
B = []
i = 0
if N == 0:
    print(0)
    exit()
while N != 0:
    if N % (2**(i+1)) != 0:
        B.insert(0,1)
        N -= (-2)**i
    else:
        B.insert(0,0)
    
    
    i += 1
print(''.join(map(str, B)))

Solution (Python):
"""
C - Base -2 Number
-2進数を出力する
"""

N = int(input())

num = []
while True:
    quotient = N // (-2)
    mod = N % -2
    
    if mod < 0:
        quotient += 1
        mod = 1
    
    num.append(mod)
    N = quotient

    if quotient == 0:
        break
        
num.reverse()
for n in num:
    print(n, end="")

Solution (Python):
N = int(input())

t = 0
ans = ''
while N != 0:
    a = N%2
    if t % 2 == 0:
        ans = str(int(a)) + ans
        N -= a
        N /= 2
    else:
        ans = str(int(a)) + ans
        N += a
        N /= 2
    t +=1
if ans == '':
    ans = '0'
print(ans)

Solution (Python):
import math

N = int(input())
if N == 0:
    print('0')
    quit()

a = 1
res = ""
while N != 0:
    if N % (2 * a) == 0:
        res = "0" + res
    else:
        res = "1" + res
        N -= a
    a *= -2
print(res)

Solution (Python):
n = int(input())

ans = []
for i in range(1, 40):
    if n % (2**i):
        n -= (-2)**(i-1)
        ans.append('1')
    else:
        ans.append('0')
    if not n:
        break
print(''.join(reversed(ans)))

Solution (Python):
n = int(input())

ans = []
for i in range(1, 40):
    if n % (2**i):
        n -= (-2)**(i-1)
        ans.append('1')
    else:
        ans.append('0')
    if not n:
        break
print(''.join(reversed(ans)))

Solution (Python):
N = int(input())

if N ==0:
    print('0')
    exit()
if N == 1:
    print('1')
    exit()
if N == -1:
    print('11')
    exit()
if N == -2:
    print('10')
    exit()

m = 400
length = 0
for i in range(3, m):
    posneg = 1 if i % 2 == 1 else -1
    if posneg == 1 and 4**((i+1)/2 - 1) / 3 <= N and N <= 4**((i+1)/2) / 3:
        length = i
        break
    elif posneg == -1 and -(4)**((i+1)/2 - 1)/ 3 >= N and N >= -(4)**((i+1) /2) / 3:
        length = i
        break
ans = ''
for i in range(length, 2, -1):
    posneg = 1 if i % 2 == 1 else -1
    if posneg == 1:
        if 4**((i+1)/2 - 1) / 3 <= N and N <= 4**((i+1)/2) / 3:
            N -= 2**(i - 1)
            ans += '1'
        else:
            ans += '0'
    elif posneg == -1:
        if posneg == -1 and -(4)**((i+1)/2 - 1)/ 3 >= N and N >= -(4)**((i+1) /2) / 3:
            N += 2**(i - 1)
            ans += '1'
        else:
            ans += '0'

if N ==	0:
    ans += '00'
if N == 1:
    ans += '01'
if N == -1:
    ans += '11'
if N == -2:
    ans += '10'


print(ans)

Solution (Python):
N = int(input())

Ans = ""
while N!=0:
    Ans = str(N%2) +Ans
    N = (N - N%2)//2
    N *= -1

print(Ans if Ans!="" else 0)

Solution (Python):
import sys

N = int(input())

if N==0:
    print(0)
    sys.exit()

ans = ""
b = -2
while N!=1:
    if N%b==0:
        ans += "0"
        N = N/b
    else:
        ans += "1"
        N = (N-1)/b
ans += "1"
print(ans[::-1])

Solution (Python):
import math

def main():
	n = int(input())
	ans = ""

	i = 0

	if n == 0:
		print(0)
		return 

	while n != 0:
		if n % (2 ** (i + 1)) != 0:
			ans += "1"
			n -= (-2) ** i
		else:
			ans += "0"

		i += 1

	print(ans[::-1])

if __name__ == '__main__':
	main()

Solution (Python):


N = int(input())

if N==0:
    print(0)
    exit()

a = ""
b = -2

while N!=1:
    if N%b==0:
        a += "0"
        N = N//b
    else:
        a += "1"
        if N>0:
            N = N//b + 1
        else:
            N = N//b + 1
if N==1:
    a += "1"
print(a[::-1])

Solution (Python):
n=int(input())
result=''
if n==0:
    result='0'
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))

Solution (Python):
n = int(input())
a = []
if n ==0:
  print(0)
else:
  while n != 0:
    if n%2 ==0:
      n = n/(-2)
      a.append("0")
    else:
      n = (n-1)/(-2)
      a.append("1")
    
  b = ""
  for i in range(len(a)):
    b += a[len(a)-i-1]

  print(b)

Solution (Python):
n = int(input())

ans = ""

i = 0
base = 1
while(n != 0):
    if(n % (base*2) == 0):
        ans += "0"
    else:
        ans += "1"
        n -= base
    i += 1
    base *= -2

if(ans == ""):
    ans = "0"

print(ans[::-1])

Solution (Python):
n = int(input())
v = -2
s = "" if n != 0 else "0"
while n != 0:
    if n%v != 0:
        s += "1"
        n -= v//(-2)
    else:
        s += "0"
    v *= -2
print(s[::-1])

Solution (Python):
import sys
N = int(input())
if N == 0:
  print(0)
  sys.exit()
ans = ''
k = 1
while N != 0:
  if N%(2**k) == 0:
    ans = '0'+ans
  else:
    ans = '1'+ans
    N = N-((-2)**(k-1))
  k += 1
print(ans)

Solution (Python):
n = int(input())

s = ''
while n!=0:
  x = abs(n%2)
  n = (n - x)//(-2)
  s = str(x) + s

if s=='':
  print(0)
else:
  print(s)

Solution (Python):
n = int(input())

s = ''

while n != 0:
    r = abs(n % 2)
    n = (n - r) // (-2)
    s = str(r) + s

if s == '':
  s = '0'

print(s)

Solution (Python):
n = int(input())

s = ''

while n != 0:
    r = abs(n % 2)
    n = (n - r) // (-2)
    s = str(r) + s

if s == '':
  s = '0'

print(s)

Solution (Python):
n = int(input())
dig,d_min,d_max = 0,0,0
d_range = []
ans = ""
while not d_min <= n <= d_max:
    if dig%2 == 0:  d_max += 2**dig
    else:  d_min -= 2**dig
    dig += 1
    d_range.append([d_min,d_max])

for i in range(dig-1):
    check = n- (-2)**(dig-1-i)
    if not d_range[dig-2-i][0] <= check <= d_range[dig-2-i][1]:
        ans += "0"
    else:
        ans += "1"
        n = check
if n == 1:
    ans+="1"
else:
    ans += "0"

print(ans)

Solution (Python):


def getMBinary(N):
    S = ""
    
    while N != 0:
        if N % -2 == 0:
            S = "0" + S
        if N % -2 != 0:
            S = "1" + S
            N = N - 1
        N = N // -2
    
    if S == "":
        S = "0"
    
    return S
if __name__ == "__main__":
    N = int(input())
    print(getMBinary(N))

Solution (Python):
import math

n=int(input())

if n==0 :
    print(0)
else:


    A=[]
    lim=int(math.log2(abs(n)))
    for i in range(lim+4):
        n%=2**(lim+4-i)
        A.append(n)
        


    ans=""

    

    if A[lim+4-1]==1:
        ans+="1"
    else:
        ans+="0"

    bi=0
    st=1
    for i in range(1,lim+4): 
        if bi==0:
            st+=2**(i-1)
        
        if A[lim+4-i-1]>=st and A[lim+4-i-1]<st+2**i :
            ans+="1"
        else:
            ans+="0"
        bi=(bi+1)%2

    

    ans2=""
    zero=0
    for i in range(len(ans)):
        if ans[-i-1]=="0" and zero==1:
            ans2+="0"
        elif ans[-i-1]=="1":
            zero=1
            ans2+="1"

    print(ans2)

Solution (Python):
n = int(input())
nn = n
ans = ''
a = 2
while True:
	if n == 0:
		break
	if n % a == 0:
		ans += '0'
	else:
		ans += '1'
		n -= (a//2)

	n = n//2
	if a == 2:
		a = -2
	else:
		a = 2


ans = ans[::-1]
if nn == 0:
	print(0)
else:
	print(ans)

Solution (Python):
n = int(input())

s = ''
while n!=0:
    if n%2 == 0:
        s = '0' + s
        n /= -2
    else:
        s = '1' + s
        n -= 1
        n /= -2
print('0' if s == '' else s)

Solution (Python):
import sys
import math
y = int(input().split()[0])
result = ""
i = 0
while True:
    z = (-2) ** (i+1)
    x = y % z
    if x != 0:
        y = y + x
        result = "1" + result
    else:
        result = "0" + result
    if y == 0:
        break
    i = i + 1
print(result)

Solution (Python):
N = int(input())

def to_bits(n):
    if n == 0:
        return [0]
    else:
        bits = []
        while (n != 0):
            bit = n % 2
            bits.append(bit)
            n = (n - bit) // (-2)
        return list(reversed(bits))

print(''.join([str(bit) for bit in to_bits(N)]))

Solution (Python):
import sys


n = int(input())

if n == 0:
    print('0')
    sys.exit()

l1 = []
t = 0
s = 0
a = 0
while a < 10 ** 9:
    a = 2 ** t
    s += a
    l1.append(s)
    t += 2

l2 = []
t = 1
s = 0
a = 0
while a < 10 ** 9:
    a = 2 ** t
    s += a
    l2.append(s)
    t += 2


result = []
while n != 0:
    if n > 0:
        N = abs(n)
        for i in range(len(l1)):
            if N <= l1[i]:
                x = 2 * i
                break
        n -= (-2) ** x
        result.append(x)
    else:
        N = abs(n)
        for i in range(len(l2)):
            if N <= l2[i]:
                x = 2 * i + 1
                break
        n -= (-2) ** x
        result.append(x)

ans = []
for i in range(result[0], -1, -1):
    if i in result:
        ans.append('1')
    else:
        ans.append('0')

answer = ''.join(ans)
print(answer)

Solution (Python):
N = int(input())
s = ''

while N != 0:

    if N % (-2) == 0:
        s = '0' + s
    else:
        s = '1' + s
        N -= 1
    N /= (-2)

if s =='':
    s = '0'
print(s)

Solution (Python):

N = int(input())

if N == 0:
    print('0')
else:

    idx = 0
    while True:
        idx += 1
        left = sum([(-2)**i for i in range(idx+1) if i%2==1])
        right = sum([(-2)**i for i in range(idx+1) if i%2==0])
        if left <= N <= right:
            break

    max_idx = idx
    coeff = [0 for _ in range(max_idx+1)]
    for idx in range(max_idx, 0-1, -1):
        left = sum([(-2)**i for i in range(idx) if i%2==1])
        right = sum([(-2)**i for i in range(idx) if i%2==0])

        if not left <= N <= right:
            N -= (-2)**(idx)
            coeff[idx] = 1
    
    
    print(''.join(map(str, reversed(coeff))))

Solution (Python):
n = int(input())

s = ""
while(n != 0):
    if n%2 == 0:
        s = '0' + s
        n /= -2
    else:
        s = '1' + s
        n -= 1
        n /= -2

if s == '':
    s = '0'

print(s)

Solution (Python):
def main():
    N = int(input())
    if N == 0:
        print('0')
    l = []
    while N:
        l.insert(0, str(-(N % (-2))))
        if l[0] == '1':
            N -= 1
        N = N // -2
    print("".join(l))

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

S = ""
while(N != 0):
	if (N % 2 == 0):
		S = '0' + S
		N /= -2
	else:
		S = '1' + S
		N -= 1
		N /= -2

if(S == ""):
	S = "0"

print(S)

Solution (Python):
def binn(n):
    if n == 0: return
    r = n % -2
    if r != 0:
        r = 1
    binn((n - r) // -2)
    print(r, end="")

n = int(input())
if n == 0:
    print(0)
else:
    binn(n)
    print()

Solution (Python):
N = int(input())
sho = N
if sho == 0 or sho == 1:
    kotae = str(sho)
else:
    kotae = ''
while sho != 1 and sho != 0:
    if sho % (-2) == 0:
        newsho = sho // (-2)
    else:
        newsho = sho // (-2) + 1
    amari = sho - newsho * (-2)
    kotae = str(amari) + kotae
    if newsho == 1:
        kotae = str(newsho) + kotae
    sho = newsho
print(kotae)

Solution (Python):


n = int(input())
a = ""

if n == 0:
    print(0)
else:
    while n != 0:
        if n % 2 == 0:
            a = "{0}{1}".format(0, a)
            n /= -2
        else:
            a = "{0}{1}".format(1, a)
            n = (n-1)/(-2)
    print(a)

Solution (Python):
import sys

n = int(input())
res = []

if n==0:
    print(0)
    sys.exit()
    
while n!=0:
    if n%2 == 1:
        res.append(1)
        n = (n-1)/(-2)
    else:
        res.append(0)
        n = n/(-2)


for i in reversed(res):
    print(i, end="")

Solution (Python):
N = int(input())

S = ''

while N != 0:
    if N%(-2) == 0:
        S = '0' + S
    else:
        S = '1' + S
        N -= 1
    N = N/(-2)
    
if S =='':
    S = '0'

print(S)

Solution (Python):
def toBasen2(x, sign):
    foo = ''
    k = 1
    while k <= x:
        if (x & k) == k:
            foo += '1'
            if not sign:
                x += k
        else:
            foo += '0'
        k <<= 1
        sign = not sign
    if foo == '':
        foo = '0'
    return foo[::-1]

def main():
    x = int(raw_input())
    if x >= 0:
        print toBasen2(x, True)
    else:
        print toBasen2(-x, False)

if __name__ == '__main__':
    main()

Solution (Python):
def ip():
    return int(input())
    
def ipp():
    return map(int,input().split())
    
def sar():
    return list(ipp())
    
def pars(a):
    print(''.join(list(map(str, a))))
    print('\r')
    
def parl(a):
    print('\r'.join(list(map(str, a))))
    print('\r')
    


if __name__=='__main__':
    T=1
    
    for _ in range(T):
        n = ip()
        k = []
        if n==0:
            print(0)
        i = 0
        while n is not 0:
            k.append((n%(-2)))
            n = n//(-2)
            if (k[-1] == -1):
                k[-1] = 1
                n+=1
            i+=1
        k = k[::-1]
        pars(k)

Solution (Python):
n = int(input())
ans = ''
if n == 0:
    ans = '0'
while n!= 0:
    if n % 2 == 0:
        ans = '0' + ans
    else:
        ans = '1' + ans
        n -= 1
    n //= -2
print(ans)

Solution (Python):
n = int(input())
if n == 0:
    print(0)
    exit()
s = ""
while n:
    s = str(n%2) + s
    n -= n%2
    n //= -2
print(s)

Solution (Python):
import math

N=int(input())
S=""
while N!=0:
    if N%2==0:
        S+="0"
        N=math.floor(N/2)
    else:
        S+="1"
        N=math.floor(N/2)
    
    N=N*-1
   

if S=="":
    print(0)
else:
    print(S[::-1])

Solution (Python):
n = int(input())
if n == 0:
    print(0)
    exit()

s = ''
while n != 0:
    n, k = n//(-2), n % (-2)
    if k < 0:
        n += 1
        k += 2
    s = str(k) + s
print(s)

Solution (Python):


import math
import sys
import itertools
import numpy as np



n =int(input())
i = 0
a = []
while n != 0:
    if n % 2 == 1:
        a.append(1)
    else:
        a.append(0)
    n = n // 2
    n = -n



if len(a) == 0:
    print(0)
    exit
for i in range(0,len(a)):
    print(a[len(a)-i-1], end='')

Solution (Python):
n = int(input())
if n == 0:
    print(0)
    exit()

s = ''
while n != 0:
    n, k = n//(-2), n % (-2)
    if k < 0:
        n += 1
        k += 2
    s = str(k) + s
print(s)