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>
#define MAX_N 45
int F[MAX_N];

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

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

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

int main() {

  int n;
  cin>>n;

  int a[n+1];
  a[0] = 1;
  a[1] = 1;

  for(int i = 2; i <= n; i++) {
    a[i] = a[i-1] + a[i-2];
  }

  cout<<a[n]<<endl;
  
  return 0;
}

C++: //
// Created by 李青坪 on 2018/10/28.
//

#include <cstdio>
#include <algorithm>
#define MAXN 44
#define NIL -1
using namespace std;

int value[MAXN];

int fibonacci(int n){
    if (n == 0 || n == 1) {
        value[n] = 1;
        return 1;
    }
    if (value[n-1] != NIL && value[n-2] != NIL){
        return value[n-1] + value[n-2];
    }
    if (value[n-1] != NIL && value[n-2] == NIL){
        return value[n-1] + fibonacci(n-2);
    }
    if (value[n-1] == NIL && value[n-2] != NIL){
        return fibonacci(n-1) + value[n-2];
    }
    return fibonacci(n-1) + fibonacci(n-2);
}

int main(){
    fill(value, value+MAXN, NIL);
    int n;
    scanf("%d", &n);
    printf("%d\n", fibonacci(n));
}

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

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

    printf("%d\n", result);

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 0;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scanf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include <bits/stdc++.h>
using namespace std;
void fib(int *a, int n)
{
    a[0] = 1;
    a[1] = 1;
    for (int i = 2; i <= n; ++i)
    {
        a[i] = a[i - 2] + a[i - 1];
    }
}
int main()
{
    int n;
    cin >> n;
    int a[n + 1] = {};
    fib(a, n);
    cout << a[n] << endl;
}

C++: #include <cstdio>

int main()
{
	int f[50]= {1, 1, 2};
	int n;
	scanf("%d", &n) ;
	for (int i = 3; i <= n; ++i)
		f[i] = f[i-1] + f[i-2];
	printf("%d\n", f[n]);
	
	return 0;
}

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

int main(){
  int fibo[MAX];
  int n;
  fibo[0] = fibo[1] = 1;
  for(int i = 2; i < MAX; i++)
    fibo[i] = fibo[i-1] + fibo[i-2];

  cin >> n;
  cout << fibo[n] << endl;
}

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

int main(){
  int dp[51];
  int num;
  cin>>num;
  dp[0]=1;
  dp[1]=1;
  for(int i=2;i<=num;i++) dp[i]=dp[i-1]+dp[i-2];
  cout<<dp[num]<<endl;
 return 0;
}

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

vector<int> fibonatti;
int dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  for (int i = 0; i < n; i++) {
    std::cout << dp[i] << " ";
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)

int f[45];

void FibonacciInit(){

    f[0] = 1;
    f[1] = 1;
    for(int i=2; i<=44; i++){
        f[i] = f[i-1] + f[i-2];
    }
}

int main() {

    int n;
    cin >> n;

    FibonacciInit();

    cout << f[n] << endl;

    return 0;
}

C++: #include <iostream>

using namespace std;


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

}

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

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

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

  return 0;
}

C++: #include <stdio.h>

int fibonacci(int);
int F[45];

int main(){
  int n;

  scanf("%d",&n);
  printf("%d\n",fibonacci(n));

  return 0;
}

int fibonacci(int n){
  int i;

  for(i=0;i<45;i++) F[i]=-1;
  
  if(n==0||n==1) return F[n]=1;
  if(F[n]!=-1) return F[n];
  return F[n]=fibonacci(n-2)+fibonacci(n-1);
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int dp[50];

int main(){
  int n;cin>>n;
  dp[0]=1;
  dp[1]=1;
  rep1(i, n){
    dp[i+1] = dp[i-1]+dp[i];
  }

  cout<<dp[n]<<endl;

  return 0;
}