Go: package main

import (
	"fmt"
)

const MAX = 45

var dp [MAX]int

func fin(n int) int {
	if dp[n] != 0 {
		return dp[n]
	}

	switch n {
	case 0:
		dp[n] = 1
	case 1:
		dp[n] = 1
	default:
		dp[n] = fin(n-1) + fin(n-2)
	}
	return dp[n]
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(fin(n))
}

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

using namespace std;

class Fibonacci{
private:
 vector< long > FN;
 long current;
public:
 Fibonacci( long num_0 = 1, long num_1 = 1, long max = 100 ) : current( 1 ), FN( max, 0 ){
  FN[ 0 ] = num_0;
  FN[ 1 ] = num_1;
 };

 void calculate( long num ){

  while( current < num ){
   ++current;
   FN[ current ] = FN[ current-2 ] + FN[ current-1 ];
  }
 };

 long get( long num ){
  if( current < num ) calculate( num );

  return FN[ num ];
 }

 void display(){
  for(long i = 0; i <= current; ++i)
   cout << FN[i] << " ";
  cout << endl;
 };

};

int main(){
 Fibonacci fn;

 long n = 0; cin >> n;

 long num = fn.get( n );

 cout << num << endl;

 return 0;
};

C++: //
// Created by 李青坪 on 2018/10/28.
//

#include <cstdio>
#include <algorithm>
#define MAXN 50
#define NIL -1
using namespace std;

int value[MAXN];

int fibonacci(int n){
    if (n == 0 || n == 1) {
        value[n] = 1;
        return 1;
    }
    if (value[n] != NIL) return value[n];
    value[n] = fibonacci(n-1) + fibonacci(n-2);
    return value[n];
}

int main(){
    fill(value, value+MAXN, NIL);
    int n;
    scanf("%d", &n);
    printf("%d\n", fibonacci(n));
}

C++: #include<stdio.h>
int a[10000]={1,1,2};
int digui(int n){
if(a[n])return a[n];
return digui(n-1)+digui(n-2);
}
int main(){
int n;
scanf("%d",&n);
printf("%d",digui(n));
return 0;
}

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

vector<int> memo(45,-1);
int fib(int n){
    if(n==0||n==1) return 1;
    if(memo.at(n)!=-1) return memo.at(n);
    return memo.at(n)=fib(n-1)+fib(n-2);
}

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

C++: #include <iostream>
#include <vector>
#include <cstdio>
 
using namespace std;
 
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)

int dp[50];

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

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
int n;
int dfep[45];

dp[0] = 1;
dp[1] = 1;

cin >> n;

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}


int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}


int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}


int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  lint n;
  vector<lint> l;
  cin>>n;
  l.pb(1);
  l.pb(1);
  for(lint i=2;i<=n;i++) l.pb(l[i-1]+l[i-2]);
  cout<<l[n]<<endl;
}