Go: package main

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

func parseToArray2d(lines []string) [][]int64 {
	var result [][]int64
	for _, line := range lines {
		var parsedLine []int64
		for _, element := range strings.Split(line, " ") {
			n, err := strconv.ParseInt(element, 10, 64)
			if err != nil {
				fmt.Printf("Error: element = %v\n", element)
			}
			parsedLine = append(parsedLine, n)
		}
		result = append(result, parsedLine)
	}
	return result
}

func pop(stack []int64) ([]int64, int64) {
	lenStack := len(stack)
	return stack[0:(lenStack - 1)], stack[lenStack-1]
}

func contains(s []int64, e int64) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	content := []string{}
	for scanner.Scan() {
		line := scanner.Text()
		content = append(content, line)
	}
	arr := parseToArray2d(content)
	x := arr[0][0]
	y := arr[0][1]

	if x == 0 && y == 0 {
		fmt.Println(1)
		return
	}

	filledRange := []int64{1, 0, 0, 0}
	direction := 0
	var prev int64 = 1
	var curr int64 = 1
	xSatisfied := false
	ySatisfied := false
	i := 1
	for ; i < 100; i++ {
		filledRange[direction%4] += curr
		direction++
		// fmt.Println(filledRange)

		if (x >= 0 && x <= filledRange[0]) || (x <= 0 && -x <= filledRange[2]) {
			xSatisfied = true
		}
		if (y >= 0 && y <= filledRange[1]) || (y <= 0 && -y <= filledRange[3]) {
			ySatisfied = true
		}

		if xSatisfied && ySatisfied {
			break
		}

		prev, curr = curr, prev+curr
	}

	fmt.Println(i%3 + 1)
}

C++: #include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


int fib[200];
signed main(){
  fib[1] = fib[2] = 1;
  repi(i,3,200)fib[i] = fib[i-1] + fib[i-2];
  
  int x, y;cin >> x >> y;
  int bottom = 0, top = 0;
  int left = 0, right = 0;
  int color = 1;
  int n = 1;
  
  while(true){
    if(left <= x and x <= right and bottom <= y and y <= top){
      cout << color << endl;
      break;
    }
    n++;
    if(n%4 == 2)right += fib[n];
    if(n%4 == 3)top += fib[n];
    if(n%4 == 0)left -= fib[n];
    if(n%4 == 1)bottom -= fib[n];
    color++;
    if(color == 4)color = 1;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(void) {
	int x, y;
	cin >> x >> y;

	
	enum d { right , top , left , bottom };
	int range[4] = { 0,0,0,0 };
	int dCnt = right, colCnt = 1;
	int fib = 1, p_fib = 0, pp_fib = 0;

	while (!(range[left] <= x && x <= range[right] && range[bottom] <= y && y <= range[top])) {
		pp_fib = p_fib;
		p_fib = fib;
		fib = p_fib + pp_fib;

		if (dCnt < 2) range[dCnt] += fib;
		else range[dCnt] -= fib;
		dCnt = (dCnt + 1) % 4;
		colCnt = colCnt % 3 + 1;
	}

	cout << colCnt << endl;

	return 0;
}

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

int main() {
    int x, y;
    cin >> x >> y;
    int xl = 0;
    int yl = 0;
    int xr = 1;
    int yr = 1;
    int F[100000]{};
    F[1] = 1;
    F[2] = F[1] + F[0];
    for (int i = 1; i < 100000; i++) {
        F[i + 1] = F[i] + F[i - 1];
        if (xl <= x && x < xr && yl <= y && y < yr) {
            int ans = i % 3;
            if (ans == 0) ans = 3;
            cout << ans<< "\n";
            return 0;
        }
        // cout << xl << " " << xr << "\n";
        // cout << yl << " " << yr << "\n";
        // cout << "-------------\n";
        if (i % 4 == 1) {
            xl = xr;
            xr += F[i + 1];
            yr = yl + F[i + 1];
        } else if (i % 4 == 2) {
            xl = xr - F[i + 1];
            yl = yr;
            yr += F[i + 1];
        } else if (i % 4 == 3) {
            xr = xl;
            xl -= F[i + 1];
            yl = yr - F[i + 1];
        } else {
            xr = xl + F[i + 1];
            yr = yl;
            yl -= F[i + 1];
        }
    }
    return 0;
}

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

int main(){
    int x_min(0),x_max(0),y_min(0),y_max(0);
    int x,y; cin >> x >> y;
    int side[35];
    side[0] = 1; side[1] = 1;

    for(int i=2; i<35; i++){
        side[i] = side[i-1] + side[i-2];
    }

    int i(1);
    while(1){
        if(x_min<=x && x<=x_max && y_min<=y && y<=y_max){
            if(i%3==0)
                cout << 3 << endl;
            else
                cout << i%3 << endl;

            break;
        }else{
            switch(i%4){
                case 0:
                    y_min -= side[i];
                    break;

                case 1:
                    x_max += side[i];
                    break;

                case 2:
                    y_max += side[i];
                    break;

                case 3:
                    x_min -= side[i];
                    break;
                
                default:
                    break;
            }
        }
        i++;
    }
}