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 <bits/stdc++.h>
using namespace std;
#define MAX 100

int dp[MAX];

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

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

  for (int i = 0; i <= n; i++) {
    dp[i] = 0;
  }

  ans = fib(n);

  cout << ans << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;

int F[50] = {};

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

int main() {
  int N;
  cin >> N;
  cout << fibonacci(N) << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD 1000000007

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

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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int F[50];
    F[0] = 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;
#define MAX 44
int fibonacci(int);
int F[MAX];

int main(){
  int i,n;
  for(i = 0; i < MAX; i++){
    F[i] = -1;
  }
  cin >> n;
  cout << fibonacci(n) << endl;
  return 0;
}

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

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==1){
    return 1;
  }else if(n==0){
    return 1;
  }else if(memo[n]!=0){
    return memo[n];
  }else{
    return memo[n]=fib(n-1)+fib(n-2);
  }
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, f[50];
  cin >> n;
  f[0] = f[1] = 1;
  for(int i = 2; i <= n; i++) f[i] = f[n - 1] + f[n - 2];

  cout << f[n] << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
int memo[50];
int fib(int n){
  if(~memo[n]) return memo[n];
  if(n<=1) return 1;
  return memo[n]=(fib(n-1)+fib(n-2));
}
signed main(){
  int n;
  cin>>n;
  memset(memo,-1,sizeof(memo));
  cout<<fib(n)<<endl;
  return 0;
}

C++: #include <iostream>
#define NIL -1
using namespace std;
int f[45] = {};

int fib(int n){
  if(n == 0 || n == 1){
    //cout << "a;n = " << n << " " << "f[n] = " << f[n] << endl;
    return f[n] = 1;
  }
  if(f[n] != NIL){
    //cout << "b;n = " << n << " " << "f[n] = " << f[n] << endl;
    return f[n];
  }
  //cout << "c;n = " << n << " " << "f[n] = " << f[n] << endl;
  return f[n] = fib(n - 1) + fib(n - 2);
}

int main(){

  int n;
  cin >> n;

  for(int i = 0;i < 45;i++) f[i] = NIL;

  cout << fib(n) << endl;

}

C++: #include<iostream>

using namespace std;

int main() {
    int n;
    int F[50];

    cin >> n;

    F[0] = F[1] = 1;

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

    cout << F[n] << endl;

    return 0;
}

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

using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

vector <ll> dp(50, -1);

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

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

C++: #include <iostream>

using namespace std;

int temp_data[50];

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

int main() {
	for (int i = 0; i < 50; i++) temp_data[i] = -1;

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int fib(int n) {
    if(n==1) 
        return 1;
    else if(n==2)
        return 2;
    else
        return fib(n-1) + fib(n-2);
}
int main(void){
    int n;
    cin >> n 
    cout << fib(n) << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

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

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