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>
using namespace std;

#define MAX 44

int F[MAX];

int main() {
    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 << F[n] << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_N = 44;

int n;

int dp[MAX_N];

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

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

const int Max = 50;
int F[Max];

int Fib(int n)
{
    F[0] = 1;
    F[1] = 1;
    if(n==0 || n==1) return F[n];
    if(!F[n-1])
        F[n-1] = Fib(n-1);
    if(!F[n-2])
        F[n-2] = Fib(n-2);
    return F[n-1]+F[n-2];
}
int main()
{
    int n;
    cin >> n;
    memset(F, 0, sizeof(F));
    cout << Fib(n) << endl;
}

C++: #include <iostream>

using namespace std;
int fib(int n){
    int dp[50];
    dp[0] = 1;
    dp[1] = 1;
    for(int i = 2; i < 45; ++i){
        dp[i] = dp[i-1] + dp[i-2];
    }
    return dp[n];
}

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

C++: #include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>

#define MAX 1000000

using namespace std;

int fib[MAX];

int solve(int a){
    if(fib[a])return fib[a];
    if(!fib[a-2])fib[a-2] = solve(a-2);
    if(!fib[a-1])fib[a-1] = solve(a-1);
    return fib[a-1]+fib[a-2];
}

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    fill(fib, fib+MAX, 0);
    fib[0] = 1;
    fib[1] = 1;
    int num; cin >> num;
    cout << solve(num) << endl;
    
    return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    int sum;
    if(n==0){
        sum=1;
    } else if(n==1){
        sum=1;
    } else{
        int older=1, oldest=1;
        sum=0;
        for(int i=2; i<=n; i++){
            sum=older+oldest;
            oldest=older;
            older=sum;
        }
    }
    printf("%d\n", sum);
    return 0;
}

C++: #include <stdlib.h>
#include <stdio.h>

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

int main(){

int x;
scanf("%d",&n);
x=fib(n);
printf("%d",x);

return 0;
}

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
    int n;
    int dp[45];

    //?????????
    /* ??????3-1 */
    dp[0] = dp[1] = 1;
    /* ??????3-2 */

    //??\???
    cin >> n;

    //DP
    for (int i = 2; i <= n; i++) {
        /* ??????3-3 */
      dp[i] = dp[i-1] + dp[i-2];
    }

    //??????
    cout << dp[n] << endl;

    return 0;
}

C++: #include<iostream>
using namespace std;
int nrec(int n){
    int a[44];
    a[0]=a[1]=1;
    for(int i=2;i<=n;i++){
        a[i]=a[i-1]+a[i-2];  
    }
    return a[n];
}

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

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

uint32_t fib(uint32_t n, std::vector<uint32_t>& result) {
  if (n == 0 || n == 1) return 1;
  if (result[n - 1] != 0) return result[n - 1];
  result[n - 1] = fib(n - 1, result) + fib(n - 2, result);
  return result[n - 1];
}

int main() {
  uint32_t n = 0;
  std::cin >> n;

  std::vector<uint32_t> result(n, 0);
  std::cout << fib(n, result) << std::endl;
  return 0;
}

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

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

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

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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

#define MAX 100005
#define INF INT_MAX

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

int main(int, char**)
{
    int n;
    cin >> n;

    vector<int> a(n+1);
    rep(i,n+1) {
        if (i <= 1) {
            a[i] = 1;
            continue;
        }
        a[i] = a[i-1] + a[i-2];
    }
    cout << a[n] << endl;
    return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: #include <stdio.h>

#define N 44

int F[N];
int n;

int  fib(int n){
	if(n==0 || n == 1)
		return 1;

	if(F[n] != 0) return F[n];

	return F[n] = fib(n-1) + fib(n-2);
}

int main(){
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		F[i] = 0;
	}
	fib(n);
	printf("%d\n",F[n]);
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int f[50] = {1, 1};
	for (int i = 2; i <= n; ++i)
	{
		f[i] = f[i - 1] + f[i - 2];
	}

	cout << n << "\t" << f[n] << endl;
}