Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll INF = 1LL << 60;
const int INF_INT = 1 << 30;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
struct mll {
	static ll MOD;
	ll val;
	mll(ll v = 0) : val(v % MOD) { if (val < 0) val += MOD; }
	mll operator - () const { return -val; }
	mll operator + (const mll &b) const { return val + b.val; }
	mll operator - (const mll &b) const { return val - b.val; }
	mll operator * (const mll &b) const { return val * b.val; }
	mll operator / (const mll &b) const { return mll(*this) /= b; }
	mll operator + (ll b) const { return *this + mll(b); }
	mll operator - (ll b) const { return *this - mll(b); }
	mll operator * (ll b) const { return *this * mll(b); }
	friend mll operator + (ll a, const mll &b) { return b + a; }
	friend mll operator - (ll a, const mll &b) { return -b + a; }
	friend mll operator * (ll a, const mll &b) { return b * a; }
	mll &operator += (const mll &b) { val = (val + b.val) % MOD; return *this; }
	mll &operator -= (const mll &b) { val = (val + MOD - b.val) % MOD; return *this; }
	mll &operator *= (const mll &b) { val = (val*b.val) % MOD; return *this; }
	mll &operator /= (const mll &b) {
		ll c = b.val, d = MOD, u = 1, v = 0;
		while (d) {
			ll t = c / d;
			c -= t * d; swap(c, d);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	mll &operator += (ll b) { return *this += mll(b); }
	mll &operator -= (ll b) { return *this -= mll(b); }
	mll &operator *= (ll b) { return *this *= mll(b); }
	mll &operator /= (ll b) { return *this /= mll(b); }
	bool operator == (const mll &b) { return val == b.val; }
	bool operator != (const mll &b) { return val != b.val; }
	bool operator == (ll b) { return *this == mll(b); }
	bool operator != (ll b) { return *this != mll(b); }
	friend bool operator == (ll a, const mll &b) { return mll(a) == b.val; }
	friend bool operator != (ll a, const mll &b) { return mll(a) != b.val; }
	friend ostream &operator << (ostream &os, const mll &a) { return os << a.val; }
	friend istream &operator >> (istream &is, mll &a) { return is >> a.val; }
	static mll Combination(ll a, ll b) {
		chmin(b, a - b);
		if (b < 0) return mll(0);
		mll c = 1;
		rep(i, b) c *= a - i;
		rep(i, b) c /= i + 1;
		return c;
	}
};
using vmll = std::vector<mll>;
using vvmll = std::vector<vmll>;
using vvvmll = std::vector<vvmll>;
using vvvvmll = std::vector<vvvmll>;

struct Fast {
	Fast() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast; //cin,cout高速化のおまじない＋桁数指定

ll mll::MOD = (ll)(1e9 + 7);// 998244353ll;



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

	vll dp(N + 1, 0);
	dp[0] = 1;
	dp[1] = 1;

	reps(i, 2, N) {
		dp[i] = dp[i - 2] + dp[i - 1];
	}

	ll result = dp[N];

	cout << result << endl;

	return 0;
}

C++: #include<iostream>
#include <bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;


int main(){
    int N;
    cin >> N;
    int Nminus2=1, Nminus1 = 1,ans =0;
    if(N==0) cout <<1 <<endl;
    else if(N==1) cout <<1 <<endl;
    else {
        for(int i=1; i<N; ++i){
           ans = Nminus2 + Nminus1;
           Nminus2 =Nminus1;
           Nminus1 = ans;
        }
        cout << ans << endl;
    }
    return 0;
}

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

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

  // n???0???1?????£?????????????????????
  if(n <= 1){ cout << 1 << endl; }
  else{
    // n???2??\????????£??????dp??????
    vector<int> dp(n + 1);
    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;

class Fib {
public:
    Fib() : _f1(1), _f2(1) {}
    int operator()(int n) {
        if (n == 0) {
            return _f1;
        }
        if (n == 1) {
            return _f2;
        }
        else {
            for (int i = 2; i <=n; ++i) {
                double x = _f1 + _f2;
                _f1 = _f2;
                _f2 = x;
            }
            return _f2;
        }
    }

private:
    int _f1;
    int _f2;
    int _x;
};

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

C++: #include<stdio.h>
int main(void)
{
	int dp[1000]={0};
	int n,i;

	scanf("%d",&n);
	dp[0]=1;
	dp[1]=1;
	for(i=2;i!=n+1;i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	printf("%d\n",dp[n]);
}

C++: #include<stdio.h>
#define N 45
int main(){
    int F[N];
    int n,i;
    scanf("%d",&n);

    for(i=0;i<=n;i++){
        if(i==0 || i==1) F[i]=1;
        else F[i]=F[i-2]+F[i-1];
    }
    printf("%d\n",F[n]);
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

void printM(vector<vector<long> > &vec, long height, long width){
    F(i, 0, height){
        F(j, 0, width){
            cout << vec[i][j] << space;
        }
        cout << endl;
    }
}

#define TST 0
int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    long n;
    cin >> n;
    // dp table has score of the test
    // for convenience, allocate more memory than actually is
    vl dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    FE(i, 2, n){
        dp[i] = dp[i-1]+dp[i-2];
    }
    cout << dp[n] << endl;
#if TST==1

#endif
}