Go: package main

/*
フィボナッチ数列
*/

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

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

Python: n = int(input())

def fib(n):
 if(n==0): return 1
 elif(n==1): return 1
 elif(n>1):
   a,b = 1,1
   for i in range(n-1):
     a,b = b,a+b
   return b

print(fib(n))

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

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

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

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

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


if __name__ == '__main__':

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

    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-2) + fibonacci(n-1)
        return F[n]

    print(fibonacci(n))

Python: n = int(input())

A = [0 for _ in range(n+1)]
A[0] = A[1] = 1
for i in range(2, n+1):
    A[i] = A[i-1] + A[i-2]
print(A[n])

Python: #coding:utf-8
n = int(input())
F = [False for i in range(n+1)]
def fib(n):
    if n == 0 or n == 1:
        F[n] = 1
        return 1
    if F[n]:
        return F[n]
    F[n] = fib(n-2) + fib(n-1)
    return F[n]

a = fib(n)
print(a)

Python: def main():
    n = int(input())
    ans = solve1(n)
    print(ans)


def solve1(n):
    if n <= 1:
        return 1
    a, b = 1, 1

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

if __name__ == '__main__':
    main()

Python: # ALDS1_10_A.py
N = int(input())
fib_list = [0]*(N+1)
def fib(n):
    if n<=1:
        fib_list[n] = 1
    else:
        if fib_list[n] == 0:
            fib_list[n] = fib(n-1) + fib(n-2)
    return fib_list[n]
fib(N)
print(fib_list[N])

Python: _fib = [None] * 45
_fib[0] = 1
_fib[1] = 1

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

_n = int(raw_input())
print(fib(_n))

Python: n = int(input())
dp = [None for _ in range(n+1)]

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

print(fib(n))

Python: n=int(input())
a=1
b=1
if n==0 or n==1:
    print(1)
else:
    for i in range (n):
        a,b=b,a+b
    print(a)

Python: # coding=utf-8

def fib(n):
    global fib_list
    if fib_list[n]:
        return fib_list[n]

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

n = int(input())
fib_list = [None for i in range(n+1)]
print(fib(n))

Python: def fib(n):
    global F
    if n not in F:
        F[n] = fib(n-1)+fib(n-2)
    return F[n]

F = {0:1,1:1}
print(fib(int(input())))

Python: a=[0]*100
a[0]=1
a[1]=1
a[2]=1
def fib(n):
    if a[n]!=0:
        return(a[n])
    elif a[n]==0:
        a[n]=(fib(n-1)+fib(n-2))
        return(a[n])
x=int(input())
print(fib(x+1))

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

    print(F[n])

Python: import sys
input = sys.stdin.readline

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

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

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

if __name__ == '__main__':
    main()