Go: package main

import (
	"fmt"
)

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

	a := make([]int, n+1)
	a[0] = 1
	a[1] = 1
	for i := 2; i <= n; i++ {
		a[i] = a[i-1] + a[i-2]
	}
	fmt.Println(a[n])
}

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

C++: using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;


ll fib[50];
signed main(){
    ll n;
    scanf("%lld",&n);
    rep(i,n+1){
        if(i==0 || i==1) fib[i]=1;
        else fib[i]=fib[i-1]+fib[i-2];
    }
    printf("%lld\n",fib[n]);
}

C++: #include<stdio.h>
#include(sys/time.h>
static double gettime(){
	struct timeval tv ={0};
	gettimeofday(&tv,NULL);
	return(tv,tv-sec*1000.0)+(tv.tv_usec/1000.0);
}

long long fibo(int n){
	if(n==0||n==1)retrn 0;
	return fibo(n-1)+fibo(n-2);
}
 int main(void){
	printf("fibo(40)=%lld\n",fibo(40));

return(0);
}