Go: package main

import (
	"fmt"
)

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

	a := make([]int, n+1)
	a[0] = 1
	a[1] = 1
	for i := 2; i <= n; i++ {
		a[i] = a[i-1] + a[i-2]
	}
	fmt.Println(a[n])
}

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

    print(F[n])

Python: from functools import lru_cache

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

n = int(input())
ans = fib(n)

print(ans)

Python: def fib(numbers, find):
    if len(numbers) < find:
        numbers.append(numbers[-1] + numbers[-2])
        fib(numbers, find)
    else:
        print(numbers)
        print(numbers[-1])


# n = 4
n = int(input())
number_list = []


if n == 0 or n == 1:
    print(1)
else:
    number_list.append(n-2)
    number_list.append(n-1)
    fib(number_list, n)

Python: import time
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)


# 何も考えずに書いてみたやつ これ一番早いじゃん・・・
def fib_org(n):
    if n in (0, 1):
        return 1

    count = 3
    prevprev = 1
    prev = 2
    while count <= n:
        tmp = prevprev + prev
        prevprev = prev
        prev = tmp
        count += 1

    return prev


# 教科書通りの再起のfib
def fib(n):
    if n == 0 or n == 1:
        return 1
    return fib(n - 2) + fib(n - 1)

# def fib2(n):
#     if n == 0 or n == 1:
#         return 1
#     if
#     return fib(n - 2) + fib(n - 1)


N = int(input())
F = [0 for i in range(N + 1)]


def fib_memo(n):
    if n == 0 or n == 1:
        F[n] = 1
    if F[n] != 0:
        return F[n]
    F[n] = fib_memo(n - 2) + fib_memo(n - 1)
    return F[n]


# start = time.time()
# print('case1: original fib calculator')
# print('result:{}'.format(fib_org(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# start = time.time()
# print('case2: base fib calculator')
# print('result:{}'.format(fib(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# start = time.time()
# print('case3: memo fib calculator')
# print('result:{}'.format(fib_memo(N)))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}[sec]".format(elapsed_time))

# 以下提出用
print(fib_org(N))

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

Python: N = 44
F = [0]*(N+1)

def dynamic(n):
    if n == 0 or n == 1:
        return 1
    if F[n] != 0:
        return F[n]
    F[n] = dynamic(n - 1) + dynamic(n - 2)
    return F[n]

if __name__ == '__main__':
    n = int(raw_input())
    print(dynamic(n))

Python: def fib2(n):
    a1, a2 = 1, 0
    while n > 0:
        a1, a2 = a1 + a2, a1
        n -= 1
    return a1

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

n = int(input())
F = make_fibonacci(n)
print(F[n])

Python: n = int(input())
dp = [0]*(n+1)
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: def fibn(n):
    fib = [1,1]
    for i in range(2,n+1):
        fib.append(fib[i-2] + fib[i-1])
    return fib[n]
    
x = int(input())
print(fibn(x))

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

Python: list=[1]*45

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

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

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

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

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

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

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

Python: def fib(n, memo={}):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    elif n in memo:
        return memo[n]
    else:
        memo[n] = fib(n-1, memo)+fib(n-2, memo)
        return memo[n]


def main():
    n = int(input())
    print(fib(n))


if __name__ == '__main__':
    main()

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

Python: def memoize(f):  
    cache = {}  
    def helper(x):  
        if x not in cache:              
            cache[x] = f(x)  
        return cache[x]  
    return helper 
         
@memoize
def fib(n):
    if n in (0, 1):
        return 1
    else:
        return fib(n - 1) + fib(n - 2)
 
print(fib(int(input())))

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

Python: memo = {}


def f(n):
    if n == 0:
        return 1
    if n == 1:
        return 1

    a1 = memo.get(n - 1)
    if not a1:
        a1 = f(n - 1)
        memo[n - 1] = a1

    a2 = memo.get(n - 2)
    if not a2:
        a2 = f(n - 2)
        memo[n - 2] = a2

    return a1 + a2


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

Python: import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

fib_list = [-1 for _ in range(100)]


def fib(n):
    if n == 0 or n == 1:
        return 1
    else:
        if fib_list[n] != -1:
            return fib_list[n]
        else:
            fib_list[n] = fib(n - 1) + fib(n - 2)
        return fib_list[n]


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

Python: n = int(input())

dp = [0 for _ in range(45)]
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):
  if n < 0:
    print("error")
    exit()
  if n < 2:
    return 1
  result = fib(n-1) + fib(n-2)
  return result

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

Python: def fibonacci(i, num_list):
    if i == 0 or i == 1:
        num_list[i] = 1
    else:
        num_list[i] = num_list[i-2] + num_list[i-1]

n = int(input()) + 1
num_list = [0 for i in range(n)]
for i in range(n):
    fibonacci(i, num_list)
print(num_list[-1])

Python: n = int(input())

fib = []
ans = 0
for i in range(n+1):
    if i == 0 or i == 1:
        ans = 1
        fib.append(ans)
    else:
        ans = fib[i-1] + fib[i-2]
        fib.append(ans)

print(ans)

Python: n = int(input())
p = [1,1]

if n <= 1:
    print (1)
    exit (0)

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

print (p[n])

Python: n = int(input())

num = [-1] * 100


def fibonacci(n):
    if n == 0:
        num[0] = 1
    elif n == 1:
        num[1] = 1

    if num[n] == -1:
        num[n] = fibonacci(n - 1) + fibonacci(n - 2)

    return num[n]


print(fibonacci(n))

Python: l = [0 for i in range(45)]
l[0] = 1
l[1] = 1
def F(n):
    if l[n] != 0:
        return l[n]
    else:
        l[n] = F(n-1) + F(n-2)
        return l[n]
print(F(int(input())))

Python: num = int(input())

dp = { 0: 1, 1: 1 }
def fibonacci(n):
  if not n in dp:
    dp[n] = fibonacci(n - 1) + fibonacci(n - 2)
  return dp[n]

print(fibonacci(num))