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<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){
  int dp[1000];
  dp[0] = 1;
  dp[1] = 1;

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

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	
	int n[47];
	n[1]=1;n[2]=2;

	for(int i=3;i<=45;i++)
		n[i]=n[i-1]+n[i-2];

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

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

#define INF 1e9
vector<int> memo;

int fib(int n){
  if(memo[n] == -INF){ memo[n] = fib(n - 1) + fib(n - 2); }
  return memo[n];
}

int main(void){
  int n;
  cin >> n;
  
  memo = vector<int>(n + 1, -INF);
  memo[0] = memo[1] = 1; 
  
  cout << fib(n) << endl;
  return 0;
}

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

constexpr ll DP_MAX = 1000000;
ll dp[DP_MAX];

int main(int argc, char **argv)
{
	ll n; cin >> n;
	memset(dp, 0, sizeof dp);
	dp[0] = dp[1] = 1;
	for (ll i = 2; i <= n; ++i)
		dp[i] = dp[i-1] + dp[i-2];
	std::cout << dp[n] << std::endl;
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){
  if(n==0 || n == 1){
    return 1;
  }else{
    return fib(n-1) + fib(n-2);
  }
}

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

using namespace std;

int main(){
  int n; cin >> n;
  vector<int> fib;
  fib.push_back(0); fib.push_back(1);

  for(int i=0; i<n; i++)
    fib.push_back(fib[i]+fib[i+1]);

  cout << fib.back() << endl;

  return 0;
}

C++: #include <iostream>

using namespace std;

int memo[45];

int fibonacchi(int num)
{
    if (memo[num] != -1) {
        return memo[num];
    } else if (num == 0 || num == 1) {
        memo[num] = 1;
        return memo[num];
    } else {
        int result = fibonacchi(num - 1) + fibonacchi(num - 2);
        memo[num] = result;
        return memo[num];
    }
}

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

    int n;
    cin >> n;
    cout << fibonacchi(n) << '\n';
}

C++: #include<stdio.h>

int main()
{
	int fib1{ 1 }, fib2{ 1 }, n;

	scanf("%d", &n);
	for (int i = 1; i < n; ++i)
	{
		int tmp = fib2;
		fib2 += fib1;
		fib1 = tmp;
	}
	printf("%d\n", fib2);
	return 0;
}

C++: #include <iostream>
#include <algorithm> // next_permutation
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <numeric> //accumulate
//#include <unordered_map> //???????????\??¢??°
#include <fstream> //ifstream, ofstream

//#define NDEBUG //NDEBUG???#include <cassert>???????????????????????????????????´???assert?????????????????????????????????NDEBUG?????????????????????????????????????????????
#include <cassert> //assert


using namespace std;

//???????????°??????TEST????????????????????¬???????????????????????????????????¢????????????
#define TEST //*******************************************************************************************************************************************
//?????????????????¨??§?????\????????????????????????????????°?????????????¨???????????????????dout???????????????????????§???????????¬??????????????????????????????????????????
//??????????????????????????????????????????????????????????§?CPU???????£??????????????????§???TLE?????????????????????????????????????????§????????¨???                           ????????????????????????cerr????????£????????????????????????????????????
#ifdef TEST
#define dout cout
#define din cin
#else
stringstream dummy; //???????????°??????dout?????????????????????????????????
#define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummy?????????????????????????????????????????¨?????¢?????¢???????????????
//???????????¨??????????????????goodbit?????????????????????????????¨???????????´????????????????????????????????¨?????°?????????????????§???????????????????????????????????? http://d.hatena.ne.jp/linden/20060427/p1
#endif

//?¨??????????????????????????????????????????????????????´??????OUTPUTFILE????????????????????¬???????????????????????????????????¢????????????
//#define OUTPUTFILE "output.txt" //*******************************************************************************************************************************************
#ifdef OUTPUTFILE
#define dout outputfile //??¨????????????TLE????????§?????????dout?????¨??¨??????????????¢????????????????????????????????????????????§????¨????????????´??????????????£??????????????????????¨?????????????????????????????????????????????§?????????????????????
ofstream outputfile(OUTPUTFILE);
#define OutputFilePath "/Users/Nag/Documents/Prgm/Test/DerivedData/Test/Build/Products/Debug/output.txt"
#endif

//?¨??????\???????????????????????????????????????????????´??????INPUTFROMTEXTFILE????????????????????¬???????????????????????????????????¢????????????
//#define INPUTFILE "input.txt" //*******************************************************************************************************************************************
#ifdef INPUTFILE
#define din inputfile
ifstream inputfile(INPUTFILE);
#endif


#define disp(A) dout << #A << " = " << (A) << endl
#define disP(A) dout << setw(3) << (A) << " " // << setw(3) ??????????????\????????????
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)

#define dispAll(A,n) dout << #A << " = "; rep(j, 0, (n)) {disP(A[j]);} dout << endl

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef unsigned long long ll;

const int INF = 1e9-1;

int F[45] = {0};

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


int main() {
    int n; cin >> n;
    
    dout << fibonacci(n) << endl;
    
    
    
#ifdef INPUTFILE
    inputfile.close();
#endif
    
#ifdef OUTPUTFILE
    outputfile.close();
    cout << "\"" << OutputFilePath << "\"" << endl;
#endif
    
    return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int dp[45];

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

int main() {
	memset(dp, -1, sizeof(dp));
	dp[0] = 0;
	dp[1] = 1;
	int n;
	scanf("%d", &n);
	printf("%d\n", fib(n));
	return 0;
}

C++: #include<iostream>
using namespace std;
void fibo(int n);
int main() {
    int n;
    cin >> n;
    fibo(n);
    return 0;
}
void fibo(int n) {
    if (n == 0) cout << "1" << endl;
    else if (n == 1) cout << "1" << endl;
    else if (n == 2) cout << "2" << endl;
    int cnt;
    int f1 = 1, f2 = 1, f3;
    f3 = f1 + f2;
    cnt = 2;
    while (cnt <= n) {
        f1 = f2 + f3;
        cnt++;
        if (cnt == n) cout << f1 << endl;
        f2 = f3 + f1;
        cnt++;
        if (cnt == n) cout << f2 << endl;
        f3 = f1 + f2;
        cnt++;
        if (cnt == n) cout << f3 << endl;
    }
    
    
}

C++: #include <stdio.h>
int main(){
int a[50],n;
a[0]=a[1]=1;
scanf("%d",&n);
for(int i=2;i<=n;i++)
a[i]=a[i-1]+a[i-2];
printf("%d",a[n]);
}