Go: package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	num, _ := strconv.Atoi(sc1.Text())
	cache := make([]*int, num+1)
	fmt.Println(fib(num, cache))

}

func fib(n int, cache []*int) int {
	if n <= 1 {
		return 1
	}

 	if cache[n] != nil {
		return *(cache[n])
	}

	result := fib(n -2, cache) + fib(n -1, cache)
	cache[n] = &result
	return result
}

C++: #include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

const ll mod = 1e9 + 7;

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

  if (n <= 1) {
    puts("1");
    return 0;
  }

  ll fn = 2;
  ll fn1 = 1, fn2 = 1;
  rep(i, n - 2) tie(fn, fn1, fn2) = T(fn + fn1, fn, fn1);
  cout << fn << endl;

  return 0;
}

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

unsigned long long ull[45];

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

C++: #include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: /*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 44;

/* typedef */

/* global variables */

int fs[MAX_N + 1];

/* subroutines */

/* main */

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

  fs[0] = fs[1] = 1;

  for (int i = 2; i <= n; i++)
    fs[i] = fs[i - 1] + fs[i - 2];

  printf("%d\n", fs[n]);
  return 0;
}

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

int main()
{
	int n,x1=1,x2=1,tmp=0;
	cin >> n;
	
	if(n==0||n==1) cout << "1";
	else{
		for(;n>2;n--){
			tmp=x1+x2;
			x1=x2;
			x2=tmp;
		}
		cout << x1 + x2;
	}
	
	return 0;
	
}

C++: #include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
    size_t n;
    scanf("%zu", &n);

    int fib[2]={1, 1};
    for (size_t i=0; i<n; ++i)
        swap(fib[0]+=fib[1], fib[1]);

    printf("%d\n", fib[0]);
    return 0;
}

C++: #include <iostream>

using namespace std;

#define MAX 45

int FibValue[MAX];

long long FibonacciNumber(int n)
{
	if (FibValue[n] != -1) return FibValue[n];

	if (n == 0 || n == 1)
	{
		FibValue[n] = 1;
		return FibValue[n];
	}

	FibValue[n] = FibonacciNumber(n - 1) + FibonacciNumber(n - 2);
	return FibValue[n];
}

int main()
{
	for (int i = 0; i < MAX; ++i)
		FibValue[i] = -1;
	int n; cin >> n;

	cout << FibonacciNumber(n) << endl;

	return 0;
}

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

int main()
{
	int F[100];
	F[0]=1;
	F[1]=1;
	for(int i=2;i<45;++i){
		F[i]=F[i-2]+F[i-1];
	}

	int n;
	cin>>n;
	cout<<F[n]<<endl;
	return 0;
}

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

int main() {
  int n; cin >> n;
  int f[45]; 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; 
}

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

long long f[50] = {};
long long fib(long long n) {
  if (f[n] > 0) return f[n];
  if (f[n-1] == 0){
    f[n-1] = fib(n-1);
  }
  if (f[n-2] == 0){
    f[n-2] = fib(n-2);
  }
  f[n] = f[n-1] + f[n-2];
  return f[n];
}

void Main()
{
  f[0] = 1; f[1] = 1;
  long long n; cin >> n;
  cout << fib(n) << endl;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

C++: #pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    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;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

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

using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> dp(n+1);

    dp[0] = 1;
    dp[1] = 1;

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

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

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

int f[46]={0};

int fib(int n){
    f[0] = 1;
    f[1] = 1;
    for(int i=2; i<46; i++)    f[i] = f[i-1]+f[i-2];

    return f[n];
}

int main(void){
    int x;
    cin >> x;
    cout << fib(x) << endl;
    return 0;
}

C++: #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));
}