Go: package main

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

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()
	n := nint()
	r := fibonacci(n)
	fmt.Println(r)
}

func fibonacci(n int) int{
	if n == 0 || n == 1{
		return 1
	}else{
		fiList := make([]int, n+1)
		fiList[0] = 1
		fiList[1] = 1
		for i:=2; i<n+1; i++{
			fiList[i] = fiList[i-1] + fiList[i-2]
		}
		return fiList[n]

	}

}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}

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: import sys
input = sys.stdin.readline

m = [1, 1] + [None]*50

def fibonacci(n):
    if m[n-2]:
        pass
    else:
        fibonacci(n-2)
    if m[n-1]:
        pass
    else:
        fibonacci(n-1)

    m[n] = m[n-1] + m[n-2]

N = int(input())

fibonacci(44)
print(m[N])

Python: def fib(n: int, meolist: dict):
    if n == 0 or n == 1:
        meolist[n] = 1
        return 1
    elif n in meolist.keys():
        return meolist[n]
    
    meolist[n] = fib(n - 1, meolist) + fib(n - 2, meolist)
    return meolist[n]

if __name__ == '__main__':
    n = int(input())
    meolist = {}
    print(fib(n, meolist))

Python: def main():
    import sys
    N = int(sys.stdin.readline())
    L = [0 for i in range(45)]
    L[0], L[1] = 1, 1
    for i in range(2, 45):
        L[i] = L[i-1] + L[i-2]
    #print(L)
    print(L[N])
    



if __name__=='__main__':
    main()

Python: def fib(a, b, fiboli):
    if len(fiboli) < n:
        fiboli.append(fiboli[-1] + fiboli[-2])
        fib(fiboli[-1], fiboli[-1] + fiboli[-2], fiboli)
    else:
        print(fiboli[-1])
        print(fiboli)

n = 4
    # n = int(input())
if n == 0 or n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    fibo_list = []
    fibo_list.append(n - 1)
    fibo_list.append(n - 2)
    fib(n - 1, n - 2, fibo_list)

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

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

Python: # -*- coding:utf-8 -*-

def solve():
    import sys

    N = int(sys.stdin.readline())

    dp = [None]*45
    dp[0], dp[1] = 1, 1

    def fib(n):
        if dp[n] is not None:
            return dp[n]
        dp[n] = fib(n-1) + fib(n-2)
        return dp[n]

    print(fib(N))


if __name__ == "__main__":
    solve()

Python: n = int(input())
DP = [None] * (n + 1)  # 計算結果を保存する配列
DP[0] = 1  # 定義より
DP[1] = 1  # 定義より

def fib(n):
    # フィボナッチ数を2からnまで順に求めていく
    for i in range(2, n + 1):
        DP[i] = DP[i-1] + DP[i-2]
    return DP[n]

print(fib(n))

Python: res = [1, 1]

n = int(input())

for i in range(n - 1):
    res.append(res[i] + res[i + 1])

print(res[n])

Python: from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
    if n==0 or n==1:
        return 1
    else:
        return fib(n-1)+fib(n-2)
n=int(input())
print(fib(n))

Python: def fibonacci(n):
    a, b = 1, 0
    for _ in range(0, n):
        a, b = b, a + b
    return b

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

Python: import sys
numbers = []
for line in sys.stdin:
	numbers.append(int(line))

k = []
k.append(1)
k.append(1)

def getFib(i, n):
    if i == n :
        print(k[-1])
        return
    k.append(int(k[i - 1]) + int(k[i - 2]))
    getFib(i + 1, n)

getFib(2, int(numbers[0])+1)

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: N = int(input())
fib = [None] * (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())
a=1
b=1
for i in range(n-1):
    c=b
    b+=a
    a=c
print(b)

Python: def fibonacci(n):
    if n == 0 or n == 1:
        F[n] = 1
        return F[n]
    if F[n] is not None:
        return F[n]
    F[n] = fibonacci(n - 1) + fibonacci(n - 2)
    return F[n]


n = int(input())
F = [None]*(n + 1)
print(fibonacci(n))

Python: """
ALDS1_10_A
簡単な動的計画法を使ってフィボナッチ数列を計算する
"""
def Fibo(num):
    List = [None]*45
    for i in range(num+1):
        if i == 0:
            List[0] = 1
        elif i == 1:
            List[1] = 1
        else:
            List[i] = List[i-1]+List[i-2]
    return List

n = int(input())

print(Fibo(n)[n])

Python: def calculate(nums):
    nums = nums.append(nums[-2] + nums[-1])
    return nums

n = int(input())
number_list = [0,1]

while True:
    if len(number_list) == n+2:
        print(number_list[-1])
        break
    else:
        calculate(number_list)

Python: memo = {}

def fib(n):
    key = n
    
    if key in memo:
        return memo[key]
    
    if n == 0:
        return 1
    if n == 1:
        return 1
    if n > 1:
        memo[key] = fib(n-1) + fib(n-2)
    
    return memo[key]

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

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

for i in range(n+1):
    if i<=1:
        dp[i]=1
        continue

    dp[i]=dp[i-1]+dp[i-2]
print(dp[-1])

Python: n = int(input())

# 動的計画法
def fibonacci(n):
    F = [0]*(n+1)
    F[0] = 1
    F[1] = 1
    for i in range(2, n+1):
        F[i] = F[i-2] + F[i-1]
    return F

f = fibonacci(n)
print(f[n])

Python: n = int(input())

first = 1
second = 1
for i in range(n-1):
    second, first = first + second, second
print(second)

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

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

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):
        print(i)
        fib[i] = fib[i - 1] + fib[i - 2]

    print(fib[n])

Python: 
def fib(n):
    if n == 1 or n == 2:
        return 1
    else:
        seq = [0 for _ in range(0, n)]
        seq[0], seq[1] = 1, 1
        for i in range(2, n):
            seq[i] = seq[i - 1] + seq[i - 2]
    return seq[n - 1]


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

Python: n = int(input())
a0 = 1
a1 = 1

#print(a0, a1, end='')
if n == 0 or n == 1:
    a2 = 1

else:
    for i in range(n-1):
        a2 = a0 + a1
        a0 = a1
        a1 = a2
    #print('',a2,end='')
print(a2)

Python: target = int(input())
fib = [0 for n in range(target + 1)]
for i in range(target):
    if i == 0:
        continue
    elif i == 1:
        fib[i] = 1
    else:
        fib[i] = fib[i - 1] + fib[i - 2]
print(fib[target])