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++: #include <bits/stdc++.h>
using namespace std;
using ll=long long;

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m);i>=(int)(n);--i)
#define debug(x) cout << #x << "=" << (x) << endl;

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;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  int num;
  cin >> num;
  int f[num+1];
  f[0]=1;
  f[1]=1;
  for(int i=2;i<=num;i++)
    f[i]=f[i-1]+f[i-2];
  cout << f[num] << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

C++: #include <iostream>
#define NUM 44

using namespace std;

int main(){
    int n, fib[NUM];

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

    cout << fib[n] << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
vector <int> F(100,-1);
int fib(int n){
    if(n==0 || n==1){
        return F[n]=1;
    }
    if(F[n]!=-1){
        return F[n];
    }
    return F[n]=fib(n-2)+fib(n-1);
}
int main() {
	int n;
	cin>>n;
	int ans;
	ans=fib(n);
	cout<<ans<<'\n';
	return 0;
}

C++: #include <cstdint>

using namespace std;

#define MEMO_SIZE 44
int64_t memo[MEMO_SIZE];

void fib_init()
{
  for (uint32_t i = 0; i < MEMO_SIZE; i++) {
    memo[i] = -1;
  }
}

uint32_t fib(uint32_t i)
{
  if (i == 0) {
    return memo[0] = 1;
  } else if (i == 1) {
    return memo[1] = 1;
  } else {
    if (memo[i] != -1)
      return memo[i];
    else {
      return fib(i - 1) + fib(i - 2);
    }
  }
}

#include <iostream>

int32_t main()
{
  fib_init();
  uint32_t i;
  cin >> i;
  cout << fib(i) << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
int fib(int n)
{
    int F[50];
    if(n<=1) return 1;
    for(int i = 2 ; i <= n; i++)
    {
        F[i] = F[i-1] + F[i-2];
    }
    return F[n];
}

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

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

int dp[50];

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

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

C++: #include<iostream>
#include<algorithm>
#define Max 44
#define null (-1)
using namespace std;
int f[Max];
int fib(int a){
	if(a==0 || a==1)
	return f[a]=1;
	if(f[a]!=null)
	return f[a]; 
	return f[a]=fib(a-1)+fib(a-2);
	
}
main(){
	int n;
	cin>>n;
	for(int i=0;i<=n;i++)
	f[i]=null;
	cout<<fib(n)<<endl;
	return 0;
}

C++: object Main extends App {
  val fibs: Array[Option[Int]] = Array.fill(45)(None)
  val n: Int = io.StdIn.readInt()
  fibs(0) = Some(1); fibs(1) = Some(1)
  println(fib(n))

  def fib(n: Int): Int = fibs(n) match {
    case None =>
      val fibN: Int = fib(n-1) + fib(n-2)
      fibs(n) = Some(fibN)
      fibN
    case Some(x) => x
  }
}

C++: #include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int N, M, K, Q, W, H, R, C;
int dp[100];

ll f(int n) {
    if (n <= 1) return 1;
    if (dp[n] != INF) return dp[n];
    ll ret = f(n - 1) + f(n - 2);
    dp[n] = ret;
    return ret;
}

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

    cin >> N;
    REP(i, 100) dp[i] = INF;
    cout << f(N) << endl;
    return 0;
}

C++: // Ref : https://book.mynavi.jp/ec/products/detail/id=35408

#include <iostream>
using namespace std;

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

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

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

  int n;
  scanf("%d",&n);

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

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

int main(void)
{
    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 <iostream>
using namespace std;

#define MAX 44

int F[MAX];

int main() {
    int n;
    cin >> n;
    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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_N = 44;

int n;

int dp[MAX_N];

int main() {
    cin >> n;
    dp[0] = 1, dp[1] = 1;
    REP2(i, 2, n+1) dp[i] = dp[i-1] + dp[i-2];
    PRINT(dp[n]);
    return 0;
}

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

const int Max = 50;
int F[Max];

int Fib(int n)
{
    F[0] = 1;
    F[1] = 1;
    if(n==0 || n==1) return F[n];
    if(!F[n-1])
        F[n-1] = Fib(n-1);
    if(!F[n-2])
        F[n-2] = Fib(n-2);
    return F[n-1]+F[n-2];
}
int main()
{
    int n;
    cin >> n;
    memset(F, 0, sizeof(F));
    cout << Fib(n) << endl;
}

C++: #include <iostream>

using namespace std;
int fib(int n){
    int dp[50];
    dp[0] = 1;
    dp[1] = 1;
    for(int i = 2; i < 45; ++i){
        dp[i] = dp[i-1] + dp[i-2];
    }
    return dp[n];
}

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