Go: package main

/*
フィボナッチ数列
*/

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

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

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

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

template<class T>
T fibonacci(T n) {
	T first = 1, second = 0, ans;
	for (int i = 0; i < n; ++i) {
		if (i == 1)
			second = 1;
		ans = first + second;
		first = second;
		second = ans;
	}
	return ans;
}

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int n,a[45];

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

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
typedef long long ll;

int dp[50];

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

int main() {
  int X;
  cin >> X;

  REP(i, 50) {
    dp[i] = -1;
  }

  cout << fib(X) << endl;
  return 0;
}

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

int n, a[45];

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

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int N;
	cin>>N;
	ll F[100];
	F[0] = F[1] = 1;
	for (int i = 2; i <= N; ++i){
		F[i] = F[i-1] + F[i-2];
	}
	cout<<F[N]<<endl;
}