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
//------------------------------------------
#include <bits/stdc++.h>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x) {
    ostringstream sout;
    sout << x;
    return sout.str();
}

// math
//-------------------------------------------
template <class T>
inline T sqr(T x) {
    return x * x;
}

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) \
    for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPI(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF_INT = 2147483647;
const LL INF_LL = 9223372036854775807;

// clear memory
//--------------------------------------------
#define CLR(a) memset((a), 0, sizeof(a))

// vector
//--------------------------------------------
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}

// pair
//--------------------------------------------
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}

// vector
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}

// list
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, const list<T> &lst) {
    os << "{";
    REPI(itr, lst) {
        os << *itr;
        itr++;
        if (itr != lst.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// map
//--------------------------------------------
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    REPI(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// set
//--------------------------------------------
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    REPI(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

// dump
//--------------------------------------------
#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                       \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                     \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \
            << endl                                                     \
            << "    ",                                                  \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

int n;
int f[45];

int main(void) {
    cin >> n;
    f[0] = f[1] = 1;
    FOR(i, 2, n + 1) f[i] = f[i - 1] + f[i - 2];
    cout << f[n] << endl;
    return 0;
}

C++: //============================================================================
// Name        : Fibonacci.cpp
// Author      : Ken
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
using namespace std;

int calcFibonacci(int n){
	vector<int> fib(n+1);
	if(n == 0){
		return 1;
	}else if(n == 1){
		return 1;
	}else{
		fib.at(0) = 1;
		fib.at(1) = 1;
		for(int i=2; i<n+1; i++){
			fib.at(i) = fib.at(i-1) + fib.at(i-2);
		}
		return fib.at(n);
	}
}

int main() {
	int n;
	cin >> n;
	cout << calcFibonacci(n) << "\n";

	return 0;
}

C++: a

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

using namespace std;

int main() {

    vector<ll> dp;
    dp.push_back(1);
    dp.push_back(1);
    ll n;
    cin >> n;
    for(ll i=0;i<n;i++) {
        dp.push_back(dp[i]+dp[i+1]);
    }
    cout << dp[n] << endl;;
}

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#define PI 3.1415926535
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

long long int n;

long long int fib(int k){
	if (!k || k == 1) return 1;
	return fib(k - 1) + fib(k - 2);
}

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

C++: #include<bits/stdc++.h>
#define N 45
using namespace std;
int n,F[N];

int main(){
  cin>>n;
  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 <cmath>
#include <vector>
#include <string>
#include <algorithm>

int fib(int* f, int n) {
    if (f[n] == 0) {
        f[n] = fib(f, n-1) + fib(f, n-2);
    }
    return f[n];
}

int main() {
    int n;
    std::cin >> n;
    int f[50] = {1, 1};

    std::cout << fib(f, n) << "\n";
    return 0;
}

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

int main(){
	int n;
	int ary[44] = { 1, 1 };

	cin >> n;

	for (int i = 2; i <= n; i++){
		ary[i] = ary[i - 1] + ary[i - 2];
	}
	
	cout << ary[n] << endl;
	
	return 0;
}

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

class Fib {
public:
    Fib(int n) : _data(n+1) {
        _data[0] = 1;
        _data[1] = 1;
    }

    int operator()(int n) {
        if (n <= _size) {
            return _data[n];
        }
        _data[n] = (*this)(n-1) + (*this)(n-2);
        _size = n;
        return _data[n];
    }

private:
    int _size = 1;
    vector<int> _data;
};


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

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

int main(){
    int n; cin >> n;
    int ans;
    if(n == 0 || n == 1){
        ans = 1;
    }else{
        int n_1 = 1;
        int n_2 = 1;
        for(int i = 2; i <= n; i++){
            ans = n_1 + n_2;
            n_2 = n_1;
            n_1 = ans;
        }
    }
    cout << ans << endl;
}