Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include <iostream>
using ll = long long;
using namespace std;
#define MAX 50
/* initialize */
int fibs[MAX];

/* main */
int main() {

    int n;
    cin >> n;
    fibs[0]=fibs[1] = 1;
    for (int i = 2; i <= n; i++) {
        fibs[i] = fibs[i-1] + fibs[i-2];
    }
    cout << fibs[n] << "\n";
    return 0;
}

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

// // TLEとなってしまう実装
// int fib(int n)
// {
//   // ベースケース
//   if (n == 0)
//   {
//     return 1;
//   }
//   if (n == 1)
//   {
//     return 1;
//   }
//   // 再帰ステップ
//   return fib(n - 1) + fib(n - 2);
// }

vector<int> F(100, 0);

int fib(int n)
{
  // n項目を計算済みのとき
  if (F.at(n) > 0)
  {
    return F.at(n);
  }
  // n項目を未計算のとき
  if (n == 0 || n == 1)
  {
    F.at(n) = 1;
  }
  else
  {
    F.at(n) = fib(n - 1) + fib(n - 2);
  }
  return F.at(n);
}

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

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

int F[SIZE];

int Fibonacci(int n)
{
    if (n == 1 || n == 0)
    {
        return F[n] = 1;
    }
    if (F[n])
    {
        return F[n];
    }
    return F[n] = Fibonacci(n - 1) + Fibonacci(n - 2);
}

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

    return 0;
}

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

int main()
{
	int n,x1=1,x2=1,tmp=0;
	cin >> n;
	
	if(n==0||n==1) cout << "1";
	else{
		for(;n>2;n--){
			tmp=x1+x2;
			x1=x2;
			x2=tmp;
		}
	}
	cout << x1 + x2;
}

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

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

	int ans = 1;
	if( n == 0 || n == 1 ) {
	}
	else {
		vector<int> dp( n + 1 );
		dp[0] = 1;
		dp[1] = 1;
		for( int i = 2; i < n + 1; i++ ) {
			dp[i] = dp[i - 1] + dp[i - 2];
		}
		ans = dp[n];
	}

	cout << ans << endl;
}

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

void fnInput(vector<int>& rvnFibDP)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  rvnFibDP.resize(nMaxSiz + 1, 0);

  if (nMaxSiz >= 1)  
    rvnFibDP[0] = rvnFibDP[1] = 1;
  else
    rvnFibDP[0] = 1;
}

int fnFibNumber(vector<int>& rvnFibDP, int nNo)
{
  if (rvnFibDP[nNo])  return rvnFibDP[nNo];

  return rvnFibDP[nNo] = 
         fnFibNumber(rvnFibDP, nNo - 1) + fnFibNumber(rvnFibDP, nNo - 2);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnFibDP; 

  fnInput(vnFibDP);
  cout << fnFibNumber(vnFibDP, vnFibDP.size() - 1) << endl;
  return 0;
}

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

using namespace std;


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

    vector<int> dp(n+1, 0);

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

C++: #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>



using namespace std;

int main() {
   

    long long n;
    cin >> n;
    long long 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;


}

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

unsigned long long ull[45];

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