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;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

vector<ll> memo;

int fib(int i){
    if(i==1)return 1;
    else if(i==0)return 0;

    if(memo[i]!=-1)return memo[i];

    return memo[i]=fib(i-1)+fib(i-2);
}

int main(){
    int N;
    cin>>N;
    memo.assign(N+2,-1);
    cout<<fib(N+1)<<endl;
    return 0;
}

//a=97,z=122

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

using namespace std;

#define loop(x, start, end) for(int x = start; x < end; x++)

void fib(vector<int> &dp, int n) {
    dp[0] = 1;
    dp[1] = 1;
    loop (i, 2, n+1) {
        dp[i] = dp[i-1] + dp[i-2];
    }
}


int main(void){
    int n;
    cin >> n;
    vector<int> dp(n+1);
    fib(dp, n);
    cout << dp[n] << endl;
}

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

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

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 44;

int memo[N+1];

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

int main() {
	int n; cin >> n;
	rep(i, n+1) memo[i] = 0;
	memo[0] = memo[1] = 1;
	cout << fib(n) << endl;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
#define int ll

int dp[45];

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

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

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

#define N 45
int A[N];

int fibonacci(int i) {
    if (A[i] != -1) {
        return A[i];
    }

    if (i == 0 || i == 1) {
        return 1;
    }

    A[i] = fibonacci(i - 1) + fibonacci(i - 2);
    return A[i];
}

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

    for (int i = 0; i <= n; i++) {
        A[i] = -1;
    }

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

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

//メモ化再帰
int f[50];
int fib(int i)
{
    if (i == 0 || i == 1)
        return 1;

    if (f[i] != -1)
        return f[i];

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

int main()
{
    rep(i, 50) f[i] = -1;
    int n;
    cin >> n;
    OP(fib(n));
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

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

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 1000000
using namespace std;

int main(){
    int n;
    int fib[50];
    cin>>n;
    fib[0]=1;
    fib[1]=1;
    rep(i,2,n+1){
        fib[i]=fib[i-1]+fib[i-2];
    }
    cout<<fib[n]<<endl;
    return 0;
}