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 <iostream>
#include <vector>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define REP(i, n) for (int i = 0; i < (n); i++)

const ll MOD = 9223372036854775807; // 1e9+7;

vvl initialize(int r, int c) {
  /*
   * r行c列の2次元零行列
   */
  vvl I = vvl(r);
  REP (i, r) {
    I[i] = vl(c, 0);
  }
  return I;
}

vvl mul(vvl A, vvl B) { // A*B
  vvl C = initialize(A.size(), B[0].size());
  REP (i, A.size()) REP (k, B.size()) REP (j, B[0].size()) {
    C[i][j] = (C[i][j] + 1l * A[i][k] * B[k][j]) %MOD;
  }
  return C;
}

vvl pow(vvl A, ll n) { 
  /*
   * Aのn乗の行列
   * Aは正方行列
   */
  int d = A.size();
  vvl B = initialize(d, d);
  REP (i, d) B[i][i] = 1; // Aと同じ次元の単位行列を作成
  while (n > 0) {
    if (n&1) B = mul(A, B);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

ll fibonacci(ll n) {
  vvl A = initialize(2,2);
  A[0][0] = A[0][1] = A[1][0] = 1;
  A[1][1] = 0;
  A = pow(A, n+1);
  return A[1][0];
}

ll n;

int main() {

  cin >> n;
  cout << fibonacci(n) << endl;;
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int d;

int fib(int a){
	if(a==0||a==1)return 1;
	d=fib(a-1)+fib(a-2);
	return d;
}

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

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

int main() {

    int F[44];

    int n;

    cin >> n;

    F[0] = 0;
    F[1] = 1;
    F[2] = 1;
    for(int i = 3; 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;

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int fib[INF];

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

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

C++: #include <stdio.h>
#define N 100
#define M -1
int fib(int);

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

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

C++: #include<stdio.h>
int main(void)
{
	int n, i, a[45];
	for (i = 0; i < 45; i++)
	{
		a[i] = 0;
		if (i == 0 || i == 1)
		{
			a[i] = 1;
		}
	}
	scanf("%d", &n);
	for (i = 2; i <= n; i++)
	{
		a[i] = a[i - 2] + a[i - 1];
		if (i == n)
		{
			printf("%d\n", a[i]);
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
long long fib[50];

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

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

int main(){
  int n,a[2]={1,1};
  cin>>n;

  int c=0;
  for(int i=1;i<n;i++)a[c]=a[0]+a[1],c=!c;
  cout << a[!c]<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int fibo[n + 1] = { 1, 1 };

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

	return 0;
}

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

int n;
vector<int> dp(50, 0);

int solve(int i){
    if(dp[i] > 0) return dp[i];
    if(i == 0) return dp[0] = 1;
    if(i == 1) return dp[1] = 1;
    return dp[i] = solve(i-1) + solve(i-2);
}

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

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	
	int n[47];
	n[0]=0;
	n[1]=1;n[2]=2;

	for(int i=3;i<=45;i++)
		n[i]=n[i-1]+n[i-2];
	int x;
	cin>>x;
	cout<<n[x]<<endl;
	return 0;
}

C++: #include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

int fib[50];

/*----------------------------------------------------------------*/
signed main(){

    int n;
	cin >> n;
	fib[0] = fib[1] = 1;
	rep(i,45)fib[i+2] = fib[i+1] + fib[i];
	cout << fib[n] << endl;

    
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc088.contest.atcoder.jp/tasks/abc088_d

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

int main() {
  vector<int> fibo(50, -1);
  fibo[0] = fibo[1] = 1;
  for (int i = 2; i <= 44; i++) {
    fibo[i] = fibo[i-1] + fibo[i-2];
  }
  int p; cin >> p;
  cout << fibo[p] << endl;
}