Go: package main

/*
フィボナッチ数列
*/

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

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

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

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

template<class T>
T fibonacci(T n) {
	T first = 1, second = 1, ans = 0;
	for (int i = 0; i < n; ++i) {
		if (i > 0) {
			ans += first;
		}
		if (i > 1) {
			ans += second;
			first = second;
			second = ans;
		}
	}
	return ans;
}

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

	return 0;
}

C++: //递归求第n个斐波那契数列
#include<iostream>
using namespace std;

int F[50];
//记忆化递归生成斐波那契数列 
/*int fibonacci(int n)
{
	if(n==1||n==2)
		return F[n]=1;
	if(F[n])
		return F[n];
	else return F[n]=fibonacci(n-1)+fibonacci(n-2);
}*/
//动态规划法生成斐波那契数列
int fibonacci(int n)
{
	if(n==0||n==1)
		F[n]=1;
	for(int i=2;i<n;i++)
	{
		F[i]=F[i-1]+F[i-2];		
	}	
} 
int main()
{
	int n;
	cin>>n;
	int result=fibonacci(n);
	cout<<result<<endl;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,dp[45]={};
  cin >> n;
  dp[0]=1;
  dp[1]=1;
  for(int i=2; i<=n; i++) {
      dp[i]=dp[i-1]+dp[i-2];
  }
  cout << dp[n] << endl;
}

C++: #include <iostream>

using namespace std;

int _fib(int n, int target, int last, int last2) {
  if (n == target)
    return last + last2;
  else
    return _fib(n + 1, target, last + last2, last);
}

int fib(int n) {
  if (n == 0 or n == 1)
    return 1;
  else
    return _fib(2, n, 1, 1);
}

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

C++: #include <iostream>

using namespace std;

#define INF -1

int dp[45];

int main()
{
	for(int i = 0; i < 45; i++) { dp[i] = INF; }

	int n;

	cin >> n;

	dp[0] = 1;
	dp[1] = 1;

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

	cout << dp[n] << endl;

	return 0;
}

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

int memoization[45] = {0};

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

int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  memoization[0] = 1;
  memoization[1] = 1;
  int n;
  cin >> n;
  cout << fib(n) << endl;
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

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

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int fib(int n){
  static vector<int> dp(45, -1);
  if(dp.at(n) != -1) return dp.at(n);
  if(n == 0 || n == 1) return dp.at(n) = 1;
  else return dp.at(n) = fib(n-1) + fib(n-2);
}

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

C++: #include <stdio.h>

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-1)+fib(n-2);
}

int main() {
	int n,i;
	for(i=0;i<50;i++) dp[i]=-1;
	
	scanf("%d",&n);
	
	printf("%d\n",fib(n));
	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define rep(i,n) for(ll i=0;i<n;i++)
#define inf 999999999
const int mod = 1000000007;
ll cnt = 0;


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

}