Go: package main

import "fmt"

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

	f := make([]int, n+1)

	fmt.Println(fib(n, f))
}

func fib(n int, f []int) int {
	if n == 0 {
		f[n] = 1
		return f[n]
	}
	if n == 1 {
		f[n] = 1
		return 1
	}

	if f[n] != 0 {
		return f[n]
	}

	f[n] = fib(n-2, f) + fib(n-1, f)
	return f[n]
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <bitset>

/*----------------------------------------------------------------*/

using ld = long double;
using vld = std::vector<ld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using str = std::string;
using vstr = std::vector<str>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;

/*----------------------------------------------------------------*/

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<typename T> T sqr(T a) { return a * a; }

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m != 0 ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; sqr(i) <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}

/*----------------------------------------------------------------*/

void solve();

/*----------------------------------------------------------------*/

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

    solve();
}

void solve() {
    vll fib(45, 1);
    for (ll i = 2; i < 45; i++)
        fib[i] = fib[i - 1] + fib[i - 2];

    ll n; std::cin >> n;

    std::cout << fib[n] << '\n';
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll n,s[45];
int main(void){
    cin>>n;
    s[0]=1;
    s[1]=1;
    for(int i=2;i<=44;i++){
        s[i]=s[i-1]+s[i-2];
    }
    cout<<s[n]<<endl;
}

C++: #include <stdio.h>

#define N 44

int F[N];
int n;

int  fib(int n){
	if(n==0 || n == 1)
		return 1;

	if(F[n] != 0) return F[n];

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

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

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 n;
	cin >> n;
	int ans;
	ans = fib(n);
	cout << ans;
	cout << endl;
}

C++: //フィボナッチ数列
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	if (n < 2){
		cout << 1 << endl;
		return 0;
	}
	int* fibnum = new int [n];
	fibnum[0] = 1; fibnum[1] = 1;
	for (int i = 2; i <= n; ++i){
		fibnum[i] = fibnum[i - 1] + fibnum[i - 2];
	}
	cout << fibnum[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", fib(n));
}

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

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

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

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 1;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scanf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;

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

C++: #include <iostream>

using namespace std;

int memo[100];

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

int main() {
    int n;
    cin >> n;
    fill(memo, memo + n, -1);
    cout << fibonacci(n) << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


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++: #define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 1e18;
using namespace std;

typedef pair<long long int, long long int> P;

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

C++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<vector>

using namespace std;

#define LL long long

LL n,fib[50];

int main() {
	cin>>n;
	for(int i=0;i<=n;i++){
		if(i==0||i==1)fib[i]=1;
		else fib[i]=fib[i-1]+fib[i-2];
	}
	cout<<fib[n]<<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>
#include<cstdio>
using namespace std;
typedef long long int ll;
ll Dp[50];
int main()
{
for(int i=2;i<50;i++)Dp[i]=Dp[i-1]+Dp[i-2];
int N;
cin >> N;
cout << Dp[N] << "\n";

return 0;
}

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

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