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>
using namespace std;
#define MAX 44

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

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

  return 0;
}

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

int F[45];
int fibonacci(int n)
{
    if(n==0||n==1)
        return F[n] = 1;
    else if(F[n]!=-1)
    {
        return F[n];
    }
    return F[n] = fibonacci(n-1)+fibonacci(n-2);
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0; i < 45; i++)
    {
        F[i] = -1;
    }
    printf("%d\n",fibonacci(n));
}

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

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

C++: // -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_10_A: Fibonacci Number

#include <algorithm>
#include <cstdio>

#define NDEBUG
#include <cassert>

class Fibonnacci {
  static const unsigned int N = 44u;
  unsigned int n_;
  unsigned long* f_;

public:
  Fibonnacci(unsigned int n = N) : n_(std::max(1u, n))
  {
    f_ = new unsigned long[n_+1];
    f_[0] = f_[1] = 1;
    for (auto i = 2u; i <= n; ++i) {
      f_[i] = f_[i-1] + f_[i-2];
    }
  }

  ~Fibonnacci() { delete[] f_; }
  
  unsigned long operator () (unsigned int n) const
  {
    assert(n <= n_);
    return f_[n];
  }
};

int main()
{
  unsigned int n;
  std::scanf("%u", &n);
  Fibonnacci fib;
  std::printf("%lu\n", fib(n));
}

// eof

C++: #include <iostream>
using namespace std;
int solution(int n){
    if(n==0) return 1;
    if(n==1) return 1;
    int one=1,two=1,tmp;
    for(int i=1;i<n;i++){
    tmp = two;
    two = two+one;
    one = tmp;
}
    return two;
}

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

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

int fib(int i) {
    if (i == 0) return 1;
    if (i == 1) return 1;
    return fib(i - 1) + fib(i - 2);
}

int main() {

    int n;
    cin >> n;

    cout << fib(n) << endl;

    return 0;
}

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

vector<int> a(100);

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

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

  cout << fibonacci(n) << endl;

  return 0;
}

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

using ull = unsigned long long;
using us = unsigned short;
constexpr us n_max = 44;
ull fib(us n);

std::array<int, n_max> memo{};
/* ref: http://nonbiri-tereka.hatenablog.com/entry/2014/07/01/123518 */

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

ull fib(us n) {
    if (n <= 1)
        return 1;
    else if (memo[n] != 0)
        return memo[n];
    else {
        memo[n] = fib(n - 1) + fib(n - 2);
        return memo[n];
    }
}

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

using namespace std;
vector<int> dp(50, -1);

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

int main(void) {
    int n;
    scanf("%d", &n);

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

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

int main() {
   int N; cin >> N;
   vector<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.at(N) << endl;
}

C++: #include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<ll> f(n + 1, 1);
    rep(i, n - 1) f[i + 2] = f[i] + f[i + 1];
    cout << f[n] << "\n";
}

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

typedef vector<vector<ll> > mat;

//行列累乗
// mat は vector<vectorのこと

// A*B　の　計算
mat mul( mat &A, mat &B){
 mat  C(A.size(), vector<ll>(B[0].size()));
 for(ll i = 0; i < A.size(); i++){
   for(ll k = 0; k < B.size(); k++){
     for(ll j = 0; j < B[0].size();j++){
       C[i][j] = (C[i][j]+A[i][k]*B[k][j]);
     }
   }
 }
return C;
}

// A^nの計算

mat pow(mat A, ll n){
  mat B(A.size(), vector<ll>(A.size()));
  
  for(int i = 0; i < A.size(); i++){
    B[i][i] = 1;}
 
  while( n > 0){
    if( n & 1){  
      B = mul(B,A);}
      A = mul(A,A);
      n >>= 1;
    }
    
    return B;
  }
  
  ll N;
  
int main(){
  cin >> N;
 
  mat A(2,vector<ll>(2));
  A[0][0] = 1LL; A[0][1] = 1LL; A[1][0] = 1LL; A[1][1] = 0LL;
  cout << pow(A,N+1)[1][0] << endl; return 0;}

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

int main()
{
  int n;
  cin >> n;
  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];
  }
  
  printf("%d\n",dp[n]);
  return 0;
}

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

int main()
{
	int n,x1=1,x2=1,tmp;
	cin >> n;
	
	if(n==0||n==1) cout << "1";
	else{
		for(;n>2;n--){
			tmp=x1+x2;
			x1=x2;
			x2=tmp;
		}
		cout << x1 + x2 << endl;
	}
	
	return 0;
	
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int f[45];
int fib(int n){
  if(n==1||n==0)return 1;
  if(f[n]!=0)return f[n];
  else 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;
main(){
  int a[44],n;
  a[0]=a[1]=1;
  cin>>n;
  for(int i=2;i<=n;i++)a[i]=a[i-1]+a[i-2];
  cout<<a[n]<<endl; 
}

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


int main()
{
    int n;
    cin >> n;
    int f1 = 1, f2 = 1;
    int temp;
    if(n == 0 && n == 1){
        cout << 1 << endl;
        return 0;
    }
    for(int i = 0; i < n - 1; i++){
        temp = f2;
        f2 = f1 + f2;
        f1 = temp;
    }
    cout << f2 << endl;
    
    return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

  int n;

  int n1,n2,st;
  //initialize
  n1=1;
  n2=1;
  st=1;
  //load number
  cin >>n;
  //fibonacci
  for(int i=1;i<n;i++){
    st=n1+n2;
    n1=n2;
    n2=st;
  }
  //print
  cout <<st<<endl;
  return 0;
}

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

int main() {
    int n; cin >> n;
    long long a = 0, b = 1;
    while (n--) {
        long long c = a + b;
        a = b;
        b = c;
    }
    cout << b << endl;
}

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

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

  int n; cin >> n;
  vector<int> dp(n+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<iostream>
using namespace std;

int fib(int n){
  switch(n){
  case 0:
    return 1;
  case 1:
    return 1;
  default:
    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 fib[50];

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