Go: package main

import (
	"fmt"
)

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

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

	for i := 2; i <= n; i++ {
		m[i] = m[i-2] + m[i-1]
	}

	fmt.Println(m[n])
}

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int n;
    cin >> n;
    ll dp[50];
    dp[0] = 1, dp[1] = 1;
    rep (i, 0, n) { dp[i + 2] = dp[i + 1] + dp[i]; }
    cout << dp[n] << "\n";
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n+1);
	a.at(0) = 1;
	a.at(1) = 1;
	for(int i=2; i<=n; i++){
		a.at(i) = a.at(i-1) + a.at(i-2);
	}
	cout << a.at(n) << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,dp[45]={1,1};
  cin >> n;
  for(int i = 2 ; i <= n ; i++ ) dp[i] = dp[i-1] + dp[i-2];
  cout << dp[n] << endl;
}