Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

Python: 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):
    fibo = [1,1]
    for i in range(2,n+1):
        fibo.append(fibo[i-2]+fibo[i-1])
    return fibo[n]
    
n=int(input())
print(fibo(n))

Python: from functools import lru_cache

@lru_cache(maxsize=None)
def Fib(n) :
    if n == 0 :
        return 1
    elif n == 1 :
        return 1
    else :
        return Fib(n-1) + Fib(n-2)

N = int(input())
print(Fib(N))

Python: n = int(input())

fib = [1]*2 + [0]*(n-1)

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


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: from functools import lru_cache


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


class Fibonacci(object):
    memo = [1, 1]

    def get_nth(self, n):
        if n < len(Fibonacci.memo):
            return Fibonacci.memo[n]
        # print('fib({0}) not found'.format(n))
        for i in range(len(Fibonacci.memo), n+1):
            result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
            Fibonacci.memo.append(result)
            # print('fib({0})={1} append'.format(i, result))
        return Fibonacci.memo[n]


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())

    # ?????£??????????????°????¨????
    #f = Fibonacci()
    #result = f.get_nth(num)
    result = fib(num+1)

    # ???????????????
    print('{0}'.format(result))

Python: N = int(input())


def fibo(n, cache):
    cache[0] = 1
    cache[1] = 1
    for n in range(2, N+1):
        cache[n] = cache[n-1] + cache[n-2]
    return cache


print(fibo(N, [-1]*(N+1))[N])

Python: N = int(input())

memo = []

memo = [1,1] + [0] * (N - 1)

def f(n):
    if memo[n] == 0:
        memo[n] = f(n-1) + f(n-2)
        return(memo[n])
    if memo[n] != 0:
        return(memo[n])

print(f(N))

Python: # -*- coding: utf-8 -*-
fibs = {0: 1, 1: 1}


def fib(n):
    if n not in fibs:
        fibs[n] = fib(n - 1) + fib(n - 2)

    return fibs[n]


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

Python: memo = {}


def fib(n):
    """
    :param n: non-negative integer
    :return: n-th fibonacci number
    """
    if n == 0 or n == 1:
        return 1

    try:
        return memo[n]
    except KeyError:
        pass

    res = fib(n-1) + fib(n-2)
    memo[n] = res

    return res


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

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

Python: n = int(input())
if n < 3:
    print(n)
else:
    n_1 = 1
    n_2 = 1
    for i in range(2, n+1):
        n_0 = n_1 + n_2
        n_2, n_1 = n_1, n_0
    print(n_0)

Python: def f(n):
    f=[1,1]
    for i in range(2,n):
        f.append(f[i-2]+f[i-1])
    return f[n-1]

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

Python: #DPによるフィボナッチ数列
n = int(input())

dp = [-1] * (n+1) #DPテーブルの用意

dp[0] = 1
dp[1] = 1#初期値設定

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

print(dp[n])

Python: F = [0 for i in range(50)]
F[0] = 1
F[1] = 1

def fib(n) :
    if n == 0 or n == 1:
        F[n] = 1
        return F[n]
    else:
        if F[n] == 0:
            F[n] = fib(n-1) + fib(n-2)
            return F[n]
        else:
            return F[n]
n = int(input())
print(fib(n))

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

Python: def fibonacci(n):
    if n==0:
        return 1
    elif n==1:
        return 1
    else:
        return fibonacci(n-1) + fibonacci(n-2)

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

Python: f=[1,1]
for _ in range(2,45):f+=[sum(f[-2:])]
print(f[int(input())])

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

Python: def main():
    n = int(input())
    if n <= 1:
        print(1)
    else:
        fib_list = [1, 1] + [None] * (n - 1)
        for i in range(2, n + 1):
            fib_list[i] = fib_list[i - 1] + fib_list[i - 2]
        print(fib_list[n])


if __name__ == "__main__":
    main()

Python: import sys
sys.setrecursionlimit(15000)
n = int(input())

memo = {0:1,1:1}

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

print(fib(n))

Python: n = int(input())
def fib(n):
    if (n == 0 or n == 1):
        return 1
    return fib(n-1) + fib(n-2)
print(fib(n))

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

Python: def solve(n):
    if n <= 1:
        print(1)
        return

    a, b = 1, 1
    for _ in range(2, n + 1):
        c = a + b
        b = a
        a = c
    print(c)

if __name__ == "__main__":
    n = int(input())
    solve(n)

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

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

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

Python: n = int(input())
l = [0 for _ in range(10**4)]
def fib(n):
    if n==0:
      l[0]=1
      return 1
    if n==1:
      l[1]=1
      return 1
    if l[n]!=0:
      return l[n]
    else:
      l[n]=fib(n-1)+fib(n-2)
      return fib(n-1)+fib(n-2)
    
print(fib(n))

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)