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++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

string Ten2Four(int a){
  string s = "";
  do{
    s += to_string(a%4);
    a /= 4;
  }while(a);
  reverse(all(s));
  return s;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin >>n && n >= 0){
    cout << Ten2Four(n) << endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
  int n;
  vector<int>num;

  while(cin >> n,~n){
    if(n==0){
      cout << 0 << endl;
      continue;
    }
    for(int i=0;n>0;i++){
      num.push_back(n%4);
      n/=4;
    }
    for(int i=num.size()-1;i>=0;i--)
      cout << num[i];
    cout << endl;
    num.clear();
  }

  return 0;
}

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

string base4(int p) {

  string s;
  while(true) {
    if(!p) break;
    s = string( 1, '0'+p%4 ) + s;
    p /= 4;
  }
  if( s == "" ) s = "0";
  return s;
}

int main() {
  int n;
  while(true) {

    cin>>n;
    if( n == -1 ) break;

    cout<<base4(n)<<endl;

  }
}

C++: #include<iostream>
#include<string>
using namespace std;
main(){
	int n;
	string s;
	while(cin>>n,n+1){
		s="";
		do{
			s = (char)('0'+n%4) + s;
			n = (n - (n%4)) / 4;
		}while(n);
		cout<<s<<endl;
	}
}

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

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

        if(n==-1){
            break;
        }

        string s;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                cout << '3';
            }
            else if(a == 2){
                cout << '2';
            }
            else if(a == 1){
                cout << '1';
            }
            else{
                cout << '0';
            }

             n /= 4;

        }

        cout << endl;

    }

    return 0;
}

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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == -1) {
            break;
        }
        long long output = 0;
        for (int i = 0; n > 0; i++) {
            output += (n % 4) * pow(10, i);
            n /= 4;
        }
        cout << output << endl;
    }
}

C++: #include <stdio.h>
#include <stdlib.h>

int main(void) {
	int n;
	for(;scanf("%d", &n), n != -1;) {
		int i = 0;
		int j;
		static int a[1024];
		while(n != 0) {
			a[i++] = n % 4;
			n /= 4;
		}

		for(j = i - 1; j >= 0; --j) printf("%d", a[j]);
		puts("");
	}
	return 0;
}

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

int main(){
  int a,b,cou;
  while(1){
    cin >>a;
    if(a==-1)break;
    b=4;
    for(b=4;b<=a;b=b*4);
    b=b/4;
    while(1){
      cout<< a/b;
      a%=b;
      if(b==1)break;
      b=b/4;
    }
    cout << endl;
  }
  return 0;

}

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

int main() {
    int d,i,f,a;
    while(cin >> d ) {
		if (d==-1) break;
		if (d==0) cout << 0; 
		for (f=0,i=20 ; i>-1 ; i-=2) {
		a=d & ((1<< (i+1))+( 1 << i));
		 if (f==0 && a>0) f=1;
		 if (f==1) cout << (a >> i);
	 }
	 cout << endl;
 } 
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;

int main(){
	int N;
	while(cin>>N,~N){
		ll ans=0;
		for(int i=0;i<N;i++){
			ans++;
			for(int j=1; ans/j%10==4; j*=10) ans += j*6;
		}
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,cnt=1,flg;
	int n;
	int fo[10]={1,4,16,64,256,1024,4096,16384,65536,262144};
	while(1) {
		cin>>n;
		flg=0;
		if(n==-1) break;
		for(i=10;i>=0;i--) {
			if(n==0&&flg==0) {
				cout<<"0";
				break;
			}
			if(n/fo[i]>0&&n!=0) {
				cout<<n/fo[i];
				n=n%fo[i];
				flg=1;
			}
			else if(flg==1) cout<<"0";
		}
		cout<<endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

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

C++: #include <cstdio>

using namespace std;

int main()
{
 int n;

 while (scanf("%d", &n) && n != -1){
  if (n == 0) printf("0\n");
  else {
   bool flag = false;
   for (int i = 30; i >= 0; i -= 2){
    if ((n >> i) & 3 || flag){
     printf("%d", (n >> i) & 3);
     flag = true;
    } 
   }
   printf("\n");
  }
 }
 return (0);
}

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

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

        if(n==-1){
            break;
        }

        string s;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                s = '3' + s;
            }
            else if(a == 2){
                s = '2' + s;
            }
            else if(a == 1){
                s = '1' + s;
            }
            else{
                s = '0' + s;
            }

             n /= 4;

        }

        cout << s << endl;

    }

    return 0;
}