Go: package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	num, _ := strconv.Atoi(sc1.Text())
	cache := make([]*int, num+1)
	fmt.Println(fib(num, cache))

}

func fib(n int, cache []*int) int {
	if n <= 1 {
		return 1
	}

 	if cache[n] != nil {
		return *(cache[n])
	}

	result := fib(n -2, cache) + fib(n -1, cache)
	cache[n] = &result
	return result
}

C++: #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <numeric>
#include <vector>

using namespace std;

int memo[45] = {0};

int fibo(int n){
  if(memo[n] != 0){
    return memo[n];
  }
  if(n == 0){
    memo[0] = 1;
    return memo[0];
  }else if(n == 1){
    memo[1] = 1;
    return memo[1];
  }else{
    memo[n] = fibo(n-1) + fibo(n-2);
    return memo[n];
  }
}


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

  return 0;
}

C++: #include<bits/stdc++.h>
#define INF 1e9
using namespace std;
int num[50];
int fib(int n){
    if(n==0 || n==1) return 1;
    else if(num[n]!=INF) return num[n];
    else return fib(n-1) + fib(n-2);
}
int main(){
    for(int i=0;i<50;i++) num[i]=INF;
    for(int i=0;i<45;i++){
        num[i]=fib(i);
    }
    int n;
    cin>>n;
    cout<<num[n]<<endl;
    return 0;
}

C++: #include <cstdio>

int main() {
	int n;
	int F[50];
	scanf("%d", &n);

	F[0] = 1;
	F[1] = 1;

	for (int i = 2; i <= n; i++) F[i] = F[i - 1] + F[i - 2];

	printf("%d\n", F[n]);
	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int fib(int n);

int memo[45];

int main() {
  int n;

  //入力
  cin >> n;

  // 出力
  cout << fib(n) << endl;

  return 0;
}

int fib(int n){

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

C++: #include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  for(int i=1;i<44;++i){
    A[i] =A[i-1];
    if(i>1)A[i]+=A[i-2];
  }
  return A[n-1];

}

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

C++: #include <iostream>

using namespace std;
int n;
int a[50];

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

C++: #include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int fib(unsigned int n);

int main(void){
    unsigned int n;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cout << fib(n) << endl;
}

int fib(unsigned int n) {
    vector<int> ary(n+1);
    ary[0] = 1;
    ary[1] = 1;
    for(int i = 2; i <= n; ++i) ary[i] = ary[i-1] + ary[i-2];
    return ary[n];
}

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

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

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
using namespace std;
long long mem[50] = {0};
long long fib(int n){
	if (mem[n] != 0) return mem[n];
	if (n == 0 || n == 1){
		mem[n] = 1;
		return 1;
	}
	else{
		mem[n] = fib(n - 1) + fib(n - 2);
		return fib(n - 1) + fib(n - 2);
	}
}
int main(){
	int n;
	cin >> n;
	cout << fib(n) << "\n";
	return 0;
}

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

C++: // DP(???????¨??????? Dynamic Programing)
// ????????±???????????¢???
// ?????£??????????????°???
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
using namespace std;

#define MAX_N 44

struct memo{
    int num;
    bool flg;
}Memo[MAX_N+1];

int n;
int fib(int);

int main()
{
    cin >> n;
    for(int i=0;i<MAX_N+1;++i)
        Memo[i].flg=false;
    cout << fib(n) << endl;
    return 0;
}

int fib(int m){
    if(m == 0){
        if(!Memo[0].flg){
        Memo[0].num=1;
        Memo[0].flg=true;
        }
        return 1;
    }
    if(m == 1){
        if(!Memo[1].flg){
        Memo[1].num=2;
        Memo[1].flg=true;
        }
        return 1;
    }

    if(Memo[m].flg){
        return Memo[m].num;
    }
    else{
        Memo[m].num=fib(m-1) + fib(m-2);
        Memo[m].flg=true;
        return fib(m-1) + fib(m-2);
    }
}

C++: #include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

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

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

int fib(int n);

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

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

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

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

C++: #include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

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

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

int fib(int i){
	if(i == 0 || 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>
using namespace std;

typedef long long hyper

hyper fib(int n)
{
    if(n < 2) return 1;
    if(n == 2) return 2;
    if(n == 3) return 3;
    return 3 * fib(n - 2) + fib(n - 4);
}
 
int main()
{
    int n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}