Go: package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	fmt.Println(fibonacci(n, make(map[int]int)))
}

func fibonacci(x int, memo map[int]int) int {
	if x == 0 || x == 1 {
		return 1
	}
	if y, ok := memo[x]; ok {
		return y
	}
	z := fibonacci(x-1, memo) + fibonacci(x-2, memo)
	memo[x] = z
	return z
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

C++: #define _USE_MATH_DEFINES

#include <array>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <utility>
#include <tuple>
#include <algorithm>
#include <limits>
#include <fstream>
#include <numeric>
#include <stack>
#include <queue>
#include <list>
#include <cstring>
#include <unordered_set>
#include <cmath>
#include <iomanip>

namespace
{
	template<int N>
	std::array<int, N> GetValue(std::istream& stream)
	{
		std::string buf;
		std::getline(stream, buf);

		std::stringstream sstr(buf);
		std::array<int, N> retval;

		for (int i = 0; i < N; ++i)
		{
			std::getline(sstr, buf, ' ');
			retval[i] = std::stoi(buf);
		}

		return retval;
	}

	std::vector<int> GetValue(std::istream& stream, int num, char delim)
	{
		std::string buf;
		std::getline(stream, buf);
		std::stringstream sstr(buf);

		std::vector<int> retval;
		retval.reserve(num);

		std::string input;;
		for (int i = 0; i < num && std::getline(sstr, input, delim); ++i)
		{
			retval.push_back(std::stoi(input));
		}

		return retval;
	}

	int GetValue(std::istream& stream)
	{
		int in;
		stream >> in;

		return in;
	}

	std::vector<std::string> GetValueString(std::istream& stream, int num, char delim)
	{
		std::string buf;
		std::vector<std::string> retval;
		retval.reserve(num);

		std::getline(stream, buf);
		std::stringstream sstr(buf);

		for (int i = 0; i < num && std::getline(sstr, buf, delim); ++i)
		{
			retval.push_back(std::move(buf));
		}

		return retval;
	}

	template<typename Itr>
	void PrintLine(Itr begin, Itr end)
	{
		bool first = true;

		for (int i = 0; begin != end; ++begin, ++i)
		{
			if (!first)
			{
				std::cout << ' ';
			}

			std::cout << (*begin);

			first = false;
		}
		std::cout << std::endl;
	}

	template<typename T>
	void Print(const std::vector<T>& sequence)
	{
		for (const auto& e : sequence)
		{
			std::cout << e << '\n';
		}

		std::cout << std::flush;
	}

	uint64_t fibonacchi[50] = {};

	uint64_t Fibonacci(uint64_t n)
	{
		if (n == 0 || n == 1)
		{
			if (fibonacchi[n] == 0)
			{
				fibonacchi[n] = 1;
			}
			return fibonacchi[n];
		}

		if (fibonacchi[n] == 0)
		{
			fibonacchi[n] = Fibonacci(n - 1) + Fibonacci(n - 2);
		}

		return fibonacchi[n];
	}
}

int main(int argc, char* argv[])
{
	auto file = (argc == 1) ? std::ifstream() : std::ifstream(argv[1]);
	std::istream& stream = (argc == 1) ? std::cin : file;
	if (argc == 1)
	{
		std::cin.tie(0);
		std::ios::sync_with_stdio(false);
	}

	int num;
	stream >> num;

	std::cout << Fibonacci(num) << std::endl;
}

C++: #include <cstdio>

int dp[45];

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

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

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

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

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

	int n;
	cin >> n;
	cout << fib(n) << endl;

	return 0;
}

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

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

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

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

int main()
{
    int input;
    cin >> input;

    int first = 1;
    int second = 1;
    
    for (int i = 2; i <= input; ++i) {
        int third = first + second;
        first = second;
        second = third;
    }
    cout << second << "\n";
    
    return 0;
}

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

int dp[45];
void solve(){
    int n;
    dp[0]=1;
    dp[1]=1;
    cin>>n;
    for(int i=2;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
}

int main(){
    solve();
    return 0;
}

C++: #include <iostream>

using namespace std;

int fibo[60] = {};

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

int main(){

  int n;
  cin >> n;
  cout << fib(n) << endl;

}

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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

// 空のベクトルを二つ渡す。N (>=2) 以下の素数を primes に順番に入れる。
void prime_vectors(int N, vector<int>& primes, vector<bool>& is_prime){
    primes = {};
    is_prime = {};
    for(int i=0; i<=N; i++){
        is_prime.push_back(true);
    }

    primes.push_back(2);
    for(int j=4; j<=N; j+=2){
        is_prime[j] = false;
    }

    int i;
    for(i=3; i*i<=N; i+=2){
        if(!is_prime[i]) continue;
        primes.push_back(i);
        for(int j=2*i; j<=N; j+=i){
            is_prime[j] = false;
        }
    }

    for(; i<=N; i+=2){
        if(is_prime[i]){
            primes.push_back(i);
        }
    }
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;

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

    return 0;
}

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

#define MAX_N 44

struct memo{
    int num;
    bool flg=false;
}Memo[MAX_N+1];

int n;
int fib(int);

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

int fib(int n){
    if(n == 0){
        if(!Memo[0].flg){
        Memo[0].num=1;
        Memo[0].flg=true;
        }
        return 1;
    }
    if(n == 1){
        if(!Memo[1].flg){
        Memo[1].num=2;
        Memo[1].flg=true;
        }
        return 1;
    }

    if(Memo[n].flg){
        return Memo[n].num;
    }
    else{
        Memo[n].num=fib(n-1) + fib(n-2);
        Memo[n].flg=false;
        return fib(n-1) + fib(n-2);
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	const int MAX=46;
	long long f[MAX]={1,1};
	for(int i=2;i<MAX;i++)f[i]=f[i-1]+f[i-2];
	int n;
	cin>>n;
	cout<<f[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++: #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 <cstdint>

using namespace std;

#define MEMO_SIZE 44
int64_t memo[MEMO_SIZE];

void fib_init()
{
  for (uint32_t i = 0; i < MEMO_SIZE; i++) {
    memo[i] = -1;
  }
}

uint32_t fib(uint32_t i)
{
  if (i == 0) {
    return 1;
  } else if (i == 1) {
    return 1;
  } else {
    int64_t val1 = memo[i - 1], val2 = memo[i - 2];
    if (val1 == -1) {
      val1 = memo[i - 1] = fib(i - 1);
    }

    if (val2 == -1) {
      val2 = memo[i - 2] = fib(i - 2);
    }

    return val1 + val2;
  }
}

#include <iostream>

int32_t main()
{
  uint32_t i;
  cin >> i;
  cout << fib(i) << endl;
  return 0;
}