Go: package main

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

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()
	n := nint()
	r := fibonacci(n)
	fmt.Println(r)
}

func fibonacci(n int) int{
	if n == 0 || n == 1{
		return 1
	}else{
		fiList := make([]int, n+1)
		fiList[0] = 1
		fiList[1] = 1
		for i:=2; i<n+1; i++{
			fiList[i] = fiList[i-1] + fiList[i-2]
		}
		return fiList[n]

	}

}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

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

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}

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;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

ll n;
pair<P,P> PP[100];

pair<P,P> multiple(pair<P,P> A,pair<P,P> B)
{
	pair<P,P> C;
	P p = A.first,q = A.second;
	P r = B.first,s = B.second;
	C.first = P((p.first*r.first+p.second*s.first),(p.first*r.second+p.second*s.second));
	C.second = P((q.first*r.first+q.second*s.first),(q.first*r.second+q.second*s.second));
	return C;
}

int main()
{
	int cnt=0;
	scanf("%lld",&n);
	if(n==0){
		printf("1\n");
		return 0;
	}else if(n==1){
		printf("1\n");
		return 0;
	}
	n;
	ll buff = n;
	while(buff != 1){
		buff /= 2;
		cnt++;
	}
	PP[0].first = P(0,1);
	PP[0].second = P(1,1);
	rep(i,cnt){
		PP[i+1] = multiple(PP[i],PP[i]);
	}
	pair<P,P> res;
	res.first = P(1,0);
	res.second = P(0,1);
	rep(i,cnt+1){
		if(n & (1 << i)){
			res = multiple(res,PP[i]);
		}
	}
	printf("%d\n",res.second.second);
	return 0;
}