Go: package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	num, _ := strconv.Atoi(sc1.Text())
	cache := make([]*int, num+1)
	fmt.Println(fib(num, cache))

}

func fib(n int, cache []*int) int {
	if n <= 1 {
		return 1
	}

 	if cache[n] != nil {
		return *(cache[n])
	}

	result := fib(n -2, cache) + fib(n -1, cache)
	cache[n] = &result
	return result
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: #include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;
const ll MOD = 1000000007;

ll dp[45];

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

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

using i64 = int64_t;

i64 calc_fib(i64 n){
    static vector<i64> memo(n+1);
    if(memo[n] > 0)return memo[n];
    if(n <= 1)return memo[n] = 1;
    return memo[n] = calc_fib(n-1) + calc_fib(n-2);
}

int main(){
    i64 n;
    cin >> n;
    cout << calc_fib(n) << endl;

    return 0;
}

C++: #include <iostream>

using namespace std;

int fib(int n){
	if (n == 1 || n == 0){
		return 1;
	}
	else {
		return fib(n - 1) + fib(n - 2);
	}
}
int main(){
	int n;

	cin >> n;

	cout << fib(n) << endl;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(long long i=0;i<n;++i)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
using namespace std;
int main(){
    long long data[45];
    int n;
    data[0]=1;
    data[1]=1;
    scanf("%d",&n);
    FOR(i,2,n+1) data[i]=data[i-2]+data[i-1];
    printf("%lld\n",data[n]);
    return 0;
}

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

int main(){
	long long f[50];
	f[0]=1;
	f[1]=1;
	
	for(int i=2; i<45; ++i) f[i]=f[i-1]+f[i-2];
	
	int n;
	scanf(" %d", &n);
	cout << f[n] << endl;
}

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

template<unsigned N> struct Fib
{
    enum
    {
        Val = Fib<N - 1>::Val + Fib<N - 2>::Val
    };
};

template<> struct Fib<0> { enum { Val = 0 }; };
template<> struct Fib<1> { enum { Val = 1 }; };


int main()
{
    cout << Fib<10>::Val << endl;
    return 0;
}

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

int n;
int dp[50];

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

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

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef unsigned int UINT;
typedef long long ll;

int fib[50];

void fibfunc()
{

	FOR(i, 2, 50)
	{
		fib[i] = fib[i - 1] + fib[i - 2];
	}

}

int main()
{
	fib[1] = 1;
	fib[0] = 1;
	int n;
	cin >> n;

	fibfunc();

	cout << fib[n] << endl;

	return 0;
}

C++:  #include<stdio.h>

int dp[50];
/*フィボナッチ関数*/
int fib(int n){
  if(n==0||n==1)
    return dp[n]=1;
  if(dp[n]!=-1)return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;

  for(i=0;i<50;i++)
    dp[i]=-1;

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

  return 0;
}

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