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 <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector <int>;

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

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

    int n; cin >> n;

    int fib[n+1];
    fib[0] = 1;
    fib[1] = 1;
    FOR(i, 2, n+1) {
        fib[i] = fib[i-1] + fib[i-2];
    }
    cout << fib[n] << "\n";
}

C++: #include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

long fib(long n){
	if(n < 2) return 1;
	return fib(n-1) + fib(n-2);
}

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

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

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

    std::vector<int> f(n+1);


    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 main() {
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for (int i = 2; i <= n; i++) {
        F[i] = F[i - 2] + F[i - 1];
    }
    cout << F[n] << endl;
    return 0;
}

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

using namespace std;

int fib(int n) {
    return n <= 1 ? 1 : fib(n - 1) + fib(n-2);
}

int dp[1000];

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

int fibdp(int n){
    vector<int> dpv(n);
    dpv[0] = dpv[1] = 1;
    for (int i = 2; i < n; ++i)dpv[i] = dpv[i-1] + dpv[i-2];
    return dpv[n-1];
}

int fibloop(int n){
    int fib,fib2;
    fib = fib2 = 1;
    for (int i = 2; i < n; ++i){
        int tmp = fib;
        fib = fib + fib2;
        fib2 = tmp;
    }
    return fib;
}

int main(){
    //freopen("in", "r", stdin);
    int n;
    cin >> n;
    cout << fibloop(n) << endl;
    return 0;
}

C++: #include <iostream>
#define MAX 100001
#define SENTINEL 2000000000
using namespace std;


int solved[MAX];

int fib(int n){
    for(int i = 0; i <= n; i++){
        if(i == 0) {
            solved[i] = 1;
            continue;
        };
        if(i == 1) {
            solved[i] = 1;
            continue;
        };
        solved[i] = solved[i - 1] + solved[i - 2];
    }
    return solved[n];
}

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

    int r = fib(n);
    cout << r << endl;

    return 0;
}

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

unsigned long long ull[44];

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

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

long long fibonacci(vector<long long>& array, int n) {
    if(n == 0 || n == 1) {
        return array[n];
    }
    int size = array.size();
    if(n < size) {
        return array[n];
    }
    long long ans = fibonacci(array, n-2) + fibonacci(array, n-1);
    array.push_back(ans);
    return ans;
}

int main() {
    int n;
    cin >> n;
    vector<long long> array;
    array.push_back(1);
    array.push_back(1);
    long long ans = fibonacci(array, n);
    cout << ans << endl;
}

C++: #include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
int f[50];

void fi(int a) {
  f[a] = f[a - 2] + f[a - 1];
}

int main(void) {
  int n;
  scanf("%d", &n);
  rep(i, 50) f[i] = 0;
  f[0] = 1, f[1] = 1;
  for(int i = 2; i < 50; ++i) fi(i);
  printf("%d\n", f[a]);
  return 0;
}