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
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int fib(int);

int main(void){
    int n;
    cout << fib(n) << endl;

    return 0;
}

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

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

const int NIL = -1;
const int MAX = 2000001;

int main(void)
{
	int n;
	int F[45];
	F[0] = F[1] = 1;
	cin >> n;
	for (int i = 2; i <= n; i++)
		F[i] = F[i - 1] + F[i - 2];
	cout << F[n] << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int sol(int x){
    int a=1,b=1;
    for(int i=0;i<x;i++){
        int tmp=a;
        a=a+b;
        b=tmp;
    }
    return b;
}

int main(){
    int n;
    long long s;
    scanf("%d",&n);
    s=sol(n);
    printf("%d\n",s);
    return 0;
}

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

int main() {

    int F[44];

    int n;

    cin >> n;

    F[0] = 1;
    F[1] = 1;
    for(int i = 2; i <= n; i++) {
        F[i] = F[i-1] + F[i-2];
        //cout << "n = " << i << " " << F[i] << endl;
    }

    cout << F[n] << endl;

    return 0;
}

C++: #include <vector>
#include <iostream>
#include <algorithm>

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

C++: #include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  for(int i=1;i<44;++i){
    A[i] =A[i-1];
    if(i>1)A[i]+=A[i-2];
  }
  return A[n-1];

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

vector<ll> table(100, -1);
ll fibo(ll n) {
  if (n <= 1) return 1;
  if (table[n] != -1) return table[n];
  return table[n] = fibo(n - 1) + fibo(n - 2);
}

int main() {
  ll input(n);
  cout << fibo(n) << endl;
}

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

int main() {
	int n[1000000], s, i;
	n[0] = 0;
	n[1] = 0;
	n[2] = 1;

	cin >> s;

	for (i = 0; i < s; i++) {
		n[3 + i] = n[i] + n[i + 1] + n[i + 2];
	}

	cout << n[s - 1] << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;


int fibonacci(int n)
{
	int preFib = 1;
	int prepreFib = 1;
	int fib;

	if (n <= 1) {
		return 1;
	}

	for (int i = 2; i <= n; i++) {
		fib = preFib + prepreFib;
		prepreFib = preFib;
		preFib = fib;
	}

	return fib;

}

int main(void)
{
	int n;
	cin >> n;
	cout << fibonacci(n);

	return 0;
}

C++: #include <stdio.h>

fi(int a) {
  return (a == 0 || a == 1) ? 1 : fi(a - 1) + fi(a - 2);
}

int main(void) {
  int n;
  scanf("%d", &n);
  printf("%d\n", fi(n));
  return 0;
}

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

int Fib(int n){
	double phi = (1+sqrt(5))/2;
	return floor(pow(phi,n)/sqrt(5) + 0.5 );
}

int main() {
	int n;
	
	while(cin>>n){
		cout<<Fib(n+1)<<endl;
	}
	
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main() {
    int n, dp[50];
    cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    FOR(i, 2, n + 1) dp[i] = dp[i - 1] + dp[i - 2];
    cout << dp[n] << endl;
    return 0;
}