Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	f := make([]int, n+1)

	fmt.Println(fib(n, f))
}

func fib(n int, f []int) int {
	if n == 0 {
		f[n] = 1
		return f[n]
	}
	if n == 1 {
		f[n] = 1
		return 1
	}

	if f[n] != 0 {
		return f[n]
	}

	f[n] = fib(n-2, f) + fib(n-1, f)
	return f[n]
}

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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //




// --------- library end - //


int main(){

  ll N = il();

  vector<ll> fib(N+1, 0);
  fib[0] = 1;

  if (N != 0){
    fib[1] = 1;
    REP(i, 2, N+1){
      fib[i] = fib[i-1] + fib[i-2];
    }
  }

  cout << fib[N] << endl;

}

C++: /*
 * ALDS1_10_A.cpp
 *
 *  Created on: May 5, 2018
 *      Author: 13743
 */

#include<iostream>

using namespace std;

int F[44];

int fib(int n) {
	if(F[n] > 0) return F[n];
	return fib(n-2) + fib(n-1);
}

int main() {
	int n;
	cin >> n;

	F[0] = F[1] = 1;

	cout << fib(n) << endl;
}

C++: #include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, c=0, m;

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

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

int n;
int _fib[100];

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

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

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

vector<int> vec;
long long cal(int n){
    if(vec[n]!=-1) return vec[n];
    if(n==0) return 0;
    if(n==1) return 1;
    return vec[n]=cal(n-1)+cal(n-2);
}

int main(void){
    int x;
    
    cin >> x;
    x=x+1;
   vec.assign(x+1,-1);
    
    cout << cal(x) <<endl;
}

C++: #include <iostream>

using namespace std;

const int MaxNum = 44;
int FibonacchiMemo[MaxNum + 1];
const int NullMemo = -1;

int fibonacci(int n) {
  if(FibonacchiMemo[n] != NullMemo) {
    return FibonacchiMemo[n];
  }

  int output;
  if (n == 0 || n == 1) {
    output = 1;
  } else {
    output = fibonacci(n - 1) + fibonacci(n - 2);
  }
  FibonacchiMemo[n] = output;
  return output;
}

void init_memo() {
  for(int i = 0; i <= MaxNum; i++) {
    FibonacchiMemo[i] = NullMemo;
  }
}

int main() {
  int n;
  init_memo();

  cin >> n;

  cout << fibonacci(n) << endl;
}

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

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

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

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

int mem[50];

long long fib(int n){
  if(mem[n]!=-1)
    return mem[n];
  
  if(n==0||n==1)
    return mem[n]=1;

  return mem[n]=fib(n-1)+fib(n-2);
}

main()
{

  int n;
  
  cin >> n;
  
  for(int i=0;i<50;i++){
    mem[i]=-1;
  }

  cout << fib(n) << endl;

  return (0);
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

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

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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int fib[100];
int main(){
	int n;
	cin>>n;
	fib[0]=1;
	fib[1]=1;
	//fib[2]=1;
	for(int i =2;i <= n;i++){
		fib[i]=fib[i-1]+fib[i-2];
	}
	cout <<fib[n]<<endl;
	return 0;
}