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
}

Python: import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    dp = [0] * 47
    dp[0] = 1
    dp[1] = 1
    for i in range(2,N+1):
        dp[i] = dp[i-1] + dp[i-2]
    print(dp[N])



if __name__ == '__main__':
    main()

Python: MAX = 10**5
fib = [0]*MAX

def fibonacci(n):
    if fib[n]:
        return fib[n]
    if n == 0 or n == 1:
        return 1
    
    fib[n] = fibonacci(n-1)+fibonacci(n-2)
    return fib[n]

N = int(input())
print(fibonacci(N))

Python: from functools import lru_cache

@lru_cache()
def fib(n:int):
    if n == 0 or n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)

n = int(input())
print(fib(n))

Python: N = int(input())
fib = [1,1]
for i in range(2, N + 1):
    fib.append(fib[i - 1] + fib[i - 2])
print(fib[N])

Python: def fib(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1

    return fib(n - 1) + fib(n - 2)

n = int(input())
print(fib(n))

Python: n = int(input())

dp = [0 for _ in range(45)]

def fib_dp(n):
    dp[0] = 1
    dp[1] = 1
    for i in range(2, n+1):
        dp[i] = dp[i-1] + dp[i-2]
    return dp[n]
       
print(fib_dp(n))

Python: n = int(input())
a=b=1
while n:
    a,b=b,a+b
    n-=1
print(a)

Python: f = [1, 1] + [0] * (int(input()) - 1)
for i in range(2, len(f)):f[i] = f[i - 2] + f[i - 1]
print(f[-1])

Python: n = int(input())
from functools import lru_cache

@lru_cache(maxsize=1000)
def fibo(n):
    if n < 2:
        return 1
    return fibo(n-1) + fibo(n-2)

print(fibo(n))

Python: class Fib:
    def __init__(self):
        self.memo = {0: 1, 1: 1}
    
    def calc_fib(self, n):
        if n in self.memo.keys():
            return self.memo[n]
        
        self.memo[n] = self.calc_fib(n - 2) + self.calc_fib(n - 1)
        return self.memo[n]
    
fib = Fib()
print(fib.calc_fib(int(input())))

Python: n = int(input())
print(round((pow((1+math.sqrt(5))/2,n) - pow((1-math.sqrt(5))/2,n)) / math.sqrt(5)))

Python: #!/usr/bin/python

n = int(input())

def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1

    for i in range(2, n+1):
        l[i] = l[i-1] + l[i-2]

    return l[i]

print(fib(n))

Python: a=1
b=1
list=[]
n=int(input())
list.append(a)
list.append(b)
for i in range(n):
    list.append(a+b)
    c=b
    b+=a
    a=c
print(list[n])

Python: a=[0]*45

def Fib(n):
    if n == 0:
        a[0]=1
        return 1
    elif n == 1:
        a[1]=1
        return 1
    else:
        if a[n]==0:
            a[n]=Fib(n-1)+Fib(n-2)
            return a[n]
        else:
            return a[n]
    
n=int(input())
print(Fib(n))

Python: n=int(input())
def func(n):
    fibonacci = [1,2]
    for i in range(2,n):
        fibonacci.append(fibonacci[i-2]+fibonacci[i-1])
    return fibonacci[n-1]
print(func(n))

Python: F = {}

def fib(n):
  global F
  if n < 0:
    print("error")
    exit()
  if n < 2:
    F[n] = 1
    return F[n]
#  F[n] = fib(n-1) + fib(n-2)
  F[n] = F[n-1] + F[n-2]
  return F[n]

n = int(input())
print(fib(n))
#n = int(input())
#print(fib(n))
#fib(44)
#for i in range(5+1):
#  print(F[i])

Python: n = int(input())
if n < 2:
    print(1)
else:
    F = [1, 1]
    for i in range(2, n + 1):
        F.append(F[i - 2] + F[i - 1])

    print(F[n])

Python: from functools import lru_cache

@lru_cache(maxsize=None)
def fib(n):
    if n <= 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)

n = int(input())
ans = fib(n)

print(ans)

Python: def fib(numbers, find):
    if len(numbers) < find:
        numbers.append(numbers[-1] + numbers[-2])
        fib(numbers, find)
    else:
        print(numbers)
        print(numbers[-1])


# n = 4
n = int(input())
number_list = []


if n == 0 or n == 1:
    print(1)
else:
    number_list.append(n-2)
    number_list.append(n-1)
    fib(number_list, n)

Python: import time
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)


# 何も考えずに書いてみたやつ これ一番早いじゃん・・・
def fib_org(n):
    if n in (0, 1):
        return 1

    count = 3
    prevprev = 1
    prev = 2
    while count <= n:
        tmp = prevprev + prev
        prevprev = prev
        prev = tmp
        count += 1

    return prev


# 教科書通りの再起のfib
def fib(n):
    if n == 0 or n == 1:
        return 1
    return fib(n - 2) + fib(n - 1)

# def fib2(n):
#     if n == 0 or n == 1:
#         return 1
#     if
#     return fib(n - 2) + fib(n - 1)


N = int(input())
F = [0 for i in range(N + 1)]


def fib_memo(n):
    if n == 0 or n == 1:
        F[n] = 1
    if F[n] != 0:
        return F[n]
    F[n] = fib_memo(n - 2) + fib_memo(n - 1)
    return F[n]


# start = time.time()
# print('case1: original fib calculator')
# print('result:{}'.format(fib_org(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# start = time.time()
# print('case2: base fib calculator')
# print('result:{}'.format(fib(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# start = time.time()
# print('case3: memo fib calculator')
# print('result:{}'.format(fib_memo(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# 以下提出用
print(fib_org(N))

Python: n=int(input())
num=[1,1]
for i in range(43):
    b=(num[-2])+(num[-1])
    num.append(b)
print(num[(n)])