Go: package main

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

func fib(n int) int {
	x, y := 1, 1
	for n > 0 {
		x, y = y, x+y
		n--
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fib(n))
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}

Python: n = int(input())

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

print(fib(n))

Python: import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

n = int(input())
dp = [0]*(1000001)
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: _fib = [None] * 44
_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: _fib = [1, 1]

def fib(n):
    if len(_fib) > n:
        return _fib[n]
    else:
        _fib[n] = fib(n-1) + fib(n-2)
        return _fib[n]

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

Python: n = int(input())
dp = {}
def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    if n in dp:
        return dp[n]
    dp[n] = fibonacci(n-1) + fibonacci(n-2)
    return dp[n]
print(fibonacci(n))

Python: n=int(input())
if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    p=n+1 
    a=((1+5**(1/2))/2)**p
    b=((1-5**(1/2))/2)**p
    c=1/(5**(1/2))
    print(int(c*(a-b)))

Python: a = int(input())

memo = [0]*100000

def  fib(n):

    if n == 0 or n ==  1:
        memo[n] =1

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



print(fib(a))

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

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())
f = [1,1]
for i in range(n-1):
    fib = f[-1] + f[-2]
    f.append(fib)
print(f[n])

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: n = int(input())
dp = [1, 1]
if n >1:
  for i in range(2, n + 1):
    dp.append(dp[i - 1] + dp[i - 2])
print(dp[n])

Python: #!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def fib_bad(n):
    if not n or n == 1:
        return 1
    return fib_bad(n - 2) + fib_bad(n - 1)


def fib_dp(n):
    fib_list[:1] = [1, 1]
    for i in range(2, n + 1):
        fib_list[i] = fib_list[i - 2] + fib_list[i - 1]
    return fib_list.pop()


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    index = int(_input[0])
    fib_list = [None] * index
    # print(fib_bad(index))
    print(fib_dp(index))

C++: #include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

long *memo;
long fib(long n){
	if(n < 2) return 1;
	return memo[n] != -1 ? memo[n] : (memo[n] = fib(n-1) + fib(n-2));
}

int main() {
	memo = new long[64];
	for(int i = 0; i < 64; i++){
		memo[i] = -1;
	}
	
	long n;
	cin >> n;
	cout << fib(n) << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int num[47];

int fib(int n){
  if(num[n]!=0)return num[n];
  else return num[n] = fib(n-1) + fib(n-2);
}

int main(){
  int n;
  cin >> n;
  num[0] = 1;
  num[1] = 1;
  n = fib(n);
  cout << n << endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int fibary[50];
    int n;
    cin >> n ;
    fibary[0]=fibary[1]=1;
    for(int i=2;i<=n;i++) {
        fibary[i]=fibary[i-1]+fibary[i-2];
    }
    cout << fibary[n] << endl;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

/*int main(){
    int n;cin >> n;
    if(n==0||n==1) {cout << 1 << endl;return 0;}
    vector<int> fb(n+1);
    fb[0] = 1;
    fb[1] = 1;
    for(int i=2;i<=n;i++){
        fb[i] = fb[i-1]+fb[i-2];
    }
    cout << fb[n] << endl;
    return 0;
}*/

int main(){
    int n;cin >> n;
    int a = 1;
    int b = 1;
    int c=0;
    if(n==1||n==0) {cout << 1 << endl;return 0;}
    for(int i=0;i<n-1;i++){
        c = a+b;
        a = b;
        b = c;
    }
    cout << c << endl;
}

C++: #include <iostream>
using namespace std;
int fib(int n,int num1,int num2);
int main(void)
{
	int n;
	cin >> n;
	cout << fib(n,1,0) << endl;
	return 0;
}
int fib(int n,int num1,int num2)
{
	if(n<2) return num1+num2;
	return fib(n-1,num1+num2,num1);
}

C++: #include <iostream>
using namespace std;

int main(){
	int n,fib[45] = {1,1};
	cin >> n;
	for(int i = 2; i <= n; i++)
		fib[i] = fib[i - 1] + fib[i - 2];
	cout << fib[n];
	cout << endl;
}

C++: #include <iostream>
using namespace std;

int main(){
    int n; cin >> n;
    long long arr[45] = {1,1};
    if (n == 1 || n == 0) cout << 1 << endl;
    else {
        for(int i = 2; i <= n; ++i){
            arr[i] = arr[i-1] + arr[i-2];
        }
        cout << arr[n] << endl;
    }
    
    return 0;
}

C++: void fibonacci_1(const int count , int data[]) {
	data[0] = 1;
	if(count == 1) return;
	data[1] = 1;
	
	for( int i = 2; i < count ; i++) {
		data[i] = data[i-1]+data[i-2];
	}
}

C++: #include <iostream>
using namespace std;

long fib(int n){
    if(n==0 || n==1) return 1;
    return fib(n-1)+fib(n-2);
}

int main(void){
    int n;
    cin>>n;
    cout<<fib(n)<<endl;
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define MAX 44
#define NIL
using namespace std;

int main() {
	int n;
	cin >> n;
	int fib[MAX + 1];
	fib[0] = 1, fib[1] = 1;
	for (int i = 0; i <= n - 2; i++)
		fib[i + 2] = fib[i + 1] + fib[i];
	cout << fib[n] << endl;
}

C++: #include <bits/stdc++.h>

#define REP( i, n) for( int i = 0; i < (n); ++i)
#define FOR( i, a, b) for( int i = (a); i < (b); ++i)

#define pb push_back

const int INF = 100100100;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

int dp[44];

ll f( int n){

  if( dp[n] ) return dp[n];
  else dp[n] = f(n-1)+f(n-2);
  
  return dp[n];
}

int main(){

  int x;
  REP( i, 44){
    dp[i] = 0;
  }

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

  cin >> x;
  cout << f(x) << endl;

}