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 <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#define PI 3.1415926535
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

long long int n;

long long int fib(int k){
	if (!k || k == 1) return 1;
	return fib(k - 1) + fib(k - 2);
}

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

C++: #include<bits/stdc++.h>
#define N 45
using namespace std;
int n,F[N];

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

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

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

int main() {
    int n;
    std::cin >> n;
    int f[50] = {1, 1};

    std::cout << fib(f, n) << "\n";
    return 0;
}

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

int main(){
	int n;
	int ary[44] = { 1, 1 };

	cin >> n;

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

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

class Fib {
public:
    Fib(int n) : _data(n+1) {
        _data[0] = 1;
        _data[1] = 1;
    }

    int operator()(int n) {
        if (n <= _size) {
            return _data[n];
        }
        _data[n] = (*this)(n-1) + (*this)(n-2);
        _size = n;
        return _data[n];
    }

private:
    int _size = 1;
    vector<int> _data;
};


int main() {
    int n;
    cin >> n;
    Fib f(n);
    cout << f(n) << endl;
}

C++: #include<bits/stdc++.h>
#include<limits.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int n; cin >> n;
    int ans;
    if(n == 0 || n == 1){
        ans = 1;
    }else{
        int n_1 = 1;
        int n_2 = 1;
        for(int i = 2; i <= n; i++){
            ans = n_1 + n_2;
            n_2 = n_1;
            n_1 = ans;
        }
    }
    cout << ans << endl;
}

C++: #include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 100000000000000000

vector<int> f (45, -1) ;

int fib (int x){
    if(f[x] >= 0){
        return f[x] ;
    }
    if (x <= 1){
        return 1 ;
    }
    else {
        
        return f[x] = fib(x -1) + fib(x - 2) ;
    }

}

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

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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    u64 f[n + 1];
    f[0] = f[1] = 1;
    rep (i, n - 1)
    {
        f[i + 2] = f[i + 1] + f[i];
    }

    cout << f[n] << "\n";
    return 0;
}

C++: #include <iostream>

using namespace std;

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

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define pb(v) push_back(v)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
#define print(var)  do{ cout << #var << " : "; view(var); } while(0)
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using P = pair<int ,int>;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;

int memo[50];

int fib(int x) {
    if (x==0 || x==1) return 1;
    int ret1, ret2;
    ret1 = (memo[x-1]==-1) ? (fib(x-1)) : memo[x-1];
    ret2 = (memo[x-2]==-1) ? (fib(x-2)) : memo[x-2];
    memo[x-1] = ret1;
    memo[x-2] = ret2;
    return ret1+ret2;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    rep(i, 50) memo[i] = -1;
    cout << fib(n) << endl;
}

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