Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		first := true
		beki := 1
		for num != 0 {
			if num % 2 == 1 {
				if !first {
					fmt.Print(" ")
				}
				fmt.Print(beki)
				first = false
			}
			num /= 2
			beki *= 2
		}
		fmt.Println()
	}
}

C++: #include <stdio.h>

int main(){
	int n;
	while(scanf("%d",&n) != EOF){
		for(int i=0; i<10; i++)if(n>>i & 1){
			printf("%d ",1<<i);
		}
		printf("\n");
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	int n;
	while(cin>>n){

		vector<int> res;
		for(int i=0;i<10;i++){
			if(n & (1<<i)) res.push_back((1<<i));
		}

		for(int i=0;i<res.size()-1;i++) cout<<res[i]<<" ";
		cout<<res[res.size()-1]<<endl;

	}

	return 0;
}

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

int main(){
	while (true)
	{
		int R[10], S[10], n, z=0;
		string str;
		R[0] = 1;
		S[0] = 0;
		for (int i = 1; i < 10; i++) {
			R[i] = R[i - 1] * 2;
			S[i] = 0;
		}
		cin >> n;
		if (cin.eof() || n == 0) { break; }
		for(int i=9;i>=0;i--){
			if(n>=R[i]){
				n -= R[i];
				S[i] += 1;
			}
		}
		for(int i=0;i<10;i++){
			if (S[i] == 1 && z==0) {
				str += to_string(R[i]);
				z = 1;
			}
			else if(S[i] == 1){
				str += " ";
				str += to_string(R[i]);
			}
		}
		cout << str << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
	int nishin[] = {1,2,4,8,16,32,64,128,256,512};
	int n;
	vector<int> result;

	while(cin >> n) {
		result.clear();
		while(true) {
			if(n<=0) break;
			if(n%2 == 1) result.push_back(1);
			else		 result.push_back(0);
			n /= 2;
		}

		for(int i=0;i<result.size();i++) {
			if(result[i] == 1 && i<result.size()-1) 
				cout << pow(2,i) << ' ';
			else if(result[i] == 1)
				cout << pow(2,i);
		}
		cout << '\n';
	}

	return 0;
}

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

int main(){
	
	int n;
	
	while(cin>>n){
		int s[11]={0};
		int j=0;
	for(int i=9;i>=0;i--){
		if(n-pow(2,i)>=0){
		n=n-pow(2,i);
		s[j++]=pow(2,i);
	}
	}
		if(j>0){
		cout<<s[--j];
	for(int i=j-1;i>=0;i--)
		cout<<" "<<s[i];
		cout<<endl;
	}
	}
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int x;
  while(cin>>x) {
    for (int i=0; x>>i; i++)
      if (1&(x>>i))
        cout << (1<<i) << " ";
    cout << endl;
  }
}

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

using namespace std;

int main(void)
{
    int a;
    while ( scanf("%d", &a) != EOF) {
        for (int i = 0; i < 10; i++) {
            if ((a&1) == 1) {
                cout << (1<<i) << " ";
            }
            a >>= 1;
        }
        puts("");
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

int main() {
  int x;
  while (scanf("%d", &x) == 1) {
    int i = 0, ws[10];
    for (int n = 9; n >= 0; n--) {
      int w = 1 << n;
      if (x >= w) {
        x -= w;
        ws[i++] = w;
      }
    }
    while (i >= 2)
      printf("%d ", ws[--i]);
    printf("%d\n", ws[0]);
  }
  return 0;
}

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

int input,i;


int main(){
	while(cin>>input){
		string ans("");
		while(1){
			if(input%2==0) ans.insert(ans.begin(),'0');
			else ans.insert(ans.begin(),'1');
			input/=2;
			if(input==0) break;
		}
		if(ans[ans.length()-1]=='1'){
			cout<<"1"<<" ";
		}
		//ans.pop_back();
		i=2;
		while(1){
			if(i==ans.length()+1) break;
			if(ans[ans.length()-i]=='1'){
				cout<<(int)pow(2.0,i)/2<<" ";
			}
			//ans.pop_back();
			i++;
		}
		cout<<endl;
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;

const int M = 512;

int main(void){
    for(int w; cin >> w; cout << endl)
        for(int a = 1; a <= M; a *= 2)
            if(a & w) cout << (a - 1 ? " ":"") << a;

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int n;
int main() {
	while(cin>>n){
		for (int i = 0; i < 11; ++i) {

			if(n%2){
				if(i!=0){
					cout<<" "<<pow(2,i);
				}else{
					cout<<pow(2,i);
				}
			}
			if(n==1)break;
			n=n/2;
		}
		cout<<endl;
	}
}

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

using namespace std;

int main()
{
  while (scanf("%d ", &x) == 1) {
    int omori = 512;
    while (x != 0) {
      if (x >= omori) {
	x -= omori;
	cout << omori << " ";
	omori /= 2;
      }
    }
    cout << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
	while(scanf("%d", &N) != EOF){
		vector<int> ans;
		for(int i = 0; i < 10; i++){
			if(N & (1 << i)){
				ans.push_back((1 << i));
			}
		}
		for(int i = 0; i < ans.size(); i++){
			cout << ans[i];
			if(i == ans.size() - 1) cout << endl;
			else cout << " ";
		}
	}
	return 0;
}

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

int baigaesi(int a){
  int n=1;
  if(a == 0)
    return 1;
  else
    for(int i=0;i<a;i++)
      n *= 2;
  return n;
}

int main(){

  int n;

  while(cin >> n){
    int i;
    std::vector<int> an;

    for(i=0;;i++){
      if(n==1){
	an.push_back(1);
	break;
      }
      an.push_back(n%2);
      n /= 2;
    }

    for(int j=0;j<=i;j++)
      if(an[j] == 1)
	cout << baigaesi(j) << ' ';
    cout << endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,0,1,-1};
int dy[4]={-1,1,0,0};
int main(){
	int a[13];a[0]=1;
	for(int i=1;i<=9;i++){
		a[i]=a[i-1]*2;
	}
	int n;
	while(cin>>n){
		bool f[10]={false};
		for(int i=9;i>=0;i--){
			if(n>=a[i]){
				f[i]=true;
				n-=a[i];
			}
		}
		vector<int> ans;
		for(int i=0;i<=9;i++){
			if(f[i]){
				ans.push_back(a[i]);
			}
		}
		for(int i=0;i<ans.size();i++){
			cout<<ans[i];
			if(i!=ans.size()-1){
				cout<<" ";
			}	
		}
		cout<<endl;
	}	
}