Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	f := make([]int, n+1)

	fmt.Println(fib(n, f))
}

func fib(n int, f []int) int {
	if n == 0 {
		f[n] = 1
		return f[n]
	}
	if n == 1 {
		f[n] = 1
		return 1
	}

	if f[n] != 0 {
		return f[n]
	}

	f[n] = fib(n-2, f) + fib(n-1, f)
	return f[n]
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

int dp[50];

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

	rep(i, n) dp[i] = -1;
	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;
}

C++: #include<iostream>
using namespace std;
int fib(int p){
    if(p==0||p==1) return 1;
    else return fib(p-1)+fib(p-2);
}
int main(){
    int n;
    cin>>n;
    cout<<fib(n)<<endl;
    return 0;
}

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

int main()
{
	int n = 0;
	long a[50] = { 1, 1 };

	cin >> n;

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

	cout << a[n] << endl;

	return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

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

	return 0;
}

C++: # -*- coding: utf-8 -*-

def main():
    def _fibonacci(n,cache):
        if n in cache:
            return cache[n]

        elif n == 0 or n == 1:
            ret = 1
            cache[n] = ret
            return ret
        else:
            ret = _fibonacci(n - 1, cache) + _fibonacci(n - 2, cache)
            cache[n] = ret
            return ret

    N = int(raw_input())
    cache = {}
    return _fibonacci(N,cache)

print main()

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

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

  vector<int> F(50);
  F.at(0) = 1;
  F.at(1) = 1;
  for (int i = 2; i <= n; i++) {
    F.at(i) = F.at(i - 2) + F.at(i - 1);
  }

  cout << F.at(n) << endl;
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
using namespace std;
int dp[45] = {};
int fib(int a) {
	if (a == 0 || a == 1) return 1;
	if (dp[a] != 0) return dp[a];
	return dp[a] = fib(a - 1) + fib(a - 2);
}
int main() {
	int n = 0;
	scanf("%d", &n);
	printf("%d\n", fib(n));
}

C++: #include<iostream>
using namespace std;
int main(){
  int f[3]={1,1},n;
  cin >> n;
  while(n--){
    f[2]=f[0]+f[1];
    f[0]=f[1];    
    f[1]=f[2];
  }
  cout<<f[2]<<endl;
  return 0;
}

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

//#define int long long
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int dp[100];
signed main() {
    dp[0] = dp[1] = 1;
    int n; cin >> n;
    
    reps(i,2,n){
        dp[i] = dp[i-1] + dp[i-2];
    }
    
    cout << dp[n] << endl;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	
#include<list>
#include<set>

constexpr auto PI = 3.14159265359;

using namespace std;

int main() {
	int N;
	cin >> N;
	int fibonacci[45];
	fibonacci[0] = 1;
	fibonacci[1] = 1;
	for (int i = 2; i <= N; ++i) {
		fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2];
	}
	cout << fibonacci[N] << endl;

	return 0;
}

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;

int n;

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

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

C++: 
#include<iostream>

using namespace std;
typedef long long ll;

const int MAX = 45;

ll f[MAX];

ll fibonacci(long n) {

	if (f[n] != -1) return f[n];
	if (n < 2) return 1;

	ll fb = fibonacci(n - 1) + fibonacci(n - 2);
	f[n] = fb;

	return fb;
}


int main() {

	for (int i = 0;i < MAX;i++) f[i] = -1;

	int num;
	cin >> num;

	cout << fibonacci(num) << endl;

	return 0;
}

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

int F[45];

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

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

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x=1,y=1;
    int ans=0;
    if(n==0||n==1){
        cout<<1<<endl;
        return 0;
    }
    for(int i=2;i<=n;i++){
        ans = x+y;
        x = y;
        y = ans;
    }
    cout<<ans<<endl;
}

C++: #include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {

    int n;
    cin >> n;

    int dp[50];
    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;
}