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: n = int(input())

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


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

print(dp[n])

Python: def fib(n):
  if n < 0:
    print("error")
    exit()
  if n < 2:
    return 1
  result = fib(n-1) + fib(n-2)
  return result

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

Python: def fibonacci(i, num_list):
    if i == 0 or i == 1:
        num_list[i] = 1
    else:
        num_list[i] = num_list[i-2] + num_list[i-1]

n = int(input()) + 1
num_list = [0 for i in range(n)]
for i in range(n):
    fibonacci(i, num_list)
print(num_list[-1])

Python: n = int(input())

fib = []
ans = 0
for i in range(n+1):
    if i == 0 or i == 1:
        ans = 1
        fib.append(ans)
    else:
        ans = fib[i-1] + fib[i-2]
        fib.append(ans)

print(ans)

Python: n = int(input())
p = [1,1]

if n <= 1:
    print (1)
    exit (0)

for i in range(2,n+1):
    p.append(p[i-2] + p[i-1])

print (p[n])

Python: n = int(input())

num = [-1] * 100


def fibonacci(n):
    if n == 0:
        num[0] = 1
    elif n == 1:
        num[1] = 1

    if num[n] == -1:
        num[n] = fibonacci(n - 1) + fibonacci(n - 2)

    return num[n]


print(fibonacci(n))

Python: l = [0 for i in range(45)]
l[0] = 1
l[1] = 1
def F(n):
    if l[n] != 0:
        return l[n]
    else:
        l[n] = F(n-1) + F(n-2)
        return l[n]
print(F(int(input())))

Python: num = int(input())

dp = { 0: 1, 1: 1 }
def fibonacci(n):
  if not n in dp:
    dp[n] = fibonacci(n - 1) + fibonacci(n - 2)
  return dp[n]

print(fibonacci(num))