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 <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
  
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

long long FibonacciNumber(long long n, long long mod) {
    long long A[2][2] = {{1, 1}, {1, 0}};
    long long M[2][2] = {{1, 0}, {0, 1}};
    while (n > 0) {
        if (n & 1) {
            long long M_00 = M[0][0] * A[0][0] + M[0][1] * A[1][0];
            long long M_01 = M[0][0] * A[0][1] + M[0][1] * A[1][1];
            long long M_10 = M[1][0] * A[0][0] + M[1][1] * A[1][0];
            long long M_11 = M[1][0] * A[0][1] + M[1][1] * A[1][1];
            M[0][0] = M_00 % mod;
            M[0][1] = M_01 % mod;
            M[1][0] = M_10 % mod;
            M[1][1] = M_11 % mod;
        }
        long long A_00 = A[0][0] * A[0][0] + A[0][1] * A[1][0];
        long long A_01 = A[0][0] * A[0][1] + A[0][1] * A[1][1];
        long long A_10 = A[1][0] * A[0][0] + A[1][1] * A[1][0];
        long long A_11 = A[1][0] * A[0][1] + A[1][1] * A[1][1];
        A[0][0] = A_00 % mod;
        A[0][1] = A_01 % mod;
        A[1][0] = A_10 % mod;
        A[1][1] = A_11 % mod;
        n >>= 1;
    }
    return M[1][0];
}

int main() {

    ll n; cin >> n;
    cout << FibonacciNumber(n + 1, 1e18) << endl;
   
    return 0;
}

C++: #include <vector>
#include <iostream>
#include <algorithm>

int main() {
    int n;
    std::cin >> n;
    std::vector<int> vec(n+1, 0);
    vec[0] = 1;
    vec[1] = 1;
    for (int i = 2; i <= n; i++) {
        vec[i] = vec[i-1] + vec[i-2];
    }
    std::cout << vec[n] << std::endl;
}

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

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

  vector<int> fib(n+2);
  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++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "MyDisjointset.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string.h>
using namespace std;
typedef pair<int, int> P; typedef long long int ll;
const int INF = 100000000;
int mod = 10000;
vector <vector<int>> mul(vector<vector<int> > f, vector<vector<int> > s) {
	vector<vector<int> > res(2, vector <int> (2) );
	res[0][0] = (f[0][0] * s[0][0] + f[0][1] * s[1][0]) % mod;
	res[0][1] = (f[0][0] * s[0][1] + f[0][1] * s[1][1]) % mod;
	res[1][0] = (f[1][0] * s[0][0] + f[1][1] * s[1][0]) % mod;
	res[1][1] = (f[1][0] * s[0][1] + f[1][1] * s[1][1]) % mod;
	return res;
}
int main() {
	int n; cin >> n;
	vector<vector<int> > base(2, vector<int> (2) );
	base[0][0] = 1;
	base[0][1] = 1;
	base[1][0] = 1;
	base[1][1] = 0;
	vector<vector<int> > ans(2, vector<int>(2));
	ans[0][0] = 1;
	ans[0][1] = 0;
	ans[1][0] = 0;
	ans[1][1] = 1;
	while (n > 0) {
		if (n & 1) ans = mul(ans, base);
		//cout << ans[0][0] << " " << ans[0][1] << endl;
		//cout << ans[1][0] << " " << ans[1][1] << endl;
		//cout << endl;
		base = mul(base, base);
		n >>= 1;
	}
	cout << ans[1][0] + ans[1][1]  << endl;
	return 0;
}

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

C++: /*
 * Problem Description: Dynamic Programming - Fibonacci Number
 * Category:
 * Author: Khan
 * Date: 18th October, 2017
 */

#include <iostream>

using namespace std;

int n;
int Fibonacci[45];

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    cin >> n;
    Fibonacci[0] = 1;
    Fibonacci[1] = 1;
    for (int i = 2; i <= n; ++i)
    {
        Fibonacci[i] = Fibonacci[i - 1] + Fibonacci[i - 2];
    }
    cout << Fibonacci[n] << endl;
    return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

int fib(int);

vector<int> num;

int main(){
    int n;
    cin >> n;
    
    num.resize(n, 0);
    
    cout << fib(n) << endl;
}

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

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

int f[45];

int fib(int n)
{
    if (n == 1 || n == 0)
        return 1;
    if (f[n] != -1)
        return f[n];

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

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

    for (int i = 0; i < 46; i++)
        f[i] = -1;

    cout << fib(n) << endl;
}

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

typedef long long ll;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> Fib(n+1,1);
    for(i = 2;i <= n;++i){
        Fib.at(i) = Fib.at(i-1) + Fib.at(i-2);
    }
    cout << Fib.at(n) << endl;

    return 0;
}