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


def fibonacci(n):
    a,b = 1,1
    if n == 0 or n == 1:
        return 1

    else:
        for i in range(n-1):
            a,b = b,a+b
        
        return b

print(fibonacci(n))

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

Python: Fib = [1,1]

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

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

Python: def fib(n):
    memo = [0 for _ in range(n+1)]
    memo[0] = 1
    memo[1] = 1
    
    for i in range(n-1):
        memo[i+2] = memo[i+1] + memo[i]
            
    return memo[n]

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

Python: n = int(input())

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

    def fib_sub(n):
        if dp[n] != 0:
            return dp[n]

        fibn1 = fib_sub(n-1)
        fibn2 = fib_sub(n-2)
        dp[n-1] = fibn1
        dp[n-2] = fibn2
        return fibn1 + fibn2

    return fib_sub(n)
print(fib(n))

Python: a=1
b=1
c=[]
n = int(input())

c.append(a)
c.append(b)

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

Python: n = int(input())

dict = {0:1,1:1}

def fib(n):
    if n in dict.keys():
        return dict[n]
    else:
        dict[n] = fib(n-1) + fib(n-2)
        return dict[n]

print(fib(n))

Python: N=int(input())
DP=[0]*(N+1)
def fin(n):
    if DP[n]!=0:
        return DP[n]
    if n<=1:
        DP[n]=1
        return DP[n]
    else:
        DP[n]=fin(n-1)+fin(n-2)
        return DP[n]
print(fin(N))

Python: n = int(input())
f1 = 1
f2 = 1
ans = 0
if n == 0 or n == 1:
    ans = 1
else:
    for i in range(n-1):
        if i%2 == 0:
            f1 = (f1 + f2)
            ans = f1
            #print(f1, f2)
        else:
            f2 = (f1 + f2)
            ans = f2
            #print(f1, f2)
print(ans)

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)
  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: p,n=(1+5**.5)/2,int(input())+1
print(int((p**n-(1-p)**n)/5**.5))

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

n=input()
F=[0]*(n+1)
num=fibonum()
print(num)

Python: def fibo(n):
	S=[1,1]
	s=1
	if n>1:
		for i in range(2,n+1):
			S.append(S[i-1]+S[i-2])
			s=S[i]
	return s

def main():
	if __name__=="__main__":
		n=int(input())
		print(fibo(n))

main()

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

Python: memo=[0]*50

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

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

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

Python: from functools import lru_cache


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


n = int(input())
print(fibo(n))

Python: def fib(F, n):
    if n == 0:
        return 1    
    if n == 1:
        return 1
    else:
        F.append(fib(F, n-1) + F[n-2])
        return F[n]

n = int(input())
F = [1, 1]
ans = fib(F, n)
print(str(ans))

Python: if __name__ == "__main__":
    n = input()
    F = []
    F.append(1)
    F.append(1)
    for i in range(2,n+1):
        F.append(F[i-1] + F[i-2])
        print(F[i])

    print(F[n])

Python: import sys
input = sys.stdin.readline

def fibo(i, dp):
	if dp[i] != -1:
		return dp[i]
	dp[i] = fibo(i-1, dp) + fibo(i-2, dp)
	return dp[i]

def main():
	n = int(input().strip())
	dp = [-1 for i in range(n+1)]
	dp[0] = 1
	dp[1] = 1
	print(fibo(n, dp))

if __name__ == '__main__':
	main()

Python: n = int(input())

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

print(fib[n])

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

Python: def fib(n):
    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 = [0]*(n+1)
fib[0] = 1
fib[1] = 1

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

Python: def fib(n):
    if n==0:
        return 1
    elif n==1:
        return 1
    else:
        a,b=1,2
        for i in range(n-2):
            a,b=b,a+b
        return b    

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

Python: a=[1,1]
def fib(n):
    try:
        return a[n]
    except:
        a.append(fib(n-2)+fib(n-1))
        return a[n]
n=int(input())
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())))

Python: def main():
    """ ????????? """
    num = int(input().strip())
    F = []
    for n in range(num+1):
        if n < 2:
            F.append(1)
        else:
            F.append(F[n-1] + F[n-2])
    print (F[num])
if __name__ == '__main__':
    main()

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


def fib(i):
    if dp[i] > 0:
        return dp[i]
    else:
        dp[i] = fib(i-1) + fib(i-2)
        return dp[i]


print(fib(n))

Python: f=lambda n:f(n-1)+f(n-2)if n>1 else 1
print(f(int(input())))