Go: package main

/*
フィボナッチ数列
*/

import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func fibWithMemo(n int, memo map[int]int) int {
	if n == 0 || n == 1 {
		return 1
	}
	if val, ok := memo[n]; ok {
		return val
	}
	memo[n] = fibWithMemo(n-1, memo) + fibWithMemo(n-2, memo)
	return memo[n]
}

func fib(n int) int {
	memo := make(map[int]int)
	return fibWithMemo(n, memo)
}

func main() {
	scanner := makeScanner(1024)
	n := eGetInt(scanner)
	fmt.Println(fib(n))
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}

type ints []int

func (s ints) String() string {
	var buf bytes.Buffer
	buf.WriteString("[")
	sep := ""
	for _, v := range s {
		buf.WriteString(fmt.Sprintf("%s%d", sep, v))
		sep = ", "
	}
	buf.WriteString("]")
	return buf.String()
}

func reverse(a ints) ints {
	r := make(ints, len(a))
	for i := 0; i < len(a); i++ {
		r[i] = a[len(a)-1-i]
	}
	return r
}
func max(a ints) (int, bool) {
	if len(a) == 0 {
		return 0, false
	}
	m := a[0]
	for _, e := range a {
		if e > m {
			m = e
		}
	}
	return m, true
}
func min(a []int) int {
	m := a[0]
	for _, v := range a {
		if v < m {
			m = v
		}
	}
	return m
}

func sum(a ints) int {
	if len(a) == 0 {
		return 0
	}
	sum := 0
	for _, e := range a {
		sum += e
	}
	return sum
}
func find(n int, a ints) int {
	for i, v := range a {
		if n == v {
			return i
		}
	}
	return -1
}

C++: #include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  vi fib(50, -1);
  fib.at(0) = 1;
  fib.at(1) = 1;

  for(int i = 2; i <= n; i++){
    fib.at(i) = fib.at(i-1) + fib.at(i-2);
  }
  cout << fib.at(n) << endl;
}

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

const int N = 102;

long m[N][N], p[N+1];

int matrixChainOrder(int n){

  for(int i=1; i<n; i++){ m[i][i] = 0; }

  for(int l=2; l<n; l++){
    for(int i=1; i < n - l + 1; i++){
      int j = i+l-1;
      m[i][j] = std::numeric_limits<long>::max();
      for(int k=i; k<=j-1; k++){
        m[i][j] = std::min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
      }
    }
  }
  return m[1][n - 1];
}

int main(){
  int n ;
  std::cin >> n; //number of matrix

  for(int i=1; i<=n; i++){
    std::cin >> p[i-1] >> p[i];
  }
  // for (int i = 0; i <=n; ++i) std::cout << p[i] << std::endl;
  std::cout << matrixChainOrder(n + 1) << std::endl;

  return 0;
}

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

int n;
int dp[44];

int fibo(int i){
  if(dp[i] != 0) return dp[i];
  else if(i == 0 || i == 1) return 1;
  else{
    return dp[i] = fibo(i-1) + fibo(i-2);
  }
}

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

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

ll F[45];
ll fibonacci(ll n) {
  if(n < 2)
    return F[n] = 1;
  if(F[n])
    return F[n];
  return F[n] = fibonacci(n-1) + fibonacci(n-2);
}
int main() {
  ll n;
  cin >> n;
  cout << fibonacci(n) << endl;
}

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

int main(int argc,char* argv[]){
  int a=1,b=1,x,n;
  cin>>n;

  for(int i=2;i<=n;i++){
    x=a+b;
    a=b;
    b=x;
  }
  cout<<x<<endl;
  return 0;
}

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

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

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

#define MAX 50

int dp[MAX];

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

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

  cout << fib(n) << endl;

  return 0;
}

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

int main(){
	int fib[45];
	int n;

	cin >>n;

	fib[0] = 1;
	fib[1] = 1;

	if(n == 0)
		cout <<fib[0] <<endl;
	else if(n == 1)
		cout <<fib[1] <<endl;
	else{
		for(int i=2;i<=n;i++){
			fib[i] = fib[i-1] + fib[i-2];
		}
		cout <<fib[n] <<endl;
	}
	return 0;
}

C++: #inclue<stdio>
#include<stream>
using namespace std;

int fibo(int x) {
  int a;
  if ( x == 0 ) return 1;
  if ( x == 1 ) return 1;
  a = fibo(x-1) + fibo(x-2);
  return a;
}

int main() {
  int x, y;

  cin >> x;

  y = fibo(x);

  cout << y << endl;

  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
int F[45];
F[0] = 1;
F[1] = 1;
int n;
cin >> n;
for (int i = 2; i <= n; i++) {
F[i] = F[i - 1] + F[i - 2];
}
cout << F[n] << endl;
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
#define MAX_N 45
int dp[MAX_N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    dp[0] = dp[1] = 1;
    for (int i = 2; i < n + 1; i++) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    cout << dp[n] << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;



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

C++: #include <iostream>

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

    int r1 = 1;
    int r2 = 1;
    int result = 1;

    if (n == 1) {
        std::cout << 1 << std::endl;
    } else {
        for (int i = 1; i < n; i++) {
            int tmp = r1;
            r1 = r2;
            r2 = result;
            result += r1;
        }
        std::cout << result << std::endl;
    }
}

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

int main(){
  int f[45];

  f[0] = 1;
  f[1] = 1;
  for( int i = 2; i < 45; i++ ){
    f[i] = f[i - 1] + f[i - 2];
  }

  int n; cin >> n;
  cout << f[n] << endl;
}