Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

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

	for sc.Scan() {
		var wgt []int
		i, _ := strconv.Atoi(sc.Text())

		if i > 1023 {
			i = 1023
		}

		bin := fmt.Sprintf("%010b", i)

		for i := 9; i >= 0; i-- {
			if bin[i] == '1' {
				wgt = append(wgt, weight[i])
			}
		}

		for i := 0; i < len(wgt); i++ {
			if i == len(wgt)-1 {
				fmt.Printf("%d\n", wgt[i])
			} else {
				fmt.Printf("%d ", wgt[i])
			}

		}
	}

}

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 << " ";
        }
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

template<typename T> string to_string(const T& v) {
  string str;
  for (const auto& i : const_cast<T&>(v)) str += to_string(i) + " ";
  return str.substr(0, max(0, (int)str.size() - 1));
}

#ifdef __MINGW32__

template<> string to_string<int>(const int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long>(const long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long long>(const long long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned int>(const unsigned int& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned long>(const unsigned long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<unsigned long long>(const unsigned long long& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<float>(const float& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<double>(const double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

template<> string to_string<long double>(const long double& v) {
  stringstream ss;
  ss << v;
  return ss.str();
}

#endif

int main() {
  int n;
  while (cin >> n) {
    int t = 1;
    vector<int> res;
    for (; n; n /= 2, t *= 2) if (n % 2) res.emplace_back(t);
    cout << to_string(res) << endl;
  }
}

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

int main(){
	int n;
	int bit[10];
	for(int i=0;i<10;i++){
		int a = 1;
		for(int j=0;j<i;j++) a *= 2;
		bit[i] = a;
	}
	while(cin>>n){
		bool s = false;
		int k[10];
		for(int i=0;i<10;i++){
			k[i] = n%2;
			n = (n-k[i])/2;
			if(k[i]==1){
				if(not s){ s = true; cout << bit[i];}
				else cout << " " << bit[i];
			}
		}
		cout << endl;
	}
}

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

using namespace std;

int main(void) {
	int weight;
	while(cin >> weight) {
		int bundo[10];
		for(int i = 9; i >= 0; i--) {
			if(weight >= pow(2, i)) {
				bundo[i] = 1;
				weight -= pow(2, i);
			} else {
				bundo[i] = 0;
			}
		}
		
		for(int i = 0; i < 8; i++) {
			if(bundo[i] == 1) {
				cout << pow(2, i) << ' ';
			}
		}
		if(bundo[9] == 1) {
			cout << pow(2, 9);
		}
		cout << endl;
	}
	
	return 0;
}

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

int main(){
  int w;
  while(cin >> w){
    int a = 1; 

    while(w > 0){
      if(w == 1){
        cout << a;
      } else if(w & 1){
        cout << a << " ";
      }
      w /= 2; a *= 2;
    }
    cout << endl;
  }
}

C++: #include<iostream>

using namespace std;

bool a[10];

int main(){
    
    int N;
    int i=0;
    
    while(!cin.eof())
    {
        cin>>N;
        
        for(int j=0;j<10;j++)
        {
            a[j]=0;
        }
        
        i=0;
        
        if(i+512 <= N){
            i += 512;
            a[9] = 1;
        }

        if(i+256 <= N){
            i += 256;
            a[8] = 1;
        }
        
        if(i+128 <= N){
            i += 128;
            a[7] = 1;
        }
        
        if(i+64 <= N){
            i += 64;
            a[6] = 1;
        }
        
        if(i+32 <= N){
            i += 32;
            a[5] = 1;
        }
        
        if(i+16 <= N){
            i += 16;
            a[4] = 1;
        }
        
        if(i+8 <= N){
            i += 8;
            a[3] = 1;
        }
        
        if(i+4 <= N){
            i += 4;
            a[2] = 1;
        }
        
        if(i+2 <= N){
            i += 2;
            a[1] = 1;
        }
        
        if(i+1 <= N){
            i += 1;
            a[0] = 1;
        }
        
        cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<a[4]<<" "<<a[5]
            <<" "<<a[6]<<" "<<a[7]<<" "<<a[8]<<" "<<a[9]<<" "<<endl;
    }
}

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

int main()
{
	int n, count = 0, sum = 1;
	int ans[100][9], data[100] = {0}, ansdata[100];
	for (int a = 0; a <= 9; a++) {
		data[a+1] = sum;
		sum = sum * 2;
	}
	while (cin >> n) {
		sum = 0;
		int count2 = 0,sin=1;
		for (int a = 0; a <= 9; a++) {
			if (n % 2 == 0 && sin==1) {
				sum = sum - 1;
			}
			sum = sum + data[a + 1];
			ans[count][count2] = a+1;
			if (sum > n) {
				sum = sum - (data[a]);
				count2 = count2 - 1;
				ans[count][count2] = a + 1;
				a--;
			}
			if (n % 2 == 0 && sin == 1) {
				count2--;
				sin = 2;
			}
			count2++;
			if (sum == n)
				break;
		}
		ansdata[count] = count2;
		count++;
	}
	for (int a = 0; a <= count; a++) {
		for (int b = 0; b < ansdata[a]; b++) {
			cout << data[ans[a][b]]<< " ";
		}
		cout << endl;
	}
	return 0;
}

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

int main()
{
    int n,weight;
	int w[10]={1,2,4,8,16,32,64,128,256,512};
	while(1){
		cin >> n;
		if(cin.eof()){break;}
		int	flag[10]={0};
	
		for(int i=9 ; i>=0; i--){
			if(n>=w[i]){
				n-=w[i];
				flag[i]++;
			}
		}
		for(int i=0; i<10 ; i++){
			if(flag[i]!=0){
				cout << w[i] << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
  int w,we[9]={1,2,4,8,16,32,64,128,256},i;
  stack<int> k;
  while(cin>>w){

    while(w!=0){
      k.push(w%2);
      w=w/2;
    }
    i=0;
    while(k.size()){
      if(k.top()==1&&k.size()>=2)cout<<we[i]<<" ";
      else if(k.top()==1)cout<<we[i]<<endl;
      k.pop();
      i++;
    }
  }
  return 0;
}