Go: package main

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

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `
3
`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}



func fib(n int, dp map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
		if v, ok := dp[n]; ok {
		return v
	}
	r := fib(n - 1, dp) + fib(n - 2, dp)
	dp[n] = r
	return r
}

// solve
func solve(sc *bufio.Scanner) {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	dp := make(map[int]int)
	r := fib(n, dp)
	fmt.Println(r)
}

C++: // -*- coding: utf-8 -*-
// Last-Updated : <2014/06/20 08:34:02 by samui>

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <bitset>

#define MP(a, b) std::make_pair(a, b)
#define X first
#define Y second
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rer(i,l,n) for(int (i) = l; (i) <= (int)(n); ++(i))
#define reu(i,l,n) for(int (i) = l; (i) < (int)(n); ++(i))
template<typename T,typename U> inline void amin(T &x,U y){ if(y<x) x = y;}
template<typename T,typename U> inline void amax(T &x,U y){ if(x<y) x = y;}
template<typename TYPE,std::size_t SIZE>
std::size_t len(const TYPE (&array)[SIZE]){return SIZE;}

// 幾何ライブ
typedef long double LD;
const LD INF = 1e100;
const LD EPS = 1e-8;
const LD PI = acos(-1);
typedef std::pair<LD,LD> PLD;
typedef std::vector<std::pair<LD,LD>> VPLD2;

class Point{
public:
  LD x,y;
  Point(LD x = 0,LD y = 0): x(x),y(y){ };
  Point operator + (Point p) {return Point(x+p.x,y+p.y);};
  Point operator - (Point p) {return Point(x-p.x,y-p.y);};
  Point operator * (LD a) {return Point(x*a,y*a);};
  Point operator / (LD a) {return Point(x/a,y/a);};
  LD abs(){return std::sqrt(x*x+y*y);};
  Point unit(){LD u = abs();return Point(x,y)/u; };
};
typedef Point Vector2D;
LD dotProduct(const Vector2D a,const Vector2D b){
  return a.x*b.x+a.y*b.y;
}
LD crossProduct(const Vector2D a, const Vector2D b){return a.x*b.y-a.y*b.x;}
LD angle(Vector2D a,Vector2D b){
  return acos(dotProduct(a,b)/(a.abs()*b.abs()));
}
LD norm(Vector2D a){return a.x*a.x+a.y*a.y;}
Point projection(Point a1,Point a2,Point a3){
  // 点a3にたいする線分a1-a2上への射影をもとめる。
  LD d = dotProduct(a3-a1,a2-a1)/norm(a2-a1);
  return (a1+(a2-a1)*d);
}
Point reflection(Point a1,Point a2,Point a3){
  return (a3+(projection(a1,a2,a3)-a3)*2);
}
int ccw(Point a1,Point a2,Point a3){
  Vector2D a = a2-a1;
  Vector2D b = a3-a1;
  if(crossProduct(a,b) > EPS) return 1; // a1,a2,a3が反時計まわり
  if(crossProduct(a,b) < -EPS) return -1;//a1,a2,a3が時計まわり
  if(dotProduct(a,b) < -EPS) return +2; //a3--a1--a2 で直線
  if(norm(a)< norm(b)) return -2; // a1--a2--a3 の順で直線
  return 0; // a1--a3--a2の順番
}


int main(int argc, char *argv[])
{
  int a[45];
  a[0] = 0;
  a[1] = 1;
  reu(i,2,45){
    a[i] = a[i-1]+a[i-2];
  }
  int t;
  std::cin>>t;
  std::cout<<a[t]<<std::endl;

  return 0;
}

C++: #include<cstdio>
#define MAX 50
#define NIL -1
int F[MAX] = {NIL};

int main() {
  int n, i;
  scanf("%d", &n);

  F[0] = 1;
  F[1] = 1;
  for (i = 2; i <= n; i++) F[i] = F[i - 2] + F[i - 1];
  printf("%d\n", F[n]);

  return 0;
}

C++: // DP(???????¨??????? Dynamic Programing)
// ????????±???????????¢???
// ?????£??????????????°???
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
using namespace std;

#define MAX_N 44

struct memo{
    int num;
    bool flg;
}Memo[MAX_N+1];

int n;
int fib(int);

int main()
{
    cin >> n;
    for(int i=0;i<MAX_N+1;++i)
        Memo[i].flg=false;
    cout << fib(n) << endl;
    return 0;
}

int fib(int m){
    if(m == 0){
        if(!Memo[0].flg){
        Memo[0].num=1;
        Memo[0].flg=true;
        }
        return 1;
    }
    if(m == 1){
        if(!Memo[1].flg){
        Memo[1].num=2;
        Memo[1].flg=true;
        }
        return 1;
    }

    if(Memo[m].flg){
        return Memo[m].num;
    }
    else{
        Memo[m].num=fib(m-1) + fib(m-2);
        Memo[m].flg=false;
        return fib(m-1) + fib(m-2);
    }
}

C++: #include <iostream>

using namespace std;

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

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  vector<ll> dp(n+1);
  dp[0] = 1;
  dp[1] = 1;
  rep(i,n-1) {
    dp[i+2] = dp[i+1] + dp[i];
  }
  cout << dp[n] << endl;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

long long dpfibo(int n){
    long long F[44];
    F[0] = F[1] = 1;
    if(n == 0 or 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;
    scanf("%d", &n);
    cout << dpfibo(n) << endl;
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<algorithm>
#include<functional>
using namespace std;
 
int n;
int s=0;
int a[45];

 
int main()
{
	cin>>n;

	if(n==0 || n==1){
		cout<<1<<endl;
		return 0;
	}
	a[0]=1;
	a[1]=1;

	for(int i=1;i<n;i++){
	s=a[i]+a[i-1];
	a[i+1]=s;
	}

	cout<<s<<endl;

    return 0;
}

C++: #include <iostream>
int F[100]; // ???????????????
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n];
}

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

using namespace std;

int main() {
	int n;
	cin >> n; 
	vector<int> v;
	v.push_back(1);
	v.push_back(1);
	for (int i = 2; i <= n; i++) v.push_back(v[i - 1] + v[i - 2]);
	cout << v[n] << endl;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <complex>
#include <cmath>
#include <ccomplex>
using namespace std;

int main() {
	int n;
	cin >> 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];
	}
	cout << dp[n] << endl;
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int Fib(int n){

	int fib = 0;

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

	fib = Fib(n-1)+Fib(n-2);

	return fib;
}

int main(){

	int n;

	cin >> n;

	cout << Fib(n) << endl;

	return 0;
}