Go: package main

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

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

// func main(){
// 	sc := bufio.NewScanner(os.Stdin)
// 	sc.Scan()
// 	n, _ := strconv.Atoi(sc.Text())
// 	fmt.Println(fib(n))
// }

import (
	"fmt"
)

func main(){
	var n, pre1, pre2, now int
	fmt.Scan(&n)
	if n == 0 || n == 1{
		fmt.Println(1)
	} else {
		pre1, pre2 = 1, 1
		for i:=1; i<n; i++{
			now = pre1 + pre2
			pre2 = pre1
			pre1 = now
		}
		fmt.Println(now)
	}

}

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

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

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 44;

int memo[N+1];

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

int main() {
	int n; cin >> n;
	rep(i, n+1) memo[i] = 0;
	memo[0] = memo[1] = 1;
	cout << fib(n) << endl;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
#define int ll

int dp[45];

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

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

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

#define N 45
int A[N];

int fibonacci(int i) {
    if (A[i] != -1) {
        return A[i];
    }

    if (i == 0 || i == 1) {
        return 1;
    }

    A[i] = fibonacci(i - 1) + fibonacci(i - 2);
    return A[i];
}

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

    for (int i = 0; i <= n; i++) {
        A[i] = -1;
    }

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

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

//メモ化再帰
int f[50];
int fib(int i)
{
    if (i == 0 || i == 1)
        return 1;

    if (f[i] != -1)
        return f[i];

    return f[i] = fib(i - 1) + fib(i - 2);
}

int main()
{
    rep(i, 50) f[i] = -1;
    int n;
    cin >> n;
    OP(fib(n));
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int memo[45];
int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(auto i=0;i<n;i++)
#define s(c) static_cast<int>((c).size())

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

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 1000000
using namespace std;

int main(){
    int n;
    int fib[50];
    cin>>n;
    fib[0]=1;
    fib[1]=1;
    rep(i,2,n+1){
        fib[i]=fib[i-1]+fib[i-2];
    }
    cout<<fib[n]<<endl;
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int fib[50];

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

int main(void){
    int n; cin >> n;
    REP(i,50) fib[i] = -1;
    fib[0] = 1; fib[1] = 1;
    int ans = rec(n);
    cout << ans << en;
    return 0;
}

C++: #include <iostream>

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

const int SIZE = 45;
int f[SIZE];

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

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

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

  std::cout << fib(n) << '\n';
  return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int dp[45];

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

int main() {
	memset(dp, -1, sizeof(dp));
	dp[0] = 1;
	dp[1] = 1;
	int n;
	scanf("%d", &n);
	printf("%d\n", fib(n));
	return 0;
}

C++: #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

ll dp[45];

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

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>

using namespace std;

void Solution()
{
	int n;
    cin >> n;
    
    vector<int> a;
    a.push_back(0);
    a[0]=1;
    
    a.push_back(1);
    a[1]=1;
    
    for ( int i = 2; i <= n; i++ ) 
    {
        a.push_back(i);
        a[i] = a[i-2] + a[i-1];
    }
    
    cout << a[n] << endl;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int  F[45]={};
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(){
  int n;
  cin>>n;
  cout<<fib(n)<<endl;
}