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: dp = [None for _ in range(50)]

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

n = int(input())
print(fib(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] = F[n-1] + F[n-2]
  return F[n]

n = int(input())
for i in range(n+1):
  result = fib(i)
print(result)

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: # -*- coding: utf-8 -*-
import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: print('Yes' if b else 'No')
YESNO=lambda b: print('YES' if b else 'NO')

def main():
    @lru_cache()
    def fib(n):
        if n==0 or n==1:
            return 1
        return fib(n-1)+fib(n-2)
    print(fib(int(input())))
        

if __name__ == '__main__':
    main()

Python: n = int(input())
dp = [1] * (50)
for i in range(n):
    dp[i + 2] = dp[i + 1] + dp[i]

print(dp[n])

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

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

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

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

Python: n=int(input())

L=[0]*(n+1)
L[0]=1
L[1]=1

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

print(L[n])

Python: 


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

F = [-1] * 50
print(fibonacci(int(input())))

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: n = int(input())
  
def fibonacci(n):
  if n <= 1:
    dp[n] = 1
    return 1
  if dp[n] != -1:
    return dp[n]
  else:
    dp[n] = fibonacci(n-1)+fibonacci(n-2)
    return dp[n]
dp = [-1]*(n+1)
fibonacci(n)
print(dp[-1])

Python: def fib(n):
    l = [0] * (n+1)
    l[0] = 1
    l[1] = 1
    for i in range(2,n+1):
        l[i] = l[i-2] + l[i-1]
    return l[i]

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

Python: n = int(input())
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: 

def main():
    n = int(input())
    dp = [0] * 100
    dp[0] = 1
    dp[1] = 1
    for i in range(2, len(dp)):
        dp[i] = dp[i - 1] + dp[i - 2]
    print(dp[n])


if __name__ == '__main__':
    main()

Python: a = int(input())
f1 = int(2)
f2 = int(1)
f = int(1)
if a == 1:
  print("1")
elif a == 2:
  print("2")
else:
  for b in range(2,a):
    f= f1+f2
    f2 = f1
    f1 = f
  print(f)

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