Go: package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	num, _ := strconv.Atoi(sc1.Text())
	cache := make([]*int, num+1)
	fmt.Println(fib(num, cache))

}

func fib(n int, cache []*int) int {
	if n <= 1 {
		return 1
	}

 	if cache[n] != nil {
		return *(cache[n])
	}

	result := fib(n -2, cache) + fib(n -1, cache)
	cache[n] = &result
	return result
}

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

using namespace std;

int m[45];
void function(int n){
  m[0]=1;
  m[1]=1;
  for(int i=2;i<=n;i++){
    m[i]=m[i-1]+m[i-2];
  }
}

int main(){
  int n;
  cin>>n;
  function(n);
  cout<<m[n]<<endl;
  return 0;
}

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

int dp[50];

int solve(int id){

  if(dp[id] != -1) return dp[id];
  if(id == 1 || id == 0) return dp[id] = 1;
  int ret = 0;

  return dp[id] = solve(id-1) + solve(id-2);

}


int main(){

  memset(dp,-1,sizeof(dp));
  int n; 

  cin >> n;

  cout << solve(n) << endl;

}

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

int main()
{
	int n,i;
	int a[44];
	cin >> n;
	a[0]=1;
	a[1]=1;
	for(i=2;i<n;i++){
		a[i]=a[i-1]+a[i-2];
	}
	cout << a[n-1]<<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>
#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;
}