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<iostream>
#include<algorithm>
using namespace std;

int main()
{
  int n, i;
  char c[1000000];
  while(true)
  {
    cin >> n;
    if(n < 0)
      break;

    for(i = 0; n > 0; i++)
    {
      c[i] = n % 4 + '0';
      n = n / 4;
    }
    reverse(c, c + i);
    cout << c << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1) break;
		vector<int> ans;
		while(n >= 4){
			ans.push_back(n%4);
			n/=4;
		}
		ans.push_back(n);
		vector<int>::reverse_iterator it=ans.rbegin();
		while(it != ans.rend()){
			cout << *it;
			it++;
		}
		cout << endl;
	}
	return 0;
}

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

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n;
    while(cin>>n && n!=-1){
        int t = 0;
        if(n==0){
            cout << 0 << endl;
        }else{
            while(n){
                t*=10;
                t+=n%4+1;
                n/=4;
            }
            stringstream ss;
            ss << t;
            string str = ss.str();
            reverse(str.begin(),str.end());
            rep(i,str.size())str[i]--;
            cout << str << endl;
        }
    }
}

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

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

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

        vector<int> v;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                v.push_back(3);
            }
            else if(a == 2){
                v.push_back(2);
            }
            else if(a == 1){
                v.push_back(1);
            }
            else{
                v.push_back(0);
            }

             n /= 4;

        }

        reverse(v.begin(),v.end());

        for(int i=0;i<v.size();i++){
            cout << v[i];
        }

        cout << '\n';

    }

    return 0;
}

C++: #include <iostream>
using namespace std;
 
int main(){
        int x,y[25000],z,i;
        while(true){
                i=0;
        cin>>x;
        if(x==-1)break;
                else if(x==0)cout<<0;
        while(x!=0){
                z=x/4;
                y[i]=x%4;
                x=z;
                i++;
        }
                for(int j=i-1;j>=0;j--){
         cout<<y[j];
                }
                
                cout<<endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;
void solve(int);
int main(){
  int n;
  while(cin >> n){
    if(n==-1)break;
    solve(n);
    cout << endl;
  }
}
void solve(int n){
  if(n/4==0){
    cout<<n%4;
    return;
  }
  solve(n/4);
  cout <<n%4;
}

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

using namespace std;

int main(){

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

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string tofour(int n){
	string ans;
	while(n){
		ans += n%4+'0';
		n/=4;
	}
	reverse(ans.begin(),ans.end());
	return ans.size()?ans:"0";
}
int main(){
	int n;
	while(cin >> n , ~n){
		cout << tofour(n) << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
typedef long long int ll;

ll henkan(int n){
	if( n < 4 ){ return n; }
	return henkan(n/4ll) * 10ll + n % 4ll;
}

int main(){
	int n;
	while( cin >> n ){
		if( n == -1 ) break;
		cout << henkan(n) << endl;
	}
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    int N,hoge[10000]={0},i;
    while(cin>>N){
        if(N==-1)break;
        for(i=0;i<10000;i++){
            if(N<4){
                hoge[i]=N;
                break;
            }
            hoge[i]=N%4;
            N/=4;
        }
        for(int j=i;j>=0;j--){
            cout<<hoge[j];
        }
        puts("");

    }
    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	while(cin>>n&&n!=-1){
		if(n==0){
			cout << 0 << endl;
			continue;
		}
		vector<int> v;
		while(n != 0){
			v.push_back(n%4);
			n /= 4;
		}
		for(int i=v.size()-1;i>=0;i--){
			cout << v[i];
		}
		cout << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
	int n, x, p, l, i, r[11];
	while (cin >> n, (x = n) != -1)
	{
		p = l = 0;
		while (x != 0)
		{
			r[p++] = x % 4;
			x /= 4;
			l++;
		}
		for (i = l-1; i >= 0; i--)
			cout << r[i];
		if (!n) cout << 0;
		cout << endl;
	}
}

C++: #include<stdio.h>

int main(void){
	int keta,n,i;
	int kai[10000];
	while(0==0){
		scanf("%d",&n); 
		keta=0;
		if(n==-1)break;
		while(n>4){
			kai[keta]=n%4;
			n=n/4;
			keta++;
		}
	  kai[keta]=n;
	  for(i=keta;i>0;i--) printf("%d",kai[i]);
	  printf("%d\n",kai[0]);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int pow(int a,int b){
	int result=1;
	for(int i=0; i<b; ++i) result*=a;
	return result;
}

int main(){
	int N;
	while(std::cin >> N&&N!=-1){
		long long int i=0,ans=0;
		while(pow(4,i)<=N+1) ++i;
		--i;
		for( ; i>=0; --i){
			long long int tmp=pow(4,i);
			ans+=N/tmp*pow(10,i);
			N%=tmp;
		}
		cout << ans << endl;
	}
	return 0; 
}

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

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

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

        vector<int> v;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                v.push_back(3);
            }
            else if(a == 2){
                v.push_back(2);
            }
            else if(a == 1){
                v.push_back(1);
            }
            else{
                v.push_back(0);
            }

             n /= 4;

        }

        reverse(v.begin(),v.end());

        for(int i=0;i<v.size();i++){
            cout << v[i];
        }

        cout << endl;

    }

    return 0;
}

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

int main ()
{
    int n;
    while (cin >> n, n != -1) {
        long long res = 0;
        long long pos = 1;
        while (n > 0) {
            res += pos * (n & 0b0011);
            n = n >> 2;
            pos *= 10;
        }
        cout << res << endl;
    }

    return 0;
}

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

using namespace std;

int main()
{
	int n;

	while (cin >> n, n != -1)
	{
		string ans;
		int keta;

		while (true)
		{
			keta = n % 4;
			n /= 4;

			ans = (char)(keta + '0') + ans;

			if (n == 0)
			{
				cout << ans << endl;
				break;
			}
		}
	}
}

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

void conv(int n)
{
    if(n/4!=0){
        conv(n/4);
    }

    cout << n%4;
}

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

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

        conv(n);

        cout << '\n';

    }

    return 0;
}