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 <bits/stdc++.h>

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

constexpr int N_MAX = 44;

int dp[N_MAX+1] = {};

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

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

    int n;
    cin >> n;
    cout << fib(n) << endl;

    return 0;
}

C++: #include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
using namespace std;

int save[44]={};

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

int main(void){
  save[0]=1,save[1]=1;
  int N;
  cin >> N;
  cout << fibo(N) << endl;
}

C++: #include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

ll dp[50];

ll fib(ll k){
    if(dp[k] != -1){
        return dp[k];
    }else if(k == 0){
        dp[k] = 1;
        return dp[k];
    }else if(k == 1){
        dp[k] = 1;
        return dp[k];
    }else{
        dp[k] = fib(k - 1) + fib(k - 2);
        return dp[k];
    }
}


signed main(){
    REP(i, 50){
        dp[i] = -1;
    }
    ll n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}

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

using namespace std;

int minana(int a,int b){
  if(a<b){
    return a;
  }
  else if(a>b){
    return b;
  }
  else return a;
}


int main(){
  int n;
  cin>>n;
  int r[100];
  int m[101][101];
  int j;
  int q=0;
  //int c[n];
  for(int i=1;i<=n;i++){
    cin>>r[i-1]>>r[i];
  }
  for(int i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<j;k++){
	q=m[i][k]+m[k+1][j]+r[i-1]*r[k]*r[j];
	m[i][j]=minana(m[i][j],q);
      }
    }
  }
  
  cout<<m[1][n]<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int n;
  cin >> n;

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

  cout << d[n] << endl;

  return 0;
}

C++: #include <iostream>
#include <map>
using namespace std;
int memofib(int n) {
    static map<int,int> cache;
    map<int,int>::iterator it = cache.find(n);
    if( it != cache.cend() )
        return it->second;   
    int t;
    if(n==1) 
        return 1;
    else if(n==2)
        return 2;
    else
        return memofib(n-1) + memofib(n-2);
    cache.insert(std::make_pair(n, t));
    return t;
}
int main(void){
    int n;
    cin >> n ;
    cout << memofib(n) << endl;
    return 0;
}

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

using namespace std;

long long inf=1000000007;

long long modpow(long long n,long long p,long long mod);

int main(){
	long long n;
	cin>>n;
	vector<long long> dp(n+1);
	for(long long i=0;i<=n;i++){
		if(i==0 || i==1){
			dp.at(i)=1;
		}else{
			dp.at(i)=dp.at(i-1)+dp.at(i-2);
		}
	}

	cout<<dp.at(n)<<endl;

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0) return (modpow(n,p/2,mod)*modpow(n,p/2,mod))%mod;
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}

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

int fibo(int n){
  if(n==0||n==1)return F[n]=1;
  if(F[n]!=NIL){
    return F[n];
  }

  return F[n]=fibo(n-2)+fibo(n-1);
}

int makeFibo(int n){
  F[0]=F[1]=1;
  for(int i=2;i<=n;i++){
    F[i]=fibo(i-1)+fibo(i-2);
  }
  return F[n];
}



int main(){
  //int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++)F[i]=NIL;
  printf("%d\n",makeFibo(n));


}

C++: #include <iostream>
using namespace std;
int n;
int dp[45];
void fibonacci(int);
int main(){
  int result;
  cin >> n;
  dp[0]=1;
  dp[1]=1;
  if(n!=0&&n!=1)  fibonacci(2);
  cout << dp[n] << endl; 
  return 0;
}
void fibonacci(int i){
  dp[i]=dp[i-1]+dp[i-2];
  if(n==i) return ;
  fibonacci(i+1);
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

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