Go: package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	return scanInt(sc)
}

func resolve(n int) int {
	dp := make([]int, n+1)
	dp[0], dp[1] = 1, 1
	for i := 2; i <= n; i++ {
		dp[i] = dp[i-1] + dp[i-2]
	}
	return dp[n]
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

C++: /*
    フィボナッチ数列
    https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/10/ALDS1_10_A
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

ll fibonacci(ll n) {
    if (n == 0 || n == 1)
        return 1;

    ll n1 = 1, n2 = 1, n3 = 0;
    n3 = n1 + n2;
    for (ll i = 0; i < n - 2; i++) {
        n1 = n2;
        n2 = n3;
        n3 = n1 + n2;
    }
    return n3;
}

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

    ll n;
    cin >> n;

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

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e16;
const int MOD = 1e9+7;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vi memo(100, 0);

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

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n; cin >> n;
    memo[0] = memo[1] = 1;
    cout << fib(n) << endl;
}

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

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

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

int solve(int n, vector<int> &v)
{
  if(v[n] == 0)
    v[n] = solve(n-1, v) + solve(n-2, v);
  return v[n];
}

int main()
{
  vector<int> fib(45);
  fib[0] = fib[1] = 1;
  int n; cin>>n;
  solve(n, fib);
  cout << fib[n]<<"\n";
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <bitset>

/*----------------------------------------------------------------*/

using ld = long double;
using vld = std::vector<ld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using str = std::string;
using vstr = std::vector<str>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;

/*----------------------------------------------------------------*/

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<typename T> T sqr(T a) { return a * a; }

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m != 0 ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; sqr(i) <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}

/*----------------------------------------------------------------*/

void solve();

/*----------------------------------------------------------------*/

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

    solve();
}

void solve() {
    vll fib(45, 1);
    for (ll i = 2; i < 45; i++)
        fib[i] = fib[i - 1] + fib[i - 2];

    ll n; std::cin >> n;

    std::cout << fib[n] << '\n';
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll n,s[45];
int main(void){
    cin>>n;
    s[0]=1;
    s[1]=1;
    for(int i=2;i<=44;i++){
        s[i]=s[i-1]+s[i-2];
    }
    cout<<s[n]<<endl;
}

C++: #include <stdio.h>

#define N 44

int F[N];
int n;

int  fib(int n){
	if(n==0 || n == 1)
		return 1;

	if(F[n] != 0) return F[n];

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

int main(){
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		F[i] = 0;
	}
	fib(n);
	printf("%d\n",fib(n));
}

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

int fib(int n){
	if(n <= 1) return 1;
	return fib(n - 1) + fib(n - 2);
}

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

C++: //フィボナッチ数列
#include <iostream>

using namespace std;

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

	return 0;
}

C++: #define scanf_s scanf
#include <iostream>
using namespace std;
int fib(int n) 
{
	if (n >= 0) {
		if (n <= 1) return 1;
		return fib(n - 1) + fib(n - 2);
	}
}
int main(void)
{
	int n;
	scanf_s("%d", &n);
	printf("%d", fib(n));
}

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

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

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

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 1;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scanf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;

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