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>
using namespace std;

long long fibodp(int n){
    long long fibodp[200]={0};
    fibodp[0]=1;
    fibodp[1]=1;
    for(int i=2; i<=n; i++){
        fibodp[i]=fibodp[i-1]+fibodp[i-2];
    }
    return fibodp[n];
}

int main(void){
    int n;
    cin>>n;
    cout<<fibodp(n)<<endl;
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

#define MAX 3000000 
char s[MAX + 10];
int wSum[MAX + 10];
int eSum[MAX + 10];

int dp[45];

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

signed main() {
	ios::sync_with_stdio(false);
	int i, n;
	cin >> n;
	rep(i, 45) dp[i] = -1;
	cout << fibo(n) << "\n";
	return 0;
}

C++: #include <bits/stdc++.h>
int N;

int fib() {
    int arr[N+1];
    arr[0] = 0; arr[1] = 1;

    for (int i = 2; i <= N+1; i++) {
        arr[i] = arr[i-1] + arr[i-2];
    }
    return arr[N+1];
}


int main() {

    std::scanf("%d", &N);
    std::printf("%d\n", fib());

}

C++: #include<algorithm>
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
#define MAX 45
int F[MAX];


int fibonacci(int i){
    if(i == 1 || i == 0) return F[i] = 1;
    if(F[i]) return F[i];
    return F[i] = fibonacci(i-1) + fibonacci(i-2);
}

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

    cout << F[n] << endl;

    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>
 
using namespace std;
 
int f(const int);
 
int main()
{
    int N;
    int num=1,old[2]={1,1};
    cin>>N;
    for(int i=1;i<N;i++){
        num=old[0]+old[1];
        old[0]=old[1];
        old[1]=num;
    }
    cout<<num<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
long long dp[50];
long long fib(int n){
if (n<=1) return 1;
if (dp[n]) return dp[n];
return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
int n; cin>>n; cout<<fib(n)<<endl;
}