Go: package main

import "fmt"

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

	x, y := int64(0), int64(1)
	for i := 0; i < n; i++ {
		x, y = y, x+y
	}

	fmt.Println(x)
}

Python: num = int(input())
fibtbl = [ 0 for x in range(50)]
fibtbl[0] = 1
fibtbl[1] = 1

def fib(n):
    global fitbl
    
    if n == 0:
        return 1
    if n == 1:
        return 1
    
    if fibtbl[n-1] != 0:
        p = fibtbl[n-1]
    else:
        p = fib(n-1)
    
    if fibtbl[n-2] != 0:
        pp = fibtbl[n-2]
    else:
        pp = fib(n-2)
    
    fibtbl[n] = p + pp
    return p + pp
    

print(fib(num))

Python: fib=[0]*45
fib[0]=1
fib[1]=1

n=int(input())

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

Python: import sys
#import numpy as np

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

n = int(input())

l = [1,1]

def f(i):
    global l
    if i <= 1:
        return 1
    else:
        return l[i-1] + l[i-2]

for i in range(2,n+1):
    l.append(f(i))

print(l[n])

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

Python: 
def fibonacci(n):
    global F

    if F[n] != -1:
        return F[n]
    elif n in [0, 1]:
        F[n] = 1
        return F[n]
    else:
        F[n] = fibonacci(n-1) + fibonacci(n-2)
        return F[n]


n = int(input())
F = [-1] * 45

print(fibonacci(n))

Python: from collections import deque
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

table = [0] * 45

table[0] = 1
table[1] = 1

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


N = int(input())
print("%d"%(table[N]))

Python: #!/usr/bin/python

n = int(input())

def fib(n):
    l = list()
    l.append(1)
    l.append(1)

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

    return l[i]

print(fib(n))

Python: n = int(input())

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


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

print(x[-1])

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

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

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

Python: A = [None] * (44 + 1)
A[0] = 1
A[1] = 1


def fibonacci(n: int) -> int:
	if A[n] == None:
		A[n] = fibonacci(n - 1) + fibonacci(n - 2)
	return A[n]


if __name__ == "__main__":
	n = int(input())
	print(fibonacci(n))

Python: n = int(input())

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

print(fib[n])

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

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

Python: def fibonacci(N, dp):
    if dp[N] != 0:
        return dp[N]
    if N == 1 or N == 0:
        dp[N] = 1
    else:
        dp[N] = fibonacci(N - 1, dp) + fibonacci(N - 2, dp)
    return dp[N]


def main():
    N = int(input())
    dp = [0] * (N + 1)
    print(fibonacci(N, dp))


if __name__ == '__main__':
    main()

Python: MAX_N = 44
dp = [None] * (MAX_N + 1)
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]

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

Python: def fib(n):
    nums = []
    for i in range(n+1):
        if i <= 1:
            nums.append(1)
        else:
            nums.append(nums[i-1]+nums[i-2])
    return nums[n]


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


if __name__ == "__main__":
    main()

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

Python: N_MAX = 45 # 0 ≤ n ≤ 44
F = [None] * N_MAX


def fibonacci(n):
    if n == 0 or n == 1:
        F[n] = 1
        return F[n]

    if F[n] != None:
        return F[n]

    F[n] = fibonacci(n - 1) + fibonacci(n - 2)

    return F[n]



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

Python: n = int(input())
L = [-1]*(n+1)
def fib(i,L):
    if i <= 1:
        return 1
    else:
        if L[i] != -1:
            return L[i]
        else:
            L[i] = fib(i-1,L)+fib(i-2,L)
            return L[i]
        return fib(i-1,L)+fib(i-2,L)
print(fib(n,L))

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

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

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

print(fibonacci(int(input())))

Python: import sys
input = sys.stdin.readline

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

print(F[n])

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

Python: n = int(input())

cache = {0: 1, 1: 1}
def fibonacci(n):
    if cache.get(n, None) is not None:
        return cache[n]
    cache[n] = fibonacci(n-1) + fibonacci(n-2)
    return cache[n]

print(fibonacci(n))

Python: fib=[0]*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 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)

pritn(fib(int(input())))

Python: from collections import deque
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

table = [0] * 45

table[0] = 1
table[1] = 1

N = int(input())

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


print("%d"%(table[N]))

Python: n=int(input())
a=list(range(n+1))
a[0]=1
i=2
while i<=n:
    a[i]=a[i-1]+a[i-2]
    i+=1
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]
n = int(input())
print(fib[n])

Python: import sys
input = sys.stdin.readline

def fib2(n):
    n0,n1 = 1,1
    ans = 1
    for i in range(2,n+1):
        n0,n1 = n1,ans
        ans = n0 + n1
    return ans

if __name__ == "__main__":
    n = int(input())
    print(fib2(n))

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: p = int(input())
def fib(n):
    dp = [0] * 50
    for i in range(n+1):
        if i == 0 or i == 1:
            dp[i] = 1
        else:
            dp[i] = dp[i-1] + dp[i-2]
    return dp[n]
print(fib(p))

Python: # -*- coding: utf-8 -*-
# 標準入力を取得
n = int(input())

# 求解処理
# dp[i+1]: フィボナッチ数列の第i項
dp = [0 for _ in range(n + 1)]

# 初期条件
dp[0] = 1
dp[1] = 1

for i in range(1, n):
    # DP漸化式
    dp[i + 1] = dp[i] + dp[i - 1]
ans = dp[n]

# 結果出力
print(ans)

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

def fibo(n):
    if n==0:
        return 1
    if n==1:
        return 1
    if memo[n] != 0:
        return memo[n]
    memo[n]=fibo(n-1)+fibo(n-2)
    return memo[n]
n=int(input())
memo=[0 for i in range(n+1)]

print(fibo(n))

Python: memo = {}

def fib(n) :
    if n in memo.keys() :
        return memo[n]
    else :
        if n == 0 :
            return 1
        elif n == 1 :
            return 1 
        else :
            memo[n] = fib(n - 1) + fib(n - 2)
            return memo[n]
    
print(fib(int(input())))

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