Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: /*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int fbc[200000];

int fb(int a)
{
	if(fbc[a]>0)
	return fbc[a];
	
	
	if(a<2)
	return 1;
	
	fbc[a]=fb(a-1)+fb(a-2);
	return fbc[a];
	
}

int main()
{
	iniarr(fbc,200000);
	int a;
	scd(a);
	a=fb(a);
	printf("%d\n",a);	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;

template<int n>
struct mat {
    vvi d;

    mat() {
        d = vvi(n, vi(n));
    }

    mat(initializer_list<initializer_list<i64>> m) {
        for (auto a: m) {
            vi row(a.begin(), a.end());
            d.emplace_back(row);
        }
        assert(n == d.size());
        assert(n == d.front().size());
    };

    mat operator+(const mat rhs) {
        mat ret;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ret.d[i][j] = d[i][j] + rhs.d[i][j];
            }
        }
        return ret;
    }

    mat operator-(const mat rhs) {
        mat ret;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ret.d[i][j] = d[i][j] - rhs.d[i][j];
            }
        }
        return ret;
    }

    mat operator*(const mat rhs) {
        mat ret;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < n; k++) {
                    ret.d[i][j] += d[i][k] * rhs.d[k][j];
                }
            }
        }
        return ret;
    }

    mat operator*(const i64 k) {
        mat ret;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ret.d[i][j] = d[i][j] * k;
            }
        }
        return ret;
    }

    static mat eye() {
        mat ret;
        for (int i = 0; i < n; i++) {
            ret.d[i][i] = 1;
        }
        return ret;
    }
};

template<int k>
mat<k> pow(mat<k> a, i64 n) {
    if (n == 0) {
        return mat<k>::eye();
    }
    if (n % 2 == 0) {
        mat<k> t = pow(a, n / 2);
        return t * t;
    }
    return a * pow(a, n - 1);
}

i64 fib(i64 n) {
    if (n <= 1) return n;
    mat<2> f{{1, 1}, {1, 0}};
    mat<2> res = pow(f, n - 2);
    return res.d[0][0] + res.d[0][1];
}

int main() {
    int n;
    cin >> n;
    cout << fib(n + 1) << endl;
}

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

int ans[100];

int fib(int n){
    if(n == 0 || n == 1) return 1;
    else return ans[n - 1] + ans[n - 2];
}

int main(){
    int n;
    cin >> n;
    for(int i = 0; i <= n; i++){
        ans[i] = fib(i);
    }
    cout << ans[n] << endl;
}

C++: #pragma GCC optimize("Ofast","unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace::std;
__attribute__((constructor))
void init(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
}
auto call=[](auto f,auto... args){return f(f,args...);};
auto call_memo=[](auto f,auto&& memo,auto... args){
	auto g=[&memo,f](auto g,auto... args)->decltype(auto){
		if(memo.count(make_tuple(args...)))return memo[make_tuple(args...)];
        else return memo[make_tuple(args...)]=f(g,args...);
    };
	return call(g,args...);
};

int main(){
	int n;
	cin>>n;
	auto f=[&](auto f,int t)->int{
		return t>=2?f(f,t-1)+f(f,t-2):1;
	};
	cout<<call_memo(f,map<tuple<int>,int>(),n)<<endl;
}

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

vector<int> fibonatti;
int dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  return 0;
}

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

int fib(int n, int FIB[]){
    if (FIB[n]) return FIB[n];
    return FIB[n] = fib(n - 1, FIB) + fib(n - 2, FIB);
}

int main(){
    int n;
    cin >> n;
    int FIB[n+1] = {};
    FIB[0] = 1;
    if (n > 0) FIB[1] = 1;
    cout << fib(n, FIB) << endl;

    return 0;
}

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

int fibo[50];
int rec(int i){
    if(i == 0 || i == 1) return 1;
    if(fibo[i] != -1) return fibo[i];
    
    int ret = 0;
    ret = rec(i-1) + rec(i-2);
    return fibo[i] = ret;
}

int main(void){
    // Your code here!
    int N;
    cin >> N;
    for(int i = 0; i < 50; i++) fibo[i] = -1;
    cout << rec(N) << endl;
}