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 <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << ", "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << ", "; cerr << "\n"; }
#define dbm(map) cerr << #map << ":"; for (auto p : map) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "\n";
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vb = vector<bool>;
using vvi = vector<vi>; using vvl = vector<vl>; using vvb = vector<vb>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vpii = vector<pii>; using vpll = vector<pll>;
using ti3 = tuple<int, int, int>; using tl3 = tuple<ll, ll, ll>;
using mii = map<int, int>; using mil = map<int, ll>; using mli = map<ll, int>; using mll = map<ll, ll>;

int main() {
	int n; cin >> n;
	vi dp(n + 1); dp[0] = dp[1] = 1;
	rep2(i, 2, n + 1) dp[i] = dp[i - 1] + dp[i - 2];
	// dbv(dp);
	cout << dp[n] << endl;
}

C++: #include<iostream>

using namespace std;

int fib(int n);

int main() {
  int n;

  //入力
  cin >> n;

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

  return 0;
}

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

C++: #include <bits/stdc++.h>
#define MAX_N 10000
#define INF 1e9

using namespace std;

typedef int long long ll;
typedef int long l;
typedef pair<int, int> Pii;
const ll MOD = 1000000007;

ll dp[45];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 0; i < n - 1; i++) {
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

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

using i64 = int64_t;

i64 calc_fib(i64 n){
    static vector<i64> memo(n+1);
    if(memo[n] > 0)return memo[n];
    if(n <= 1)return memo[n] = 1;
    return memo[n] = calc_fib(n-1) + calc_fib(n-2);
}

int main(){
    i64 n;
    cin >> n;
    cout << calc_fib(n) << endl;

    return 0;
}

C++: #include <iostream>

using namespace std;

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

	cin >> n;

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

C++: #include<bits/stdc++.h>
#define REP(i,n) for(long long i=0;i<n;++i)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
using namespace std;
int main(){
    long long data[45];
    int n;
    data[0]=1;
    data[1]=1;
    scanf("%d",&n);
    FOR(i,2,n+1) data[i]=data[i-2]+data[i-1];
    printf("%lld\n",data[n]);
    return 0;
}

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

int main(){
	long long f[50];
	f[0]=1;
	f[1]=1;
	
	for(int i=2; i<45; ++i) f[i]=f[i-1]+f[i-2];
	
	int n;
	scanf(" %d", &n);
	cout << f[n] << endl;
}

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

template<unsigned N> struct Fib
{
    enum
    {
        Val = Fib<N - 1>::Val + Fib<N - 2>::Val
    };
};

template<> struct Fib<0> { enum { Val = 0 }; };
template<> struct Fib<1> { enum { Val = 1 }; };


int main()
{
    cout << Fib<10>::Val << endl;
    return 0;
}

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

int n;
int dp[50];

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

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

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef unsigned int UINT;
typedef long long ll;

int fib[50];

void fibfunc()
{

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

}

int main()
{
	fib[1] = 1;
	fib[0] = 1;
	int n;
	cin >> n;

	fibfunc();

	cout << fib[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;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

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

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  int a[44],n;
  a[0]=a[1]=1;
  for(int i=2;i<=44;i++)a[i]=a[i-1]+a[i-2];
  cin>>n;
  cout<<a[n]<<endl; 
}

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

int fib(int n)
{
  long long num[10000] = {1, 1};
  for (int i = 2; i <= n; i++){
    num[i] = num[i - 1] + num[i - 2];
  }
  return (num[n]);
}

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

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


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

cout<< fib[n]<< endl;
  return 0;
}