Go: package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

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

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	dp := make([]int, N+1)
	dp[0] = 1
	dp[1] = 1
	for i := 2; i <= N; i++ {
		dp[i] = dp[i-1] + dp[i-2]
	}

	fmt.Fprintln(wtr, dp[N])
	wtr.Flush()
}

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: def fib(n):
  if n==0 or n==1:
    return 1
  
  x=[1,1]
  for i in range(2,n+1):
    x.append(x[i-1]+x[i-2])

  return x[-1]

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

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

Python: def memolize(f):
    cache = {}

    def helper(x):
        if x not in cache:
            cache[x] = f(x)
        return cache[x]
    return helper

@memolize
def fib(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1

    return fib(n - 1) + fib(n - 2)

n = int(input())
print(fib(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: F = {}

def fib(n):
  global F
  if n < 0:
    print("error")
    exit()
  if n < 2:
    F[n] = 1
    return F[n]
#  F[n] = fib(n-1) + fib(n-2)
  F[n] = F[n-1] + F[n-2]
  return F[n]

n = int(input())
#print(fib(n))
#n = int(input())
#print(fib(n))
#fib(44)
for i in range(n+1):
  result = fib(i)
print(result)
#  print(F[i])

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(46)]
dp[0] = 1
dp[1] = 1
for i in range(2, 46):
	dp[i] = dp[i-1] + dp[i-2]
print(dp[n])

Python: def fib(n):
    n1 = n2 = 1
    for _ in range(n - 1):
        tmp = n1 + n2
        n1, n2 = n2, tmp
    return tmp

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

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

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=int(input())
MAX_N=n
X = [None] * (MAX_N + 1)
def f(n):
    if n==0:
        return 1
    if n==1:
        return 1
    if X[n]:
        return X[n]
    r=f(n-1)+f(n-2)
    X[n]=r
    return r
    
print(f(n))

Python: def fib_loop(a, t, n):
    if a < n:
        return fib_loop(a+1, (t[0]+t[1],t[0]), n)
    else:
        return t[0] + t[1]

def fib(n):
    if n < 2:
        return 1
    else:
        return fib_loop(2, (1,1), n)

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

Python: n=int(input())
memo=[0]*47
def fibo(x):
    if x==0 or x==1:
        return 1
    elif memo[x]!=0:
        return memo[x]
    else:
        tmp=fibo(x-1)+fibo(x-2)
        memo[x]=tmp
        return tmp
print(fibo(n))

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

Python: n = input()

if n == 0:
    print(1)
elif n == 1:
    print(1)
else:
    fib = [0 for i in range(n + 1)]

    fib[0] = 1
    fib[1] = 1

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

    print(fib[n])

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

Python: n = int(input())
dp = [0] * (n + 1)

dp[0] = 1
dp[1] = 1

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

print(dp[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: #coding:UTF-8
def FN(n):
    if n==0 or n==1:
        F[n]=1
        return F[n]
    if F[n]!=None:
        return F[n]
    F[n]=FN(n-1)+FN(n-2)
    return F[n]

if __name__=="__main__":
    n=int(input())
    F=[None]*(n+1)
    ans=FN(n)
    print(ans)

Python: import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
def fib(num):
    d = defaultdict(int)
    d[0] = 1
    d[1] = 1
    if num <= 1:
        return d[num]
    else:
        for i in range(1,num):
            d[i+1] = d[i]+d[i-1]
        return d[num]
    
    
    
def main():
    num = I()
    print(fib(num))
    
if __name__ == "__main__":
    main()

Python: n = int(input().strip())
if n <= 1:
    print(1)
    raise SystemExit
prev1 = 1
prev2 = 1
for i in range(2, n+1):
    fib = prev2 + prev1
    prev2, prev1 = prev1, fib
print(fib)

Python: def get_fibonacci_number(n):
    if n < 2:
        return 1
    if not fibonacci_numbers[str(n)]:
        fibonacci_numbers[str(n)] = get_fibonacci_number(n-1) + get_fibonacci_number(n-2)
    return fibonacci_numbers[str(n)]

if __name__ == "__main__":
    n = int(input())
    fibonacci_numbers = {str(i):None for i in range(45)}
    print(get_fibonacci_number(n))

Python: if __name__ == '__main__':
    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: def makeFibonacci(n):
    F = [None]*n
    F[0] = 1
    F[1] = 1
    for i in range(2, n):
        F[i] = F[i-1] + F[i - 2]
    return str(F[n-1])

n = int(input())
print(makeFibonacci(n))

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

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))