Go: package main

import "fmt"

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

	x, y := int64(1), int64(1)

	for i := 0; i < n; i++ {
		x, y = y, x+y
	}

	fmt.Println(x)
}

C++: #include<iostream>
#include<cstring>
#include<cstdio>

long long 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(void){
	int n, i;
	long long int m;
	for (i = 0; i <= 50; i++) {
		dp[i] = -1;
	}

	scanf("%d", &n);
	m = fib(n);
	printf("%lld\n", m);

	return 0;
}

C++: 
#include<iostream>

using namespace std;

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

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

int Fibonacci(const int& n)
{
	if(n == 0 || n == 1){
		return 1;
	}else{
		return Fibonacci(n-1) + Fibonacci(n-2);
	}
}

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

C++: #include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int F[n + 1];

    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 fib( int n ) {

	if (n == 0 || n == 1) return 1;

	else return fib(n - 1) + fib(n - 2);
}

int main() {


	int n;

	cin >> n;

	cout << fib(n) << endl;

	return 0;
}

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

class Fibonacci{
private:
	int f[45];
	int len;
public:
	Fibonacci(){ f[0] = f[1] = 1; len = 2; }
	int calc(int n);
};

int Fibonacci::calc(int n)
{
	if (n < len) return f[n];
	f[n] = calc(n - 1) + calc(n - 2);
	len++;
	return f[n];
}

int main(void)
{
	Fibonacci fib;
	int n;
	cin >> n;
	cout << fib.calc(n) << endl;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
int F[50];
int fib(int i){
	if(i == 0 || i == 1) return 1;

	if(F[i] != -1) return F[i];
	
	return F[i] = fib(i-1) + fib(i-2);
}

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

C++: #include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <climits>
using namespace std;

#define DEBUG (0)

#if DEBUG
#define DPRINTF(...) do { \
    printf("D(L%d) %s: ", __LINE__, __func__); \
    printf(__VA_ARGS__); \
  } while (false)
#else
#define DPRINTF(...)
#endif // DEBUG

const uint64_t kInvalid = 0;

#if 0
uint64_t calFibonacci(int num, uint64_t *pArray)
{
  if (pArray[num-1] == kInvalid)
    pArray[num-1] = calFibonacci(num-1, pArray);

  if (pArray[num-2] == kInvalid)
    pArray[num-2] = calFibonacci(num-2, pArray);

  return pArray[num-1] + pArray[num-2];
}
#endif


uint64_t calFibonacci(int num, uint64_t *pArray)
{
  assert(num >= 0);

  if (num == 0 | num == 1)
    return 1;

  if (pArray[num] != kInvalid)
    return pArray[num];

  pArray[num] = calFibonacci(num-1, pArray) + calFibonacci(num-2, pArray);
  return pArray[num];
}


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

  DPRINTF("numOfFibonacci %d\n", numOfFibonacci);

  if (numOfFibonacci <= 1)
  {
    cout << "1" << endl;
    return 0;
  }

  uint64_t fibonacci[numOfFibonacci + 1];

  // init
  for (int i = 0; i <= numOfFibonacci; i++)
  {
    fibonacci[i] = kInvalid;
  }

  //fibonacci[0] = 1;
  //fibonacci[1] = 1;

  uint64_t ans = calFibonacci(numOfFibonacci, fibonacci);
  cout << ans << endl;

  return 0;
}

C++: #include <iostream>
using namespace std;
int solution(int n){
    if(n==0) return 1;
    if(n==1) return 1;
    int one=1,two=1,tmp;
    for(int i=1;i<n;i++){
    tmp = two;
    two = two+one;
    one = two;
}
    return two;
}

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

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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

int dp[45];

void init() {
    dp[0] = dp[1] = 1;
    rep(i, 2, 45) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
}

signed main() {
    int N;
    cin >> N;
    init();
    cout << dp[N] << "\n";
}

C++: #include<iostream>
#include<string>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<deque>
using namespace std;
int memo[44];
int fib(int n)
{
	if (n < 0)return 0;
	if (memo[n] != -1)return memo[n];
	if (n == 0 || n == 1)return 1;
	int ans = 0;
	ans += fib(n - 1) + fib(n - 2);

	return memo[n]=ans;
	
}

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

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

unordered_map<int,int> memo;
int fib(int n){
    if(n<2) return 1;
    if (not memo.count(n)) memo[n] = fib(n-1)+fib(n-2);
    return memo[n];

}

int main(void){cin.tie(0);ios::sync_with_stdio(false);
    int n; cin>>n;
    cout<<fib(n);
}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  int dp[n+1];
  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;
}