Go: package main

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

func fib(n int) int {
	x, y := 1, 1
	for n > 0 {
		x, y = y, x+y
		n--
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fib(n))
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

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

C++: #include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void ok() { cerr << "ok" << endl; }
template <class T>
struct Matrix {
    vector<vector<T>> a;
    Matrix() {}
    Matrix(int n, int m) : a(n, vector<T>(m)) {}
    inline const vector<T> &operator[](int k) const {
        return a.at(k);
    }
    inline vector<T> &operator[](int k) {
        return a.at(k);
    }
    Matrix I(int n) {
        Matrix mat(n, n);
        for (int i = 0; i < n; i++) {
            mat[i][i] = 1;
        }
        return mat;
    }
    Matrix &operator+=(const Matrix &rhs) {
        for (int i = 0; i < a.size(); i++) {
            for (int j = 0; j < a[i].size(); j++) {
                (*this)[i][j] += rhs[i][j];
            }
        }
        return (*this);
    }
    Matrix &operator-=(const Matrix &rhs) {
        for (int i = 0; i < a.size(); i++) {
            for (int j = 0; j < a[i].size(); j++) {
                (*this)[i][j] -= rhs[i][j];
            }
        }
        return (*this);
    }
    Matrix &operator*=(const Matrix &rhs) {
        int n = a.size(), m = a[0].size(), p = rhs[0].size();
        assert(m == rhs.a.size());
        vector<vector<T>> b(n, vector<T>(p));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < p; j++) {
                for (int k = 0; k < m; k++) {
                    b[i][j] += (*this)[i][k] * rhs[k][j];
                }
            }
        }
        swap(a, b);
        return (*this);
    }
    Matrix &operator^=(const long long &rhs) {
        long long n = rhs;
        Matrix res = Matrix::I(a.size());
        while (n > 0) {
            if (n & 1) {
                res *= (*this);
            }
            (*this) *= (*this);
            n >>= 1;
        }
        swap(a, res.a);
        return (*this);
    }
    Matrix operator+(const Matrix &rhs) const {
        return Matrix(*this) += rhs;
    }
    Matrix operator-(const Matrix &rhs) const {
        return Matrix(*this) -= rhs;
    }
    Matrix operator*(const Matrix &rhs) const {
        return Matrix(*this) *= rhs;
    }
    Matrix operator^(const long long &rhs) const {
        return Matrix(*this) ^= rhs;
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    Matrix<ll> a(2, 2), b(2, 1), res;
    a[0][1] = 1, a[1][0] = 1, a[1][1] = 1;
    b[0][0] = 1, b[1][0] = 1;
    if (n == 0) {
        cout << 1 << endl;
        return 0;
    }
    res = (a ^ (n - 1)) * b;
    cout << res[1][0] << 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()
{
	int n;
	cin >> n;
	
	cout << fib(n) << endl;
	
	return 0;
}

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

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

C++: #include<iostream>

using namespace std;

int n[44];

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

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

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

int main() {

    long long int F[44]; 

    int n;

    cin >> n;

    F[0] = 0;
    F[1] = 1;
    F[2] = 1;
    for(int i = 3; i <= n; i++) F[i] = F[i-1] + F[i-2];

    cout << F[n] << endl;

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <random>
#include <map>

using namespace std;

int fibArray[50];

void makeFibArray() {
    for (int i = 2; i <= 46; i++) {
	fibArray[i] = fibArray[i - 1] + fibArray[i - 2];
    }
}

int main() {

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

    int n; scanf("%d", &n);
    fibArray[0] = 1;
    fibArray[1] = 1;
    makeFibArray();
    printf("%d", fibArray[n]);


    return 0;

}

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

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

C++: #include <stdio.h>

#define MAX_N 45

int main(){
  int N,i,dp[MAX_N] = {1,1};
  for(i = 2 ; i < MAX_N ; i++){
    dp[i] = dp[i-1] + dp[i-2];
  }
  scanf("%d",&N);
  printf("%d\n",dp[N]);
  return 0;
}

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

int main(){

  int n;
  cin >> n;
  vector<int> fibDP(n+1);
  rep(i,n+1){
    if(i == 0 || i == 1) fibDP[i] = 1;
    else fibDP[i] = fibDP[i-1] + fibDP[i-2];
  }

  cout << fibDP[n] << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<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;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int dp[50];

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

int main(){
	int n;
	cin>>n;
	int a[1000];
	memset(dp,-1,sizeof(dp));
	cout<<fibonacci(n)<<endl;
}