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>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;

int main() {
    ios_base::sync_with_stdio(false);

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

C++: #include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
const int MAXN = (int)1e4 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

int n;
int fib[MAXN];

void work(){
    fib[0]=fib[1]=1;
    for(int i=2;i<=44;i++) fib[i]=fib[i-1]+fib[i-2];
    scanf("%d",&n);
    printf("%d\n",fib[n]);
}

int main(){
    work();
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int linersearch(int a[], int n, int x);
void insetrtionsort(int a[], int n);
void printarray(int n, int a[]);
void babblesort(int n, int a[]);
void selectionsort(int n, int a[]);
void countingsort(int n, int a[]);
void minimumcostsort(int n, int a[]);

int linersearch(int a[], int n, int x)
{
    int ret = 0;
    for (int i = 1; i < n; i++)
    {
        if (a[i] == x)
        {
            ret = 1;
            break;
        }
    }
    return ret;
}

void insetrtionsort(int a[], int n)
{
    int j, v;
    for (int i = 1; i < n; i++)
    {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v)
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        for (int i = 0; i < n; i++)
        {
            cout << a[i] << " ";
        }
        cout << endl;
    }
}

void babblesort(int n, int a[])
{
    int flag = 1;
    int counter = 0;
    int tmp;
    while (flag)
    {
        flag = 0;
        for (int j = n - 1; j > 0; j--)
        {
            if (a[j] < a[j - 1])
            {
                swap(a[j], a[j - 1]);
                counter++;
                flag = 1;
            }
        }
    }
    printarray(n, a);
    cout << counter << endl;
}

void selectionsort(int n, int a[])
{
    int minj;
    int counter = 0;
    for (int i = 0; i < n; i++)
    {
        minj = i;
        for (int j = i; j < n; j++)
        {
            if (a[j] < a[minj])
                minj = j;
        }
        if (i != minj)
        {
            swap(a[minj], a[i]);
            counter++;
        }
    }
    printarray(n, a);
    cout << counter << endl;
}

void countingsort(int n, int a[])
{
    int b[n] = {};
    int k = 0;
    for (int i = 0; i < n; i++)
        k = max(a[i], k);
    int c[k + 1] = {};
    for (int i = 0; i < n; i++)
        c[a[i]]++;
    for (int i = 1; i < k + 1; i++)
        c[i] += c[i - 1];
    for (int i = n - 1; i > -1; i--)
    {

        b[c[a[i]] - 1] = a[i];
        c[a[i]]--;
    }
    printarray(n, b);
}

void minimumcostsort(int n, int a[])
{
    int maxa, maxindex, cost;
    cost = 0;
    for (int i = n - 1; i > 0; i--)
    {
        maxa = a[0];
        maxindex = 0;
        for (int j = 1; j <= i; j++)
        {
            if (a[j] > maxa)
            {
                maxa = a[j];
                maxindex = j;
            }
        }
        if (maxindex != i)
        {
            cost += maxa + a[i];
            swap(a[maxindex], a[i]);
        }
    }
    cout << cost << endl;
}

void printarray(int n, int a[])
{
    for (int i = 0; i < n; i++)
    {
        cout << a[i];
        if (i != n - 1)
            cout << " ";
    }
    cout << endl;
}

int gcd(int a, int b)
{
    if (a < b)
    {
        int t = a;
        a = b;
        b = t;
    }
    cout << a << " " << b << endl;
    if (b == 0)
        return a;
    else
        return gcd(b, b % a);
}

ll fib(int x){
    ll a[x+1] = {}; 
    a[0] = 1, a[1] = 1;
    if (x >= 2){
        for (int i = 2; i < x + 1; i++){
            a[i] = a[i-1] + a[i-2];
        }
    }
    return a[x];
}

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

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

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

  int n;
  cin >> n;

  cout << fib(n) << endl;

  return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
long long func(int);
long long fib[45];
int main(void)
{
	int n,i;
	long long x;
	scanf("%d",&n);
	fib[0]=1;	fib[1]=1;
	for(i=2;i<=n;i++)	fib[i]=0;
	x=func(n);
	printf("%lld\n",x);
	return 0;
}
long long func(int nn)
{
	long long x;
	if(nn<2)	return fib[nn];
	else {
		if(fib[nn]==0)	{
			x=func(nn-1)+func(nn-2);
			fib[nn]=x;
			return x;
		}
		else return fib[nn];
	}
}

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

#define REP(i, s, n) for (int i = s; i < n; i++)
#define rep(i, n) REP(i, 0, n)

using namespace std;

int fib(int n){
    if(n <= 1 ) return 1;

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


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

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

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

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

C++: #include <iostream>
#include <stdlib.h>
 
using namespace std;
 
#define MAX_N 44

class Fib{
private:
  int size;
  int *A;
public:
  Fib(int size){
    this->size = size;
    makeFib();
  }

  int getFib(int n){
    return A[n];
  }

  void makeFib(){
    int i;
    this->A = (int*)malloc(sizeof(int)*this->size);
    this->A[0] = 1;
    this->A[1] = 1;
    for(i = 2;i < sizeof(this->A);i++){
      this->A[i] = this->A[i-2]+this->A[i-1];
    }
  }

  ~Fib(){
    free(A);
  }
};
 
int main(){
 
    int n;
    Fib *fib = new Fib(MAX_N); 

    cin >> n;
 
    cout << fib->getFib(n) << endl;
 
    delete fib;

    return 0;
}