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 <iostream>
#include <cstdio>
using namespace std;

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

    return 0;
}

C++: #include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


int main() {
   ll n;
   cin>>n;
   vll a(n+1);
   a.at(0)=1;
   a.at(1)=1;
   rep(i,n-1){
       a.at(i+2)=a.at(i+1)+a.at(i);
   }
   cout<<a.at(n)<<endl;
}

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

int main(){
	int n;
	cin >> n;
	if (n < 2) {
		cout << 1 << endl;
	} else {
		int f[n+1];
		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 "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

const int INF = 1000000000;
const double PI = 3.1415926535897932384626433832795;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

using LL = long long int;
using LD = long double;
using pii = pair<int, int>;
using pdd = pair<double, double>;
using pll = pair<LL, LL>;
using vi = vector<int>;
using vd = vector<double>;
using vvi = vector<vi>;
using vll = vector<LL>;

//==============================================
vi dp(94);

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	
	REP2(i, 1, n + 1)  dp[i] = -1;
	cout << fib(n) << "\n";
	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

vector<int> F(45, -1);

int fib(int n)
{
  if (!n || n == 1) return F[n] = 1;
  if (F[n] != -1) return F[n];

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

C++: #include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

C++: #include <iostream>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

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

	int F[50];

	F[0] = 1;
	F[1] = 1;

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

	cout << F[n] << endl;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<string, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    vector<ll> res(50);
    res[0] = res[1] = 1;
    for (int i = 2; i <= 44; i++)
        res[i] = res[i - 1] + res[i - 2];
    int n;
    cin >> n;
    cout << res[n] << endl;
}

C++: #include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  A[1] =2;
  for(int i=2;i<44;++i){
    A[i] =A[i-1];
    if(i>1)A[i]+=A[i-2];
  }
  return A[n-1];

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

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

int fibonacci(int n){
	if(n==0) return 1; //たぶん本当はフィボナッチ数列はf(0)=0 だと思うのだが、問題文がそうなっていたので１を返す。
	else if(n==1) return 1;
	else return fibonacci(n-2) + fibonacci(n-1);
}

int fibonacci_dp(int n){
	int i;
	int fib[45];

	fib[0]=1;
	fib[1]=1;

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

int main() {
	int n;

	cin >> n;
	//cout << fibonacci(n) << endl;
	cout << fibonacci_dp(n) << endl;

	return 0;
}

C++: #include <iostream> 

using namespace std;
int main()
{
	int f[100];
	int n;
	cin >> n;
	f[0] = 1;
	f[1] = 1;
	for(int i = 0; i < n; i++)
	{
		f[i+2] = f[i+1] + f[i];
	}
	cout << f[n] << endl;
    return 0;
}

C++: #include <iostream>
#include <map>

std::pair<int, int> FibonacciPair(int Index)
{
	if(Index == 0) return std::make_pair(0, 1);
	if(Index == 1) return std::make_pair(1, 1);
	std::pair<int, int> Prev = FibonacciPair(Index - 1);
	return std::make_pair(Prev.second, Prev.first + Prev.second);
}

int FibonacciNumber(int Index)
{
	return FibonacciPair(Index).second;
}

int main()
{
	int Index;
	std::cin >> Index;
	std::cout << FibonacciNumber(Index) << std::endl;
	return 0;
}

C++: #include <iostream>

int fib(int, int[]);

int main()
{
	int n;
	const int size = 44;
	int memo[size + 1];

	for (int i = 0; i < size + 1; i++)
	{
		memo[i] = -1;
	}

	std::cin >> n;

	std::cout << fib(n, memo) << std::endl;

	return 0;
}

int fib(int n, int memo[])
{
	int ans;

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

	return ans;
}

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

int fib(int n){
  int n1,n2,t;
  n1 = n2 = t = 1;
  for(int i = 1;i < n;i++){
    t = n1 + n2;
    n1 = n2;
    n2 = t;
  }

  return t;
}

int main(){
  int n;

  cin >> n;
  cout << fib(n) << endl;

  return 0;
}

C++: #include<stdio.h>
 
#define Max 45
 
int F[Max];
 
int fibonacci(int n){
  if( n == 0 || n == 1)
    return F[n] = 1;
  if( F[n] != NULL ) 
    return F[n];
  return F[n] = fibonacci(n - 2) + fibonacci(n - 1);
}
 
int main(){
 
  int n, i, A;
 
  scanf("%d",&n);
 
  for( i = 0 ; i <= n  ; i++)
    A = fibonacci(i);
 
  printf("%d\n",A);
 
  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;
}