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++: /*
** 本题使用两个stack，一个用来统计总积水，一个用来统计单独的积水面积。
*/

# include <cstdio>
# include <stack>
# include <vector>
using namespace std;

static const int maxn = 20000 + 10;

char buff[maxn];

int main() {
	// freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
	while (scanf("%s", buff) != EOF) {
		/*
		** ts用来存储每一个'\'字符的位置，然后当出现'/'字符的时候，通过距离计算积水面积
		** ps用来存储每一个'\'所对应的积水面积，默认是0，当出现'/'后，再把面积加进去
		*/
		stack <int> ts, ps;
		int sum = 0;
		for (int i = 0; buff[i] != '\0'; i++) {
			if (buff[i] == 92) { // 92 是 '\'的 ascii码值
				ts.push(i);
				ps.push(0);
			}
			else if (buff[i] == 47 && !ts.empty()) { // 47 是 '/'的 ascii码值
				int s = i - ts.top(); ts.pop();
				sum += s;
				while (ps.top() != 0) { // 找到相对应的'\'，同时累加中间的积水面积
					s += ps.top();
					ps.pop();
				}
				ps.top() += s;
			}
		}
		
		printf("%d\n", sum);
		vector <int> v;
		while (!ps.empty()) {
			if (ps.top() != 0)
				v.push_back(ps.top());
			ps.pop();
		}
		if (v.size() == 0) // 针对积水面积为0的情况
			printf("0\n");
		else {
			printf("%d ", v.size());
			for (int i = v.size()-1; i > 0; i--)
				printf("%d ", v[i]);
			printf("%d\n", v[0]);
		}
	}
	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 <vector>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define VIEW(dat) for(auto v : dat){cout<<v<<endl;}

int dat[45];
int count;
int fib(int n){
	if(n<2){
		return 1;
	}else{
		if(dat[n]) return dat[n];
		dat[n]=fib(n-1)+fib(n-2);
		return dat[n];
	}
}

int main(){
	count=0;
	rep(i,45) dat[i]=0;	
	int n;
	cin>>n;
	cout<<fib(n)<<endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int n;  cin >> n;
    int *dp = new int[n+1];
    dp[0] = 1, dp[1] = 1;

    for (int i = 0; i + 2 <= n; i++)
        dp[i+2] = dp[i+1] + dp[i];

    cout << dp[n] << endl;

    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

int f(const int);

int main()
{
    int N;
    cin>>N;
    cout<<f(N)<<endl;
}
int f(const int d)
{
    if(d<2)return 1;
    return f(d-1)+f(d-2);
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

  cout << a[n] << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

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

C++: #include <iostream>

using namespace std;

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

C++: #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

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

    int N;
    cin >> N;
    memset(F, -1, sizeof(F));
    cout << fibonacchi(N) << endl;

    return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

typedef long long ll;
typedef pair<int, int> PII;

const double EPS = 1e-10;

const int N = 44;
int n;
int dp[N+1];

//???????£?
//recursive function(with/without memo)

int fib(int k) {
  if (dp[k]) return dp[k];
  return fib(k-1) + fib(k-2);
}

int main() {
  memset(dp, 0, sizeof(dp));
  dp[0] = dp[1] = 1;
  scanf("%d ", &n);
  printf("%d\n", fib(n));

	return 0;
}