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: #!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


# def fib_bad(n):
#     if not n or n == 1:
#         return 1
#     return fib_bad(n - 2) + fib_bad(n - 1)


def fib_dp(n):
    fib_list[:1] = [1, 1]
    for i in range(2, n + 1):
        fib_list[i] = fib_list[i - 2] + fib_list[i - 1]
    return fib_list.pop()


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    index = int(_input[0])
    fib_list = [None] * index
    print(fib_dp(index))

Python: def fib(n):
    if n == 0 or n == 1:
        return 1
    else:
        seq = [0 for _ in range(n+1)]
        seq[0], seq[1] = 1, 1
        for i in range(2,n+1):
            seq[i] = seq[i-1] + seq[i-2]
        return seq[n]

if __name__ == '__main__':
    print(fib(int(input())))

Python: def g(a,b,n):
    if n==1:return a
    else:return g(a+b,a,n-1)
print(g(1,1,int(input())))

Python: n=int(input())
MAX_N=n
MEMO = [None] * (MAX_N + 1)
def f(n):
    if n==0:
        return 1
    if n==1:
        return 1
    if MEMO[n]:
        return MEMO[n]
    r=f(n-1)+f(n-2)
    MEMO[n]=r
    return r
    
print(f(n))

Python: n=int(input())
x=1
y=1
a=0
for i in range(n):
    a=x
    x=y
    y=a+y
print(x)

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: n = int(input())
map = [0]*(n+1)
map[0] = 1
map[1] = 1

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

print(map[-1])

Python: N = int(input())

one = 1
two = 1
for _ in range(1, N):
    three = one + two
    one, two = two, three
print(two)

Python: print([1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170][int(input())])

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

Python: def fib(n):
    if n == 0:
        return 1
    if n == 1:
        return 1
    return fib(n-1) + fib(n-2)

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

Python: n = int(input())
dp = [0] * (n+1)
dp[0] = 1

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

print(dp[n])

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

Python: # coding=utf-8


def fib(number):
    if number == 0 or number == 1:
        return 1
    return fib(number-1) + fib(number-2)


if __name__ == '__main__':
    N = int(input())
    print(fib(N))

Python: # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(100000)

calculated = set([0, 1])
cal_fib = [0 for _ in range(45)]
cal_fib[0:2] = 1, 1

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

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

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

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

Python: n = int(input())

F = [0]*(n+1)
if n == 0:
    print(1)
elif n==1:
    print(1)
elif n > 1:
    F[0] = 1
    F[1] = 1

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

    print(F[-1])

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

Python: def fib(n):
    n=int(n)
    F=[1,1]
    for i in range(1,n):
        F.append(F[i-1]+F[i])
    
    return F[n]
    
a=input(int())
fib(a)

Python: l=[1,1]
n=int(input())
for i in range(n):
    fib=[l[i]+l[i+1]]
    l=l+fib
print(l[n])

Python: lis=[]
lis.append(1)
lis.append(1)
for i in range(2,45):
    lis.append(lis[i-1]+lis[i-2])

n = int(input())
print(lis[n])

Python: import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    fb = [-1] * (N + 1)
    print(fib(fb, N))


if __name__ == '__main__':
    main()

Python: # -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N=INT()

memo=[0]*50
memo[0]=memo[1]=1
def rec(n):
    if memo[n]:
        return memo[n]
    return rec(n-1)+rec(n-2)

print(rec(N))