For this Question: You are given a tree rooted at 1 (root is at level 1). The entire tree can be created in the following fashion:-
<li> Nodes at odd level have 2 children. So node 1 has two children, nodes 2 and 3.
<li> Nodes at even level have 4 children. So node 2 has 4 children, nodes 4, 5, 6, and 7. Similarly node 3 has 4 children, nodes 8, 9, 10, and 11.
<li> This process goes on infinitely. Node 4 has 2 children, nodes 12 and 13, node 5 has 2 children, nodes 14 and 15,... , and so on.

Now you are given an integer N, you need to report the path from the root to the node.The first and the only line of input contains an integer N.

Constraints
1 <= N <= 10<sup>16</sup>Output the path from the root to the node N in the form of space separated integers.Sample Input
14

Sample Output
1 2 5 14

Explanation: The path to node 14  from root is 1 -> 2 -> 5 -> 14 (Explained in problem text)

Sample Input
999

Sample Output
1 2 6 16 44 125 353 999 
, I have written this Solution Code: n = int(input())
import math
check=1
temp=1
ans=1
stk=[]
if n == 1:
    print('1')
else:
    while ans<n:
        if check:
            temp*=2
            stk.append(ans+1)
            ans+=temp
            check=0
        else:
            temp*=4
            stk.append(ans+1)
            ans+=temp
            check=1
    path=[]
    pos = n  - stk[-1]+1
    while stk:
        path.append(stk[-1]+pos-1)
        if not check:
            pos = math.ceil(pos/2)
            check=1
        else:
            pos = math.ceil(pos/4)
            check=0
        stk.pop()
    path.append(1)
    while stk:
        path.append(stk[-1]+pos-1)
        if not check:
            pos = math.ceil(pos/2)
            check=1
        else:
            pos = math.ceil(pos/4)
            check=0
    path=path[::-1]
    ans=''
    for i in path:
        ans+=str(i)+' '
    print(ans[:-1]), In this Programming Language: Python, Now tell me if this Code is compilable or not?