Go: package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	num, _ := strconv.Atoi(sc1.Text())
	cache := make([]*int, num+1)
	fmt.Println(fib(num, cache))

}

func fib(n int, cache []*int) int {
	if n <= 1 {
		return 1
	}

 	if cache[n] != nil {
		return *(cache[n])
	}

	result := fib(n -2, cache) + fib(n -1, cache)
	cache[n] = &result
	return result
}

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

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

long long fib(int n){
    if(n==0 || n==1) return 1;
    return fib(n-1)+fib(n-2);
}

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

C++: #include<iostream>

using namespace std;

int fib(int n);

int memo[1000];

int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){

  if(n==0 || n == 1){
    return 1;
  }else if(memo[n] != 0){
    return memo[n];
  }else{
    return memo[n] = fib(n-1) + fib(n-2);
  }
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
#include <iomanip>

#include <vector>
#include <string>
#include <iterator>
#include <algorithm>

typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

using namespace std;

// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> void output(std::vector<T> & A) {
    const int n = A.size();
    for (int i = 0; i < n - 1; ++i) {
        std::cout << A[i] << " ";
    }
    std::cout << A[n - 1] << std::endl;
}


int fib(const int n, vector<int>& dp) {
    if (n == 0) return 1;
    if (n == 1) return 1;
    if (dp[n] != -1) return dp[n];
    dp[n] = fib(n - 1, dp) + fib(n - 2,dp);
    return dp[n];
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout << std::fixed << std::setprecision(15);

    const long maxn = 45;
    vector<int> dp(maxn, -1);
    dp[0] = dp[1] = 1;

    int n; cin >> n;
    const int ret = fib(n, dp);
    cout << ret << endl;

    return 0;
}