Go: package main

import (
	"fmt"
)

const MAX = 45

var dp [MAX]int

func fin(n int) int {
	if dp[n] != 0 {
		return dp[n]
	}

	switch n {
	case 0:
		dp[n] = 1
	case 1:
		dp[n] = 1
	default:
		dp[n] = fin(n-1) + fin(n-2)
	}
	return dp[n]
}

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

Python: n = int(input())
dp = [0]*(n+1)
def fibo(n):
  if n <2:
    return 1
  if dp[n]  > 0:
    return dp[n]
  dp[n] = fibo(n-1) + fibo(n -2)
  return dp[n]
print(fibo(n))

Python: import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

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

main()

Python: n = int(input())
def fib(i):
    if i<=1: return 1
    else: 
     a=0
     b=1
     for i in range(n+1):
      c=b+a
      b=a
      a=c
     return c
print(fib(n))

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

print(dp[n])

Python: # coding: utf-8
# 40

n = int(input())
a = int(0)
b = int(1)

if n==1:
    A = b
elif n==2:
    A = 2
else:
    for i in range(n):
        a,b = b,a+b
        A = b

print(A)

Python: n = int(input())
f = [0]*45
f[0] = 1
f[1] = 1

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

Python: def fib(n):
    if n ==0 or n == 1:
        return 1
    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: # -*- coding: utf-8 -*-
"""
Created on Fri May  4 20:13:10 2018
ALDS1_10_A
@author: maezawa
"""

fib_arr = [None for _ in range(45)]
fib_arr[1] = 1
fib_arr[2] = 1

def fib(n):
    if fib_arr[n] != None:
        return fib_arr[n]
    fib_arr[n] = fib(n-1)+fib(n-2)
    return fib_arr[n]
    
n = int(input())
print(fib(n))

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

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

Python: 
fibo_list=[0 for i in range(48)]

def fibo(n):
    f=fibo_list[n]
    if f:
        return f
    else:
        if n==0 or n==1:
            return 1
        else:
            f=fibo(n-1)+(fibo(n-2))
    fibo_list[n]=f
    return f


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

Python: def fina(n, fina_list):

    if n <= 1:
        fina_list[n] = 1
        return fina_list[n]
    elif fina_list[n]:
        return fina_list[n]
    else:
        fina_list[n] = fina(n-1, fina_list) + fina(n-2, fina_list)
        return fina_list[n]


n = int(input())
fina_list = [None]*(n + 1)
print(fina(n, fina_list))

Python: n = int(input())


dps = [0 for _ in range(n + 1)]

dps[0] = 1
dps[1] = 1

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

print(dps[n])

Python: n=int(input())

a1=1
a=1

i=1
while i<n:
    a1,a=a,a1+a
    i+=1


print(a)

Python: 
f = [-1 for i in range(45)]
f[0] = f[1] = 1

def fib(n):
    global f
    for i in range(2,n+1):
        f[i] = f[i - 1] + f[i - 2]
        #print(i,f[i])
    return f[n]

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

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

N = int(input())
a = fib(N, 1, 0)
print(a)

Python: # Aizu Problem ALDS_1_10_A: Fibonacci Number
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


n = int(input())
if n < 2:
    print(1)
else:
    a, b = 1, 1
    for k in range(n - 1):
        a, b = b, a + b
    print(b)

Python: N = int(input())

memo = [-1]*500

def fibo(x):
    if memo[x] != -1:
        return memo[x]
    
    if x == 0 or x == 1:
        ans=1
        memo[x] = ans
        return ans
    
    ans = fibo(x-1) + fibo(x-2)
    memo[x] = ans
    return ans

print(fibo(N))

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


print(a)

Python: A=1
B=1
C=0 #２つ前の項
D=0 #1
N=int(input())
if N==0 or N==1:
    print(1)
elif N==2:
    print(2)

else:   
    C=B  #１
    D=A+B #2
    for i in range (N-3):
        B=C
        C=D
        D=B+C
    print(C+D)

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

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

Python: n = int(input())
f = [0] * (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[n])

Python: def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()

m = [-1] * (n+1)
m[0] = 1
m[1] = 1

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

print(fib(n))

Python: n = int(input())

dp = [0] * 45
dp[0], dp[1] = 1, 1

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

print(dp[n])

Python: # coding: utf-8
# Your code here!

n = int(input())
m = [1,1]
if n == 0:
    print(1)
elif n == 1:
    print(1)
else:
    for i in range(2, n+1):
        m.append( m[i-1] + m[i-2] )
    print(m.pop())

Python: def Fibonacci(n):
    if n == 0 or n == 1:
        dic[n] = 1
    if n in dic.keys():
        return dic[n]
    dic[n] = Fibonacci(n-1) + Fibonacci(n-2)
    return dic[n]

a = int(input())
dic ={}
print(Fibonacci(a))

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

Python: def fb(num):
    a, b = 1, 0
    for _ in range(num):
        a, b = a + b, a
    return b

n = int(input())
print(fb(n+1))

Python: from functools import lru_cache

@lru_cache(maxsize=1024)

def fib(n):
    if n in [0, 1]:
        return 1
    return fib(n - 1) + fib(n - 2)

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

Python: import math
import copy
import sys
import fractions
# import numpy as np
# import statistics
import decimal
import heapq
import collections
import itertools
import bisect

# from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputIntList():
    outputDataList = []
    inputData = input().split()
    outputDataList = [int(n) for n in inputData]

    return outputDataList


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())

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

print(d[n])

Python: #!/usr/bin/python

n = int(input())

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

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

    return l[i]

print(fib(n))

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

Python: def fibonacci(n, memo=None):
    if memo==None:
        memo = [None]*n
    if n<=1:
        return 1 
    else:
        if memo[n-2]==None:
            memo[n-2] = fibonacci(n-2, memo)
        if memo[n-1]==None:
            memo[n-1] = fibonacci(n-1, memo)
    return memo[n-1] + memo[n-2]

n = int(input())
print(fibonacci(n))

Python: n = int(input())
# dpテーブルの用意
dp = [-1]*(n+1)
# dpの初期値
dp[0], dp[1] = 1, 1

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