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: class Fib:
    def __init__(self):
        self.FIB = [1, 1]

    def fib(self, n):
        if n < len(self.FIB):
            return self.FIB[n]
        else:
            self.FIB.append(self.fib(n-1) + self.fib(n-2))
            return self.FIB[n]


N = int(input())
f = Fib()
print(f.fib(N))

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

Python: n=int(input())

dp=[0 for _ in range(n+1)]
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):
    a = 1
    b = 1
    if n == 0:
        print(a)
    elif n == 1:
        print(b)
    else:
        for i in range(n-1):
            c = a + b
            a , b = b , c
        print(c)

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

Python: n = int(input())

table = [0] * 45

table[0] = 1
table[1] = 1
for i in range(2,45):
    table[i] = table[i-1]+table[i-2]

print(table[n])

Python: N = int(input())

def memorize(f) :
    cache = {}
    def helper(*args) :
        if args not in cache :
            cache[args] = f(*args)
        return cache[args]
    return helper

@memorize
def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    res = fibonacci(n - 2) + fibonacci(n - 1)
    return res

print(fibonacci(N))

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

def main():
    n = int(input())
    F  = [0]*(n+1)
    ans = fibonacci(F,n)
    return ans

print(main())

Python: n=int(input())
def fib(n):
    a,b=1,1
    for i in range(n):
        a,b=b,a+b
    return a
print(fib(n))

Python: 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 fibr(n):
    if arr[n] != 0:
        return arr[n]
    if n < 2:
        arr[n] = 1
    else:
        arr[n] = fibr(n-1) + fibr(n-2)
    return arr[n]

n = int(input())
arr = [0 for i in range(n+1)]
print(fibr(n))

Python: n = int(input())
n1 = 1
n2 = 1

for i in range(n):
    n1, n2 = n2, n1+n2

print(n1)

Python: import sys
n=int(input())

if n<=1:
    print(1)
    sys.exit()
else:
    i=1
    a0=1
    a1=1
    while i<=n-1:
        temp=a1
        a1+=a0
        a0=temp
        i+=1
print(a1)

Python: inf = 10**9+7
mod = 10**9+7
n = int(input())
dp = [1 for i in range(n+1)]
for i in range(2,n+1):
    dp[i] = dp[i-2] + dp[i-1]
print(dp[n])

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

Python: def fib(n,memo={}):
    if n==0 or 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]
n=int(input())
print(fib(n))

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

for i in range(n - 1):
    pair[i % 2] = sum(pair)

print(pair[n % 2])

Python: n = int(input())

n_L = [0] * 45

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

print(n_L[n])

Python: a=b=1
for _ in range(int(input())):a,b=b,a+b
print(a)

Python: def fib(n):
    F = {}
    F[0], F[1] = 1, 1

    if n == 1 or n == 0:
        return 1

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

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

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: def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1
    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

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

Python: def fib(n):
    n1 = n2 = tmp = 1
    for _ in range(n - 1):
        tmp = n1 + n2
        n1, n2 = n2, tmp
    return tmp

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

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

n = int(input())
f = [None for i in range(n + 1)]
print(fibonacci(f, n))

Python: import numpy as np
import sys
n  = 45
f = [-1 for i in range(45)]

def fib(n):
    global f

    if (n == 0):
        return 1
    elif (n == 1):
        return 1
    elif(f[n] == -1):
        f[n] = fib(n - 1) + fib(n - 2)

    return f[n]

if __name__ == "__main__":


    n = input("input number: ")
    n = int(n)
    #print(type(n))
    print(fib(n))

Python: import numpy as np
def f(n):
    m = np.matrix('1 1 ; 1 0') ** n
    return m.item(0)
print(f(int(input())),end="")

Python: n=int(input())
fib=[0 for _ in range(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: n = int(input())
memo = [-1]*(n+1)
memo[0] = 1
memo[1] = 1

def fib(n):
    if memo[n] != -1:
        return memo[n]
    else:
        ans = fib(n-1)+fib(n-2)
        memo[n] = ans
        return ans

print(fib(n))

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


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


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

Python: n=int(input())

a=[None] * (n+1)
a[0] = 1
a[1] = 1

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

print(a[n])