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 <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

void printM(vector<vector<long> > &vec, long height, long width){
    F(i, 0, height){
        F(j, 0, width){
            cout << vec[i][j] << space;
        }
        cout << endl;
    }
}

#define TST 0
int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    long n;
    cin >> n;
    // dp table has score of the test
    // for convenience, allocate more memory than actually is
    vl dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    FE(i, 2, n){
        dp[i] = dp[i-1]+dp[i-2];
    }
    cout << dp[n] << endl;
#if TST==1

#endif
}

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

int fibonacci(int n){
	if(n==0) return 1; //たぶん本当はフィボナッチ数列はf(0)=0 だと思うのだが、問題文がそうなっていたので１を返す。
	else if(n==1) return 1;
	else return fibonacci(n-2) + fibonacci(n-1);
}

int main() {
	int n;

	cin >> n;
	cout << fibonacci(n) << endl;

	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> dp(N+1, 0);
    dp[0] = 1;
    dp[1] = 1;
    rep2(i, 2, N+1) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

C++: // fibonacci number.
#include<stdio.h>

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

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
#define fprint(NUM,X) cout << fixed << setprecision(NUM) << (X) << endl
#define fprints(NUM,X,Y) cout << fixed << setprecision(NUM) << (X) << " " << (Y) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];
double w[1000],v[1000];
double box[200010];

ll fib(int i){
  if(i == 1 || i == 0)return 1;
  if(d[i] != 0)return d[i];
  return d[i] = fib(i-1) + fib(i-2);
}

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

C++: #include <stdio.h>

int dp[50];

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

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

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

long long fib[45];

int main(int argc, char *argv[])
{
    
 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    fib[0]= 1;
    fib[1] = 1;
    
    for (int i = 2; i < 45; i++) {
        fib[i] = fib[i - 1] + fib[i - 2];
    }
    
    int n;
    cin >> n;
    cout << fib[n] << endl;
    
    return 0;
}

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

typedef long long hyper;

hyper fib(int n)
{
    if(n < 2){ return 1; }
    return fib(n - 1) + fib(n - 2);
}

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

C++: #include <iostream>
#include <string>
#include <math.h>
#define LEN 1000000
using namespace std;

int f[50];
int fib(int);

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

int fib(int a){
	if(f[a]!=-1) return f[a];
	return f[a]=fib(a-1)+fib(a-2);
}

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

long long Fib(int n){
	vector<long long> F(n+1);
	int i;
	F[0]=1;
	F[1]=1;
	for (i=2;i<=n+1;i++){
		F[i]=F[i-1]+F[i-2];
	}
	return F[n];
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	cout << Fib(n)<<endl;
	return 0;
}

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])return dd[a];
	return dd[a]=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 main(){
    int n;
    cin >> n;
    int F[50];
    F[0]=1;
    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 <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 <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

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

	return 0;
}