Go: package main

import (
	"fmt"
)

func answer(n int) string {
	f := []int{1, 1}
	for i := 2; i <= n; i++ {
		f = append(f, f[i-1]+f[i-2])
	}

	return fmt.Sprintf("%d", f[n])
}

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

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

int main(){
  int fibo[MAX];
  int n;
  fibo[0] = fibo[1] = 1;
  for(int i = 2; i < MAX; i++)
    fibo[i] = fibo[i-1] + fibo[i-2];

  cin >> n;
  cout << fibo[n-1] << endl;
}

C++: #include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000

int A[MAX];
int n = 0;

int fib(int num) {
  if (num == 0 || num == 1) {
    return A[num];
  } else {
    return fib(num-1)+fib(num-2);
  }
}

int main() {
  int num;
  A[0] = 1;
  A[1] = 1;
  scanf("%d", &num);
  printf("%d\n", fib(num));
  return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);

int memo[45];
int main(){
  int n;
  cin >> n;
  cout << fib(n) << endl;
  retrun 0;
}

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

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

const int Max = 45;

int FibArray[Max];

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

int main(){
    int index;
    scanf("%d", &index);

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
int n;
int dfep[45];

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>
using namespace std;
int main(void){

	int n;

	cin >> n;

	int f[44];
	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 <iostream>

using namespace std;

#define INF -1

int dp[45];

int main()
{
	for(int i = 0; i < 45; i++) { dp[i] = INF; }

	int n;

	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;

	getchar();
	getchar();
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int A[50];
int fib(int n){
	if(A[n]) return A[n];
	else 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 <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n; cin >> n;
	vi v(50, 0);
	v[0] = v[1] = 1;
	rep(i, 2, n + 1) {
		v[i] = v[i - 2] + v[i - 1];
	}
	P(v[n]);
	return 0;
}

C++: #include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	int N;
	cin >> N;
	vector<int> F(50);
	F.at(0) = F.at(1) = 1;
	for (int i = 2; i <= N; i++) {
		F.at(i) = F.at(i - 1) + F.at(i - 2);
	}
	cout << F.at(N) << endl;
}

C++: #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

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

C++: #include"iostream"
using namespace std;
int main()
{
  int a,b,c;
  int n;
  cin>>n;
  c=1;
  a=1;b=1;
  for(int i=1;i<n;i++)
    {
      c=a+b;
      a=b;
      b=c;
    }
  cout<<c<<endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
 
int main() {
	int fib[45]={1,1},i;
for(i=2;i<=44;i++){
fib[i]=fib[i-1]+fib[i-2];
}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

  int n;

  int n1,n2,st;

  n1=1;
  n2=1;
  st=1;

  cin >>n;

  for(int i=1;i<=n;i++){
    st=n1+n1;
    n1=n2;
    n2=st;
  }
  cout <<st<<endl;

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

int fib[46];

int main()
{
	memset (fib, 0, sizeof (fib ) );
	fib[0] = 1;
	fib[1] = 1;
	for (int i = 2; i < 46; i++ ){
		fib[i] = fib[i-1] + fib[i-2];
	} // end for

	ios_base::sync_with_stdio(0);
	int n; cin >> n;
	printf ("%d\n", fib[n] );
		
	return 0;
}

C++: #include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[] = {-1,0,1,0,-1,-1,1,1};
const int dy[] = {0,-1,0,1,1,-1,1,-1};

int main(){
  int n; cin>>n;
  int dp[10101010];
  rep(i,10101010){
    if(i==0||i==1) dp[i]=1;
    else dp[i]=dp[i-1]+dp[i-2];
  }
  cout<<dp[n]<<endl;
}

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

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n + 1);
    a[0] = a[1] = 1;
    for (int i = 2; i <= n; i++)
    {
        a[i] = a[i - 1] + a[i - 2];
    }
    printf("%d\n", a[n]);
}

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

#define MAX 50

int dp[MAX];

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

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

  cout << fib(n) << endl;

  return 0;
}

C++: #include <stdio.h>
int F[50];
int fib(int n) {
	if (n == 0 || n == 1) {
		return F[n]=1;
	}
	if (F[n] != -1) return F[n];
	return F[n]=fib(n - 1) + fib(n - 2);
}
int main(void) {
	int n,i=50;
	while (i--) F[i]=-1;
	scanf("%d", &n);
	printf("%d\n",fib(n));
	return 0;
}