Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

C++: #include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


mat mul(mat &A, mat &B){
    mat C(A.size(), vll(B[0].size()));
    rep(i,A.size()){
        rep(k,B.size()){
            rep(j,B[0].size()){
                C[i][j]=(C[i][j]+A[i][k]*B[k][j]);
            }
        }
    }
    return C;
}

mat pow(mat A,ll n){
    mat B(A.size(), vll(A.size()));
    rep(i,A.size()){
        B[i][i]=1;
    }
    while(n>0){
        if(n&1) B=mul(B,A);
        A=mul(A,A);
        n>>=1;
    }
    return B;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    mat A(2,vll(2));
    A[0][0]=1,A[0][1]=1,A[1][0]=1,A[1][1]=0;
    A=pow(A,n);
    mat v(1,vll(2));
    v[0][0]=1,v[0][1]=1;
    A=mul(A,v);
    cout<<A[0][0]<<endl;
    return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
    int n; cin >> n;
    vector<ll> dp(n + 1);
    dp[0] = 1, dp[1] = 1;

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

C++: #include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
#define F first
#define S second
#define MK make_pair
const ll E=1e17+7;
const ll MOD=1000000007;




int main(){
    ll n;
    cin>>n;
    vector<ll> a={1,1};
    for(int i=2;i<=44;i++){
        a.push_back(a[i-1]+a[i-2]);
    }
    cout<<a[n]<<endl;
    
    return 0;
}

C++: #include <stdio.h>
int main()
{
    int x;
    int f[100];
    f[0]=f[1]=1;
    scanf("%d",&x);
    for(int i=2;i<=x;i++){
      f[i]=f[i-1]+f[i-2];
    }
    printf("%d\n",f[x]);
    return 0;
}

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

C++: #include<cstdio>
#include<iostream>
using namespace std;
int main()
{
  int n;
  scanf("%d", &n);
  int A[50];
  A[0] = A[1] = 1;
  for(int i=2; i<=n; i++)
  {
    A[i] = A[i-1] + A[i-2];
  }
  printf("%d\n", A[n]);//dynamic programing;


  return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vll F;
ll Fib(ll n){
	if(F[n]>0) return F[n];
	return F[n]=Fib(n-1)+Fib(n-2);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	F.resize(50,-1);
	F[0]=F[1]=1;

	out(Fib(N));
	return 0;
}

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

C++: #include <iostream>

#define N 50

int dp[N];

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

int main() {
    int n;
    std::cin>>n;
    std::cout << fibonacci(n) << std::endl;
}

C++: #include <iostream>

using namespace std;

int A[128];
int fib(int n){
  A[0] =1;
  A[1] =2
  for(int i=2;i<44;++i){
    A[i] =A[i-1];
    if(i>1)A[i]+=A[i-2];
  }
  return A[n-1];

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

C++: #include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int dp [50] ;
int fib(int x){
    if(x == 1 || x == 0){
        return 1 ;
    }
    if(dp[x]>0){
        return dp[x] ;
    }
    dp[x] = fib(x-1) + fib(x-2) ;
    return fib(x-1) + fib(x-2) ;
}
int main() {
    int n ;
    cin >> n ;
    int ans = fib(n) ;
    cout << ans << endl ; 
}

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

typedef unsigned long long ull;
unsigned long long m[44]={0};


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

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

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

const int MAX = 44;
int MEM[MAX];

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

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

  for (int i = 0; i <= MAX; i++) MEM[i] = -1;

  int i;
  cin >> i;

  cout << fibonacci(i) << endl;

  return 0;
}