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;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n;cin>>n;
  ll fib[50];
  fib[0]=fib[1]=1;
  rep(i,2,50){
    fib[i]=fib[i-1]+fib[i-2];
  }

  out(fib[n]);

  return 0;
}

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

ll memo[55];

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

int main() {
    fib(50);
    int n;
    cin >> n;
    cout << memo[n] << endl;
}

C++: #include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
int main() {
  int n;
  int dp[44] = {};
  cin >> n;
  dp[1] = dp[0] = 1;

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

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


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

    return fib[n];
}

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

    cout << fibonacci(n) <<endl;

    return 0;
}

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

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

C++: #include <iostream>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define NIL -1
#define MAX 10000

int dp[50];


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

int main()
{
    int n;
    rep(i, 50) dp[i] = -1;

    cin >> n;
    cout << fibonacci(n) << endl;

    return 0;
}

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

void make_fib(vector<int>& fib){
  for(int i=2; i<fib.size(); i++){
    fib[i] = fib[i-1] + fib[i-2];
  }
}

int main(){
  vector<int> fib(50,1);
  make_fib(fib);
  int n; cin >> n;
  cout << fib[n] << "\n";
}

C++: #include <cstdio>

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

int
main ()
{
    int n;
    int dp[50];
    for (int i=0; i<50; i++) dp[i] = -1;
    scanf("%d", &n);
    printf("%d\n", fibo(n, dp));
    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<climits>
#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++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

#define max 44

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

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

C++: #include<iostream>
using namespace std;
  
typedef long long hyper;
  
hyper fib(int n)
{
    if(n < 2) return 1;
    if(n == 2) return 2;
    if(n == 3) return 3;
    return 3 * fib(n - 2) - fib(n - 4);
}
   
int main()
{
    int n;
    cin >> n;
    cout << fib(n) << endl;
    return 0;
}

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

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

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