Go: package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	fmt.Fprintln(writer, fib(n))
	writer.Flush()

}

func fib(n int) int {
	if n <= 1 {
		return 1
	}
	dp := make([]int, n+1)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= n; i++ {
		dp[i] = dp[i-2] + dp[i-1]
	}
	return dp[n]
}

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

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

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

int DP[45];
void init(){
    rep(i,45)DP[i]=-1;
}

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

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

C++: #include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

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

int result[45];

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

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

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;


ll dp[50];

int main(){
    int n; cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    rep(i, n){
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

C++: #include <stdio.h>

//int f[44];

int fib(int n)
{
  if (n < 2) return 1;
  //if (f[n] == 0) f[n] = 
  return fib(n - 1) + fib(n - 2);
  //return f[n];
}

int main()
{
  int n;

  scanf("%d", &n);

  printf("%d\n", fib(n));

  return (0);
}

C++: #include <iostream>
#include <stdlib.h>
 
using namespace std;
 
#define MAX_N 44

class Fib{
private:
  int size;
  int *A;
public:
  Fib(int size){
    this->size = size;
    makeFib();
  }

  int getFib(int n){
    return A[n];
  }

  void makeFib(){
    int i;
    this->A = (int*)malloc(sizeof(int)*this->size);
    this->A[0] = 1;
    this->A[1] = 1;
    for(i = 2;i < this->size;i++){
      this->A[i] = this->A[i-2]+this->A[i-1];
    }
  }

  ~Fib(){
    free(A);
  }
};
 
int main(){
 
    int n;
    Fib *fib = new Fib(MAX_N); 

    cin >> n;
 
    cout << fib->getFib(n) << endl;
 
    delete fib;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int n;
    cin >> n;
    vector<int> fib(n + 1, 1);
    repd(i, 2, n + 1) {
        fib[i] = fib[i - 1] + fib[i - 2];
    } 

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

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

class Fib {
	vector<ll> memo;
public:
	Fib(ll initial_size = 16) : memo(initial_size,-1) {};// -1 is sentinel
	ll operator() (ll n) {
		if (n > memo.size() - 1) {
			memo.resize(2*n,-1);
		}
		if (n == 0 || n == 1) {
			return 1;
		}
		if (memo[n] != -1) {
			return memo[n];
		}
		memo[n] = operator()(n-1) + operator()(n-2); 
		return memo[n];
	}
};

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

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

int fibmemo[45] = {0};
int fibMemo(int n);

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

int fibMemo(int n){
    if(fibmemo[n] == 0){
        fibmemo[n] = fib(n);
    }
    return fibmemo[n];
}


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

C++: #include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector <int>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)

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

    int n; cin >> n;

    int fib[n+1];
    fib[0] = 1;
    fib[1] = 1;
    FOR(i, 2, n+1) {
        fib[i] = fib[i-1] + fib[i-2];
    }
    cout << fib[n] << "\n";
}

C++: #include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

long fib(long n){
	if(n < 2) return 1;
	return fib(n-1) + fib(n-2);
}

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

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

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> f(n+1);


    f[0] = 1;
    f[1] = 1;
    
    for(int i = 2; i <= n; i++){
        f[i] = f[i-1] + f[i-2];
    }
    std::cout << f[n] << std::endl;
    
    

    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 - 2] + F[i - 1];
    }
    cout << F[n] << endl;
    return 0;
}

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

using namespace std;

int fib(int n) {
    return n <= 1 ? 1 : fib(n - 1) + fib(n-2);
}

int dp[1000];

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

int fibdp(int n){
    vector<int> dpv(n);
    dpv[0] = dpv[1] = 1;
    for (int i = 2; i < n; ++i)dpv[i] = dpv[i-1] + dpv[i-2];
    return dpv[n-1];
}

int fibloop(int n){
    int fib,fib2;
    fib = fib2 = 1;
    for (int i = 2; i < n; ++i){
        int tmp = fib;
        fib = fib + fib2;
        fib2 = tmp;
    }
    return fib;
}

int main(){
    //freopen("in", "r", stdin);
    int n;
    cin >> n;
    cout << fibloop(n) << endl;
    return 0;
}

C++: #include <iostream>
#define MAX 100001
#define SENTINEL 2000000000
using namespace std;


int solved[MAX];

int fib(int n){
    for(int i = 0; i <= n; i++){
        if(i == 0) {
            solved[i] = 1;
            continue;
        };
        if(i == 1) {
            solved[i] = 1;
            continue;
        };
        solved[i] = solved[i - 1] + solved[i - 2];
    }
    return solved[n];
}

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

    int r = fib(n);
    cout << r << endl;

    return 0;
}