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;

int A[45] = {};
int B[45];

int fib(int n);

int main() {
	
	int n;
	
	while(cin >> n) {
		
		for(int i=0;i<n;i++)
			B[i] = 0;
		
		cout << fib(n) << "\n";
		
	}

	return 0;
}

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

}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  vector<ll> dp(50, 1);
  int n = 0;
  fscanf(stdin, "%d", &n);
  for (int i = 2; i <= n; ++i) {
    dp[i] = dp[i - 2] + dp[i - 1];
  }
  fprintf(stdout, "%lld\n", dp[n]);
  return 0;
}

C++: #include <stdio.h>
#define N 100
#define M -1
int fib(int);

int array[N];
int main()
{
  int i,n;
  scanf("%d",&n);
  for(i=0;i<N;i++)
    {
      array[i]=M;
    }
  printf("%d\n",fib(n));
}

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

C++: #include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <climits>
using namespace std;

#define DEBUG (0)

#if DEBUG
#define DPRINTF(...) do { \
    printf("D(L%d) %s: ", __LINE__, __func__); \
    printf(__VA_ARGS__); \
  } while (false)
#else
#define DPRINTF(...)
#endif // DEBUG

const uint64_t kInvalid = 0;

uint64_t calFibonacci(int num, uint64_t *pArray)
{
  if (pArray[num-1] == kInvalid)
    pArray[num-1] = calFibonacci(num-1, pArray);

  if (pArray[num-2] == kInvalid)
    pArray[num-2] = calFibonacci(num-2, pArray);

  return pArray[num-1] + pArray[num-2];
}


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

  DPRINTF("numOfFibonacci %d\n", numOfFibonacci);

  if (numOfFibonacci <= 1)
  {
    cout << "1" << endl;
    return 0;
  }

  uint64_t fibonacci[numOfFibonacci + 1];

  // init
  for (int i = 0; i <= numOfFibonacci; i++)
  {
    fibonacci[i] = kInvalid;
  }

  fibonacci[0] = 1;
  fibonacci[1] = 1;

  uint64_t ans = calFibonacci(numOfFibonacci, fibonacci);
  cout << ans << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll n;
    cin >> n;
    vll a(n + 1);
    a[0] = 1, a[1] = 1;
    REP(i, n - 1){
        a[i + 2] = a[i] + a[i + 1];
    }
    cout << a[n] << endl;
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

int dp[50];

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

	rep(i, n) dp[i] = -1;
	dp[0] = 1;
	dp[1] = 1;

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

C++: #include<iostream>
using namespace std;
int fib(int p){
    if(p==0||p==1) return 1;
    else return fib(p-1)+fib(p-2);
}
int main(){
    int n;
    cin>>n;
    cout<<fib(n)<<endl;
    return 0;
}

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

int main()
{
	int n = 0;
	long a[50] = { 1, 1 };

	cin >> n;

	if (n > 1) {
		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;

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

	return 0;
}