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++: // input: aldsalds1_10_a.in
#include<iostream>
#define MAX_N 44
#define NIL -1
using namespace std;

int dp[MAX_N];

int fib(int n) {
  if(n == 0 || n == 1)
    return 1;

  if(dp[n] != NIL)
    return dp[n];

  return fib(n-1) + fib(n-2);
}

int main() {
  for(int i=0; i<MAX_N; i++)
    dp[i] = NIL;

  int x;
  cin >> x;

  cout << fib(x) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < (int)(n); i++)
using ull = unsigned long long;
using ll = long long;



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

    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;

long long n;
vector<long long> f;

long long calc(long long x) {
  if(f[x] != -1) return f[x];
  return f[x] = calc(x - 1) + calc(x - 2);
}

int main() {
  cin >> n;
  f.assign(n + 1, -1);
  f[0] = f[1] = 1;
  cout << calc(n) << endl;
  return 0;
}

C++: #include<iostream>
#include <string>
using namespace std;
int a,ans[46];
int main(){
	cin>>a;
	ans[0]=1,ans[1]=2;
	for(int i=0;i<a;i++){
	ans[i+2]=ans[i+1]+ans[i];}
	cout<<ans[a-1]<<endl;
		    return 0;
	}

C++: #include <iostream>
 
using namespace std;
 
typedef unsigned long long ull;
 
auto fib(ull const n) -> ull
{
    return ( n == 1 || n == 0 ) ? n : fib( n - 1 ) + fib( n - 2 );
}
 
int main()
{
    ull n;
    cin >> n;
    cout << fib( n ) << endl;
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

int fib(int n){
  int dp[1000];
  dp[0] = 1;
  dp[1] = 1;

  for(int i = 2; i <= n; i++){
    dp[i] = dp[i-1] + dp[i-2];
  }
  return dp[n];
}

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

int main(){
	
	int n[47];
	n[1]=1;n[2]=2;

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

	cout<<n[44]<<endl;
	return 0;
}

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

#define INF 1e9
vector<int> memo;

int fib(int n){
  if(memo[n] == -INF){ memo[n] = fib(n - 1) + fib(n - 2); }
  return memo[n];
}

int main(void){
  int n;
  cin >> n;
  
  memo = vector<int>(n + 1, -INF);
  memo[0] = memo[1] = 1; 
  
  cout << fib(n) << endl;
  return 0;
}

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

constexpr ll DP_MAX = 1000000;
ll dp[DP_MAX];

int main(int argc, char **argv)
{
	ll n; cin >> n;
	memset(dp, 0, sizeof dp);
	dp[0] = dp[1] = 1;
	for (ll i = 2; i <= n; ++i)
		dp[i] = dp[i-1] + dp[i-2];
	std::cout << dp[n] << std::endl;
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

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

using namespace std;

int main(){
  int n; cin >> n;
  vector<int> fib;
  fib.push_back(0); fib.push_back(1);

  for(int i=0; i<n; i++)
    fib.push_back(fib[i]+fib[i+1]);

  cout << fib.back() << endl;

  return 0;
}

C++: #include <iostream>

using namespace std;

int memo[45];

int fibonacchi(int num)
{
    if (memo[num] != -1) {
        return memo[num];
    } else if (num == 0 || num == 1) {
        memo[num] = 1;
        return memo[num];
    } else {
        int result = fibonacchi(num - 1) + fibonacchi(num - 2);
        memo[num] = result;
        return memo[num];
    }
}

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

    int n;
    cin >> n;
    cout << fibonacchi(n) << '\n';
}

C++: #include<stdio.h>

int main()
{
	int fib1{ 1 }, fib2{ 1 }, n;

	scanf("%d", &n);
	for (int i = 1; i < n; ++i)
	{
		int tmp = fib2;
		fib2 += fib1;
		fib1 = tmp;
	}
	printf("%d\n", fib2);
	return 0;
}