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 <iostream>

using namespace std;

int fib(int n);

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

    //?????????
    /* ??????3-1 */
    dp[0] = 1;
    /* ??????3-2 */
    dp[1] = 1;

    //??\???
    cin >> n;

    //DP
    for (int i = 2; i <= n; i++) {
        /* ??????3-3 */
        dp[i] = dp [i-1] + dp[i-2];
    }

    //??????
    cout << dp[n] << endl;

    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int fib[45]={1,1};
    int n;
    cin>>n;
    for(int i=2; i<=n; i++) fib[i]=fib[i-1]+fib[i-2];
    cout<<fib[n]<<'\n';
    return 0;
}

C++: #include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    int dp[50];

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

    cout << dp[n] << endl;
}

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

int main(void){
	int n;
	cin>>n;
	if(n == 0 || n == 1){
		cout<<1<<endl;
	}else{
		vector<int> v(n);
		v[0] = v[1] = 1;
		for(int i = 2 ; i <= n ; i ++){
			v[i] = v[i-1] + v[i-2];
		}
		cout<<v[n]<<endl;
	}
}

C++: #include <stdlib.h>
#include <stdio.h>

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

int main(){

int x,n;
scanf("%d",&n);
x=fib(n);
printf("%d\n",x);

return 0;
}

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

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

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

C++: #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

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


}

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

int main() {
	std::vector<int> v(2, 1);
	int num;

	std::cin >> num;

	while (v.size() < num + 1) {
		v.push_back((v.back()) + (v[v.size() - 2]));
	}

	std::cout << v.back() << 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-1] + F[i-2];
    }
    
    cout << F[n] << endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

int fib(int);

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

    return 0;
}

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

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

int main(void){

    int  n;
    cin >>n;
    int dp[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 "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
string s;

int main() {
    cin >> n;

    Vi dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    REP2(i, 2, n+1) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    std::cout << dp[n] << '\n';

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

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

typedef long long ll;
typedef vector<int> VI;

ll dp[45];
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    dp[0] = 1;
    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 fib(int n) {
	if (n <= 1) return 1;
	return fib(n-1) + fib(n-2);
}

int main()
{
	int i = 0;
	cin >> i;
	cout << fib(i) << endl;
}