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>
using namespace std;

#define NIL -1

int dp[100];

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

int main(){
    int n;
    cin >> n;
    for(int i=0; i<100; i++){
        dp[i] = NIL;
    }
    dp[0] = 1;
    dp[1] = 1;
    for(int i=0; i<n; i++){
        fib(i);
    }
    cout << fib(n) << endl;
}

C++: fibonacci :: Int -> Int
fibonacci = fibo (1, 1) 2
    where
      fibo :: (Int, Int) -> Int -> Int -> Int
      fibo (pp, prev) pos n
          | n < 2 = 1
          | pos >= n = pp + prev
          | otherwise = fibo (prev, pp+prev) (pos+1) n

main :: IO ()
main = do
  n <- readLn
  putStrLn $ show $ fibonacci n

C++: #include <stdio.h>

int dp[50];

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

int main()
{
    int n, i;
    for (i = 0; i < 50; i++)
        dp[i] = -1;

    scanf("%d", &n);
    printf("%d\n", fib(n));

    return 0;
}

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

int F[45];

int fib(int x)
{
	if (F[x]) return F[x];
	if (x <= 1) return F[x] = 1;
	return F[x] = fib(x - 1) + fib(x - 2);
}

int main()
{
	int x;
	scanf("%d", &x);

	printf("%d\n", fib(x));

	return 0;
}

C++: #include<algorithm>
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
#define MAX 45
int F[MAX];


int fibonacci(int i){
    if(i == 1 || i == 0) return F[i] = 1;
    if(F[i]) return F[i];
    return F[i] = fibonacci(i-1) + fibonacci(i-2);
}

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

    cout << F[n] << endl;

    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
vector<int> memo;
int fib(int n){
    if(n==1||n==0){
        return 1;
    }
    if(memo[n]==-1){
        memo[n] = fib(n - 1) + fib(n - 2);
    }
    return memo[n];
}


int main(){
    int n ;
    cin >> n;
    memo = vector<int>(n + 1, -1);
    cout << fib(n)<<endl;
}

C++: #include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
const ll inf=(1e18);
const ll mod=1000000007;
ll dp[100];
ll fib(int n){
    if(n<2){
        return dp[n];
    }
    if(dp[n]!=-1)return dp[n];
    ll res=fib(n-1)+fib(n-2);
    return dp[n]=res;

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

}

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

int n, d[50];

long long int fib(long long int k){
	if (!k || k == 1) return 1;
	if (!d[k]) { 
		d[k] = fib(k - 1) + fib(k - 2);
		return d[k];
	}
	else return d[k];
}

int main(){
	cin >> n;
	d[0] = 1; d[1] = 1;
	cout << fib(n) << endl;
}

C++: //#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll Fib[45];

int main(){
  Fib[0] = 1; Fib[1] = 1;
  for (int i = 2; i < 45; i++){
    Fib[i] = Fib[i - 2] + Fib[i - 1];
  }
  int N; cin >> N;
  cout << Fib[N] << endl;

  return 0;
}

C++: // -*- coding: utf-8 -*-
// Last-Updated : <2014/06/20 08:34:56 by samui>

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <bitset>

#define MP(a, b) std::make_pair(a, b)
#define X first
#define Y second
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rer(i,l,n) for(int (i) = l; (i) <= (int)(n); ++(i))
#define reu(i,l,n) for(int (i) = l; (i) < (int)(n); ++(i))
template<typename T,typename U> inline void amin(T &x,U y){ if(y<x) x = y;}
template<typename T,typename U> inline void amax(T &x,U y){ if(x<y) x = y;}
template<typename TYPE,std::size_t SIZE>
std::size_t len(const TYPE (&array)[SIZE]){return SIZE;}

// 幾何ライブ
typedef long double LD;
const LD INF = 1e100;
const LD EPS = 1e-8;
const LD PI = acos(-1);
typedef std::pair<LD,LD> PLD;
typedef std::vector<std::pair<LD,LD>> VPLD2;

class Point{
public:
  LD x,y;
  Point(LD x = 0,LD y = 0): x(x),y(y){ };
  Point operator + (Point p) {return Point(x+p.x,y+p.y);};
  Point operator - (Point p) {return Point(x-p.x,y-p.y);};
  Point operator * (LD a) {return Point(x*a,y*a);};
  Point operator / (LD a) {return Point(x/a,y/a);};
  LD abs(){return std::sqrt(x*x+y*y);};
  Point unit(){LD u = abs();return Point(x,y)/u; };
};
typedef Point Vector2D;
LD dotProduct(const Vector2D a,const Vector2D b){
  return a.x*b.x+a.y*b.y;
}
LD crossProduct(const Vector2D a, const Vector2D b){return a.x*b.y-a.y*b.x;}
LD angle(Vector2D a,Vector2D b){
  return acos(dotProduct(a,b)/(a.abs()*b.abs()));
}
LD norm(Vector2D a){return a.x*a.x+a.y*a.y;}
Point projection(Point a1,Point a2,Point a3){
  // 点a3にたいする線分a1-a2上への射影をもとめる。
  LD d = dotProduct(a3-a1,a2-a1)/norm(a2-a1);
  return (a1+(a2-a1)*d);
}
Point reflection(Point a1,Point a2,Point a3){
  return (a3+(projection(a1,a2,a3)-a3)*2);
}
int ccw(Point a1,Point a2,Point a3){
  Vector2D a = a2-a1;
  Vector2D b = a3-a1;
  if(crossProduct(a,b) > EPS) return 1; // a1,a2,a3が反時計まわり
  if(crossProduct(a,b) < -EPS) return -1;//a1,a2,a3が時計まわり
  if(dotProduct(a,b) < -EPS) return +2; //a3--a1--a2 で直線
  if(norm(a)< norm(b)) return -2; // a1--a2--a3 の順で直線
  return 0; // a1--a3--a2の順番
}


int main(int argc, char *argv[])
{
  int a[45];
  a[0] = 0;
  a[1] = 1;
  reu(i,2,45){
    a[i] = a[i-1]+a[i-2];
  }
  int t;
  std::cin>>t;
  std::cout<<a[t+1]<<std::endl;

  return 0;
}

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

int main() {
	int n,a=1,b=1;
	cin>>n;
	for(int i=0;i<n;i++){
		if(i%2==0){
			a=a+b;
		}
		else{
			b=b+a;
		}
	}
	
	if(n%2==0){
		cout<<a<<endl;
	}
	else{
		cout<<b<<endl;
	}
	
	return 0;
}

C++: #include<cstdio>
int F[46];
int fib(int flag){
	if(flag<2){
		return 1;
	}else if(F[flag]){
		return F[flag];
	}else{
		return F[flag]=fib(flag-1)+fib(flag-2);
	}
}
int main(){
	int num;
	scanf("%d", &num);
	printf("%d\n", fib(num));
	return 0;
}