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>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
using namespace std;

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

C++: #include <iostream>

static int has_fib[44];
static int fib[44];

int fibonacci(int n) {
    if (has_fib[n] == 1) {
        return fib[n];
    }
    fib[n] = fibonacci(n - 1) + fibonacci(n - 2);
    has_fib[n] = 1;
    return fib[n];
}

int main() {
    int N;
    fib[0] = 1;
    has_fib[0] = 1;
    fib[1] = 1;
    has_fib[1] = 1;
    std::cin >> N;
    std::cout << fibonacci(N) << std::endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int fib[50];

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

int main(){
    fib[0]=1;
    fib[1]=1;
    int n;
    cin >> n;
    cout << f(n) << endl;   
    return 0;
}

C++: ///
// File:  alds1_10_a.cpp
// Author: ymiyamoto
//
// Created on Tue Oct 17 00:57:42 2017
//

#include <cstdint>
#include <iostream>

using namespace std;
#define SIZE 100
static uint64_t mem[SIZE];

uint64_t fib(uint32_t n)
{
  if (n == 0) {
    return mem[0] = 1;
  } else if (n == 1) {
    return mem[1] = 1;
  } else {
    uint64_t n1, n2;

    if (mem[n - 2] == 0) {
      n2 = mem[n - 2] = fib(n - 2);
    } else {
      n2 = mem[n - 2];
    }

    if (mem[n - 1] == 0) {
      n1 = mem[n - 1] = fib(n - 1);
    } else {
      n1 = mem[n - 1];
    }
    return n1 + n2;
  }
}

int32_t main()
{
  uint32_t n;
  cin >> n;

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

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

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

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x) ((x) * (x))
#define bit(n) (1LL<<(n))
#define pcnt(x) __builtin_popcountll(x)
#define PB push_back
#define MP make_pair
#define endl "\n"
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

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

int main() {
    int n;    cin >> n;
    int F[50];
    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>

using namespace std;


int fib(int n){
  if(n<0){
    return 0;
  }
  if(n==1||n==2){
    return 0
  }
  return fib(n-1)+fib(n-2);

}

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

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

const int MAX_N = 50;

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

    int F[MAX_N];
    F[0] = F[1] = 1;
    rep(i, 2, n+1) F[i] = F[i-1] + F[i-2];

    cout << F[n] <<endl;
    
    return 0;
}

C++: #include <iostream>
using namespace std;
#define ll long long int
ll fib[1000];
ll fibonacci(ll n)
{
    if(fib[n])
        return fib[n];
    if (n<=1)
        return n;
    return fib[n] = fibonacci(n-2) + fibonacci(n-1);
}
int main ()
{
    int a;
    cin>>a;
    cout<<fibonacci(a+1)<<endl;

}

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

int main() {
	int n;
	cin >> n;
	int ans = 0;
	vector<int> fib = { 1,1 };
	if (n == 0) {
		cout << 1 << endl;
		return 0;
	}
	else if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	for (int i = 2; i <= n; i++) {
		fib.push_back(fib.at(i - 1) + fib.at(i - 2));
	}

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

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

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

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

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

int fibonacci(int* dp, int i, int n)
{
    // メモ化再帰
    if(n == 1) return 1;
    if(i == 0 || i == 1){
        dp[i] = 1;
        return fibonacci(dp, i+1, n);
    }
    dp[i] = dp[i-1] + dp[i-2];
    if(i >= n) return dp[i];
    return fibonacci(dp, i+1, n);
}

int fibonacci2(int n)
{
    // DP
    int dp[50];
    dp[0] = dp[1] = 1;
    for(int i=2;i<=n; ++i)
    {
        dp[i] = dp[i-1] + dp[i-2];
    }
    return dp[n];
}

int main()
{
    int n;
    int dp[50];
    cin >> n;
    cout << fibonacci2(n) << endl;
}