Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

VI memo;
int fib(int i){
	if (memo[i]) return memo[i];
	
	return memo[i] = fib(i - 1) + fib(i - 2);
	
}


void solve(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int n;
	cin >> n;
	memo.resize(n + 2);
	memo[0] = memo[1] = 1;
	
	cout << fib(n) << endl;
}


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


	solve();
	return 0;
}

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

int fib(int n);

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

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

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

int f[45] = {};

int fib(int n);

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 (f[n] != 0)return f[n];
	else return f[n] = fib(n - 1) + fib(n - 2);
}

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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9
vector<ll> memo;
ll fib(int a){
  if(a == 0 || a== 1){
    return 1;
  }
  if(memo[a] != -1){
    return memo[a];
  }
  return memo[a] = (fib(a-1) + fib(a-2));
}

int main(){
  int n;
  cin >> n;
  memo.resize(50, -1);
  cout << fib(n) << endl;
  return 0;
}

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) {
		F[n] = fib(n-2) + fib(n-1);
	}
	return F[n];
}

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

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

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int memo[45];

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++: #include <iostream>
using namespace std;
int num;

int fib(int n) {
    if (n ==0 || n == 1) {
        return 1;
    }
    return fib(n-1) + fib(n - 2);
}
int main(void) {
    cin >> num;
    cout << fib(num) << endl;
    
    
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
ll mem[MAX_N];
int N;
int main() {

	int ret;
	cin >> N;
	mem[0] = 1;
	mem[1] = 1;
	rep(i, N+1){
		if (i >= 2) mem[i] = mem[i - 1] + mem[i - 2];
	}
	cout << mem[N] << endl;
}

C++: #include<stdio.h>
using namespace std;

int f[50]={1,1};

void Fibonacci(){
    for(int i=2;i<45;i++) f[i]=f[i-1]+f[i-2];
}

int main(){
    Fibonacci();
    int n;
    scanf("%d",&n);
    printf("%d\n",f[n]);
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
typedef pair<int, int> pint;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<Int> dp(n+1,0);
    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;

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <sstream>
#include <string>
#include <utility>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <array>

using namespace std;

class Fibonacci
{
public:
  array<int,45> f;
  int fib( int n );
  int init();
};

int Fibonacci::init()
{
  for ( auto& i : f )
    i = -1;

  f[0] = 1;
  f[1] = 1;

  return 0;
}

int Fibonacci::fib( int n )
{
  if ( f[n] > 0 )
    return f[n];

  int ret = fib( n - 1 ) + fib( n - 2 );
  f[n] = ret;

  return ret;
}

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

  Fibonacci f;

  f.init();
  cout << f.fib( n ) << endl;

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i <= n; i++) //変数,初期値,終値
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(void)
{
    int n,i;
    int ans=0;
    int dp[44] = {1,1};
    cin >> n;
    i=n;
    REP(i,2,n){
        dp[i] = dp[i-1] + dp[i - 2];
    }
    cout << dp[i] << endl;
    
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
using namespace std;

const int MAX = 55;
int n;
int dp[MAX];

int solve(int n) {
    if (dp[n] != -1) return dp[n];
    return dp[n] = (solve(n-1) + solve(n-2));
}

int main() {
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    memset(dp, -1, sizeof(dp));
    dp[0] = 1;
    dp[1] = 1;
    scanf("%d", &n);
    printf("%d\n", solve(n));
    return 0;
}

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

const int MAX = 44;
int F[MAX];

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
#include <list>
using namespace std;

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

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

  cout << fibonacci(n) << endl;

  return 0;
}