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 <bits/stdc++.h>

//#include <vector>
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pii = pair<int, int>; // これ以降 pii という型名はpair<int, int> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


 
int main(){
 
   
    ll n,ans;
    cin>>n;
       vi s(n+1);
        s.at(0)=1;
    s.at(1)=1;
    
    for(int i=2;i<=n;i++){
        s.at(i)=s.at(i-1)+s.at(i-2);
    }
    
    
    
    cout<<s.at(n)<<endl;
}

C++: #include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int F[50];
    F[0] = 1;
    F[1] = 1;
    for(int i=2; i<50; i++) F[i] = F[i-2] + F[i-1];
    
    printf("%d\n", F[n]);
    return 0;
}

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

int main() {
  int dp[MAX];
  dp[0] = dp[1] = 1;
  for (int i = 2; i < MAX; i++) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }

  int n;
  cin >> n;
  cout << dp[n] << endl;

  return 0;
}

C++: #include <iostream>

int main()
{
    constexpr int N = 45;
    
    int dp[N] {};
    
    dp[0] = 1;
    dp[1] = 1;
    
    for(int i = 2; i < N; ++i)
        dp[i] = dp[i-1] + dp[i-2];
    
    int n;
    std::cin >> n;
    std::cout << dp[n] << std::endl;
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<cstdio>
int fib(int);
using namespace std;
int main()
{
	int n,ans,dp[1001];
	dp[0] = 1;
	dp[1] = 1;
	cin >> n;
	for (int i = 0; i <= n; i++){
		dp[i + 2] = dp[i] + dp[i + 1];
	}
	//ans = fib(n - 1);
	ans = dp[n];
	cout << ans << endl;
}
int fib(int n)
{
	if (n < 1)
		return 1;
	else
	{
		return fib(n - 1)+fib(n - 2);
	}
}

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

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;

int n;
ll fib[45];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	fib[0] = 1; fib[1] = 1;
	for (int i = 2; i <= 44; i++) {
		fib[i] = fib[i - 1] + fib[i - 2];
	}
	cout << fib[n] << endl;
	return 0;
}

C++: /* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/30 05:57:50 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	vector<ll>	V(45);
	V.at(0) = V.at(1) = 1;
	rep2(i, 2, 45)
		V.at(i) = V.at(i - 2) + V.at(i - 1);
	int	n;
	cin >> n;
	cout << V.at(n) << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}

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

int f[46]={0};

int fib(int n){
    if(n==0)    f[0] = 1;
    else if(n==1)   f[1] = 1;
    if(f[n]==0)    f[n] = fib(n-1)+fib(n-2);

    return f[n];
}

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

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
typedef long long ll;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

vector<int> dp;
int N;
int calc(int n){
    ll res1,res2;
    dp[n-1]!=-1 ? res1 = dp[n-1] : res1 = calc(n-1);
    dp[n-2]!=-1 ? res2 = dp[n-2] : res2 = calc(n-2);
    return dp[n]=res1 + res2;
}
signed main () {
    scanf("%d",&N);
    dp.assign(N+1,-1);
    dp[0]=1;dp[1]=1;
    if(N-1<1){
        printf("1\n");
        return 0;
    }
    calc(N);
    printf("%d\n",dp[N]);
}

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<bits/stdc++.h>
using namespace std;

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

C++: 

#include<stdio.h>
#define N 45
 
int main(){
int i,n,F[N];
F[0]=F[1]=1;

for(i=2;i<N;i++){
F[i]=F[i-1]+F[i-2];
}
scanf("%d",&n);
printf("%d\n",F[n]);
return 0;
}

C++: #include<iostream>
#define MAX_N 45
int F[MAX_N];

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

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

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 44
int F[MAX]={};
int fibonacci(int);

int main()
{
  int n,memo;

  scanf("%d",&n);

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

  return 0;
}

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

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

int main(){
    int n;cin>>n;
    int F[n+1]={};F[0]=1;F[1]=1;
    for(int i=2;i<n+1;i++){
        F[i]=F[i-1]+F[i-2];//小さい値から計算していくので無駄がない.
    }
    cout<<F[n]<<endl;
    return 0;
}