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 <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
vector<ll> fibs(100, -1);
ll fib(int n){
    if(fibs[n]!=-1) return fibs[n];
    if(n==0 || n==1) return 1;

    return fibs[n] = fib(n-2) + fib(n-1);
}

int main()
{
    int n; cin >> n;
    pr(fib(n));
    return 0;}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int f1=0,f2=1,n,xx;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
       xx=f2;
        int next = f1 + f2;
        f1 = f2;
        f2 = next;
}
printf("%d\n",f2);
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

vector<lint> Fib{0, 1, 1};
lint fib(int k) {
  if (k < 0) return 0;
  if (k == 0) return 0;
  if (k < 3) return 1;
  if (Fib.size() <= k + 1) {
    Fib.push_back(fib(k - 1) + fib(k - 2) /* % mod */);
  }

  return Fib[k];
}

signed main() {
  cout << fib(in() + 1) << endl;
}

C++: #include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  int n;
  cin >> n;

  vector<int> list(n,0);
  list[0] = list[1] = 1;
  

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

  cout << list[n] << eol;
  
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
typedef long long ll;
int main(){
    int n;cin>>n;
    int dp[50];
    rp(i,50){
        if(i==0||i==1)dp[i]=1;
        else dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
}

C++: #include "iostream"

using namespace std;

int F[46];

int fib( int n ) {

	if (F[n] != 0) return F[n];

	if (n == 0 || n == 1) F[n] = 1;

	else F[n] = fib(n - 1) + fib(n - 2);

	return F[n];
}

int main() {


	int n;

	cin >> n;

	cout << fib(n) << endl;

	return 0;
}

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

int dp[50];

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

int main(void){
  int n; cin >> n;
  rep(i,50) dp[i] = -1;
  cout << fibonacci(n) << endl;
  return 0;
}

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 main() {
  int FB[45];
  FB[0] = FB[1] = 1;
  int n;
  cin >> n;
  if (n>1) {
    for (int i=2; i<=n; i++) {
      FB[i] = FB[i-1] + FB[i-2];
    }
  }
  cout << FB[n] << endl;
}

C++: #include <iostream>
int F[100];
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n];
}

C++: /**
*    created: 12.05.2020 12:38:55
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    int f[50];
    f[0] = f[1] = 1;
    rep2(i,2,50) {
        f[i] = f[i-1] + f[i-2];
    }
    cout << f[n] << endl;


    return 0;
}

C++: #include <stdlib.h>
#include <stdio.h>

int fib(int n){
int i;
int a[25];
a[0]=a[1]=1;
for(i=2;i<=n;i++){
a[i]=a[i-1]+a[i-2];
   }
return a[n];
}

int main(){

int x,n;
scanf("%d",&n);
x=fib(n);
printf("%d",x);

return 0;
}