Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define vll vector<ll>
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define line "\n"
#define mav(a) (*max_element(ALL(a)))
#define miv(a) (*min_element(ALL(a)))
#define vfind(a,n) (find(ALL(a),n)-a.begin())
#define prque priority_queue
#define MOD 1000000007ll
using namespace std;
void solve();
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}

//nCk(mod p)
/*ll fac[510000], finv[510000], inv[510000];
void cmodf(ll p = MOD) {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	rep(i, 2, 510000) {
		fac[i] = fac[i - 1] * i%p;
		inv[i] = p - inv[p%i] * (p / i) % p;
		finv[i] = finv[i - 1] * inv[i] % p;
	}
}
ll cmod(ll n, ll k, ll p = MOD) {
	return fac[n] * (finv[k] * finv[n - k] % p) % p;
}*/

//最大公約数
ll gcd(ll n, ll m) {
	ll k = n % m;
	while (k != 0) { n = m; m = k; k = n % m; }
	return m;
}
ll gcd(vector<ll> a) {
	rep(i, 1, a.size()) {
		ll k = a[i - 1] % a[i];
		while (k != 0) {
			a[i - 1] = a[i];
			a[i] = k;
			k = a[i - 1] % a[i];
		}
	}
	return a.back();
}

//最小公倍数
ll lcm(ll n, ll m) {
	ll t = n * m, k = n % m;
	while (k != 0) { n = m; m = k; k = n % m; }
	return t / m;
}
ll lcm(vector<ll> a) {
	ll n;
	rep(i, 1, a.size()) {
		n = a[i - 1] * a[i];
		ll k = a[i - 1] % a[i];
		while (k != 0) {
			a[i - 1] = a[i];
			a[i] = k;
			k = a[i - 1] % a[i];
		}
		n /= a[i];
		a[i] = n;
	}
	return n;
}

//keyの小さい方から探していった時に初めてvalueがjoken以上になる時のkey（keyが増えたらvalueも増えるか同じになるとき）
ll value(ll key) {
	/*変更*/
	return 0;
}
ll mini(ll lkey, ll rkey/*ここも調べる*/, ll joken) {
	ll mkey;
	while (lkey != rkey) {
		mkey = (lkey + rkey) / 2;
		if (value(mkey) >= joken)rkey = mkey;
		else lkey = mkey + 1;
	}
	return rkey;
}

//ペア配列の整理
struct pea { ll n, m; };
void msort(vector<pea> &a, bool k = true) {
	struct hikakukansu {
		static bool unstable(const pea &x, const pea &y) { return x.m < y.m; }
		static bool stable(const pea &x, const pea &y) { return (x.m == y.m ? x.n < y.n : x.m < y.m); }
	};
	if (k)sort(ALL(a), hikakukansu::unstable);
	else sort(ALL(a), hikakukansu::stable);
}

//変数定義

//再帰関数

//アルゴリズム
void solve() {
	ll n; cin >> n;
	vll a(n+1,1);
	rep(i, 2, n+1)a[i] = a[i - 1] + a[i - 2];
	cout << a[n] << line;
}

C++: #include <iostream>

using namespace std;
int F[100];
int main() {
	int n;
	cin >> n;
	F[0] = 1;
	F[1] = 1;
	for (int i=2; i<=n; ++i) {
		F[i] = F[i-2] + F[i-1];
	}
	cout << F[n] << endl;
}

C++: #include<iostream>
#include<vector>
#define NIL -1
using namespace std;

int fib(vector<int>& F, int n){
    if (F[n] != NIL) return F[n];
    return F[n] = fib(F, n - 1) + fib(F, n - 2);
}

int main(){
    int n;
    cin >> n;
    vector<int> F(n + 1, NIL);
    F[0] = F[1] = 1;
    cout << fib(F, n) << endl;
    return 0;
}

C++: #include<cstdio>
#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>
#include<string>
using namespace std;

int fib(int n);

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

    return 0;
}

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

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


using namespace std;


int main()
{
	int n;
	int a[45] = { 1,1 };
	ios::sync_with_stdio(false);

	cin >> n;

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

	cout << a[n] << endl;

	return 0;

}

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

int FibonacciNumber(int n) {

	if (n <= 1) {
		return 1;
	}
	return FibonacciNumber(n - 1) + FibonacciNumber(n - 2);
}

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

	cout << FibonacciNumber(n) <<endl;
	
}

C++: #include<cstdio>

const int maxn = 44 + 1;
int a[maxn];

int calcFibonacciNumber(int n) {
    if (n < 0) {
        return 0;
    }
    if (n == 0 || n == 1) {
        return 1;
    }
    if (a[n] != -1) {
        return a[n];
    }
    a[n] = calcFibonacciNumber(n - 1) + calcFibonacciNumber(n - 2);
    return a[n];
}

int getFibonacciNumber(int n) {
    return calcFibonacciNumber(n);
}

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

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

long long fibodp(int n){
    long long fibodp[200]={0};
    fibodp[0]=1;
    fibodp[1]=1;
    for(int i=2; i<=n; i++){
        fibodp[i]=fibodp[i-1]+fibodp[i-2];
    }
    return fibodp[n];
}

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

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

#define MAX 3000000 
char s[MAX + 10];
int wSum[MAX + 10];
int eSum[MAX + 10];

int dp[45];

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

signed main() {
	ios::sync_with_stdio(false);
	int i, n;
	cin >> n;
	rep(i, 45) dp[i] = -1;
	cout << fibo(n) << "\n";
	return 0;
}

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

int fib() {
    int arr[N+1];
    arr[0] = 0; arr[1] = 1;

    for (int i = 2; i <= N+1; i++) {
        arr[i] = arr[i-1] + arr[i-2];
    }
    return arr[N+1];
}


int main() {

    std::scanf("%d", &N);
    std::printf("%d\n", fib());

}

C++: #include<algorithm>
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
#define MAX 45
int F[MAX];


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

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

    cout << F[n] << endl;

    return 0;
}