Go: package main

import "fmt"

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

	x, y := int64(1), int64(1)

	for i := 0; i < n; i++ {
		x, y = y, x+y
	}

	fmt.Println(x)
}

C++: #include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
// 0 -> 1
// 1 -> 1
// 2 -> 2
// 3 -> 3
int main() {
  int n;
  int dp[44] = {};
  cin >> n;
  dp[1] = dp[0] = 1;

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

C++: #include "bits/stdc++.h"
using namespace std;
int d;
int dd[50];
int fib(int a){
	if(a==0||a==1)return dd[a]=1;
	if(dd[a]!=-1)return dd[a];
	return fib(a-1)+fib(a-2);
}

int main() {
int c;
cin>>c;
for (int i = 0; i < 50; ++i) {
	dd[i]=-1;
}

cout<<fib(c)<<endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int fib(int n) {
    int a = 1;
    int b = 1;

    for (int i = 0; i < n-1; ++i) {
        int tmp = a;
        a = b;
        b += tmp;
    }
    return b;
}

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

    cout << fib(n) << endl;

    return 0;
}

C++: #include <stdio.h>

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

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

constexpr int dx[4] = {1, -1, 0, 0};
constexpr int dy[4] = {0, 0, 1, -1};

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

    int n;
    cin >> n;
    vector<ll> dp(n + 1, -1);
    auto MemoRec = [&](auto&& self, int N) -> ll {
        if(dp[N] != -1) return dp[N];
        if(N <= 1)  return dp[N] = 1;
        return dp[N] = self(self, N - 1) + self(self, N - 2);
    };
    cout << MemoRec(MemoRec, n) << endl;
}

C++: #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    *t++;
    while(t != V.end()) {
        cout << " " << *t++;
        // if(t != V.end()) cout << " ";
    }
    cout << endl;
};

ll fib[100] = {0};
ll solve(int i) {
    if(fib[i] > 0) return fib[i];
    if(i < 2) return 1;
    return fib[i] = solve(i - 1) + solve(i - 2);
}

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

    int n;
    cin >> n;
    cout << solve(n) << endl;
}

C++: /*
** 斐波那契数列 使用动态规划来避免重复的计算
*/

# include <cstdio>
# include <cstring>

const int MAX = 44 + 5;

int n, dp[MAX];

int fib(int i) {
    if (dp[i] != 0) {
        return dp[i];
    }
    if (i <= 1) {
        return 1;
    }
    dp[i] = fib(i - 1) + fib(i - 2);
    return dp[i];
}

void solve() {
    scanf("%d", &n);
    memset(dp, 0, sizeof(dp));
    printf("%d\n", fib(n));
}

int main() {
    // freopen("infile", "r", stdin);
    // freopen("outfile", "w", stdout);
    solve();
    return 0;
}

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

long long f[10000000];

long long fib(int n)
{
  if (n == 0 || n == 1) return (1);
  if (f[n] != 0)  return (f[n]);
  else {
    f[n] = fib(n - 1) + fib(n - 2);
  }
  return f[n];
}
int main()
{
  int n;
  cin >> n;
  cout << fib(n) << endl;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}



int fib(int i, vector<int> &dp){
    if(dp[i] != -1) return dp[i];
    if(i == 0) return dp[i] = 1;//dpにメモしながら返す
    if(i == 1) return dp[i] = 1;
    return dp[i] = fib(i-1, dp) + fib(i-2, dp);

}
int main(){//
   int n;
   cin >> n;
   vector<int> dp(n+5, -1);

   cout << fib(n, dp) << endl;


}

C++: #include <iostream>

long long int Fibo(long long int n)
{
    if(n == 0 || n == 1) return 1;
    return Fibo(n-1) + Fibo(n-2);
}
int main(){
    long long int n;
    std::cin >> n;
    std::cout << Fibo(n) << std::endl;
    return 0;
}

C++: #include <iostream>
#include <cstdlib>
#define MAX 50
using namespace std;

void fib(int n){
  int a[MAX];
  for(int i=0;i<MAX;i++) a[i]=1;
  for(int i=2;i<=n;i++){        
    a[i]=a[i-1]+a[i-2];
  }  cout << a[n] << endl;
}

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

C++: #include <cstdio>

int fibo(int n, int *dp) {
    if (n == 0 || n == 1) return 1;
    if (0 < dp[n]) return dp[n];
    return dp[n] = fibo(n-1, dp) + fibo(n-2, dp);
}

int
main ()
{
    int n;
    int dp[50];
    for (int i=0; i<50; i++) dp[i] = -1;
    scanf("%d", &n);
    printf("%d\n", fibo(n, dp));
    return 0;
}

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

int f[50];

int fibo(int n)
{
  if(n <= 1) return 1;
  else{
    if(f[n]){
      return f[n];
    }
    else{
      return f[n] = fibo(n-1)+fibo(n-2);
    }
  }
}

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

  cout << fibo(n) << endl;
  return 0;
}

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

int arr[46];

int fib(int n)
{
    if(n==1 || n==0)
    {
        return arr[n];
    }
    if(arr[n]!=-1)
        return arr[n];

    else
        arr[n]=fib(n-1)+fib(n-2);
    return arr[n];

}


int main()
{
    arr[0]=1;
    arr[1]=1;

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


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




    return 0;
}

C++: #if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int F[100];

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