Go: package main

import "fmt"

func fibonacci() func() int {
	x, y := 0, 1
	return func() int {
		x, y = y, x+y
		return x
	}
}
func main() {
	var n int

	fmt.Scan(&n)
	f := fibonacci()
	for i := 0; i < n; i++ {
		f()
	}
	fmt.Println(f())
}

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

vector<long long int> fibonatti;
long long int  dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n + 1);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int dp[50];
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<=n;i++)dp[i]=dp[i-1]+dp[i-2];
    cout<<dp[n]<<endl;
}

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

int main()
{
	int n, a[50];
	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] << endl;
}

C++: #include <iostream>
#include <vector>
#include <cstdio>
// #include <cstdint>

using namespace std;

static vector<int> M(44, 0);

static inline int fibonacci(int n) {
  if (n == 0 || n == 1) {
    return 1;
  } 

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

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

C++: #include <iostream>

using namespace std;

int i = 1;
int sum = 1;
int num[2] = {1, 1};
int l = 0;
int fib(int n)
{
  if (i == n) return sum;
  sum += num[l];
  num[l] = sum;
  l = 1 - l;

  if (i != n) {
   i++;
   return fib(n);
  }
}

int main()
{
  int n;
  cin >> n;
  
  if (n == 0) cout << 1 << endl;
  else cout << fib(n) << endl;

  return 0;
}

C++: #include <stdio.h>
#define N 100
#define M -1
int fib(int);

int array[N];
int main()
{
  int i,n;
  scanf("%d",&n);
  for(i=0;i<N;i++)
    {
      array[i]=M;
    }
  printf("%d\n",fib(n));
}

int fib(int x)
{
  if(x==0||x==1)
    {
      return array[x]=1;
    }
  if(array[x]!=M) return array[x];
  else
    {
     return  array[x]=fib(x-2)+fib(x-1);
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const long long INF=1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define nyan "(=^･ω･^=)"
using namespace std;

const int mod = 1e9 + 7;
const long long INF = 1LL<<60;
//using ll = long long;
//using P = pair<int,int>;

long long dp[50];

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

int main(){
    int n;
    cin >> n;
    
    dp[0] = 1, dp[1] = 1;
    
    cout << fibonacci(n) << endl;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
//#include <cmath>
//#include <iomanip>
//#include <map>
//#include <unordered_map>
//#include <cstring>
#include <queue>

using namespace std;
using ll = long long;
// using pint = pair<int, int>;
// ll INF = 1LL << 60;

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

C++: # include <iostream>
using namespace std;
int main(void)
{
	int a[50] = {1,1},n;
	for(int i = 2;i < 50;i++) a[i] = a[i-1]+a[i-2];
	cin>>n; cout<<a[n]<<endl;
	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

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 <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

int f(const int);

int main()
{
    int N;
    cin>>N;
    cout<<f(d)<<endl;
}
int f(const int d)
{
    if(d<2)return 1;
    return f(d-1)+f(d-2);
}

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

using namespace std;

vector<int>dp;

int fib_dp(int n) {
    if (dp[n] != -1) return dp[n];
    dp[n] = fib_dp(n-1) + fib_dp(n-2);
    return dp[n];
}

int main() {
    int n;
    cin >> n;
    dp.resize(n+1);
    for (int i = 0; i <= n; ++i) dp[i] = -1;
    dp[0] = 1;
    dp[1] = 1;
    cout << fib_dp(n) << endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int f[50] = {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;

vector<int> F(45, -1);
int fib(int n) {
  if (F[n] != -1)
    return F[n];
  else if (n == 1 || n == 0) {
    F[n] = 1;
  } 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 int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int fib[45];

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

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

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

int main(){

  int n;
  cin >> n;

  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;


}

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

int Fibonacci(int n) {
    int F[45];
    F[0] = 1;
    F[1] = 1;
    for(int i = 2; i <= n; i++) {
        F[i] = F[i-1] + F[i-2];
    }
    return F[n];
}

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

C++: #include <iostream>

using namespace std;

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

    int i = 0;
    while (i < n) {
        a = b;
        b = a + b;
        ++i;
    }
    return a;
}

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

    cout << fib(n) << endl;

    return 0;
}

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

int main()
{
int n;cin>>n;//scanf("%d",&n);
int fib[n+1];//vector<int> fib(n+1,1);
for(int i=0;i<n+2;i++)fib[i]=1;
if(n>1){for(int i=2;i<n+2;i++){fib[i]=fib[i-2]+fib[i-1];}}
cout<<fib[n]<<endl;//printf("%d\n",fib[n]);
}