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>
using namespace std;
#define MAX 45

int main(){
  int fibo[MAX];
  int n;
  fibo[0] = fibo[1] = 1;
  for(int i = 2; i < MAX; i++)
    fibo[i] = fibo[i-1] + fibo[i-2];

  cin >> n;
  cout << fibo[n] << endl;
}

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

int main(){
  int dp[51];
  int num;
  cin>>num;
  dp[0]=1;
  dp[1]=1;
  for(int i=2;i<=num;i++) dp[i]=dp[i-1]+dp[i-2];
  cout<<dp[num]<<endl;
 return 0;
}

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

vector<int> fibonatti;
int dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  for (int i = 0; i < n; i++) {
    std::cout << dp[i] << " ";
  }
  return 0;
}

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

int f[45];

void FibonacciInit(){

    f[0] = 1;
    f[1] = 1;
    for(int i=2; i<=44; i++){
        f[i] = f[i-1] + f[i-2];
    }
}

int main() {

    int n;
    cin >> n;

    FibonacciInit();

    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<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 <stdio.h>

int fibonacci(int);
int F[45];

int main(){
  int n;

  scanf("%d",&n);
  printf("%d\n",fibonacci(n));

  return 0;
}

int fibonacci(int n){
  int i;

  for(i=0;i<45;i++) F[i]=-1;
  
  if(n==0||n==1) return F[n]=1;
  if(F[n]!=-1) return F[n];
  return F[n]=fibonacci(n-2)+fibonacci(n-1);
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int dp[50];

int main(){
  int n;cin>>n;
  dp[0]=1;
  dp[1]=1;
  rep1(i, n){
    dp[i+1] = dp[i-1]+dp[i];
  }

  cout<<dp[n]<<endl;

  return 0;
}

C++: #include <stdio.h>

using namespace std;

long long Fibonacci[43] = {0};

long long fibo(int n){
	if(n == 0)	return 1;
	else if(n == 1)	return 1;
	else{
		if(Fibonacci[n-1] != 0 && Fibonacci[n-2] != 0){
			//Do nothing
		}else if(Fibonacci[n-1] != 0){
			Fibonacci[n-2] = fibo(n-2);
		}else if(Fibonacci[n-2] != 0){
			Fibonacci[n-1] = fibo(n-1);
		}else{
			Fibonacci[n-1] = fibo(n-1);
			Fibonacci[n-2] = fibo(n-2);
		}
		return Fibonacci[n-1] + Fibonacci[n-2];
	}
}

int main(){
	int n;
	scanf("%d",&n);
	printf("%lld\n",fibo(n));
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

int dp[50];

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

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

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

int main(){
    int n;
    cin>>n;
    int sum[n+1];
    for(int i=0;i<=n;i++){
        if(i==0||i==1){
            sum[i]=1;
        }
        else{
            sum[i]=sum[i-1]+sum[i-2];
        }
    }
    cout<<sum[n]<<endl;
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(i) for(int i = 0;true; i++)
#define all(x) (x).begin(), (x).end()
#define mn 1000000007
int main() {
	int N;
	cin >> N;
	int num = 1;
	vi A;
	loop(i) {
		if (N+1==i) {
			cout<<A[A.size()-1]<<endl;
			break;
		}
		if (i >= 2) {
			A.push_back(A[i-1]+A[i-2]);
		}
		else {
			A.push_back(1);
		}
	}
};

C++: //ALDS1_10_A:Fibonacci Number
#include <bits/stdc++.h>
using namespace std;
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807

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

C++: #include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp


int main() {
    std::cout << std::fixed << std::setprecision(15);
    long long n;
    cin >> n;

    ll dp[50];

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

    rep(i,n){
        if(i == 0){
            continue;
        }
        dp[i+1] = dp[i] + dp[i-1];
    }

    cout << dp[n] << endl;

}

C++: #include<iostream>

using namespace std;

int dp[45] = {1,1};
int fibo(int n){
  if(dp[n] != 0) return dp[n];
  dp[n] = fibo(n-1) + fibo(n-2);
  return dp[n];
}

int main() {
  int n;
  cin >> n;
  cout << fibo(n) << endl;
  return 0;
}