Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n+1)
	a[0] = 1
	a[1] = 1
	for i := 2; i <= n; i++ {
		a[i] = a[i-1] + a[i-2]
	}
	fmt.Println(a[n])
}

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

C++: #include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<vin> vvin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
const int MOD=1e9+7;

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

C++: /**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>
#include<bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n"
using namespace std;
using ll=long long;
using ld=long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void bl(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void bl2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) {
            for (auto vvv : vv) cout << vvv << " ";
            cout << endl;
        }
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class a {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        if(n == 0 || n == 1) {
            out << 1 << enl;
            return;
        }
        vi dp(n+1, 0);
        dp[0] = dp[1] = 1;
        for(int i=1; i<n; i++){
            dp[i+1] = dp[i] + dp[i-1];
        }
//
//        debug.vd(dp);

        out << dp[n] << enl;
	}
};


int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	a solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

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

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

int main(int argc, char const *argv[])
{
  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] ;

  return 0;
}