Go: package main

import (
	"fmt"
)

const MAX = 45

var dp [MAX]int

func fin(n int) int {
	if dp[n] != 0 {
		return dp[n]
	}

	switch n {
	case 0:
		dp[n] = 1
	case 1:
		dp[n] = 1
	default:
		dp[n] = fin(n-1) + fin(n-2)
	}
	return dp[n]
}

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

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)

int main()
{
    int n, ans = 1;
    scanf("%d", &n);

    int tmp0, tmp1 = 1;
    rep(i, n-1){
        tmp0 = tmp1;
        tmp1 = ans;
        ans = tmp0 + tmp1; 
    }
    printf("%d\n", ans);
    return 0;
}

C++: #include <iostream>
const int MAX_N = 50;
using namespace std;

int dp[MAX_N];

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

    dp[0] = 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>

using namespace std;

int F[50];

int main(void) {
	int n;
	cin >> n;
	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<stdio.h>
int a[10000]={1,1};
int kaishi(int n){
    if(a[n])return a[n];
    a[n]=kaishi(n-1)+kaishi(n-2);
    return a[n];
}
int main(){
    int n;
    scanf("%d",&n);
    printf("%d\n",kaishi(n));
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int d;
int dd[50];
int fib(int a){
	if(a==0||a==1)return dd[a]=1;
	if(dd[a])return dd[a];
	return fib(a-1)+fib(a-2);
}

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

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

#define NIL -1
#define INF 1000000001

using namespace std;

int fib(int n,vector<int> &fib_array){
     if(n == 0 || n == 1) {
         fib_array[n] = 1;
         return 1;
     }
     else {
         if(fib_array[n-2] == 0) fib_array[n-2] = fib(n-2,fib_array);
         if(fib_array[n-1] == 0) fib_array[n-1] = fib(n-1,fib_array);
         return fib_array[n-1] + fib_array[n-2];
     }
}

int main(){
    int n;
    scanf("%d",&n);
    vector<int> fib_array(n,0);
    printf("%d\n",fib(n,fib_array));
    return 0;
}

C++: #include <iostream>
using namespace std;
int solution(int n){
    if(n==0) return 1;
    if(n==1) return 1;
    return solution(n-1)+solution(n-2);
}

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

C++: #include <iostream>

using namespace std;

int main() {
  int n;
  int dp[45];

  // 初期化
  dp[0] = 1;
  dp[1] = 1;

  //入力
  cin >> n;

  // DP
  for(int i = 2; i <= n; i++) dp[i] = dp[i-1] + dp[i-2];

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

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

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

C++: #include <iostream>
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;
    return 0;
}

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

int fibonacci(int i){
  int fib;
  if(i == 0 or i == 1){
    return 1;
  }else{
    fib = fibonacci(i - 1) + fibonacci(i - 2);
    return fib;
  }
  return 0;
}

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

  fn = fibonacci(n);

  cout << fn << endl;

  return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

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

const ll MOD = 9223372036854775807; // 1e9+7;

vvl initialize(int r, int c) {
  /*
   * r行c列の2次元零行列
   */
  vvl I = vvl(r);
  REP (i, r) {
    I[i] = vl(c, 0);
  }
  return I;
}

vvl mul(vvl A, vvl B) { // A*B
  vvl C = initialize(A.size(), B[0].size());
  REP (i, A.size()) REP (k, B.size()) REP (j, B[0].size()) {
    C[i][j] = (C[i][j] + 1l * A[i][k] * B[k][j]) %MOD;
  }
  return C;
}

vvl pow(vvl A, ll n) { 
  /*
   * Aのn乗の行列
   * Aは正方行列
   */
  int d = A.size();
  vvl B = initialize(d, d);
  REP (i, d) B[i][i] = 1; // Aと同じ次元の単位行列を作成
  while (n > 0) {
    if (n&1) B = mul(A, B);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

ll fibonacci(ll n) {
  vvl A = initialize(2,2);
  A[0][0] = A[0][1] = A[1][0] = 1;
  A[1][1] = 0;
  A = pow(A, n+1);
  return A[1][0];
}

ll n;

int main() {

  cin >> n;
  cout << fibonacci(n) << endl;;
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int d;

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

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

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

int main() {

    int F[44];

    int n;

    cin >> n;

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

    cout << F[n] << endl;

    return 0;
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int fib[INF];

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

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

C++: #include <stdio.h>
#define N 100
#define M -1
int fib(int);

int array[N];
int main()
{
  int i,n;
  scanf("%d",&n);
  for(i=0;i<N;i++)
    {
      array[i]=M;
    }
  printf("%d\n",fib(n));
}

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

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

C++: #include <iostream>
using namespace std;
long long fib[50];

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

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

int main(){
  int n,a[2]={1,1};
  cin>>n;

  int c=0;
  for(int i=1;i<n;i++)a[c]=a[0]+a[1],c=!c;
  cout << a[!c]<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int fibo[n + 1] = { 1, 1 };

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

	return 0;
}

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

int n;
vector<int> dp(50, 0);

int solve(int i){
    if(dp[i] > 0) return dp[i];
    if(i == 0) return dp[0] = 1;
    if(i == 1) return dp[1] = 1;
    return dp[i] = solve(i-1) + solve(i-2);
}

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

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

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

	for(int i=3;i<=45;i++)
		n[i]=n[i-1]+n[i-2];
	int x;
	cin>>x;
	cout<<n[x]<<endl;
	return 0;
}