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++: #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int i=0,n,dp[45]={0};
	cin>>n;
	dp[0]=1;
	dp[1]=1;
	while(dp[n]<=0)
	{
		dp[i+2]=dp[i]+dp[i+1];
		i++;
	}
	cout<<dp[n]<<endl;	
	return 0;
}

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

int main()
{
	int f[45]={1,1},n;
	for(int i=2;i<=44;i++)
		f[i] = f[i-1]+f[i-2];
	cin>>n;
	cout<<f[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;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

ll fibo(vll &fi, int n) {
  if (n == 0 || n == 1) return 1; 
  if (fi[n] != -1) return fi[n];
  
  fi[n] = fibo(fi, n - 1) + fibo(fi, n - 2);
  return fi[n];
}

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

  vll fi(n + 1, -1);
  cout << fibo(fi, n) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef float fl;
typedef long long ll;
int n, dp[50];

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


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

C++: #include<stdio.h>

int fibonacci(int);
#define N 10000

int F[N];

int main(){
  int num;
  int i;

  scanf("%d",&num);

  for(i=0;i<N;i++) F[i] = -1;
  
  printf("%d\n",fibonacci(num));


  return 0;

}

int fibonacci(int n){
  
  
  if( n == 0 || n == 1) return F[n] = 1;

  if(F[n] != -1) return F[n];

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

}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<int> l;
  l.push_back(1);
  l.push_back(1);

  for (int i = 2; i <= n; i++) {
    l.push_back(l[i-2] + l[i-1]);
  }
  cout << l[n] << endl;

  return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

C++: #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
int fib[50];
int Solve(int n)
{
    if(n == 0 || n == 1) return fib[n] = 1;
    if(fib[n] != 0) return fib[n];
    return fib[n] = Solve(n - 1) + Solve(n - 2);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for(int i = 0; i < 50; i++) fib[i] = 0;
    cout << Solve(n) << endl;
    return 0;
}

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

int main(){
  int m=1,u=1,n,h;
  cin>>n;
  for(int i=2;i<=n;i++){
    h=u;
    u+=m;
    m=h;
  }
  cout<<u<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

const int N = 45;
int memo[N];

int fib(int n)
{
    if (memo[n]) return memo[n];
    if (n < 2) return memo[n] = 1;
    return memo[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 main(){
  int n; cin >> n;
  int memo[45];

  memo[0] = memo[1] = 1;

  for(int i = 2; i <= n; i++)
    memo[i] = memo[i - 1] + memo[i - 2];

  cout << memo[n] << endl;

  return 0;
}

C++: #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
#include<map>
#include<set>
#include<list>
#include<unordered_map>
#include<queue>
#define int long long
using namespace std;

signed main(){
	int a; cin >> a;
	int b = 0, c = 1;
	for (int d = 0; d < a; d++) {
		int e = b + c;
		b = c;
		c = e;
	}
	cout << c << endl;
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

ll fib[100];

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

    // input
    ll N;
    cin >> N;

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

    p(fib[N]);
    
    return 0;
}

C++: using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;


ll fib[50];
signed main(){
    ll n;
    scanf("%lld",&n);
    rep(i,n+1){
        if(i==0 || i==1) fib[i]=1;
        else fib[i]=fib[i-1]+fib[i-2];
    }
    printf("%lld\n",fib[n]);
}

C++: #include<stdio.h>
#include(sys/time.h>
static double gettime(){
	struct timeval tv ={0};
	gettimeofday(&tv,NULL);
	return(tv,tv-sec*1000.0)+(tv.tv_usec/1000.0);
}

long long fibo(int n){
	if(n==0||n==1)retrn 0;
	return fibo(n-1)+fibo(n-2);
}
 int main(void){
	printf("fibo(40)=%lld\n",fibo(40));

return(0);
}

C++: #include<iostream>

using namespace std;

int main() {
	int n,now;
	int before1=1, before2=1;
	cin >> n;
	if (n <= 1) {
		cout << 1<<endl;
		return 0;
	}
	for (int i = 2;i <= n;) {
		now = before1 + before2;
		before2 = before1;
		before1 = now;
		i++;
	}
	cout << now<<endl;
}

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

int memo[100];

int fib(int n){
	if(memo[n])return memo[n];

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

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

	memo[0]=memo[1]=1;
	cout<<fib(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\n", fib(n));
}

C++: #include <bits/stdc++.h>
using namespace std;
vector<int> dp(50, 0);

int fib(int n)
{
  if (n == 0 || n == 1)
    return dp.at(n) = 1;
  if (dp.at(n) != 0)
    return dp.at(n);
  return dp.at(n) = fib(n - 1) + fib(n - 2);
}

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