Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
#define MAX_N 45
int dp[MAX_N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    dp[0] = dp[1] = 1;
    for (int i = 2; i < n + 1; i++) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    cout << dp[n] << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;



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

C++: #include <iostream>

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

    int r1 = 1;
    int r2 = 1;
    int result = 1;

    if (n == 1) {
        std::cout << 1 << std::endl;
    } else {
        for (int i = 1; i < n; i++) {
            int tmp = r1;
            r1 = r2;
            r2 = result;
            result += r1;
        }
        std::cout << result << std::endl;
    }
}

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

int main(){
  int f[45];

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

  int n; cin >> n;
  cout << f[n] << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#define PI 3.1415926535
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

long long int n;

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

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

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

using namespace std;

int main() {

	int n;
	cin >> n;

	int oold = 1;
	int old = 1;
	int neww;

	if (n == 0 || n == 1) { cout << 1 << endl; return 0; }

	for (int i = 2; i <= n; i++) {
		neww = old + oold;
		oold = old;
		old = neww;
	}

	cout << neww << endl;

	return 0;

}

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

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

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)

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

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

int main() {
	int n;
	cin >> n;
	int dp[45];
	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>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
using namespace std;

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

	int n;
	cin>>n;
	vector<ll> a(n+1);
	a[0]=1;
	a[1]=1;
	rep(i,n-1){
		a[i+2]=a[i+1]+a[i];
	}
	cout<<a[n]<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<long long> fib(n + 1, 1);
  for (int i = 2; i <= n; i++){
    fib[i] = fib[i - 1] + fib[i - 2];
  }
  cout << fib[n] << endl;
}

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

const int N = 44;
int dp[N] = {};
int n;

int rec(int x)
{
	if(x == 0 || x == 1){
		dp[x] = 1;
		return dp[x];
	}
	
	if(dp[x] != 0)
		return dp[x];
	
	return dp[x] = rec(x - 1) + rec(x - 2);
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n;
	
	cout << rec(n) << endl;
	
	return 0;
}

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

const int MAX = 100;
long long dp[MAX];

long long fb(int n) {
  if (n < 2) {
    return 1;
  }
  if (dp[n] != 0) {
    return dp[n];
  } else {
    return dp[n] = fb(n-1) + fb(n-2);
  }
}

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

C++: #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

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