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++: /**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <cstdint>
#include <iostream>
#include <string>

constexpr int32_t kMaxNumberOfIndex = 100;

void CallFibonacciNumber(std::istream &input_stream);

class FibonacciNumber {
 public:
  FibonacciNumber() noexcept;
  ~FibonacciNumber() noexcept;
  int32_t Calculate(const int32_t n);

 private:
  FibonacciNumber(const FibonacciNumber &obj) = delete;
  FibonacciNumber &operator=(const FibonacciNumber &obj) = delete;
  FibonacciNumber(FibonacciNumber &&obj) = delete;
  FibonacciNumber &operator=(FibonacciNumber &&obj) = delete;

 private:
  int32_t values_[kMaxNumberOfIndex];
};

void CallFibonacciNumber(std::istream &input_stream) {
  input_stream.tie(0);
  std::ios::sync_with_stdio(false);
  FibonacciNumber *fibonacci_number = new FibonacciNumber();
  try {
    int32_t n;
    input_stream >> n;
    std::cout << fibonacci_number->Calculate(n) << std::endl;
  } catch (...) {
    std::cerr << "ERROR: CallFibonacciNumber()" << std::endl;
    throw;
  }
  delete fibonacci_number;
}

// ****************************************************

FibonacciNumber::FibonacciNumber() noexcept {
  values_[0] = 1;
  values_[1] = 1;
}
FibonacciNumber::~FibonacciNumber() noexcept {}

int32_t FibonacciNumber::Calculate(const int32_t n) {
  for (int32_t index = 2; index <= n; ++index) {
    values_[index] = values_[index - 1] + values_[index - 2];
  }
  return values_[n];
}

int main(int argc, char *argv[]) {
  try {
    CallFibonacciNumber(std::cin);
  } catch (...) {
    std::cerr << "ERROR: main()" << std::endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
const int MAX=50;
ll f[MAX];
ll fib(int n){
	f[0]=f[1]=1;
	for(int i=2;i<=n;i++){
		f[i]=f[i-1]+f[i-2];
	}
	return f[n];
} 

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
    int n;

    //??\???
    cin >> n;

    //??????
    cout << fib(n) << endl;

    return 0;
}

int fib(int n){
    /* ??????1 */
  if(n <= 1) return 1;
  return fib(n-1) + fib(n-2);
}

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

int f[1000000] = {};

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

int fib2(int n){
    int ff[100000] = {};
    ff[0] = 1;
    ff[1] = 1;
    for(int i = 2; i <= n; i++){
        ff[i] = ff[i-2] + ff[i-1];
    }
    return ff[n];
}

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

    cout << fib2(n) << endl;
    return 0;
}