Go: package main

import (
	"bufio"
	"fmt"
	"strconv"
	"strings"
	"os"
)

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `
3
`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}



func fib(n int, dp map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
		if v, ok := dp[n]; ok {
		return v
	}
	r := fib(n - 1, dp) + fib(n - 2, dp)
	dp[n] = r
	return r
}

// solve
func solve(sc *bufio.Scanner) {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	dp := make(map[int]int)
	r := fib(n, dp)
	fmt.Println(r)
}

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

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