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++: //This template was last modified on 2/1/2020.
//Define many functions and words.
//The functions I have defined start with a capital letter.
#include <bits/stdc++.h>
using namespace std;
//C++ words.

#define MOD 1000000007
//#define MOD 998244353

typedef long long ll;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<vl> matrix;//A(n, vl(m));
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
typedef pair<double,double> pd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef map<ll,ll> mapl;
typedef priority_queue<ll> pque;
#define nl "\n"s
#define rep(i,n) for(ll i=0LL; i<(n); i++)
#define INF 1001001001001001001
#define PI 3.14159265358979323846
#define SP << " "s <<
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define All(V) V.begin(),V.end()
#define Sortup(V) sort(All(V))
#define Sortdown(V) sort(V.rbegin(), V.rend())
#define Atleast(key, V) lower_bound(All(V), key)
#define Largerthan(key, V) upper_bound(All(V), key)

ll IN(){ll x; cin>>x; return x;}
void VIN(vl &x){rep(i, x.size()) cin>>x[i];}
#define endYes do{cout << "Yes" << nl; return 0;}while(0)
#define endYES do{cout << "YES" << nl; return 0;}while(0)
#define endNo  do{cout << "No" << nl; return 0;}while(0)
#define endNO  do{cout << "NO" << nl; return 0;}while(0)
#define endS(str) do{cout << str << nl; return 0;}while(0)


//Mathmatical functions.

template<class T>bool Chmax(T &a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool Chmin(T &a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T>double Dist(T x,T y,T X,T Y){return sqrt( (x-X)*(x-X)+(y-Y)*(y-Y) );}
ll Digit(ll N){ll res=0;while(N) res++, N/=10;return res;}
bool Bit(ll subset, ll Rsift){ return ((subset)>>(Rsift))&1; }
ll Gcd(ll a,ll b){ return b?Gcd(b,a%b):abs(a); }
ll Lcm(ll A,ll B){ return A/Gcd(A,B)*B; }
ll Lpow(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;}return res;}
ll Pow(ll e,ll x){ll res=1LL;while(x){if(x&1)res=(1LL*res*e)%MOD;e=(1LL*e*e)%MOD;x/=2;}return res;}
void Mul(ll &a,ll b){ a=1LL*a*b%MOD; }
void CumuSum(vl &A){rep(i,A.size())if(i)A[i]+=A[i-1];}
void Eratos_prime(vb &is_prime){//1-indexed
    ll N=is_prime.size()-1;
    rep(i, N) is_prime.at(i) = true;
    is_prime.at(0) = is_prime.at(1) = false;
    for(ll i=2; i*i<=N; i++) if(is_prime.at(i)) {
        for(ll j=i+i; j<=N; j+=i) is_prime.at(j) = false;
    }
}
void Primefact(ll N, mapl &elem){
    for(ll i=2; i*i<=N; i++) {
        while(N%i==0) {
            elem[i]++;
            N /= i;
        }
    }
    if(N>1) elem[N]++;
}


/*
//Topological sort  O(|V|+|E|)
vl g[100100];
vb used(100100);
vl Sortedgraph;

void dfs_Tsort(ll u) {
  if(used[u]) return;
  used[u] = true;
  for(auto x: g[u]) dfs_Tsort(x);
  Sortedgraph.push_back(u);
}

//N:=|V|
void Topo_sort(ll N) {
  rep(i, N) dfs_Tsort(i);
  reverse(All(Sortedgraph));
}
*/

/*
//Warshall floyd  O(N**3)
#define MAX_V 100
matrix d(MAX_V, vl(MAX_V));

void warshall_floyd(ll V){
    rep(k, V) rep(i, V) rep(j, V){
        Chmin(d[i][j], d[i][k] + d[k][j]);
    }
}
*/

/*
//Combination in MOD  O(N)
//Constraints 1<=k<=n<10^7  and  MOD is prime  and MOD>n
const ll MAX=1001001;
vl fac(MAX), finv(MAX), inv(MAX);
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
//Combination
ll COM(ll n, ll k){
    if (n<k or n<0 or k<0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
*/

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// solution comes here

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll N; cin >> N;
    vl fi(N+1);
    fi[0] = fi[1] = 1;
    for(ll i=2; i<=N; i++) fi[i] = fi[i-1]+fi[i-2];
    cout << fi[N] << nl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int dp[45];
	dp[0]=1;
	dp[1]=1;
	for(int i=2; i<45; i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	int n;
	cin>>n;
	cout<<dp[n]<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

ll dp[50];
void solve(){
  int n;
  cin>>n;
  memset(dp,0,sizeof(dp));
  dp[0]=1,dp[1]=1;
  rep(i,n-1)dp[i+2]=dp[i+1]+dp[i];
  cout<<dp[n]<<"\n";
}

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

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

int main()
{
	int n; cin >> n;
	int f[max];
	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>
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 <bits/stdc++.h>
using namespace std;
 
// #define int long long
 
/* short */
#define pb push_back
#define print(x) cout << x << '\n'
 
/* REPmacro */
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
 
/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = INT_MAX;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

int dp[45];

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

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

signed main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  fill(dp, dp + 45, -1);
  print(fibo(n));
  return (0);
}

C++: #include <bits/stdc++.h>
#include <tuple>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;
int calc[45];

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

int main() {
    int n;
    cin >> n;
    REP(i, 45) calc[i] = 0;
    calc[0] = 1;
    calc[1] = 1;
    cout << fib(n) << endl;
    return 0;
}