Go: package main

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

const max int = 44
var ans []int = make([]int, max+1)

func generateFib() {
	ans[0] = 1
	ans[1] = 1
	for i:=2; i<=max; i++ {
		ans[i] = ans[i-1] + ans[i-2]
	}
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	i := nextInt(scanner)
	generateFib()
	fmt.Printf("%d\n", ans[i])
}

C++: /*
** 斐波那契数列 使用动态规划来避免重复的计算
*/

# include <cstdio>
# include <cstring>

const int MAX = 44 + 5;

int n, dp[MAX];

// 记忆化递归 
/*
int fib(int i) {
    if (dp[i] != 0) {
        return dp[i];
    }
    if (i <= 1) {
        return 1;
    }
    dp[i] = fib(i - 1) + fib(i - 2);
    return dp[i];
}
*/

// 动态规划

int fib(int t) {
    dp[0] = dp[1] = 1;
    for (int i = 2; i <= t; i++) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    return dp[t];
}

void solve() {
    scanf("%d", &n);
    memset(dp, 0, sizeof(dp));
    printf("%d\n", fib(n));
}

int main() {
    // freopen("infile", "r", stdin);
    // freopen("outfile", "w", stdout);
    solve();
    return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;

template<typename Integral = int> Integral fibonacci(const int &n) {
  static std::vector<Integral> dp(2, 1);
  int prev = dp.size();
  if (prev < n + 1) {
    dp.resize(n + 1);
    loop(i, prev, dp.size()) dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

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

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

int main(void){
	int a=0, b=1, n;
	cin>>n;
	if (n<0) return NULL;

	for (int i=-1; i<n; i++){
		a += b;
		swap(a,b);
	}
	cout<<a<<endl;
	return 0;
}

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

using namespace std;

long long fib(long long n, vector<long long>& memo) {
    if (memo[n] >= 0) {
        return memo[n];
    }

    if (n == 0) {
        return 1;
    }
    else if (n == 1) {
        return 1;
    }
    else {
        long long ret = fib(n - 1, memo) + fib(n - 2, memo);
        memo[n] = ret;
        return ret;
    }
}

void Main() {
    long long n;
    cin >> n;

    vector<long long> memo(n + 10, -1LL);
    memo[0] = 1;
    memo[1] = 1;
    long long ans = fib(n, memo);
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

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

typedef long long ll;

ll table[45];
bool flg[45];

ll fib(int n){
    if(flg[n])return table[n];
    else{
        flg[n]=true;
        return table[n]=fib(n-1)+fib(n-2);
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    table[0]=table[1]=1;
    flg[0]=flg[1]=true;
    int n;
    cin >> n;
    cout << fib(n) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
//using ll = long long;
#define MAX 100

int main(void) {
  int n;
  cin >> n;
  
  vector<int> F(50);
  F.at(0) = F.at(1) = 1;
  for (int i = 2; i <= n; i++) F.at(i) = F.at(i-1) + F.at(i-2);

  cout << F.at(n) << endl;


}

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

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define _shv(v) for (auto _t1 : v) cerr << _t1 << " "; cerr << endl;
#define dbg(x) cerr << #x << ": " << (x) << endl;
#define dbgv(v) cerr << #v << ": "; _shv(v);
#define dbgm(m) cerr << #m << ":" << endl; for (auto _t2 : m) { _shv(_t2); }

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }
template<typename T> inline void prt(T x) { cout << (x) << endl; }
template<typename T> inline void prtv(T& v) { for (auto t : v) cout << t << " "; cout << endl; }
template<typename T> inline void prtl(T& v) { for (auto t : v) cout << t << endl; }
template<typename T> inline T pop(stack<T>& x) { T t = x.top(); x.pop(); return t; }
template<typename T> inline T pop(queue<T>& x) { T t = x.front(); x.pop(); return t; }
template<typename T> inline T pop(priority_queue<T>& x) { T t = x.top(); x.pop(); return t; }
template<typename T> inline int sz(T& x) { return x.size(); }
template<typename T> inline ll pow2(T n) { return 1ll << n; }
template<typename T, typename U> inline int bit(T x, U n) { return x >> n & 1; }

template<typename T, typename U>
inline void getv(T& v, U n) { v = T(n); rep(i, n) cin >> v[i]; }
template<typename T, typename U>
inline void inv(T& v, U n) { v = T(n); rep(i, n) { cin >> v[i]; v[i]--; } }
template<typename T, typename U>
inline void getm(T& v, U r, U c) { v = T(r); rep(i, r) getv(v[i], c); }
template<typename T, typename U>
inline void inm(T& v, U r, U c) { v = T(r); rep(i, r) inv(v[i], c); }
template<typename T, typename U>
inline bool cmax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool cmin(T& m, U x) { if (m > x) { m = x; return true; } return false; }


int main() {
    int n;
    cin >> n;
    if (n <= 1) {
        prt(1);
        return 0;
    }
    vl f(n + 1, 1);
    repp(i, 2, n) {
        f[i] = f[i - 1] + f[i - 2];
    }
    prt(f[n]);

    return 0;
}

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

vector<int> dp;

int fib(int n){
    if(dp[n]!=-1){
        return dp[n];
    }else{
        dp[n]=fib(n-1)+fib(n-2);
        return dp[n];
    }
}

int main(){
    int n; cin >> n;
    dp.assign(n+1,-1);
    dp[0]=1;
    dp[1]=1;
    cout << fib(n) << endl;
}
//g++ -o proa.exe proa.cpp

//VSCなら./test
//Atomならtest.exe