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;

long dp[50];

long fib(long n) {
    if (n == 0 || n == 1) {
        dp[n] = 1;
    }
    if (dp[n] != -1) {
        return dp[n];
    }
    return dp[n] = fib(n - 1) + fib(n - 2);
}

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

    for (long i = 0; i < 50; i++) {
        dp[i] = -1;
    }

    cout << fib(n) << endl;
}

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

vector<int> fibonacci_list(45,0);

int fibonacci(int n){
    int f;
    if(fibonacci_list.at(n)!=0){
        f=fibonacci_list.at(n);
    }else{
        f=fibonacci(n-1)+fibonacci(n-2);
        fibonacci_list.at(n)=f;
    }
    return f;
}

int main(){
    fibonacci_list.at(0)=1;
    fibonacci_list.at(1)=1;
    int n;
    cin >> n;
    cout << fibonacci(n) << endl;
    return 0;
}

C++: #include <iostream>

int dp[50];

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

  return dp[n] = fib(n-1) + fib(n-2);
}

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

  for(int i=0; i<50; ++i) {
    dp[i] = -1;
  }
  dp[0] = 1;
  dp[1] = 1;

  int fb = fib(n);
  std::cout << fb << std::endl;

}

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

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

int main(){
    int a;
    cin>>a;
    cout<<fib(a)<<endl;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<math.h>
#include<stdlib.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

int N, fib[50];

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


    return 0;
}

/*

*/

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

#define REP( i, n) for( int i = 0; i < (n); ++i)
#define FOR( i, a, b) for( int i = (a); i < (b); ++i)

#define pb push_back

const int INF = 100100100;
const int MOD = (int)1e9 + 7;

using ll = long long;

using namespace std;

ll f( int n){
  if( n == 0) return 1;
  if( n == 1) return 1;

  return f(n-1)+f(n-2);
}

int main(){

  int x;
  

  cin >> x;
  cout << f(x) << endl;

}

C++: #include<iostream>
long dp[50];
int fib(int n){
	if (n == 0 || n == 1)
		return 1;
	else{
		if (dp[n]==0)
		    return (dp[n] = fib(n - 1) + fib(n - 2));
		else return dp[n];
	}
}
int main(){
	int n;
	std::cin >> n;
		std::cout << fib(n) << "\n";
}

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

const int MAX = 44;
int F[MAX];

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


int main() {
    ios::sync_with_stdio(false);

    F[0] = F[1] = 1;
    for(int i=2; i<MAX; i++) F[i] = -1;

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

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

int F[50];

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

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

int n, arr[100000];

int solve(int n) {
	arr[0]=arr[1]=1;
	for (int i = 2; i <= n; i++) arr[i] = arr[i-2]+arr[i-1];
	return arr[n];
}

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

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

int dp[44];

int fib(int n) {
	if (dp[n] != -1)return dp[n];
	int res;

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

	dp[n] = res;
	return res;
}

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

	return 0;
}

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

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

C++: //#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;
const ll MOD=1000000007LL;
int main(){
  int n;
  cin>>n;
  int fib[100];
  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 <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ O(logN)
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//


int main() {

    int n; cin >> n;

    ll dp[45];
    dp[0] = dp[1] = 1;
    for (int i = 2; i <= 44; ++i) dp[i] = dp[i-1] + dp[i-2];
    out(dp[n]);

    return 0;
}

C++: #inclue<stdio>
#include<stream>
using namespace std;

int fibo(int x) {
  int a;
  if ( x == 0 ) return 1;
  if ( x == 1 ) return 1;
  a = fibo(x-1) + fibo(x-2);
  return a;
}

int main() {
  int x, y;

  cin >> x;

  y = fibo(x);

  cout << y << endl;

  return 0;
}

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

C++: // ALDS1_10_A Fibonacci Number
#include <iostream>
#include <vector>
bool debug = false;

std::vector<int> dp_array;

int main() {
    int target; std::cin >> target;

    dp_array.push_back(1); // i == 0
    dp_array.push_back(1); // i == 1
    for (int i=2; i<=target; i++) {
        dp_array.push_back(dp_array.at(i-1)+dp_array.at(i-2));
    }

    std::cout << dp_array.back() << "\n";
}

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

int main()
{
	int n;
	std::cin >> n;
	std::vector<int> dp(n + 1, 0);
	dp[1] = 1;
	dp[0] = 1;
	for (int i = 2; i < n + 1; i++)
	{
		dp[i] = dp[i - 1] + dp[i - 2];
	}
	std::cout << dp[n] << '\n';
	return 0;
}

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

#define MAX 50
#define NIL -1

int F[MAX];

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

    return F[n] = fib(n-1) + fib(n-2);
}

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

    rep(i,MAX) F[i] = NIL;

    cout << fib(n) << endl;

    return 0;
}