Go: package main

import (
	"fmt"
)

const MAX = 45

var dp [MAX]int

func fin(n int) int {
	if dp[n] != 0 {
		return dp[n]
	}

	switch n {
	case 0:
		dp[n] = 1
	case 1:
		dp[n] = 1
	default:
		dp[n] = fin(n-1) + fin(n-2)
	}
	return dp[n]
}

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

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

int main(){
    int n;
    cin >> n;
    int F[50];
    F[0]=1;
    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 <bits/stdc++.h>
using namespace std;

long long f[10000000];

long long fib(int n)
{
  if (n == 0 || n == 1) return (1);
  if (f[n] != 0)  return (f[n]);
  else {
    f[n] = fib(n - 1) + fib(n - 2);
  }
  return f[n];
}
int main()
{
  int n;
  cin >> n;
  cout << fib(n) << endl;
}

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

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

	return 0;
}

C++: #include <cstdio>
#define MAX_N 45
int F[MAX_N] = { 0 };

int fib(const int &n) {
	if (F[n] != 0) return F[n];
	if (n == 0 || n == 1) {
		F[n] = 1;
		return F[n];
	}

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

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

C++: #include<cstdio>
main(){int n,i=1,f[45]={1,1};for(scanf("%d",&n);++i<=n;f[i]=f[i-1]+f[i-2]);printf("%d\n",f[n]);}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int fib(int);

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

    return 0;
}

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

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int dp[100];
    dp[0] =dp[1]= 1;
    rep(i, n)
    {
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    cout << dp[n] << endl;

    return 0;
}

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;
}