Go: package main

import (
	"bufio"
	"fmt"
	"strconv"
	"strings"
	"os"
)

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `
3
`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}



func fib(n int, dp map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
		if v, ok := dp[n]; ok {
		return v
	}
	r := fib(n - 1, dp) + fib(n - 2, dp)
	dp[n] = r
	return r
}

// solve
func solve(sc *bufio.Scanner) {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	dp := make(map[int]int)
	r := fib(n, dp)
	fmt.Println(r)
}

Python: def resolve():
    '''
    code here
    '''
    import sys

    sys.setrecursionlimit(100000000)
    N = int(input())

    memo = [0 for _ in range(N+1)]

    def fina(n):
        if n <= 1:
            memo[n] = 1
            return 1

        if memo[n] != 0:
            return memo[n]

        memo[n-1] = fina(n-1)
        memo[n-2] = fina(n-2)        
        memo[n] = memo[n-1] + memo[n-2]

        return memo[n]
    
    print(fina(N))



if __name__ == "__main__":
    resolve()

Python: 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())
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())))