Go: package main

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

//util
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func printList(list []int) {
	buf := bufio.NewWriter(os.Stdout)
	for _, v := range list {
		buf.Write([]byte(fmt.Sprintf(" %d", v)))
	}
	buf.Write([]byte("\n"))
	buf.Flush()
}

//solve
//単純な場合
func fibonacci_(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return fibonacci_(n-2) + fibonacci_(n-1)
}

//メモ再帰の利用
func fibonacci(n int) int {
	if n == 0 || n == 1 {
		F[n] = 1
	}
	//F[n]が計算済みの場合
	if F[n] > 0 {
		return F[n]
	}
	F[n] = fibonacci(n-2) + fibonacci(n-1)
	return F[n]
}

const MAX = 50

var F [MAX]int

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	fmt.Println(fibonacci(n))

}

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

vector<long long int> fibonatti;
long long int  dp[10000];
int calc(int n){
  if(n <= 1) return 1;
  if(dp[n] != -1)return dp[n];
  fibonatti[n] = calc(n - 1) + calc(n - 2);
  return dp[n] = fibonatti[n];
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  fibonatti.resize(n);
  fibonatti[0] = fibonatti[1] = 1;
  for (int i = 0; i <= n; i++) {
    dp[i] = -1;
  }
  dp[0] = dp[1] = 1;
  std::cout << calc(n) << std::endl;
  return 0;
}

C++: #include <iostream>
  
using namespace std;
  
typedef unsigned long long ull;
  
auto fib(ull const n) -> ull
{
    return ( n == 0 || n == 1 ) ? 1 : fib( n - 2 ) + fib( n - 1 );
}
  
int main()
{
    ull n;
    cin >> n;
    cout << fib( n ) << endl;
}

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

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

  cout << fn[n] << end;
  return 0
}

C++: #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
#define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
#define vec vector
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(), v.rend())
#define All(a) (a).begin(),(a).end()
using intl = int64_t;
using vi = vec<intl>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;


int main(){
    int n;
    cin >>n;
    if(n==0){cout<<1;return 0;}
    vi fib(n+1);
    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<cstdio> 
int F[50]={1,1};

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

C++: #include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793

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

C++: 
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

ll dp[50];

ll fib(ll n){
    if(n<=1) return 1;
    if(dp[n]!=-1) return dp[n];
    return dp[n]=fib(n-1)+fib(n-2);
}

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

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

vector<int> F(50, 0);

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  int n;
  cin >> n;
  cout << fib(n) << "\n";
}

C++: #include<iostream>
int F[100]; // ???????????????
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n];
}

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

int main(){
    int n;
    int ans;
    int f[44];
    f[0] = 1;
    f[1] = 1;
    cin >> n;
    for(int i=2; i<=n; i++) f[i] = f[i-1] + f[i-2];
    ans = f[n];
    cout << ans << '\n';
}

C++: #include <iostream>
#define rep(i,a) for(int i=0;i<(a);++i)

int fib[45];
int n;

int main()
{
  scanf( "%d", &n );

  fib[0] = fib[1] = 1;
  rep( i, n-1 )
    fib[i+2] = fib[i] + fib[i+1]; 

  printf( "%d\n", fib[n] );

  return 0;
}

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

int memo[100];
int fibonacci( int a )
{
    if( a == 0 || a == 1 )
        return memo[0] = memo[1] = 1;
    else
    {
        if( memo[a] != 0 )
            return memo[a];
        else
            return memo[a] = fibonacci( a - 1 ) + fibonacci( a - 2 );
    }
}

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

    cout << fibonacci(n) << endl;

    return 0;
}

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

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

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

C++: #include<iostream>
#include<cstring>
#include<cstdio>

long long 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(void){
	int n, i;
	long long int m;
	for (i = 0; i <= 50; i++) {
		dp[i] = -1;
	}

	scanf("%d", &n);
	m = fib(n);
	printf("%lld\n", m);

	return 0;
}

C++: 
#include<iostream>

using namespace std;

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

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

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

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

C++: #include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int F[n + 1];

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