Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	f := make([]int, n+1)

	fmt.Println(fib(n, f))
}

func fib(n int, f []int) int {
	if n == 0 {
		f[n] = 1
		return f[n]
	}
	if n == 1 {
		f[n] = 1
		return 1
	}

	if f[n] != 0 {
		return f[n]
	}

	f[n] = fib(n-2, f) + fib(n-1, f)
	return f[n]
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int fib[100];

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

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

   return 0;
}

C++: #include <iostream>

using namespace std;

int fib(int n);

int main() {
    int n;
    int dp[45];

    //?????????
    /* ??????3-1 */
    dp[0] = 1;
    /* ??????3-2 */
    dp[1] = 1

    //??\???
    cin >> n;

    //DP
    for (int i = 2; i <= n; i++) {
        /* ??????3-3 */
        dp[i] = dp[i-1] + dp[i-2];
    }

    //??????
    cout << dp[n] << endl;

    return 0;
}

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
// #define SORT(v, n) stable_sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

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

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

    return 0;
}

C++: /*
    Problem 34
    https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_10_A
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    vector<ll> fib(n+1);
    fib[0] = 1, fib[1] = 1;
    for (int i = 2; i <= n; i++) fib[i] = fib[i-1] + fib[i-2];
    cout << fib[n] << '\n';
}

C++: #include <cstdio>

int dp[44];
bool dpf[44] = { false };

int fib(int n){
	if(n == 0 || n == 1) return dp[n] = 1;
	if(dpf[n] == true) return dp[n];
	dpf[n] = true;
	return dp[n] = fib(n-1)+fib(n-2);
}

int main(){
	int n;
	scanf("%d", &n);
	printf("%d\n", fib(n));
	return 0;
}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;

int dp[100];
int N;

int main() {
	cin >> N;
	rep(i, N+1){
		if(i == 0 || i == 1) dp[i] = 1;
		else dp[i] = dp[i-2] + dp[i+1];
	}
	cout << dp[N] << endl;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	vector<long long>Fib(45);
	Fib.at(0) = 1;
	Fib.at(1) = 1;
	for (int i = 2; i < 45; i++) {
		Fib.at(i) = Fib.at(i - 2) + Fib.at(i - 1);
	}
	int N;
	cin >> N;
	cout << Fib.at(N) << endl;
}

C++: #include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

vector<long> dp(10000);

int main () {
    int n;
    cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i++ ) {
        dp[i] = dp[i - 1] + dp[i - 2];
    }
    printf("%ld\n", dp[n]);
}

C++: #include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
//using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
const double PI = acos(-1.0);

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

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

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <functional>
#include <stack>
#define PI 3.1415926535
#define INF 114514810
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)

using namespace std;

int n;

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

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

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


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

int main()
{
    int C;

    cin >> C;

    cout << fibonacci(C) << endl;

    return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);

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

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