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
}

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)])

Python: N = 44
F = [0]*(N+1)

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

if __name__ == '__main__':
    n = int(raw_input())
    print(dynamic(n))

Python: def fib2(n):
    a1, a2 = 1, 0
    while n > 0:
        a1, a2 = a1 + a2, a1
        n -= 1
    return a1

Python: def make_fibonacci(n):
    F = []
    F.append(1)
    F.append(1)
    for i in range(2, n+1):
        F.append(F[i-2]+F[i-1])
    return F

n = int(input())
F = make_fibonacci(n)
print(F[n])

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

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

Python: n = int(input())
F = [1, 1] + [0 for i in range(44)]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])

Python: list=[1]*45

n=int(input())
def fib(n):
    if n==0 or n==1:
        return list[n]
    else:
        if list[n]==1:
            list[n]=fib(n-1)+fib(n-2)
            return list[n]
        else:
            return list[n]
      
print(fib(n))

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

Python: n=(int)(input())
a=1
b=1
i=0
for i in range(n-1):
    c=a+b
    a=b
    b=c
print(b)

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: n = int(input())
def fib(n):
    if (n == 0 or n == 1):
        return 1
    else:
        return fib(n-1) + fib(n-2)
print(fib(n))

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

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

Python: def fib(n, memo={}):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    elif n in memo:
        return memo[n]
    else:
        memo[n] = fib(n-1, memo)+fib(n-2, memo)
        return memo[n]


def main():
    n = int(input())
    print(fib(n))


if __name__ == '__main__':
    main()

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

Python: def memoize(f):  
    cache = {}  
    def helper(x):  
        if x not in cache:              
            cache[x] = f(x)  
        return cache[x]  
    return helper 
         
@memoize
def fib(n):
    if n in (0, 1):
        return 1
    else:
        return fib(n - 1) + fib(n - 2)
 
print(fib(int(input())))

Python: def fib(n):
    if n==0 or n==1:
        return 1
    else:
        return fib(n-1) + fib(n-2)
print(fib(int(input())))

Python: memo = {}


def f(n):
    if n == 0:
        return 1
    if n == 1:
        return 1

    a1 = memo.get(n - 1)
    if not a1:
        a1 = f(n - 1)
        memo[n - 1] = a1

    a2 = memo.get(n - 2)
    if not a2:
        a2 = f(n - 2)
        memo[n - 2] = a2

    return a1 + a2


n = int(input())
print(f(n))

Python: import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

fib_list = [-1 for _ in range(100)]


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


print(fib(int(input())))