Go: 
package main

import (
	"fmt"
	"math"
)

func solve(n int) int {
	i := 0
	for {
		if val := math.Pow(2, float64(i)); val*2 > float64(n) {
			return int(val)
		}
		i++
	}
}

func main() {
	for {
		var n int
		_, err := fmt.Scan(&n)
		if err != nil {
			break
		}

		res := []int{}
		for {
			val := solve(n)
			res = append(res, val)
			n -= val

			if n <= 0 {
				break
			}
		}

		for i := range res {
			if i != 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[len(res)-i-1])
		}
		fmt.Println()
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

bool cross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
    double a,b,c,d;
    
    a=(x3-x4)*(y1-y3)+(y3-y4)*(x3-x1);
    b=(x3-x4)*(y2-y3)+(y3-y4)*(x3-x2);
    c=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3);
    d=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4);
    
    if((c<0)^(d<0))
        return true;
    else
        return false;
}

int main(){
    int w;
    
    while(EOF!=scanf("%d",&w)){
        
        bool f = true;
        
        for(int i=0;i<=9;i++){
    
            if(w & (1 << i)){
                printf(f ? "%d" : " %d",(int)pow(2,i));
                f=false;
            }
        }
        
        printf("\n");
    }
    
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	while( cin >> n ){
		int s = 512;
		stack<int> st;
		while( n != 0 ){
			if( n - s >= 0 ){
				st.push(s);
				n -= s;
				s /= 2;
			}
			else{
				s /= 2;
			}

		}

		while( !st.empty() ){
			cout << st.top() << " ";
			st.pop();
		}
		cout << endl;
	}
	ret 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
        int w;
        int ans[10];

        while (cin >> w) {
                int cnt = 0;
                for (int i = 1; w; i*=2) {
                        if (w % 2) {
                                ans[cnt++] = i;
                        }
                        w /= 2;
                }
                for (int i = 0; i < cnt; i++) {
                        cout << ans[i];
                        if (i < cnt - 1) {
                                cout << " ";
                        }
                }
                cout << endl;
        }

        return 0;
}

C++: #include <stdio.h>

int quo,rem;

void divide_by_2(int x) {

  quo=x/2;
  rem=x%2;

}

int main(void) {

  int w;

  int count;

  while(scanf("%d",&w)!=EOF) {

    count=1;
    quo=w;

    while(quo>0) {

      divide_by_2(quo);
      
      if(rem==1) printf("%d ",count);

      count*=2;

    }

    puts("");

  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  unsigned int n;
  int p;
  bool f;
  while(cin>>n){
    p=1;
    f=false;
    while(n!=0){
      if(n&1==1){
	if(f){
	  cout<<" ";
	}
	else{
	  f=true;
	}
	cout<<p;
      }
      n=n>>1;
      p*=2;
    }
    cout<<endl;
  }
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main(){
  int n;
  while(cin >> n){
    if(cin.eof())break;
    vector<int> ar;
    int flg = 0;
    for(int i = 1024 ; i>=1; i /=2){
   
      if(n >= i&&flg == 0){
	cout << i;
	flg = 1;
	n-=i; 
	continue;
      }
      if(n >= i&&flg == 1){
	cout <<" "<< i;
	n-=i; 
      }
    }
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
  int w;
  while(cin >> w) {
    for(int i = 0, cnt = 0; w; ++i) {
      if(w & (1<<i)) {
	if(cnt) cout << " ";
	++cnt;
	cout << (1<<i);
	w &= ~(1<<i);
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  int n;
  int a[10] = {1,2,4,8,16,32,64,128,256,512};
  while (cin >> n) {
    stack<int> s;
    for (int i = 9; i >= 0; i--) {
      if (n >= a[i]) {
        n -= a[i];
        s.push(a[i]);
      }
    }
    int m = s.size() - 1;
    while (m--) {
      cout << s.top() << " ";
      s.pop();
    }
    cout << s.top() << endl;
  }
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
#include <string.h>
#include <utility>
#include <cstdio>
#include <set>
#include <map>
#include <assert.h>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

#define ll long long
#define LL long long

int main() {
	int w;
	while (cin >> w) {
		int bun = 1;
		int flg = 0;
		while (bun != 1024) {
			if (w % (2 * bun)) {
				if (flg) cout << ' ';
				cout << bun;
				w -= bun;
				flg++;
			}
			bun *= 2;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>

using namespace std;

bool a[10];

    int main(){

    int N;
    int i=0;
    
    while(!cin.eof())
    {
        cin>>N;
        for(int k=9;k>-1;k--){
            
            if(i+(pow(2,k)) <= N){
                i += pow(2,k);
                a[k] = 1;
            }
        }
        
        bool last = false;
        for(int k=0;k<10;k++){
            
            if(a[k] ==1)
            {
                if(last){
                    cout<<" ";
                }
                last =true;
                cout<<pow(2,k);    
            }        
        }
 
        cout<<endl;
    }
}

C++: #include <stdio.h>

int quo,rem;

void divide_by_2(int x) {

  quo=x/2;
  rem=x%2;

}

int main(void) {

  int w;

  int count;

  while(scanf("%d",&w)!=EOF) {

    count=1;
    quo=w;

    while(quo>0) {

      divide_by_2(quo);
      
      if(rem==1) printf("%d ",count);

      count*=2;

    }

    printf("\n");

  }

  return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;

const vector<int> v = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

int main() {
  int n;
  vector<int> sum(1024, 0);
  for (int i = 0; i <= 1024; ++i) {
    for (int j = 0; j < 10; ++j) {
      if ((i >> j) & 1) sum[i] += v[j];
    }
  }
  while (cin >> n) {
    int pos = 0;
    for (int i = 0; i <= 1024; ++i) {
      pos = i;
      if (sum[i] == n) break;
    }
    bool ok = false;
    for (int i = 0; i <= 10; ++i) {
      if ((sum[pos] >> i) & 1) {
        if (ok) {
          cout << ' ';
        } else {
          ok = true;
        }
        cout << (1 << i);
      }
    }
    cout << endl;
  }
  return 0;
}