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 <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
using namespace std;
long long mem[50] = {0};
long long fib(int n){
	if (mem[n] != 0) return mem[n];
	if (n == 0 || n == 1){
		mem[n] = 1;
		return 1;
	}
	else{
		mem[n] = fib(n - 1) + fib(n - 2);
		return fib(n - 1) + fib(n - 2);
	}
}
int main(){
	int n;
	cin >> n;
	cout << fib(n) << "\n";
	return 0;
}

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

C++: // DP(???????¨??????? Dynamic Programing)
// ????????±???????????¢???
// ?????£??????????????°???
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
using namespace std;

#define MAX_N 44

struct memo{
    int num;
    bool flg;
}Memo[MAX_N+1];

int n;
int fib(int);

int main()
{
    cin >> n;
    for(int i=0;i<MAX_N+1;++i)
        Memo[i].flg=false;
    cout << fib(n) << endl;
    return 0;
}

int fib(int m){
    if(m == 0){
        if(!Memo[0].flg){
        Memo[0].num=1;
        Memo[0].flg=true;
        }
        return 1;
    }
    if(m == 1){
        if(!Memo[1].flg){
        Memo[1].num=2;
        Memo[1].flg=true;
        }
        return 1;
    }

    if(Memo[m].flg){
        return Memo[m].num;
    }
    else{
        Memo[m].num=fib(m-1) + fib(m-2);
        Memo[m].flg=true;
        return fib(m-1) + fib(m-2);
    }
}

C++: #include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

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

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

int fib(int n);

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

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

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

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

C++: #include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

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

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

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

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

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

typedef long long hyper

hyper fib(int n)
{
    if(n < 2) return 1;
    if(n == 2) return 2;
    if(n == 3) return 3;
    return 3 * fib(n - 2) + fib(n - 4);
}
 
int main()
{
    int n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

int calc_memo(vi& dp, int n) {
    if (n <= 1) { return 1; }
    if (dp[n] != 0) { return dp[n]; }
    return dp[n] = calc_memo(dp, n - 2) + calc_memo(dp, n - 1);
}

int calc_dp(vi& dp, int n) {
    dp[0] = dp[1] = 1;
    int i = 2;
    while(i <= n) {
        dp[i] = dp[i - 1] + dp[i - 2];
        ++i;
    }
    return dp[i - 1];
}

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

    int n;
    cin >> n;

    vi dp(n + 1, 0);
    cout << calc_dp(dp, n) << endl;

    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]<<"\n";
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int n;
  unsigned long long fib[50];
  
  fib[0] = 1;
  fib[1] = 1;

  cin >> n;

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

  cout << fib[n] << endl;

  return 0;
}

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

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

}

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

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

C++: #include <bits/stdc++.h>
using namespace std;
#define MAX 50
int fibonacci(int);
int F[MAX];

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

int fibonacci(int n){
  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);
}