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 <iostream>
#include <cmath>

using namespace std;

int main(void){

  int w[10];
  for( int i = 0 ; i < 10 ; i++ ){
    w[i] = pow( (double)2 , i );
  }

  int thing;
  while( cin >> thing ){

    int h[10];
    int j = 0;
    int cnt = 0;

    for( int i = 9 ; i >= 0 ; i-- ){
      thing -= w[i];
      if( thing < 0 ){
        thing += w[i];
      }
      else {
        h[j++] = i;
        cnt++;
      }
      if( thing == 0 ){
        for( int i = cnt - 1 ; i >= 0 ; i-- ){
          if(i) cout << w[h[i]] << " ";
          else cout << w[h[i]] << endl;
        }
      }
      }
  end:;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int w[10]={1,2,4,8,16,32,64,128,256,512};
  int n;
  while(cin>>n){
    for(int i=0;n>0;i++){
      if (n%2){
	cout<<w[i];
	n/=2;
      if(n)cout<<" ";
      }
      else
	n/=2;
    }
    cout<<endl;
  }
  return 0;
}

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

int main() {
  int w = 0;
  ostringstream oss;
  while(cin >> w, w) {
    for (int i = 0; i < 32; i++) {
      if (w & (1<<i)) {
        oss << (1<<i);
        oss << " ";
      }
    }
    string out = oss.str();
    cout << out.substr(0, out.length() - 1) << endl;
    w = 0;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
int n,b[10],f,i;
while(cin>>n){
for(i=0;i<9;i++){b[i]=n%2;n/=2;}
for(f=0,n=1,i=0;i<9;i++){
if(b[i]==1){
if(f==0){cout<<n;f=1;}
else cout<<" "<<n;
}
n*=2;
}
cout<<endl;
}
return 0;
}

C++: #include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD
 
int main(){
  int n;
  while(~scanf("%d",&n)){
    int b = 1;
    bool flag = false;
    while(n){
      if(n&1){
        if(!flag){
          cout<<b;
          flag = true;
        }else{
          cout<<" "<<b;
        }
      }
      b<<=1;
      n>>=1;
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>

int main(){
	int a,b,c=1;
	int d[10];
	
	
	while(std::cin>>a){
		for(b=1;b<=10;b++){
		d[b]=0;
	}
		
		for(b=0;b<2;b++){
			if(a==b){
				d[1]=b;
			}else{
				for(c=0;c<3;c=c+2){
					if(a==b+c){
						d[1]=b;
						d[2]=c;
						
						
					}else{
						for(int e=0;e<5;e=e+4){
			if(a==b+c+e){
				d[1]=b;
				d[2]=c;
						d[3]=e;
					
			}else{
				for(int f=0;f<9;f=f+8){
					if(a==b+c+e+f){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						
					}else{
						for(int g=0;g<17;g=g+16){
			if(a==b+c+e+f+g){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						
			}else{
				for(int h=0;h<33;h=h+32){
					if(a==b+c+e+f+g+h){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						
					
					}else{
						for(int i=0;i<65;i=i+64){
			if(a==b+c+e+f+g+h+i){
				d[1]=b;d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						
			}else{
				for(int j=0;j<129;j=j+128){
					if(a==b+c+e+f+g+h+i+j){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						
					}else{
						for(int k=0;k<257;k=k+256){
			if(a==b+c+e+f+g+h+i+j+k){
				d[1]=b;
				d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						
			}else{
				for(int l=0;l<513;l=l+512){
					if(a==b+c+e+f+g+h+i+j+k+l){
						d[1]=b;
						d[2]=c;
						d[3]=e;
						d[4]=f;
						d[5]=g;
						d[6]=h;
						d[7]=i;
						d[8]=j;
						d[9]=k;
						d[10]=l;
					}else{
						
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
					}
				}
			}
			
		}
		for(int m=1;m<11;m++){
		if(d[m]!=0){
			std::cout<<d[m]<<" ";
		}
	}
	std::cout<<std::endl;
	}
}

C++: #include <iostream>

using namespace std;

const int w[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

int main(){
  int n;
  while (cin >> n) {
    for (int i = 0; n > 0; i++) {
      if (n % 2)
        (n < 2) ? cout << w[i] << endl : cout << w[i] << " ";
      n = n / 2;
    }
  }
  return 0;
}

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

int main()
{
	const int weight[] = {1,2,4,8,16,32,64,128,256,512}; 

	std::vector<int> answer;

	int n;

	while(std::cin >> n)
	{
		for(size_t i=0; i<10; ++i)
		{
			if(n/weight[9-i])
			{

				answer.push_back(weight[9-i]);

				n = n%weight[9-i];
			}
		}

		for(size_t i=0; i<answer.size()-1; ++i)
		{
			std::cout << answer[answer.size()-1-i] << ' ';
		}

		std::cout << answer[0] << '\n';

		answer.clear();
	}

}

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

using namespace std;

int main(void){
    int i,j,k,l;
    int n;
    int weight[10]={1,2,4,8,16,32,64,128,256,512};
    int weight_f[10];
    
    while(cin>>n){
    
    memset(weight_f,0,sizeof(weight_f));
    
    for(i=9;i>=0;i--){
        if(n-weight[i]>=0){
            n=n-weight[i];
            weight_f[i]=1;
        }
    }
    i=0;
    while(true){
        if(weight_f[i]==1){
            cout<<weight[i]<<flush;
            break;
        }
        i++;
    }
    for(j=i+1;j<10;j++){
        if(weight_f[j]==1){
            cout<<" "<<weight[j]<<flush;
        }
    }
    cout<<endl;
    }
    return(0);
}

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

int main() {
    int month, day;
    string weekday[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
    while (cin >> month >> day) {     
        time_t rawtime;
        struct tm * timeinfo;

        time(&rawtime);
        timeinfo = localtime(&rawtime);

        timeinfo->tm_year = 2004-1900;
        timeinfo->tm_mon = month - 1;
        timeinfo->tm_mday = day;
        
        mktime(timeinfo);

        cout << weekday[timeinfo->tm_wday] << endl;
    }
    return 0;
}

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

using namespace std;
int main()
{
    int N;
    while ( !cin.eof() )
    {
        cin >> N;
        vector<int> ans;
        
        for (int a = 0; a < 10; a++)
        {   
            if (N % 2 == 1)
            {
                N = (N - 1) / 2;
                ans.push_back( pow(2,a) );
            }
            else
                N = N / 2;
        }
        
        for (int i = 0; i < ans.size(); i++)
        {
            cout << ans[i] ;
            if (i == ans.size()-1)
                cout << endl;
            else
                cout << " ";
        }
    }
}