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 Fib(int n) {

	long a[50] = { 1, 1 };

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

int main()
{
	int n = 0;

	cin >> n;

	cout << Fib(n) << endl;

	return 0;
}

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

int fib(int n){
	int ans[45] = {1,1},i;
	for(i=1;i<n;i++){
		ans[i] = ans[i-1]+ans[i-2];
	}
	return ans[i];
}

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

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

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

    cout << dp[n] << endl;

    return 0;
}

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;
}