Go: package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n+1)
	a[0] = 1
	a[1] = 1
	for i := 2; i <= n; i++ {
		a[i] = a[i-1] + a[i-2]
	}
	fmt.Println(a[n])
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: /*
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 44;

/* typedef */

/* global variables */

int fs[MAX_N + 1];

/* subroutines */

/* main */

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

  fs[0] = fs[1] = 1;

  for (int i = 2; i <= n; i++)
    fs[i] = fs[i - 1] + fs[i - 2];

  printf("%d\n", fs[n]);
  return 0;
}

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

int main()
{
	int n,x1=1,x2=1,tmp=0;
	cin >> n;
	
	if(n==0||n==1) cout << "1";
	else{
		for(;n>2;n--){
			tmp=x1+x2;
			x1=x2;
			x2=tmp;
		}
		cout << x1 + x2;
	}
	
	return 0;
	
}

C++: #include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
    size_t n;
    scanf("%zu", &n);

    int fib[2]={1, 1};
    for (size_t i=0; i<n; ++i)
        swap(fib[0]+=fib[1], fib[1]);

    printf("%d\n", fib[0]);
    return 0;
}

C++: #include <iostream>

using namespace std;

#define MAX 45

int FibValue[MAX];

long long FibonacciNumber(int n)
{
	if (FibValue[n] != -1) return FibValue[n];

	if (n == 0 || n == 1)
	{
		FibValue[n] = 1;
		return FibValue[n];
	}

	FibValue[n] = FibonacciNumber(n - 1) + FibonacciNumber(n - 2);
	return FibValue[n];
}

int main()
{
	for (int i = 0; i < MAX; ++i)
		FibValue[i] = -1;
	int n; cin >> n;

	cout << FibonacciNumber(n) << endl;

	return 0;
}

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

int main()
{
	int F[100];
	F[0]=1;
	F[1]=1;
	for(int i=2;i<45;++i){
		F[i]=F[i-2]+F[i-1];
	}

	int n;
	cin>>n;
	cout<<F[n]<<endl;
	return 0;
}

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

int main() {
  int n; cin >> 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];
  }
  cout << f[n] << endl; 
}

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

long long f[50] = {};
long long fib(long long n) {
  if (f[n] > 0) return f[n];
  if (f[n-1] == 0){
    f[n-1] = fib(n-1);
  }
  if (f[n-2] == 0){
    f[n-2] = fib(n-2);
  }
  f[n] = f[n-1] + f[n-2];
  return f[n];
}

void Main()
{
  f[0] = 1; f[1] = 1;
  long long n; cin >> n;
  cout << fib(n) << endl;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

C++: #pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    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;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

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

using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> dp(n+1);

    dp[0] = 1;
    dp[1] = 1;

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

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

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

int f[46]={0};

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

    return f[n];
}

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

C++: #include <iostream>
using namespace std;
int fib(int n) 
{
	if (n >= 0) {
		if (n <= 1) return 1;
		return fib(n - 1) + fib(n - 2);
	}
}
int main(void)
{
	int n;
	scanf_s("%d", &n);
	printf("%d", fib(n));
}

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

int fib(int dp[50],int n){
    if(n<=1)return dp[n]=1;
    if(dp[n]!=-1)return dp[n];
    return dp[n]=fib(dp,n-1)+fib(dp,n-2);
}

int main(){
    int n;
    int dp[50];
    memset(dp,-1,sizeof(dp));

    scanf("%d",&n);
    printf("%d\n",fib(dp,n));
}

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

int fib(int n){

  if(n == 0 || n == 1) return 1;
  
  return fib(n-1) + fib(n-2);
  
}

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

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

  return 0;

}

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main() {
	int n; cin >> n;
	int dp[50];
	dp[0] = dp[1] = 1;

	FOR( i, 2, n + 1 ) dp[i] = dp[i - 1] + dp[i - 2];

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

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

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

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>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using P = pair<int,int>;
const int inf = 1e8;

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

C++:     #include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;
    
    int main() {
   
    int n;
    scanf("%d",&n);
    int ans = 0;
    int second = 0;
    for(int i = 0; i <= n; i++){
    	if(i == 0 || i == 1){	ans = 1;
    	} else{
    		if(i == 2){
    			second = 1;
    		    ans = 1;
    		}
    		int t = second;
    		second = ans;
    		ans = ans + t;
    	}
    }
    	printf("%d\n",ans);
    
     return 0;
    }