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 int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int n; cin >> n;
  int fib[45]={};
  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;
main(){
  int a[44],n;
  a[0]=a[1]=1;
  for(int i=2;i<=44;i++)a[i]=a[i-1]+a[i-2];
  cin>>n;
  cout<<a[n]<<endl; 
}

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

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

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

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


int main(){
  int fib[N+1];
  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;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;

    map<ll, ll> memo;
    memo[0] = 1;
    memo[1] = 1;
    function<ll(ll)> fib = [&](ll m) {
        if (memo.count(m)) return memo[m];
        return memo[m] = fib(m - 1) + fib(m - 2);
    };
    cout << fib(n) << endl;
}

C++: #include <iostream>
using namespace std;
int dp[45];

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

C++: #include <stdio.h>

 int F[44];
 int fib(int);

 int main(){

   int n;

   scanf("%d",&n);

   printf("%d\n",fib(n));

   return 0;

 }

int fib(int n){

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

  if(F[n]>1)return F[n];

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

}

C++: #include<bits/stdc++.h>
using namespace std;
using ll =long long;
ll dp[50];
ll fib(ll n){
    if(n==0)return dp[0]=1;
    else if(n==1)return dp[1]=1;
    else if(dp[n]!=-1)return dp[n];
    return dp[n]=fib(n-1)+fib(n-2);
}
int main(){
    ll n;
    cin>>n;
    for(int i=0;i<50;i++)dp[i]=-1;
    cout<<fib(n)<<endl;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


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

    cout<<fib[n]<<endl;
}

C++: #include<iostream>
using namespace std;
int main() {
	int fib[50];
	fib[0] = 1;
	fib[1] = 1;
	int n; cin >> n;
	for (int i = 2; i < n + 1; i++){
		fib[i] = fib[i - 1] + fib[i - 2];
	}
	cout << fib[n] << endl;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <cstdio>

int main()
{
    int N;
    int i = 2;

    int now;
    int l1 = 1;
    int l2 = 1;

    scanf("%d", &N);
    if(N < 2){
        printf("%d\n", 1);
        return 0;
    }

    for (;;)
    {
        now = l1 + l2;
        if(i == N){ break; }
        l1 = l2;
        l2 = now;
        i++;
    }

    printf("%d\n", now);
    return 0;
}

C++: 

#include<stdio.h>
#define N 45
 
int main(){
int i,n,F[N];
F[0]=F[1]=1;

for(i=2;i<N;i++){
F[i]=F[i-1]+F[i-2];
}
scanf("%d",&n);
printf("%d\n",a[n]);
return 0;
}

C++: 
f = [-1 for i in range(45)]
f[0] = f[1] = 1

def fib(n):
    global f
    for i in range(2,n+1):
        f[i] = f[i - 1] + f[i - 2]
        #print(i,f[i])
    return f[n]

if __name__ == "__main__":
    n = input("input number: ")
    n = int(n)
    #print(type(n))
    print(fib(n))