Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	f := make([]int, n+1)

	fmt.Println(fib(n, f))
}

func fib(n int, f []int) int {
	if n == 0 {
		f[n] = 1
		return f[n]
	}
	if n == 1 {
		f[n] = 1
		return 1
	}

	if f[n] != 0 {
		return f[n]
	}

	f[n] = fib(n-2, f) + fib(n-1, f)
	return f[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())))

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

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

Python: fib = [1]*100

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

Python: #(40)フィボナッチ数列
n=int(input())
def fib(n):
    a=1
    b=1
    for _ in range(n):
        a,b=b,a+b
    return a
print(fib(n))

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=input()
		print(fibo(n))

main()

Python: if __name__ == '__main__':
    n = int(input())
    ans = [1, 1, ]
    if n == 0 or n == 1:
        print(ans[n])
    else:
        for i in range(2, n + 1):
            ans.append(ans[i - 2] + ans[i - 1])
        print(ans[n])

Python: def fib(n):
    def iter(a, b, cnt):
        if cnt == 0:
            return a
        return iter(b, a+b, cnt-1)
    return iter(1, 1, n)

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

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

Python: 
fibo = [0] * 45
N = int(input())
fibo[0] = 1
fibo[1] = 1

for i in range(2,N+1):
    fibo[i] = fibo[i-1]+fibo[i-2]

print(fibo[N])
# N = int(input())　再帰のみ
# def fibo(n):
#     if n == 0 or n == 1:
#         return 1
#     return fibo(n-1)+fibo(n-2)
# print(fibo(N))
# N = int(input()) メモ化再帰　5596KB 635B
# def fibo(n):
#     return fib2(1,1,n-1)
# def fib2(a,b,c):
#     if c < 1:
#         return a
#     return fib2(a+b,a,c-1)
# print(fibo(N))

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

Python: n = int(input())

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

print(fib[n])

Python: memo = [1, 1]

def fib(n):
    if (n < len(memo)):
        return memo[n]

    memo.append(fib(n-1) + fib(n-2))
    return memo[n]

N = int(input())
print(fib(N))

Python: import sys
m = int(input())
f = [0]*50
def fib(n):
  if n==0 or n==1:
    f[n] == 1
    return 1
  if f[n]!=0:
    return f[n]
  f[n] = fib(n-2) + fib(n-1)
  return f[n]

print(fib(m))

Python: n = int(input())

dp = [-1] * 100
dp[0] = 1
dp[1] = 1


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


if __name__ == "__main__":
    print(fib(n))

Python: #!/usr/bin/python3

# main
n = int(input()) - 1
fib = [1, 2]
for i in range(2, n + 1):
    fib.append(fib[i - 1] + fib[i - 2])
print(fib[n])