Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

const int NIL = -1;
const int MAX_N = 50;
vector<ll> fib(MAX_N);

int fibonach(vector<ll> &fib, int i){
    if(i == 0) return fib[0];
    if(i == 1) return fib[1];
    if(fib[i] != NIL) return fib[i];
    fib[i] = fibonach(fib, i-1) + fibonach(fib, i-2);
    return fib[i];
}

int main()
{
    int n; cin >> n;
    rep(i, MAX_N) fib[i] = NIL;
    fib[0] = 1;
    fib[1] = 1;
    ll res = fibonach(fib, n);
    cout << res << endl;
}

C++: #include <cstdio>

using namespace std;

int sum = 0, dp[50];

int fib( int n ){

    if( n == 0 || n == 1 ){

        return dp[n] = 1;

    } else if( dp[n] != -1 ){

        return dp[n] ;        

    } else{

        return dp[n] = fib( n - 1 ) + fib( n - 2 );

    }

}

int main(){

    int n;

    scanf("%d", &n);

    for( int i = 0; i < 50; i++ ) dp[i] = -1;

    int ans = fib(n);

    printf("%d\n", ans);

}

C++: #include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for(int i = 2; i <= n; i++)F[i] = F[i -1] + F[i - 2];
        cout << F[n] << endl;
    return 0;
}

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

int main()
{
	int x = 1, y = 1, n, value = 0;
	cin >> n;

	if (n == 0 || n == 1) value = 1;
	else
	{
		while (n > 1)
		{
			value = x + y;
			x = y;
			y = value;
			n--;
		}
	}
	cout << value << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int n;
	long f[45];
	f[0] = f[1] = 1;
	cin >> n;
	for (int i = 2; i <= n; i++){
		f[i] = f[i - 1] + f[i - 2];
	}
	cout << f[n];
	return 0;
}

C++:  #include<iostream>
 #include<vector>
 using namespace std;
 int main(int arg, char* argv[]) {
    int n = 0;
    cin >> n;
    vector<int> f(45,0);
    f[0] = 1; f[1] = 1;
    for(int i = 2; i <= n; i++){
      f[i] = f[i-1] + f[i-2];
    }
   cout << f[n] << endl;
 }

C++: // DP(???????¨??????? Dynamic Programing)
// ????????±???????????¢???
// ?????£??????????????°???
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
using namespace std;

#define MAX_N 44

struct memo{
    int num;
    bool flg;
}Memo[MAX_N+1];

int n;
int fib(int);

int main()
{
    cin >> n;
    for(int i=0;i<MAX_N+1;++i)
        Memo[i].flg=false;
    cout << fib(n);
    return 0;
}

int fib(int m){
    if(m == 0){
        if(!Memo[0].flg){
        Memo[0].num=1;
        Memo[0].flg=true;
        }
        return 1;
    }
    if(m == 1){
        if(!Memo[1].flg){
        Memo[1].num=2;
        Memo[1].flg=true;
        }
        return 1;
    }

    if(Memo[m].flg){
        return Memo[m].num;
    }
    else{
        Memo[m].num=fib(m-1) + fib(m-2);
        Memo[m].flg=false;
        return fib(m-1) + fib(m-2);
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = INT_MAX;
const ll LLINF = INT64_MAX;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll dp[50];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    for (ll i = 2; i <= n; i++)
    {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    cout << dp[n] << endl;
}

C++: #include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll fib[50];
    ll n;
    cin>>n;
    fib[0]=fib[1]=1;
    for(int i=2;i<=n;i++){
    	fib[i]=fib[i-1]+fib[i-2];
    }
    cout << fib[n]<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
 
typedef long long hyper;
 
hyper fib(int n)
{
    if(n < 2) return 1;
    if(n == 2) return 2;
    if(n == 3) return 3;
    return 3 * fib(n - 2) + fib(n - 4);
}
  
int main()
{
    int n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}