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 <iostream>
#include <unordered_map>

std::unordered_map<int, int> memo;

int fibonacci(int n) {
    if (memo.find(n) != memo.end()) {
        return memo[n];
    } else if (n == 0 || n == 1) {
        return 1;
    } else {
        int fib = fibonacci(n - 1) + fibonacci(n - 2);
        memo[n] = fib;
        return fib;
    }
}

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

    std::cout << fibonacci(n) << std::endl;
}

C++: #include<iostream>
using namespace std;
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; cin >> n;
	for (int i = 0; i < 50; i++)dp[i] = -1;
	cout << fib(n) << endl;
	return 0;
}

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){
    return 1;
  }else if(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 fibonacci(int n)
{
	int preFib = 1;
	int prepreFib = 1;
	int fib;

	if (n <= 1) {
		return 1;
	}

	for (int i = 2; i <= n; i++) {
		fib = preFib + prepreFib;
		prepreFib = preFib;
		preFib = fib;
	}

	return fib;

}

int main(void)
{
	int n;
	cin >> n;
	cout << fibonacci(n) << endl;

	return 0;
}

C++: #include <stdio.h>

int main(){
  int n, i;  
  int a[45] = {1,1};
  
  scanf("%d", &n);
  
  for(i=2; i<=n; i++)
    a[i] = a[i-1] + a[i-2];
  
  printf("%d\n", a[n]);
  
  return 0;
}

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

vector<long long int> fibonatti;
long long int  dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  return 0;
}

C++: #include <iostream>
  
using namespace std;
  
typedef unsigned long long ull;
  
auto fib(ull const n) -> ull
{
    return ( n == 0 || n == 1 ) ? 1 : fib( n - 2 ) + fib( n - 1 );
}
  
int main()
{
    ull n;
    cin >> n;
    cout << fib( n ) << endl;
}

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

int main(){
  int n;
  cin >> n;
  int fn[50];
  fn[0] = fn[1] = 1;
  for(int i = 2; i <= n; i++) fn[i] = fn[i - 1] + fn[i - 2];

  cout << fn[n] << end;
  return 0
}

C++: #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
#define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
#define vec vector
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(), v.rend())
#define All(a) (a).begin(),(a).end()
using intl = int64_t;
using vi = vec<intl>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;


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

C++: #include<cstdio> 
int F[50]={1,1};

int fib(int i){
	if(F[i]) return F[i];
	return F[i] = fib(i-1) + fib(i-2);
}
int main(){
	int n;
	scanf("%d",&n);
	printf("%d\n",fib(n));
}

C++: #include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

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