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>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
vector<ll> fibs(100, -1);
ll fib(int n){
    if(fibs[n]!=-1) return fibs[n];
    if(n==0 || n==1) return 1;

    return fibs[n] = fib(n-2) + fib(n-1);
}

int main()
{
    int n; cin >> n;
    pr(fib(n));
    return 0;}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int f1=0,f2=1,n,xx;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
       xx=f2;
        int next = f1 + f2;
        f1 = f2;
        f2 = next;
}
printf("%d\n",f2);
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

vector<lint> Fib{0, 1, 1};
lint fib(int k) {
  if (k < 0) return 0;
  if (k == 0) return 0;
  if (k < 3) return 1;
  if (Fib.size() <= k + 1) {
    Fib.push_back(fib(k - 1) + fib(k - 2) /* % mod */);
  }

  return Fib[k];
}

signed main() {
  cout << fib(in() + 1) << endl;
}

C++: #include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

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

  vector<int> list(n,0);
  list[0] = list[1] = 1;
  

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

  cout << list[n] << eol;
  
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rp(i,j) for(long long i=0;i<j;i++)
#define rep(i,j,k) for(long long i=j;i<k;i++)
#define mod 1000000007
typedef long long ll;
int main(){
    int n;cin>>n;
    int dp[50];
    rp(i,50){
        if(i==0||i==1)dp[i]=1;
        else dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
}

C++: #include "iostream"

using namespace std;

int F[46];

int fib( int n ) {

	if (F[n] != 0) return F[n];

	if (n == 0 || n == 1) F[n] = 1;

	else F[n] = fib(n - 1) + fib(n - 2);

	return F[n];
}

int main() {


	int n;

	cin >> n;

	cout << fib(n) << endl;

	return 0;
}

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

int dp[50];

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

int main(void){
  int n; cin >> n;
  rep(i,50) dp[i] = -1;
  cout << fibonacci(n) << endl;
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int F[50];
    F[0] = 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 main() {
  int FB[45];
  FB[0] = FB[1] = 1;
  int n;
  cin >> n;
  if (n>1) {
    for (int i=2; i<=n; i++) {
      FB[i] = FB[i-1] + FB[i-2];
    }
  }
  cout << FB[n] << endl;
}

C++: #include <iostream>
int F[100];
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n];
}

C++: /**
*    created: 12.05.2020 12:38:55
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    int f[50];
    f[0] = f[1] = 1;
    rep2(i,2,50) {
        f[i] = f[i-1] + f[i-2];
    }
    cout << f[n] << endl;


    return 0;
}

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

int fib(int n){
int i;
int a[25];
a[0]=a[1]=1;
for(i=2;i<=n;i++){
a[i]=a[i-1]+a[i-2];
   }
return a[n];
}

int main(){

int x,n;
scanf("%d",&n);
x=fib(n);
printf("%d",x);

return 0;
}