Go: package main

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

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()
	n := nint()
	r := fibonacci(n)
	fmt.Println(r)
}

func fibonacci(n int) int{
	if n == 0 || n == 1{
		return 1
	}else{
		fiList := make([]int, n+1)
		fiList[0] = 1
		fiList[1] = 1
		for i:=2; i<n+1; i++{
			fiList[i] = fiList[i-1] + fiList[i-2]
		}
		return fiList[n]

	}

}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}

C++: #include <bits/stdc++.h>
using namespace std;
 
// #define int long long
 
/* short */
#define pb push_back
#define print(x) cout << x << '\n'
 
/* REPmacro */
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
 
/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = INT_MAX;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

int dp[45];

int fibo(int n)
{
  if (dp[n] != -1){
    return (dp[n]);
  }

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

signed main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  fill(dp, dp + 45, -1);
  print(fibo(n));
  return (0);
}

C++: #include <bits/stdc++.h>
#include <tuple>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
const int INF = 1e9;

using namespace std;
int calc[45];

int fib(int n){
    if(calc[n] != 0)
        return calc[n];
    for(int i = 2; i <= n; i++)
        calc[i] = calc[i-2] + calc[i-1];
    return calc[n];
}

int main() {
    int n;
    cin >> n;
    REP(i, 45) calc[i] = 0;
    calc[0] = 1;
    calc[1] = 1;
    cout << fib(n) << endl;
    return 0;
}

C++: import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

/// n 番目のフィボナッチ数を求める
/// F(0) = 0, F(1] = 1, F(2) = 1, F(3) = 2, F(4) = 3
int fib(int n) {
    if (n == 0) return 0;

    auto mat = new Mat2x2([[1, 1], [1, 0]]);
    auto m = mat.pow(n, int.max);
    return m.get(0, 1);
}

void main() {
    int n = readint;
    // 問題文の定義だとF(0) = 1, F(1) = 1 なので値を 1 だけずらす
    writeln(fib(n + 1));
}

class Mat2x2 {
    private const N = 2;
    private const int[][] _mat;

    this(const int[][] init) {
        assert(init.length == N);
        assert(init[0].length == init[1].length && init[0].length == N);

        _mat = init.dup;
    }

    int get(int r, int c) const {
        return _mat[r][c];
    }

    Mat2x2 mul(const Mat2x2 m, int mod) const {
        auto t = new int[][](N, N);

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                int x = 0;
                for (int k = 0; k < N; k++) {
                    x = (x + (_mat[i][k] * m.get(k, j)) % mod) % mod;
                }
                t[i][j] = x;
            }
        }
        return new Mat2x2(t);
    }

    Mat2x2 copy() const {
        return new Mat2x2(_mat);
    }

    Mat2x2 pow(int k, int mod) const {
        assert(k > 0);
        if (k == 1) return this.copy();

        auto m = this.pow(k / 2, mod);
        return k % 2 == 0
            ? m.mul(m, mod)
            : this.mul(m.mul(m, mod), mod);
    }

    void dump() const {
        writeln(_mat[0][0], " ", _mat[0][1]);
        writeln(_mat[1][0], " ", _mat[1][1]);
    }
}

C++: #include <iostream>

using namespace std;


int F[44];

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

  int input;
  cin >> input;
  cout << F[input]<< endl;
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

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

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

C++: #include <iostream>

using namespace std;


int main()
{
    long fib[45];
    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 <iostream>
#include <string>
#include <map>
#include <set>
using namespace std;
#define MAX 100000

int main(){
  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;

int fib(int n);

int main() {
    int n;
    int dp[45];

    //?????????
    /* ??????3-1 */
    dp[0]=1;
    /* ??????3-2 */
    dp[1]=1;
    //??\???
    cin >> n;

    //DP
    for (int i = 2; i <= n; i++) {
        /* ??????3-3 */
      d@[i]=dp[i-1]+dp[i-2];
    }

    //??????
    cout << dp[n] << endl;

    return 0;
}

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

int main() {
	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>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int DP[45];

void fibonacci(int n){
    if(DP[n-1]==0){
        fibonacci(n-1);
    }
    if(DP[n-2]==0){
        fibonacci(n-2);
    }
    DP[n] = DP[n-1] + DP[n-2];
}

int main() {
    int n;
    cin>>n;
    DP[0] = 1;
    DP[1] = 1;
    if(n>=2){
        fibonacci(n);
    }
    cout<<DP[n]<<endl;
}

C++: #include <iostream>
using namespace std;
long long dp[45];

long long fib(int n) {
    for (int i = 0; i <= n; i++) {
        if (i <= 1) dp[i] = 1;
        else dp[i] = dp[i-2] + dp[i-1];
    }
    return dp[n];
}

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