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>
using namespace std;
  
struct Node{
  int key;
  Node *right,*left,*p;
};
  
Node *NIL,*root;
  
void insert(int k){
  Node *x=root;
  Node *y=NIL;
  Node *T;
    
  T=(Node *)malloc(sizeof(Node));
  T->key=k;
  T->left=NIL;
  T->right=NIL;
    
  while(x!=NIL){
    y=x;
    if(T->key<x->key) x=x->left;
    else x=x->right;  
  }
  T->p=y;
  if(y==NIL) root=T;
  else if(T->key<y->key) y->left=T;
  else y->right=T;
}
  
void in(Node *T){
  if(T!=NIL){
    in(T->left);
    cout<<' '<<T->key;
    in(T->right);
  }
} 
 
void pre(Node *T){
  if(T!=NIL){
    cout<<' '<<T->key;
    pre(T->left);
    pre(T->right);
  }
}
  
int main(){
  int m,k;
  string str;
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>str;
    if(str[0]=='i'){
      cin>>k;
      insert(k);
    }
    else {
      in(root);
      cout<<endl;
      pre(root);
      cout<<endl;
    }
  }
  return 0;
}

C++: def fib(n):
  if n <= 1:
      return n
  return fib(n - 1) + fib(n - 2)

n = int(strip(raw_input()))

print fib(n)

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define vi vector<int>
#define vl vector<long long>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define MOD 1e9+7

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

ll dp[50];

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

int main() {
    int n;
    cin >> n;
    REP(i, n+1) dp[i] = -1; 
    cout << fib(n) << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <list>
#include <stack>

typedef long long ll;
using namespace std;
const int mod = 1000000007;

vector<ll> f(45);

int main() {

    int n; cin >> n;

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

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

    cout << f[n] << '\n';

}

C++: #include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>
#include <map>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

void printFixedDouble(double d, int fix) {
    cout << std::fixed;
    cout << std::setprecision(fix) << d << endl;
}

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

    int fibonatti[45];

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

    cout << fibonatti[n] << endl;

}

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

using namespace std;

int fib[50];

int main()
{

    int n;

    fib[0]=fib[1]=1;

    cin>>n;

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

    cout<<fib[n]<<endl;


    return 0;
}

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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <random>
#include <map>

using namespace std;

int fibArray[50];

void makeFibArray() {
    for (int i = 2; i <= 46; i++) {
	fibArray[i] = fibArray[i - 1] + fibArray[i - 2];
    }
}

int main() {

    //cin.tie(0);
    //ios::sync_with_stdio(false);

    int n; scanf("%d", &n);
    fibArray[0] = 1;
    fibArray[1] = 1;
    makeFibArray();
    printf("%d", fibArray[n]);


    return 0;

}

C++: #include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;

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

  
  return 0;
}

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

int main(void) {
    cin >> num;
    int array[num] = {};
    array[0] = 1;
    array[1] = 1;
    for (int i= 2; i <= num; i++) array[i] = array[i - 1] + array[i - 2];
    cout << array[num] << endl;
}