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<iostream>
using namespace std;

int fib(int n){
  switch(n){
  case 0:
    return 1;
  case 1:
    return 1;
  default:
    return fib(n-1) + fib(n-2);
  }
}

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

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

int fib[50];

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

C++: #include <iostream>
#include <cstdio>

using namespace std;

long long fib[45];

int main(void) {

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

    int n;
    cin >> n;
    printf("%lld\n", fib[n]);

    return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

C++: #include <stdio.h>
#include <stdlib.h>
#define N 45
 
int f[N];
int fib(int);

int main(){
  int n,i;
  
  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}
 
int fib(int n){
  if(n==0 || n==1) return f[n]=1;
  if(f[n]!=NULL) return f[n];
  return f[n]=fib(n-2)+fib(n-1);
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int fib[100];

ll f(int n) {
   if (n == 1 || n == 2) return fib[n] = 1;
   if (fib[n]) return fib[n];
   return fib[n] = f(n-1) + f(n-2);
}

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

   return 0;
}

C++: // #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;

int dp[50];

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

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