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++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	LL fib[47];
	fib[0] = 1;
	fib[1] = 1;
	FOR(i, 2, 45)fib[i] = fib[i - 1] + fib[i - 2];

	int n; cin >> n;
	cout << fib[n] << endl;
}

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

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

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

int main(){
  int n;
  cin >> n;
  int fn[50];
  fn[0] = fn[1] = 1;
  for(int i = 2; i <= n; i++) fn[i] = fn[i - 1] + fn[i - 2];

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

C++: #include<cstdio>

int main(){
  int fib[45],n;
  fib[0] = 1;
  fib[1] = 1;
  for(int i=2;i<45;i++){
    fib[i] = fib[i-1] + fib[i-2];
  }
  scanf("%d",&n);
  printf("%d\n",fib[n]);
  return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
int n;
int dp[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] << endl;
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
        int n;
        cin >> n;
        if (n <= 1) {
                cout << 1;
                return 0;
        }

        int *fib = new int[n + 1];
        fib[0] = fib[1] = 1;
        for (int i = 2; i <= n; i++) {
                fib[i] = fib[i - 1] + fib[i - 2];
        }
        cout << fib[n] << endl;
        delete [] fib;

        return 0;
}

C++: #include<stdio.h>

int fib(int);
int f[45];

int main()
{
  int a,n;

  scanf("%d",&n);

  a = fib(n);
  printf("%d\n",a);

  return 0;
}

int fib(int n){

  int a;

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

  f[n] = a;
  return a;
}

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;

unsigned long memo[50] = {};

int fib(int n) {
	if (n == 0 || n == 1)return 1;
	if (memo[n] != 0) {
		return memo[n];
	}
	return memo[n] = fib(n - 1) + fib(n - 2);
}
int main() {
	int n;

	cin >> n;

	cout << fib(n) << endl;

	return 0;
}

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

using namespace std;

int fiv(int a[], int n){
    if(a[n])return a[n];
    if(n == 0)return a[n] = 1;
    if(n == 1)return a[n] = 1;
    return a[n] = fiv(a, n-1) + fiv(a, n-2);
}

int main(void){
    int n;
    cin >> n;
    int a[n+1];
    for(int i = 0; i <= n; i++)a[i] = 0;
    fiv(a, n);
    cout << a[n] << endl;
}

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

int F[10000];

int fib(int n)
{
  if (n <= 1)
    return F[n] = 1;
  if(F[n]!=0)
    return F[n];
  return F[n] = fib(n - 1) + fib(n - 2);
}

int main()
{
  int n;
  cin >> n;
  for(int i=0;i<n;i++) F[i] = 0;
  cout << fib(n) << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
long long fib[100];
long long fibonacci(long long n)
{
    if(fib[n])
        return fib[n];
    if(n<=1) return n;
    return fib[n]=fibonacci(n-2)+fibonacci(n-1);
}

int main()
{
    long long n;
    cin>>n;
    fibonacci(n);
    cout<<fibonacci(n+1)<<endl;
    return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;cin>>n;
  int i;
  vector<int> dp(n+1);
  dp[0]=1;
  dp[1]=1;
  rep(i,n-1)dp[i+2]=dp[i+1]+dp[i];
  cout<<dp[n]<<endl;
}

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

const int MAX = 44;
int fibo_res[MAX];

void init()
{
    for (int i = 0; i < MAX; i++) {
        fibo_res[i] = -1;
    }
}

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

int main(int argc, char *argv[])
{
    init();
    int n;
    scanf("%d", &n);
    fprintf(stdout, "%d\n", fibonacci(n));
}

C++: #include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* dlm = "";
  for(const auto& x:v) cout << exchange(dlm, "\t") << x;
  return os;
}
int32_t main(){
  size_t n; cin>>n;
  size_t f[45];
  f[0]=1; f[1]=1;
  for(size_t i=2; i<45; ++i) f[i]=f[i-1]+f[i-2];
  cout<<f[n]<<endl;
}