Go: package main

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

// func fib(n int) int{
// 	if n == 0 || n == 1{
// 		return 1
// 	} else {
// 		return fib(n-1) + fib(n-2)
// 	}
// }

// func main(){
// 	sc := bufio.NewScanner(os.Stdin)
// 	sc.Scan()
// 	n, _ := strconv.Atoi(sc.Text())
// 	fmt.Println(fib(n))
// }

import (
	"fmt"
)

func main(){
	var n, pre1, pre2, now int
	fmt.Scan(&n)
	if n == 0 || n == 1{
		fmt.Println(1)
	} else {
		pre1, pre2 = 1, 1
		for i:=1; i<n; i++{
			now = pre1 + pre2
			pre2 = pre1
			pre1 = now
		}
		fmt.Println(now)
	}

}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int DP[45];

void fibonacci(int n){
    if(DP[n-1]==0){
        fibonacci(n-1);
    }
    if(DP[n-2]==0){
        fibonacci(n-2);
    }
    DP[n] = DP[n-1] + DP[n-2];
}

int main() {
    int n;
    cin>>n;
    DP[0] = 1;
    DP[1] = 1;
    if(n>=2){
        fibonacci(n);
    }
    cout<<DP[n]<<endl;
}

C++: #include <iostream>
using namespace std;
long long dp[45];

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

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

C++: #include <iostream>

int F[45] = {1, 1};

int fib_recurse(int n) {
    if (n < 2) {
        return 1;
    }
    return fib_recurse(n - 1) + fib_recurse(n - 2);
}

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

int fib_dp(int n) {
    if(n < 2) {
        return F[n];
    }
    for (int i = 2; i <= n; i++) {
        F[n] = F[i - 1] + F[i - 2];
    }
}

int main() {
    int n;
    std::cin >> n;
    std::cout << fib_memo(n) << std::endl;
    return 0;
}

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

template <class T> struct Matrix {
  vector<vector<T>> value;
  T init;

  Matrix(vector<vector<T>> vec,T init_) :init(init_), value(vec) {}
  Matrix(int h, int w, T init_) : init(init_) , value(h, vector<T>(w,init_)) {}

  Matrix<T> operator*(Matrix<T>& left) {
      Matrix<T> res(value.size(),left[0].size(),init);
      for(int i = 0;i < value.size();i++){
          for(int k = 0;k < left.size();k++){
              for(int j = 0;j < left[0].size();j++){
                  res[i][j] = (res[i][j] + value[i][k] * left[k][j]);
              }
          }
      }
      return res;
  }

  vector<T>& operator[](int n){
      return value[n];
  }

  size_t size(){
      return value.size();
  }

  Matrix<T> operator^(long long n){
      Matrix<T> a = *this;
      Matrix<T> res(a.size(),a.size(),init);
      for(int i = 0;i < a.size();i++){
          res[i][i] = 1;
      }

      while(n > 0){
          if(n & 1) res = res * a;
          a = a * a;
          n >>= 1;
      }
      return res;
  }
};



int main(){
    int n;
    cin >> n;
    Matrix<int> a({{1,1},{1,0}},0);
    cout << (a ^ (n + 1))[1][0] << endl;
}

C++: #include <iostream>
using namespace std;
int F[100];
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n]<<endl;
}

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>
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>
using namespace std;
int main(){
	int n, t, a = 1, b = 1;
	cin >> n;
	while (n-- > 1)
		t = a, a = b, b += t;
	cout << b << endl;
}

C++: #include <stdio.h>

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

int main()
{
    int n;
    scanf("%d",&n);
    int a[n+1];
    printf("%d\n",fib(a,n));
}

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

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

int main(){
  int n,fibonacci;
  cin >> n;
  fibonacci = fib(n+1);
  cout << fibonacci << endl;
  return 0;
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A
#include <iostream>
using namespace std;

int fibonacci(int n){
    if(n == 0 || n == 1){
        return 1;
    }
    else{
        return fibonacci(n-1)+fibonacci(n-2);
    }
}


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

C++: #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 44
lli F[N]={0};

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

}

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

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

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

    printf("%d\n", result);

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 0;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scnaf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int a[55];
    a[0]=a[1]=1;
    rep(i,50)a[i+2]=a[i+1]+a[i];
    int n;cin>>n;
    cout<<a[n]<<endl;
    return 0;
}

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

int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret != 0) {
        if (num > 1) {
            ret = Fibonatch(num - 1) + Fibonatch(num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};

    scanf("%d", &num);
    result = Fibonatch(ret, num);
}

C++: #include<iostream>
#include<cstdio>
#define Lens 50
using namespace std;

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

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

long long int fib(int, long long int*);
int main(){
  int n; cin >> n;
  long long int fibarray[n+1];
  for(int i=0; i<=n; i++) fibarray[i]=-1;
  cout << fib(n, fibarray) << endl;

  return 0;
}

long long int fib(int n, long long int* array){
  if(array[n]>0) return array[n];
  if(n==1 || n==2){
    return array[n]=1;
  }
  else return fib(n-1, array)+fib(n-2, array);
}