Go: package main

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

const max int = 44
var ans []int = make([]int, max+1)

func generateFib() {
	ans[0] = 1
	ans[1] = 1
	for i:=2; i<=max; i++ {
		ans[i] = ans[i-1] + ans[i-2]
	}
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	i := nextInt(scanner)
	generateFib()
	fmt.Printf("%d\n", ans[i])
}

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

vector<int> fibonatti;
long long int  dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::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(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;
}

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

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

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

C++: #include <bits/stdc++.h>
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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    int n;
    cin >> n;
    vector<ll> fib(1000);
    fib[0] = fib[1] = 1;
    rep(i, 50) fib[i + 2] = fib[i + 1] + fib[i];
    cout << fib[n] << endl;
}

C++: //递归求第n个斐波那契数列
#include<iostream>
using namespace std;

int F[50];
//记忆化递归生成斐波那契数列 
/*int fibonacci(int n)
{
	if(n==1||n==2)
		return F[n]=1;
	if(F[n])
		return F[n];
	else return F[n]=fibonacci(n-1)+fibonacci(n-2);
}*/
//动态规划法生成斐波那契数列
/*
int fibonacci(int n)
{
	if(n==0||n==1)
		F[n]=1;
	for(int i=2;i<n;i++)
	{
		F[i]=F[i-1]+F[i-2];		
	}	
} */
int main()
{
	int n;
	cin>>n;
	F[0]=F[1]=1;
	for(int i=2;i<=n;i++)
	{
		F[i]=F[i-1]+F[i-2];		
	}
	//int result=fibonacci(n);
	cout<<F[n]<<endl;
	return 0;
}

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

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

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

long long fib(int n){
    long long  a = 1, b = 1, tmp = 0;
    while (n--){
        tmp = a;
        a += b;
        b = tmp;
    }
    return b;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int dp[45];
int main()
{
    int n;
    cin>>n;
    dp[0]=dp[1]=1;
    for(int i=2;i<=n;i++)
    {
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<"\n";
    return 0;
}

C++: // C++ Program to find n'th fibonacci Number in 
// with O(Log n) arithmatic operations 
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll;
  
const int MAX = 1000; 

int f[MAX] = {0}; 
  

ll fib(ll n) { 
    if (n == 0) return 0; 
    if (n == 1 || n == 2) return (f[n] = 1); 

    if (f[n]) return f[n]; 
    int k = (n & 1)? (n+1)/2 : n/2; 
    f[n] = (n & 1)? (fib(k)*fib(k) + fib(k-1)*fib(k-1)) : (2*fib(k-1) + fib(k))*fib(k); 
    return f[n]; 
} 
  
/* Driver program to test above function */
int main() { 
    ll n; cin >> n; 
    cout << fib(n+1) << endl;
    return 0; 
}

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<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];
    }
}