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>
using namespace std;

int main(int argc, char const *argv[])
{
    int a, *Fibonacci;
    cin >> a;
    Fibonacci = (int *)malloc((a+1) * sizeof(int));
    Fibonacci[0] = Fibonacci[1] = 1;
    for(int i=2; i<=a; ++i) {
        Fibonacci[i] = Fibonacci[i-1] + Fibonacci[i-2];
    }
    cout << Fibonacci[a] << endl;
    return 0;
}

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

using namespace std;

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

int main(){
    int n; cin >> n;
    cout << fibo(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 <iostream>
using namespace std;
int main(){
	int n; cin>>n;
	int r[] = {1,1,2};
	if( n<=2 ){
		cout<<r[n]<<endl;
		return 0;
	}
	while( n>0 ){
		int tmp = r[1] + r[2];
		r[0] = r[1]; r[1] = r[2]; r[2] = tmp;
		n = n-1;
	}
	cout<<r[0]<<endl;
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#define MAX 50
using namespace std;

int main(int argc, char *argv[])
{
    int n;
    int fib[MAX] = {0};
    fib[0] = 1;
    fib[1] = 1;
    scanf("%d", &n);
    if (n < 2)
    {
        printf("%d\n", 1);
        return 0;
    }

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

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;
vector<int> f;
int makeFib(int k){
    f.pb(1);
    f.pb(1);
    if(k >= 2){
    FOR(i,2,(k + 1)){
        f.pb(f[i - 2] + f[i - 1]);
      }
    }
      return f[k];
  }
int main(){
  int n;
  cin >> n;

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

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

int dp[50];

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

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

signed 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<bits/stdc++.h>
using namespace std;

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

C++: /*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A&lang=jp
*/
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(s,e) for(int i=s;i<e;i++)
ll A[44];
ll Fibo(int n){
  if(n==0 || n==1) return 1;
  if(A[n]!=0) return A[n];
  A[n-1]=Fibo(n-1);
  return A[n-1]+A[n-2];
}
int main(){
  int n;
  cin>>n;
  A[0]=A[1]=1;
  cout<<Fibo(n)<<"\n";
}

C++: #include <iostream>

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;
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
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;
  int F[50];
  F[0] = F[1] = 1;
  for ( i = 2; i < 50; i++ ) F[i] = F[i-1] + F[i-2];

  cin >> x;
  cout << F[x] << endl;

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


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

C++: #include <iostream>
  
using namespace std;
  
typedef unsigned long long ull;
  
int main()
{
    ull t[45] = { 1, 1 };
    for( int i=2; i<45; ++i )
        t[i] = t[i-1] + t[i-2];
    ull n;
    cin >> n;
    cout << t[n] << endl;
}

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


int fib(int n){
	  if(n==0 or n==1) return 1;
	  return fib(n-1) + fib(n-2);
}

int main (){

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

}

C++: #include <iostream>

using namespace std;

int main()
{
	int a=1,b=1,n;
	cin>>n;
	for (int i=0; i<n-1; i++) {
		swap(a,b);
		a+=b;
	}
	cout<<a<<endl;
}

C++: #include <iostream>

const int MAX_SIZE = 44 + 1;

int main() {
  int f[MAX_SIZE] = {0};
  
  int n = 0;

  std::cin >> n;

  f[0] = 1;
  f[1] = 1;

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

  std::cout << f[n] << std::endl;

  
  return 0;
}

C++: #include <iostream>

using namespace std;

int N;
unsigned long memo[50] = {};

unsigned long fibo(unsigned n)
{
	if (n <= 1) return 1;
	if (memo[n] == 0) {
		memo[n] = fibo(n - 1) + fibo(n - 2);
	}
	return memo[n];
}

int main()
{
	cin >> N;

	cout << fibo(N) << endl;

	return 0;
}

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

int f[50];

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

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

	fill(f, f + 50, 0);

	int N; cin >> N;
	cout << fib(N) << endl;
}

C++: #include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int main() {
	int n;
	int dp[64];
	dp[0] = 1; dp[1] = 1;

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

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
#include <cstdlib>
#define INT_MAX 2147483647
#define INT_MIN -2147483646
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;

vector<ll> A(100);

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

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

int A[51];

void func(int n){
  if(n==50) return;
  A[n]=A[n-1]+A[n-2];
  func(n+1);
}

int main(){
  int n;
  cin >> n;
  A[0]=1; A[1]=1;
  func(2);

  cout << A[n] << endl;
}

C++: #include <cstdio>

using namespace std;

int sum = 0;

int fib( int n ){

    if( n >= 0) {

        if( n == 0 || n == 1 ){

            return 1;

        } else {

            sum = fib( n - 1 ) + fib( n - 2 );        

        }

    } else return 0;

    return sum;

}

int main(){

    int n;

    scanf("%d", &n);

    int ans = fib(n);

    printf("%d\n", ans);

}

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

int fib[46]={};
int n = 0 ;

int main(){
    
	cin >> n ;

	fib[0]=1;
	fib[1]=1;

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


cout << fib[n] << endl ;

  return 0;
}