Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: #include<iostream>

using namespace std;

int fib(int n);

int memo[1000];

int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

int fib(int n){

  if(n==0 || 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>
#include <vector>
#include <stack>
#include <queue>

using namespace std;


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

	int f1 = 1;
	int f2 = 1;
	int f3 = 0;
	for (int i = 2; i <= n; ++i){
		f3 = f1 + f2;
		f1 = f2;
		f2 = f3;
	}
	if (n == 1){
		cout << 1 << endl;
		return;
	}
	if (n == 2){
		cout << 2 << endl;
		return;
	}
	cout << f3 << endl;

	return 0;
}

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

using namespace std;

class Fibonacci{
private:
  vector<int64_t> fibstore;
public:
  Fibonacci(int num){
    for(int i=0;i<=num;i++){
      fibstore.push_back(0);
    }
    if(num>0){
      fibstore.at(0)=1;
      fibstore.at(1)=1;
    }
  }

  int64_t fibcalc(int num){
    if(fibstore.at(num)!=0) return fibstore.at(num);
     int64_t fib1;
     if(fibstore.at(num-1)==0) fibstore.at(num-1)=fibcalc(num-1);
     fib1=fibstore.at(num-1);

     int64_t fib2;
     if(fibstore.at(num-2)==0) fibstore.at(num-2)=fibcalc(num-2);
     fib2=fibstore.at(num-2);
    return fib1+fib2;
  }
};
int main(void){
  int num;
  cin>>num;
  Fibonacci fib(num);
  cout<<fib.fibcalc(num)<<endl;
  return 0;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

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

int main(int argc, char const *argv[]) {
	int n;
	cin >> n;
	int ans = fib(n);
	cout << ans << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> F(50);
    F.at(0) = 1;
    F.at(1) = 1;
    for (int i = 2; i <= n; i++) {
        F.at(i) = F.at(i-1) + F.at(i-2);
    }
    cout << F.at(n) << endl;

    return 0;
}

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

using namespace std;

int main(){
  int n;
  int fibn[1000];
  for(int i=0;i<1000;i++)fibn[i]=-1;
  fibn[0]=fibn[1]=1;
  scanf("%d",&n);
  for(int i=2;i<=n;i++){
    fibn[i]=fibn[i-1]+fibn[i-2];
  }
  cout << fibn[n] << endl;
  return 0;
}

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

vector<long long 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 + 1);
  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 <iostream>
using namespace std;

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

C++: #define PI 3.14159265359
#define INF 2000000000
#define MAX 500000
#include <map>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;
typedef long long ll;

ll F[45]={0};

ll fibo(int n){
    if(F[n]) return F[n];
    if(n==0||n==1) return F[n]=1;
    return F[n]=fibo(n-1)+fibo(n-2);
}

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

C++: #include <cstdint>

using namespace std;

#define MEMO_SIZE 44
int64_t memo[MEMO_SIZE];

void fib_init()
{
  for (uint32_t i = 0; i < MEMO_SIZE; i++) {
    memo[i] = -1;
  }
}

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

#include <iostream>

int32_t main()
{
  fib_init();
  uint32_t i;
  cin >> i;
  cout << fib(i) << endl;
  return 0;
}

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

using namespace std;

int fib(int n);

map<int, int> fib_array;


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

	cout << fib(input) << endl;
	return 0;


}

int fib(int n){
	switch (n)
	{
	case 0:
	case 1:
		return 1;
		break;
	default:
		break;
	}
	
	if (fib_array[n] == 0){
		int new_fib = fib(n - 1) + fib(n - 2);
		fib_array[n] = new_fib;
		return new_fib;
	}
	else{
		return fib_array[n];
	}

}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


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

    vector<ll> fib(n+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;

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
int memo[50];
int fib(int n){
  if(~memo[n]) return memo[n];
  if(n<=1) return 1;
  return memo[n]=(fib(n-1)+fib(n-2));
}
signed main(){
  int n;
  cin>>n;
  memset(memo,-1,sizeof(memo));
  cout<<fib(n)<<endl;
  return 0;
}

C++: /* ALDS1_10_A: Fibonacci Number */

#include <iostream>

const int MAX_N = 440;

long memo[MAX_N] = {};

long fibonacci(int n) {
    switch (n) {
        case 0:
        case 1:
            return 1;
        default:
            if (memo[n])
                return memo[n];
            else
                return memo[n] = fibonacci(n - 1) + fibonacci(n - 2);
    }
}

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