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<bits/stdc++.h>
using namespace std;
int main(){
  int a[44];
  a[0]=1;
  a[1]=1;
  for(int i=2;i<=44;i++)a[i]=a[i-1]+a[i-2];
  int n;
  cin>>n;
  cout<<a[n]; 
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define  all(x) (x).begin(),(x).end()
typedef long long ll;

int f[45];

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

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

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

int fib(int n) {
    if (n == 0) return 1;
    else if (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 <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
  
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

long long FibonacciNumber(long long n, long long mod) {
    long long A[2][2] = {{1, 1}, {1, 0}};
    long long M[2][2] = {{1, 0}, {0, 1}};
    while (n > 0) {
        if (n & 1) {
            long long M_00 = M[0][0] * A[0][0] + M[0][1] * A[1][0];
            long long M_01 = M[0][0] * A[0][1] + M[0][1] * A[1][1];
            long long M_10 = M[1][0] * A[0][0] + M[1][1] * A[1][0];
            long long M_11 = M[1][0] * A[0][1] + M[1][1] * A[1][1];
            M[0][0] = M_00 % mod;
            M[0][1] = M_01 % mod;
            M[1][0] = M_10 % mod;
            M[1][1] = M_11 % mod;
        }
        long long A_00 = A[0][0] * A[0][0] + A[0][1] * A[1][0];
        long long A_01 = A[0][0] * A[0][1] + A[0][1] * A[1][1];
        long long A_10 = A[1][0] * A[0][0] + A[1][1] * A[1][0];
        long long A_11 = A[1][0] * A[0][1] + A[1][1] * A[1][1];
        A[0][0] = A_00 % mod;
        A[0][1] = A_01 % mod;
        A[1][0] = A_10 % mod;
        A[1][1] = A_11 % mod;
        n >>= 1;
    }
    return M[1][0];
}

int main() {

    ll n; cin >> n;
    cout << FibonacciNumber(n + 1, 1e18) << endl;
   
    return 0;
}

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

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

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

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

  vector<int> fib(n+2);
  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++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "MyDisjointset.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string.h>
using namespace std;
typedef pair<int, int> P; typedef long long int ll;
const int INF = 100000000;
int mod = 10000;
vector <vector<int>> mul(vector<vector<int> > f, vector<vector<int> > s) {
	vector<vector<int> > res(2, vector <int> (2) );
	res[0][0] = (f[0][0] * s[0][0] + f[0][1] * s[1][0]) % mod;
	res[0][1] = (f[0][0] * s[0][1] + f[0][1] * s[1][1]) % mod;
	res[1][0] = (f[1][0] * s[0][0] + f[1][1] * s[1][0]) % mod;
	res[1][1] = (f[1][0] * s[0][1] + f[1][1] * s[1][1]) % mod;
	return res;
}
int main() {
	int n; cin >> n;
	vector<vector<int> > base(2, vector<int> (2) );
	base[0][0] = 1;
	base[0][1] = 1;
	base[1][0] = 1;
	base[1][1] = 0;
	vector<vector<int> > ans(2, vector<int>(2));
	ans[0][0] = 1;
	ans[0][1] = 0;
	ans[1][0] = 0;
	ans[1][1] = 1;
	while (n > 0) {
		if (n & 1) ans = mul(ans, base);
		//cout << ans[0][0] << " " << ans[0][1] << endl;
		//cout << ans[1][0] << " " << ans[1][1] << endl;
		//cout << endl;
		base = mul(base, base);
		n >>= 1;
	}
	cout << ans[1][0] + ans[1][1]  << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,dp[45]={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++: /*
 * Problem Description: Dynamic Programming - Fibonacci Number
 * Category:
 * Author: Khan
 * Date: 18th October, 2017
 */

#include <iostream>

using namespace std;

int n;
int Fibonacci[45];

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    cin >> n;
    Fibonacci[0] = 1;
    Fibonacci[1] = 1;
    for (int i = 2; i <= n; ++i)
    {
        Fibonacci[i] = Fibonacci[i - 1] + Fibonacci[i - 2];
    }
    cout << Fibonacci[n] << endl;
    return 0;
}

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

using namespace std;

int fib(int);

vector<int> num;

int main(){
    int n;
    cin >> n;
    
    num.resize(n, 0);
    
    cout << fib(n) << endl;
}

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

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

int f[45];

int fib(int n)
{
    if (n == 1 || n == 0)
        return 1;
    if (f[n] != -1)
        return f[n];

    return (f[n] = fib(n - 1) + fib(n - 2));
}

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

    for (int i = 0; i < 46; i++)
        f[i] = -1;

    cout << fib(n) << endl;
}

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

typedef long long ll;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> Fib(n+1,1);
    for(i = 2;i <= n;++i){
        Fib.at(i) = Fib.at(i-1) + Fib.at(i-2);
    }
    cout << Fib.at(n) << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
vector<ll> fibs(100, -1);
ll fib(int n){
    if(fibs[n]!=-1) return fibs[n];
    if(n==0 || n==1) return 1;

    return fibs[n] = fib(n-2) + fib(n-1);
}

int main()
{
    int n; cin >> n;
    pr(fib(n));
    return 0;}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int f1=0,f2=1,n,xx;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
       xx=f2;
        int next = f1 + f2;
        f1 = f2;
        f2 = next;
}
printf("%d\n",f2);
}