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 <iostream>
using namespace std;
int solution(int n){
    if(n==0) return 1;
    if(n==1) return 1;
    return solution(n-1)+solution(n-2);
}

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

C++: #include <iostream>

using namespace std;

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

  // 初期化
  dp[0] = 1;
  dp[1] = 1;

  //入力
  cin >> n;

  // DP
  for(int i = 2; i <= n; i++) dp[i] = dp[i-1] + dp[i-2];

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

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

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

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

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

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

int fibonacci(int i){
  int fib;
  if(i == 0 or i == 1){
    return 1;
  }else{
    fib = fibonacci(i - 1) + fibonacci(i - 2);
    return fib;
  }
  return 0;
}

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

  fn = fibonacci(n);

  cout << fn << endl;

  return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define REP(i, n) for (int i = 0; i < (n); i++)

const ll MOD = 9223372036854775807; // 1e9+7;

vvl initialize(int r, int c) {
  /*
   * r行c列の2次元零行列
   */
  vvl I = vvl(r);
  REP (i, r) {
    I[i] = vl(c, 0);
  }
  return I;
}

vvl mul(vvl A, vvl B) { // A*B
  vvl C = initialize(A.size(), B[0].size());
  REP (i, A.size()) REP (k, B.size()) REP (j, B[0].size()) {
    C[i][j] = (C[i][j] + 1l * A[i][k] * B[k][j]) %MOD;
  }
  return C;
}

vvl pow(vvl A, ll n) { 
  /*
   * Aのn乗の行列
   * Aは正方行列
   */
  int d = A.size();
  vvl B = initialize(d, d);
  REP (i, d) B[i][i] = 1; // Aと同じ次元の単位行列を作成
  while (n > 0) {
    if (n&1) B = mul(A, B);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

ll fibonacci(ll n) {
  vvl A = initialize(2,2);
  A[0][0] = A[0][1] = A[1][0] = 1;
  A[1][1] = 0;
  A = pow(A, n+1);
  return A[1][0];
}

ll n;

int main() {

  cin >> n;
  cout << fibonacci(n) << endl;;
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int d;

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

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

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

int main() {

    int F[44];

    int n;

    cin >> n;

    F[0] = 0;
    F[1] = 1;
    F[2] = 1;
    for(int i = 3; 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;

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int fib[INF];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;

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

C++: #include <stdio.h>
#define N 100
#define M -1
int fib(int);

int array[N];
int main()
{
  int i,n;
  scanf("%d",&n);
  for(i=0;i<N;i++)
    {
      array[i]=M;
    }
  printf("%d\n",fib(n));
}

int fib(int x)
{
  if(x==0||x==1)
    {
      return array[x];
    }
  else if(array[x]!=M) return array[x];
  else
    {
      array[x]=(fib(x-2)+fib(x-1));
    }
}

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

C++: #include <iostream>
using namespace std;
long long fib[50];

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

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

int main(){
  int n,a[2]={1,1};
  cin>>n;

  int c=0;
  for(int i=1;i<n;i++)a[c]=a[0]+a[1],c=!c;
  cout << a[!c]<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int fibo[n + 1] = { 1, 1 };

	for (int i = 2; i <= n; i++) {
		fibo[i] = fibo[i - 1] + fibo[i - 2];
	}
	cout << fibo[n] << endl;

	return 0;
}

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

int n;
vector<int> dp(50, 0);

int solve(int i){
    if(dp[i] > 0) return dp[i];
    if(i == 0) return dp[0] = 1;
    if(i == 1) return dp[1] = 1;
    return dp[i] = solve(i-1) + solve(i-2);
}

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