Go: package main

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

// main
func main() {
	//testFunction()
	solve(bufio.NewScanner(os.Stdin))
}

// test
func testFunction() {
	input := `
3
`
	sc := bufio.NewScanner(strings.NewReader(strings.Trim(input, "\n")))
	solve(sc)
}



func fib(n int, dp map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
		if v, ok := dp[n]; ok {
		return v
	}
	r := fib(n - 1, dp) + fib(n - 2, dp)
	dp[n] = r
	return r
}

// solve
func solve(sc *bufio.Scanner) {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	dp := make(map[int]int)
	r := fib(n, dp)
	fmt.Println(r)
}

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

int main()
{
	int n;
	cin >> n;

	int F[50];

	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;
}

C++: #include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<string, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    vector<ll> res(50);
    res[0] = res[1] = 1;
    for (int i = 2; i <= 44; i++)
        res[i] = res[i - 1] + res[i - 2];
    int n;
    cin >> n;
    cout << res[n] << endl;
}

C++: #include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  A[1] =2;
  for(int i=2;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>
using namespace std;

int fibonacci(int n){
	if(n==0) return 1; //たぶん本当はフィボナッチ数列はf(0)=0 だと思うのだが、問題文がそうなっていたので１を返す。
	else if(n==1) return 1;
	else return fibonacci(n-2) + fibonacci(n-1);
}

int fibonacci_dp(int n){
	int i;
	int fib[45];

	fib[0]=1;
	fib[1]=1;

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

int main() {
	int n;

	cin >> n;
	//cout << fibonacci(n) << endl;
	cout << fibonacci_dp(n) << endl;

	return 0;
}

C++: #include <iostream> 

using namespace std;
int main()
{
	int f[100];
	int n;
	cin >> n;
	f[0] = 1;
	f[1] = 1;
	for(int i = 0; i < n; i++)
	{
		f[i+2] = f[i+1] + f[i];
	}
	cout << f[n] << endl;
    return 0;
}

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

std::pair<int, int> FibonacciPair(int Index)
{
	if(Index == 0) return std::make_pair(0, 1);
	if(Index == 1) return std::make_pair(1, 1);
	std::pair<int, int> Prev = FibonacciPair(Index - 1);
	return std::make_pair(Prev.second, Prev.first + Prev.second);
}

int FibonacciNumber(int Index)
{
	return FibonacciPair(Index).second;
}

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

C++: #include <iostream>

int fib(int, int[]);

int main()
{
	int n;
	const int size = 44;
	int memo[size + 1];

	for (int i = 0; i < size + 1; i++)
	{
		memo[i] = -1;
	}

	std::cin >> n;

	std::cout << fib(n, memo) << std::endl;

	return 0;
}

int fib(int n, int memo[])
{
	int ans;

	if (n == 0 || n == 1) {
		return 1;
	}
	else {
		if (memo[n] != -1) {
			return memo[n];
		}
		else {
			ans = fib(n - 1, memo) + fib(n - 2, memo);
			memo[n] = ans;
		}
	}

	return ans;
}

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

int fib(int n){
  int n1,n2,t;
  n1 = n2 = t = 1;
  for(int i = 1;i < n;i++){
    t = n1 + n2;
    n1 = n2;
    n2 = t;
  }

  return t;
}

int main(){
  int n;

  cin >> n;
  cout << fib(n) << endl;

  return 0;
}

C++: #include<stdio.h>
 
#define Max 45
 
int F[Max];
 
int fibonacci(int n){
  if( n == 0 || n == 1)
    return F[n] = 1;
  if( F[n] != NULL ) 
    return F[n];
  return F[n] = fibonacci(n - 2) + fibonacci(n - 1);
}
 
int main(){
 
  int n, i, A;
 
  scanf("%d",&n);
 
  for( i = 0 ; i <= n  ; i++)
    A = fibonacci(i);
 
  printf("%d\n",A);
 
  return 0;
}

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<iostream>
using namespace std;
int main() {
	long long l[44];
	l[0] = 1;
	l[1] = 1;
	for (int i = 2; i < 44; i++)
	{
		l[i] = l[i - 2] + l[i - 1];
	}
	int n;
	cin >> n;
	cout << l[n] << endl;
	char c;
	cin >> c;
}

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

int dp[50];

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

C++: #include <cstdio>
#define NMAX 45

int main() {
    int n;
    scanf("%d", &n);

    if (n == 0 || n == 1) {
        printf("1\n");
    } else {
        int fib[NMAX];
        fib[0] = fib[1] = 1;
        for (int i = 2; i < NMAX; i++) {
            fib[i] = fib[i-1] + fib[i-2];
            if (i == n) {
                printf("%d\n", fib[i]);
                break;
            }
        }
    }
    return 0;
}

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

int fib(int n);

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

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

C++: #include <iostream>
using ll = long long;
using namespace std;
#define MAX 50
/* initialize */
int fibs[MAX];

/* main */
int main() {

    int n;
    cin >> n;
    fibs[0]=fibs[1] = 1;
    for (int i = 2; i <= n; i++) {
        fibs[i] = fibs[i-1] + fibs[i-2];
    }
    cout << fibs[n] << "\n";
    return 0;
}

C++: #include <iostream>
#include <sys/time.h>
using namespace std;

int memo[100] = {0};

int fibo(int n){//メモ化再帰を用いて再計算を防ぎ、再帰計算速度を上げる
    if(memo[n] != 0) return memo[n];
    if(n == 0 || n == 1) return 1;
    memo[n] = fibo(n - 1) + fibo(n - 2);
    return memo[n];
}

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 50;
int n;
ll f[MAXN];

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

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int n;

int fib(int x, int y, int i){
	if(i == n) return x+y;
	i++;
	fib(y, x+y, i);
}

int main(){
	cin >> n;
	if(n == 1 || n == 0){
		cout << 1 << endl;
		return 0;
	}
	cout << fib(1, 1, 2) << endl;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  long long int fib1,fib2,fib3;
  cin>>n;
  fib1=1;
  fib2=1;
  if(n==0){
    cout<<0<<endl;
  }else if(n==1){
    cout<<1<<endl;
  }else if(n>=2){
    for(int i=0;i<n-1;i++){
      fib3=fib1+fib2;
      fib1=fib2;
      fib2=fib3;
    }
    cout<<fib3<<endl;
  }
}

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

int main() {
  int n; cin >> n;
  int fib[50];
  fib[0] = fib[1] = 1; //初期条件
  //n>=2のとき
  for ( int i = 2; i <= n; i++ ) {
    fib[i] = fib[i-2] + fib[i-1];
  }

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