Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: #include <iostream>

using namespace std;

int memo[100];

int fibonacci(int n) {
    if (memo[n] == -1) {
        return memo[n];
    }
    if (n == 0) { return 0; }
    if (n == 1) { return 1; }
    memo[n] = fibonacci(n - 1) + fibonacci(n - 2);
    return memo[n];
}

int main() {
    int n;
    cin >> n;
    fill(memo, memo + n, -1);
    cout << fibonacci(n) << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


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++: #define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 1e18;
using namespace std;

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

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

C++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<vector>

using namespace std;

#define LL long long

LL n,fib[50];

int main() {
	cin>>n;
	for(int i=0;i<=n;i++){
		if(i==0||i==1)fib[i]=1;
		else fib[i]=fib[i-1]+fib[i-2];
	}
	cout<<fib[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] << endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
typedef long long int ll;
ll Dp[50];
int main()
{
for(int i=2;i<50;i++)Dp[i]=Dp[i-1]+Dp[i-2];
int N;
cin >> N;
cout << Dp[N] << "\n";

return 0;
}

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

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

C++: #include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

int n,a[55];

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

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
//using ll = long long;
//using P = pair<int, int>;
 
int fib[50];

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

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

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

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

int main() {
  int N; cin >> N;
  int dp[45];
  dp[0] = dp[1] = 1;
  rep(i, 1, N) dp[i + 1] = dp[i] + dp[i - 1];
  cout << dp[N] << endl;
  return 0;
}

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

//短縮
#define rep(i,n) for(int i=0;i<(n);++i)
//sort()用
#define all(v) v.begin(), v.end()

using namespace std;

using Graph = vector<vector<int>>;

int main(){
  int n;
  cin >> n;
  int n1=1,n2=1;
  vector<int> fib(n+1);
  fib.at(0)=1;
  fib.at(1)=1;
  for(int i=2;i<=n;i++){
    fib.at(i)=fib.at(i-1)+fib.at(i-2);
  }
  cout << fib.at(n)<< endl;
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int f[45] = {};

int fib(int i)
{
    if (f[i] > 0)
        return f[i];

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

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

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

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

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A
// Dynamic Programming - Fibonacci Number

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 44;
int dp[MAX_N + 1];

int main() {
    // initialize
    memset(dp, 0, sizeof(dp));
    dp[0] = 1, dp[1] = 1;

    for (int i = 2; i <= MAX_N; ++i) dp[i] = dp[i - 1] + dp[i - 2];

    int n;
    cin >> n;

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

C++: #include<iostream>

using namespace std;
int fib(int n);

int memo[45];
int main(){
  int n;
  cin >> n;
  cout << fib(n) << endl;
  retrun 0;
}

int bib(int n){

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

  }

C++: #include <iostream>
#include <unordered_map>
using namespace std;
int fib(int);
unordered_map<int, int> memoFib;

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

int fib(int n) {
  if(memoFib.count(n)) return memoFib[n];
  int a;
  a = memoFib[n] = n == 0 || n == 1 ? 1 : fib(n - 1) + fib(n - 2);
  return a;
}