Go: package main

/*
フィボナッチ数列
*/

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

C++: #include <stdio.h> 
using namespace std;
 long long Fibonacci[43] = {0};
 long long fibo(int n){ 
if(n == 0) return 1;
 else if(n == 1) return 1; 
else{ if(Fibonacci[n-1] != 0 && Fibonacci[n-2] != 0){ 
//Do nothing }else if(Fibonacci[n-1] != 0){
 Fibonacci[n-2] = fibo(n-2); 
}
else if(Fibonacci[n-2] != 0){ 
Fibonacci[n-1] = fibo(n-1);
 }
else{ Fibonacci[n-1] = fibo(n-1);
 Fibonacci[n-2] = fibo(n-2); 
} 
return Fibonacci[n-1] + Fibonacci[n-2]; 
}
 } 

int main(){ int n; 
scanf("%d",&n);
 printf("%lld\n",fibo(n));

 }

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

C++: #include <iostream>
using namespace std;
int fibonacci(int);
int dp[45];
int main(){
  int n,result,i;
  for(i=0;i<45;i++) dp[i]=0;
  cin >> n;
  result=fibonacci(n);
  cout << result << endl;
  return 0;
}
int fibonacci(int n){
  if(n==0||n==1) return dp[n]=1;
  if(dp[n]!=0) return dp[n];
  return dp[n]=fibonacci(n-1)+fibonacci(n-2);
}

C++: #include <cstdio>

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

int main(void){
	int n;
	scanf("%d", &n);
	printf("%d\n", fibonacci(n));
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define MAX 44
int Fib[MAX];

// n番目のフィボナッチ数列を求める(再帰)
// int Calc_Fibonacci(int n1, int n2, int cnt)
// {
//     cnt--;
//     int n3 = n1 + n2;
//     if(cnt == 0) {
//         return n3;
//     } else {
//         return Calc_Fibonacci(n2, n3, cnt);
//     }
// }

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

int main()
{
    int n = 0;
    int nRes = 0;

    scanf("%d",&n);
    // if (n==0 || n==1) {
    //     printf("1\n");
    // } else {
    //     nRes = Calc_Fibonacci(1, 1, n-1);
    //     printf("%d\n", nRes);        
    // }
    nRes = MakeFibonacci(n);
    printf("%d\n", nRes);  
}

C++: /**
 * @Author: yujirotakahashi
 * @Date:   2020-05-17T20:21:41+09:00
 * @Last modified by:   yujirotakahashi
 * @Last modified time: 2020-05-25T00:28:40+09:00
 */

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

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//const ll INF = (1LL << 60);
//const double pi=acos(-1.0);
using ll = long long;
using PAIR = pair<int, int>;
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
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; }
/**************************************/

/******** User-defined Function *******/
using Graph = vector<vector<int>>;
int dx[4] = {-1,0,0,1};
int dy[4] = {0,1,-1,0};
/**************************************/

/********** Main()  function **********/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n; cin >> n;
  ll dp[50];
  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;
}
/********  Main() Ends Here *************/

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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

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

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

int main()
{
  int n;
  cin >> n;
  if (n <= 1)
  {
    cout << 1 << endl;
    return 0;
  }
  vector<int> dp(n + 1, 1);
  for (int i = 2; i <= n; i++)
  {
    dp.at(i) = dp.at(i - 1) + dp.at(i - 2);
  }
  cout << dp.at(n) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
long long dp[50];
long long fib(int n){
if (n<=1) return 1;
if (dp[n]) return n;
return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
int n; cin>>n; cout<<fib(n)<<endl;
}