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>

long long int Fibo(int n)
{
    long long int a = 1;
    long long int pre = 1;
    long long int prepre = 1;
    for(int i = 2; i <= n; ++i){
        a = pre + prepre;
        prepre = pre;
        pre = a;
    }
    return a;
}
int main(){
    int n;
    std::cin >> n;
    std::cout << Fibo(n) << std::endl;
    return 0;
}

C++: #include <iostream>
#include <bits/stdc++.h>
#define MAX_SIZE 500010
#define INFTY 2000000000
using namespace std;

int D[MAX_SIZE];


int fib(int n) {
    if (D[n] > 0) {
        return D[n];
    }
    if (n <= 1) {
        return 1;
    }
    D[n] = fib(n -1) + fib(n - 2);
    return D[n];
}

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

C++: #include <iostream> 
#include <queue>
#include <string>
#include <set>
using namespace std;
int f(int n)
{
	if(n == 0)
	{
		return 1;
	}
	if(n == 1)
	{
		return 1;
	}
	return f(n-1)+f(n-2);
};

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

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

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

  cout << fib[n] << endl;

  return 0;
}

C++: /*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int fbc[200000];

int fb(int a)
{
	//if(fbc[a]>0)
	//return fbc[a];
	
	
	if(a<2)
	return 1;
	
	//fbc[a]=fb(a-1)+fb(a-2);
	return fb(a-1)+fb(a-2);
	
}

int main()
{
	//iniarr(fbc,200000);
	int a;
	scd(a);
	printf("%d\n",fb(a));	
	return 0;
}

C++: #include<bits/stdc++.h>
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 <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep1(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;

int a[45];

int main()
{
	int n;

	a[0] = 1;
	a[1] = 1;
	rep1(i, 2, 44) a[i] = a[i - 1] + a[i - 2];

	cin >> n;
	cout << a[n] << endl;

	return 0;
}

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

// ?????£??????????????°???????±???????
int fibonacci(int n);
int fib[45];

int main()
{
    int num;
    cin >> num;
    int res = 0;

    res = fibonacci(num);
    cout << res << endl;

    //getchar();
    //getchar();

    return 0;
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

vector<int> f(100, -1);

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

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

C++: =

C++: #include<iostream>

using namespace std;

int n;
int dp[44];

int main(){
    cin >> n;
    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;
    return 0;
}

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

int main()
{
	int x = 1, y = 1, n, value = 0;
	cin >> n;

	if (n == 0 && n == 1) value = 1;
	else
	{
		while (n > 1)
		{
			value = x + y;
			x = y;
			y = value;
			n--;
		}
	}
	cout << value << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int memo[100];

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

int main() {
    int n;
    cin >> n;
    fill(memo, memo + 100, -1);
    cout << fibonacci(n) << endl;
}

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

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 <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int A[50];
int fib(int n){
	if(n==1 || n==0) A[n]=1;
	else A[n]=fib(n-1)+fib(n-2);
	return A[n];
}

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

C++: #include <iostream>
#include <string>
#define MAX 44
using namespace std;

int main(int argc, char* argv[]) {
    int n;
    int F[MAX+1];
    cin >> n;
    F[0] = 1;
    F[1] = 1;
    for (int i = 2; i <= n; i++){
        F[i] = F[i-2] + F[i-1];
    }
    cout << F[n] << "\n";
    return 0;
}

C++: #include <iostream>

using namespace std;

#define MAX 45
int array[MAX];

void setNumber(int n) {
  array[0] = 1;
  array[1] = 1;
  for(int i = 2; i < n + 1; i++) {
    array[i] = array[i - 1] + array[i - 2];
  }
}


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

  setNumber(n);
  cout << array[n] << endl;

  return 0;
}