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 main()
{
        int n;
        cin >> n;
        if (n <= 1) {
                cout << 1;
                return 0;
        }

        int *fib = new int[n + 1];
        fib[0] = fib[1] = 1;
        for (int i = 2; i <= n; i++) {
                fib[i] = fib[i - 1] + fib[i - 2];
        }
        cout << fib[n];
        delete [] fib;

        return 0;
}

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

int main() {
    int n, dp[45];
    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] << endl;
}

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

int main()
{
	int n;
	scanf("%d", &n);
	std::vector<int64_t> table(n + 1, 1ll);
	for (int i{2}; i <= n; i++)
		table[i] = table[i - 1] + table[i - 2];
	printf("%lld\n", table[n]);

	return 0;
}

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

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

    int first = 1;
    int second = 1;
    
    for (int i = 2; i < input; ++i) {
        int third = first + second;
        first = second;
        second = third;
    }
    cout << second;
    
    return 0;
}

C++: #include<iostream>
int dp[1000000];
int main(){
	int n;
	std::cin>>n;
	dp[0]=1;
	dp[1]=1;
	for(int i=2;i<=n;i++){
		dp[i]=dp[i-1]+dp[i-2];
	}
	std::cout<<dp[n]<<"\n";
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

using namespace std;

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(){
    vector<ll> fib(50);
    rep(i, 50) {
        if(i == 0 || i == 1) {
            fib[i] = 1;
        } else {
            fib[i] = fib[i-1] + fib[i-2];
        }
    }
    int n; cin >> n;
    cout << fib[n] << endl;
}

C++: #include<stdio.h>
#include<cstdlib>

#define MAX 44

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

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

  printf("%d\n", fibonacci(n));
}

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

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

  // n???0???1?????£?????????????????????
  if(n <= 1){ cout << 1 << endl; }
  else{
    // n???2??\????????£??????dp??????
    vector<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 << n << endl;
  }

  return 0;
}

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

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

int main(void){
	int l;
  	cin>>l;
    cout<<feb(l)<<endl;
	return 0;
}

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


int a[50];
using namespace std;


int fibonacci(int n) {
	if (a[n] > 0)
		return a[n];

	a[n] = fibonacci(n-1) + fibonacci(n-2);
	return a[n];
}


int main() {

	fill(a,a + 50, -1);

	int n;

	cin >> n;

	a[0] =  1;
	a[1] =  1;

	cout << fibonacci(n) << endl;

}

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

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

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

  return 0;
}

C++: #include <stdio.h>
int main(){
int a[50],n;
a[0]=a[1]=1;
scanf("%d",&n);
for(int i=2;i<=n;i++)
a[i]=a[i-1]+a[i-2];
printf("%d\n",a[n]);
}

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

using namespace std;

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

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

C++: #include <iostream>

using namespace std;

int cache[45];

int fibonacci(int n) {
    if (cache[n] != -1) {
        return cache[n];
    } else {
        int ret = fibonacci(n - 1) + fibonacci(n - 2);
        cache[n] = ret;
        return ret;
    }
}

int main() {
    for (int i = 0; i < 45; ++i)
        cache[i] = -1;
    cache[0] = cache[1] = 1;

    int n;
    cin >> n;
    cout << fibonacci(n) << '\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 <cstdio>

int main(void) {
    int i, n;
    scanf("%d", &n);
    int fib[n+1];
    fib[0] = fib[1] = 1;
    for (i = 2; i <= n; i++) fib[i] = fib[i-2] + fib[i-1];
    printf("%d\n", fib[n]);

    return 0;
}

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

using Lint=long long;

int main()
{
   int N; cin>>N;
   vector<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];
   cout<<dp[N]<<endl;
   return 0;
}

C++: #include<stdio.h>

int A[44];

void fibo(int n){
    A[0] = 1;
    A[1] = 1;
    for(int i=2; i<=n; i++){
        A[i] = A[i-1] + A[i-2]; //メモ化
    }
}

int main(){

    int n;
    scanf("%d", &n);

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