Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == -1 {
			break
		}
		if n == 0 {
			fmt.Println(0)
			continue
		}
		ans := make([]int, 0)
		for n > 0 {
			ans = append([]int{n % 4}, ans...)
			n = n / 4
		}

		buf := make([]string, len(ans))
		for i := range ans {
			buf[i] = strconv.Itoa(ans[i])
		}
		fmt.Println(strings.Join(buf, ""))
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

VI p4 = { 1,4,16,64,256,1024,4096,16384,65536,262144,1048576, };

string solve(int n) {
	string ret;

	bool flag = false;
	for (int i = 9; i >= 0; i--) {
		int p = n / p4[i];
		n %= p4[i];
		if (p != 0 || i == 0)flag = true;

		//cout << p4[i] << " : " << p << endl;

		if (flag)ret += '0' + p;
	}

	return ret;
}


int main() {
	while (true) {
		int a; cin >> a;
		if (a == -1)break;
		Cout(solve(a));
	}
}

C++: #include<iostream>
#include<bitset>
#include<string>
using namespace std;
int main() {
    int n, a,j=0;
    bool bo = false;
    int ans[102] = { 0 },ans1=0;
    bitset <101> bset;
    while (1) {
        cin >> n;
        if (n == 0) {
            break;
        }
        bset = n;
        for (int i = bset.size() - 1; i >= 0; i--) {
            if (i % 2 == 0) {
                if (1 & bset[i] == 1) {
                    ans[j] += 1;
                }
                if (i != 0) {
                    j++;
                }
            }
            else {
                if (1 & bset[i] == 1) {
                    ans[j] += 2;
                }
            }
        }
        for (int i = 0; i <= j; i++) {
            if (ans[i] != 0) {
                bo = true;
            }
            if (bo) {
                cout << ans[i];
            }
        }cout << endl;
        bo = false;
        for (int i = 0; i < 102; i++) {
            ans[i] = 0;
        }
        j = 0;
        bset = 0;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#include<string>
#include<cctype> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  int n;
  int a[]={262144,65536,16384,4096,1024,256,64,16,4,1};
  int i,j,s=10;
  int ans=0;
  while(cin >> n){
    n==-1;
    break;
 
  if(n==0){
    cout << 0;
  }
  rep(i,10){
    if(n>=a[i]){  
      if(i<s){
	s=i;
      }
    }
  }
  for(j=s;j<10;j++){
    cout << n/a[j]; 
    n=n%a[j];
  }
                     
  cout <<'\n';
  }                
  return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int n;
    while(cin>>n){
        if(n==-1)break;
        
        string ans="";
        while(n>0){
            ans+='0'+(n%4);
            n=n/4;
        }
        reverse(all(ans));
        if(ans=="")ans='0';
        cout<<ans<<endl;
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll n;
    while (cin >> n && n != -1) {
        ll base = 4;
        string ans;
        while (n) {
            ans += to_string(n % base);
            n /= base;
        }
        reverse(ans.begin(), ans.end());
        if (ans.empty()) cout << 0 << endl;
        else cout << ans << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
 #define int long long
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};

class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  int n;
  Radix r;
  while(true) {
    cin >> n;
    if(n == -1) break;
    cout << r.to(n, 4) << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 1e-8;

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==-1) break;
		stack<int> stk;
		while(n>0){
			stk.push(n%4);
			n/=4;
		}

		if(stk.empty()) {
			printf("0\n");
			continue;
		}

		while(!stk.empty()){
			printf("%d",stk.top());
			stk.pop();
		}

		printf("\n");
	}
		
}

C++: #include<stdio.h>
int main(void)
{
	long long int a,b,c,i;
	while(1){
		scanf("%lld",&a);
		if(a<0) break;
		b=0; c=0;
		for(i=0;i<a;i++){
			c++;
			b++;
			if(c==4){
				c=0;
				b=b/10*10+10;
			}
		}
		printf("%lld",b);
	}
	return 0;
}

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

int main(){
  int n;
  string str;

  while(cin >> n , n != -1){
    str = "";
    if(!n) cout << '0' << endl;
    else{
      while(n){
	str += n % 4 + '0';
	n /= 4;
      }
      reverse(str.begin(),str.end());
      cout << str << endl;
    }
  }

  return 0;
}

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

int main(){
	int n,t;
	while(1){
		string a;
		cin >> n;
		if(n==-1){
			return 0;
		}
		if(n==0){
			a += '0';
		}
		for(t=0;n!=0;t++){
			a += '0' + n%4;
			n=n/4;
		}
		reverse(a.begin(), a.end());
		cout << a << endl;

	}
}