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++: using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;


ll fib[50];
signed main(){
    ll n;
    scanf("%lld",&n);
    rep(i,n+1){
        if(i==0 || i==1) fib[i]=1;
        else fib[i]=fib[i-1]+fib[i-2];
    }
    printf("%lld\n",fib[n]);
}

C++: #include<stdio.h>
#include(sys/time.h>
static double gettime(){
	struct timeval tv ={0};
	gettimeofday(&tv,NULL);
	return(tv,tv-sec*1000.0)+(tv.tv_usec/1000.0);
}

long long fibo(int n){
	if(n==0||n==1)retrn 0;
	return fibo(n-1)+fibo(n-2);
}
 int main(void){
	printf("fibo(40)=%lld\n",fibo(40));

return(0);
}

C++: #include<iostream>

using namespace std;

int main() {
	int n,now;
	int before1=1, before2=1;
	cin >> n;
	if (n <= 1) {
		cout << 1<<endl;
		return 0;
	}
	for (int i = 2;i <= n;) {
		now = before1 + before2;
		before2 = before1;
		before1 = now;
		i++;
	}
	cout << now<<endl;
}

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

int memo[100];

int fib(int n){
	if(memo[n])return memo[n];

	memo[n]=fib(n-1)+fib(n-2);
	return memo[n];
}

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

	memo[0]=memo[1]=1;
	cout<<fib(n)<<endl;

	return 0;
}

C++: #define scanf_s scanf
#include <iostream>
using namespace std;
int fib(int n) 
{
	if (n >= 0) {
		if (n <= 1) return 1;
		return fib(n - 1) + fib(n - 2);
	}
}
int main(void)
{
	int n;
	scanf_s("%d", &n);
	printf("%d\n", fib(n));
}

C++: #include <bits/stdc++.h>
using namespace std;
vector<int> dp(50, 0);

int fib(int n)
{
  if (n == 0 || n == 1)
    return dp.at(n) = 1;
  if (dp.at(n) != 0)
    return dp.at(n);
  return dp.at(n) = fib(n - 1) + fib(n - 2);
}

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

C++: #include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <ios>
#include <iomanip>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;

void solve() {
    int n,fib[50]; 
    cin >> n;
    fib[0] = 1;
    fib[1] = 1;
    rng(i,2,n+1){
        fib[i] = fib[i-1]+fib[i-2];
    }
    print(fib[n]);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define Rep1(i,k,n) for(int i=k ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

int main(){
    int n; cin >> n;
    vi dp(n+10,0);


    dp[0] = 1;
    dp[1] = 1;
    rep(i,n){
        dp[i+2] = dp[i+1]+ dp[i];
    }

    cout << dp[n] << endl;

}

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

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

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

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

using namespace std;

int m[45];
void function(int n){
  m[0]=1;
  m[1]=1;
  for(int i=2;i<=n;i++){
    m[i]=m[i-1]+m[i-2];
  }
}

int main(){
  int n;
  cin>>n;
  function(n);
  cout<<m[n]<<endl;
  return 0;
}

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

int dp[50];

int solve(int id){

  if(dp[id] != -1) return dp[id];
  if(id == 1 || id == 0) return dp[id] = 1;
  int ret = 0;

  return dp[id] = solve(id-1) + solve(id-2);

}


int main(){

  memset(dp,-1,sizeof(dp));
  int n; 

  cin >> n;

  cout << solve(n) << endl;

}

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

int main()
{
	int n,i;
	int a[44];
	cin >> n;
	a[0]=1;
	a[1]=1;
	for(i=2;i<n;i++){
		a[i]=a[i-1]+a[i-2];
	}
	cout << a[n-1]<<endl;

}

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 - 1] + F[i - 2];

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